Skip to content

Commit

Permalink
Scaffold: Normalize repository
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Dec 28, 2018
1 parent 11ba45d commit 72c44b5
Show file tree
Hide file tree
Showing 15 changed files with 329 additions and 277 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf

[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "gulp"
}
35 changes: 31 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
*.DS_Store
*.sublime-*
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules
npm-debug.log
test/actual

# Users Environment Variables
.lock-wscript

# Garbage files
.DS_Store
19 changes: 0 additions & 19 deletions .jshintrc

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ os:
- linux
- osx
node_js:
- "10"
- "8"
- "6"
- "5"
- "4"
- "0.12"
- "0.10"
after_script:
- npm run coveralls
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2013-2018 Ben Alman <[email protected]>, Blaine Bublitz <[email protected]>, and Eric Schoffstall <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 0 additions & 24 deletions LICENSE-MIT

This file was deleted.

70 changes: 29 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# findup-sync [![Build Status](https://travis-ci.org/js-cli/node-findup-sync.svg)](https://travis-ci.org/js-cli/node-findup-sync) [![NPM version](https://badge.fury.io/js/findup-sync.svg)](http://badge.fury.io/js/findup-sync)
<p align="center">
<a href="http://gulpjs.com">
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
</a>
</p>

> Find the first file matching a given pattern in the current directory or the nearest ancestor directory.

Matching is done with [micromatch][], please report any matching related issues on that repository.
# findup-sync

## Install with [npm](npmjs.org)
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]

```bash
npm i findup-sync --save
```
Find the first file matching a given pattern in the current directory or the nearest ancestor directory.

Matching is done with [micromatch][micromatch], please report any matching related issues on that repository.

## Usage

Expand All @@ -23,47 +26,32 @@ var filepath1 = findup('{a,b}*.txt');
var filepath2 = findup('{a,b}*.txt', {cwd: '/some/path', nocase: true});
```

* `patterns` **{String|Array}**: Glob pattern(s) or file path(s) to match against.
* `options` **{Object}**: Options to pass to [micromatch]. Note that if you want to start in a different directory than the current working directory, specify a `cwd` property here.
* `returns` **{String}**: Returns the first matching file.

## Running tests

Install dev dependencies:

```bash
npm i -d && npm test
```
## API

## Contributing
### `findup(patterns, [options])`

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/)
* `patterns` **{String|Array}**: Glob pattern(s) or file path(s) to match against.
* `options` **{Object}**: Options to pass to [micromatch]. Note that if you want to start in a different directory than the current working directory, specify a `cwd` property here.
* `returns` **{String}**: Returns the first matching file.

For bugs and feature requests, [please create an issue](https://github.com/cowboy/node-findup-sync/issues).
## License

## Release History
MIT

2017-08-07 - v2.0.0 - Drop node 0.8 support, Bump all dependencies (including some Majors)
2017-04-18 - v1.0.0 - Major bump from stable 0.4.3
2015-01-30 - v0.4.0 - Refactored, not also uses [micromatch][] instead of minimatch.
2015-09-14 - v0.3.0 - updated glob to ~5.0.
2014-12-17 - v0.2.1 - Updated to glob 4.3.
2014-12-16 - v0.2.0 - Removed lodash, updated to glob 4.x.
2014-03-14 - v0.1.3 - Updated dependencies.
2013-03-08 - v0.1.2 - Updated dependencies. Fixed a Node 0.9.x bug. Updated unit tests to work cross-platform.
2012-11-15 - v0.1.1 - Now works without an options object.
2012-11-01 - v0.1.0 - Initial release.
[micromatch]: http://github.com/jonschlinkert/micromatch

## Authors
[downloads-image]: http://img.shields.io/npm/dm/findup-sync.svg
[npm-url]: https://www.npmjs.com/package/findup-sync
[npm-image]: http://img.shields.io/npm/v/findup-sync.svg

**"Cowboy" Ben Alman**

+ [github/cowboy](https://github.com/cowboy)
+ [twitter/cowboy](http://twitter.com/cowboy)
[travis-url]: https://travis-ci.org/gulpjs/findup-sync
[travis-image]: http://img.shields.io/travis/gulpjs/findup-sync.svg?label=travis-ci

## License
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/findup-sync
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/findup-sync.svg?label=appveyor

Copyright (c) 2012-2016 "Cowboy" Ben Alman
Released under the MIT license
[coveralls-url]: https://coveralls.io/r/gulpjs/findup-sync
[coveralls-image]: http://img.shields.io/coveralls/gulpjs/findup-sync/master.svg

[micromatch]: http://github.com/jonschlinkert/micromatch
[gitter-url]: https://gitter.im/gulpjs/gulp
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ environment:
- nodejs_version: "5"
- nodejs_version: "6"
- nodejs_version: "8"
- nodejs_version: "10"

install:
- ps: Install-Product node $env:nodejs_version
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ function findFile(cwd, filename, options) {
function tryReaddirSync(fp) {
try {
return fs.readdirSync(fp);
} catch(err) {}
} catch (err) {
// Ignore error
}
return [];
}
37 changes: 25 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
{
"name": "findup-sync",
"description": "Find the first file matching a given pattern in the current directory or the nearest ancestor directory.",
"version": "2.0.0",
"author": "\"Cowboy\" Ben Alman (http://benalman.com)",
"repository": "js-cli/node-findup-sync",
"license": "MIT",
"files": [
"index.js"
"description": "Find the first file matching a given pattern in the current directory or the nearest ancestor directory.",
"author": "Gulp Team <[email protected]> (http://gulpjs.com/)",
"contributors": [
"Ben Alman <[email protected]>",
"Tyler Kellen <[email protected]>",
"Jon Schlinkert <[email protected]>",
"Blaine Bublitz <[email protected]>"
],
"main": "index.js",
"repository": "gulpjs/findup-sync",
"license": "MIT",
"engines": {
"node": ">= 0.10"
},
"main": "index.js",
"files": [
"index.js",
"LICENSE"
],
"scripts": {
"lint": "jshint index.js test/support/index.js test/test.js",
"test": "npm run lint && mocha"
"lint": "eslint .",
"pretest": "npm run lint",
"test": "mocha --async-only",
"cover": "istanbul cover _mocha --report lcovonly",
"coveralls": "npm run cover && istanbul-coveralls"
},
"dependencies": {
"detect-file": "^1.0.0",
Expand All @@ -23,10 +33,13 @@
"resolve-dir": "^1.0.1"
},
"devDependencies": {
"eslint": "^2.13.0",
"eslint-config-gulp": "^3.0.1",
"expect": "^1.20.2",
"homedir-polyfill": "^1.0.1",
"is-absolute": "^1.0.0",
"jshint": "^2.9.5",
"mocha": "^3.5.0",
"istanbul": "^0.4.3",
"istanbul-coveralls": "^1.0.3",
"mocha": "^3.5.3",
"normalize-path": "^2.1.1",
"resolve": "^1.4.0"
},
Expand Down
3 changes: 3 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "gulp/test"
}
45 changes: 21 additions & 24 deletions test/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

var path = require('path');
var normalizePath = require('normalize-path');
var isAbsolute = require('is-absolute');
var resolve = require('resolve');
var expect = require('expect');

exports.normalize = function(filepath) {
return filepath ? normalizePath(path.relative('.', filepath)) : null;
Expand All @@ -24,28 +24,25 @@ exports.npm = function npm(name) {
return path.dirname(resolve.sync(name));
};

exports.assert = function(assert) {
assert.isPath = function (filepath) {
assert(filepath);
assert.equal(typeof filepath, 'string');
};

assert.isAbsolute = function (filepath) {
assert(filepath);
assert.equal(typeof filepath, 'string');
assert(isAbsolute(filepath));
};

assert.basename = function (filepath, basename) {
assert(filepath);
assert.equal(typeof filepath, 'string');
assert.equal(path.basename(filepath), basename);
};

assert.dirname = function (filepath, dirname) {
assert(filepath);
assert.equal(typeof filepath, 'string');
assert.equal(path.dirname(path.resolve(filepath)), path.resolve(dirname));
};
exports.expectExtras = {
isPath: function() {
var filepath = this.actual;
expect(filepath).toExist();
expect(filepath).toBeA('string');
return this;
},
toHaveBasename: function(basename) {
var filepath = this.actual;
expect(filepath).toExist();
expect(filepath).toBeA('string');
expect(path.basename(filepath)).toEqual(basename);
return this;
},
toHaveDirname: function(dirname) {
var filepath = this.actual;
expect(filepath).toExist();
expect(filepath).toBeA('string');
expect(path.dirname(path.resolve(filepath))).toEqual(path.resolve(dirname));
},
};

Loading

0 comments on commit 72c44b5

Please sign in to comment.