Skip to content

Commit 72c44b5

Browse files
committed
Scaffold: Normalize repository
1 parent 11ba45d commit 72c44b5

15 files changed

+329
-277
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
end_of_line = lf
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "gulp"
3+
}

.gitignore

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
1-
*.DS_Store
2-
*.sublime-*
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
.nyc_output
16+
17+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
18+
.grunt
19+
20+
# Compiled binary addons (http://nodejs.org/api/addons.html)
21+
build/Release
22+
23+
# Dependency directory
24+
# Commenting this out is preferred by some people, see
25+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
326
node_modules
4-
npm-debug.log
5-
test/actual
27+
28+
# Users Environment Variables
29+
.lock-wscript
30+
31+
# Garbage files
32+
.DS_Store

.jshintrc

Lines changed: 0 additions & 19 deletions
This file was deleted.

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ os:
44
- linux
55
- osx
66
node_js:
7+
- "10"
78
- "8"
89
- "6"
910
- "5"
1011
- "4"
1112
- "0.12"
1213
- "0.10"
14+
after_script:
15+
- npm run coveralls

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013-2018 Ben Alman <cowboy@rj3.net>, Blaine Bublitz <blaine.bublitz@gmail.com>, and Eric Schoffstall <yo@contra.io>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

LICENSE-MIT

Lines changed: 0 additions & 24 deletions
This file was deleted.

README.md

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
# 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)
1+
<p align="center">
2+
<a href="http://gulpjs.com">
3+
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
4+
</a>
5+
</p>
26

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

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

7-
## Install with [npm](npmjs.org)
10+
[![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]
811

9-
```bash
10-
npm i findup-sync --save
11-
```
12+
Find the first file matching a given pattern in the current directory or the nearest ancestor directory.
13+
14+
Matching is done with [micromatch][micromatch], please report any matching related issues on that repository.
1215

1316
## Usage
1417

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

26-
* `patterns` **{String|Array}**: Glob pattern(s) or file path(s) to match against.
27-
* `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.
28-
* `returns` **{String}**: Returns the first matching file.
29-
30-
## Running tests
31-
32-
Install dev dependencies:
33-
34-
```bash
35-
npm i -d && npm test
36-
```
29+
## API
3730

38-
## Contributing
31+
### `findup(patterns, [options])`
3932

40-
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/)
33+
* `patterns` **{String|Array}**: Glob pattern(s) or file path(s) to match against.
34+
* `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.
35+
* `returns` **{String}**: Returns the first matching file.
4136

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

44-
## Release History
39+
MIT
4540

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

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

59-
**"Cowboy" Ben Alman**
60-
61-
+ [github/cowboy](https://github.com/cowboy)
62-
+ [twitter/cowboy](http://twitter.com/cowboy)
47+
[travis-url]: https://travis-ci.org/gulpjs/findup-sync
48+
[travis-image]: http://img.shields.io/travis/gulpjs/findup-sync.svg?label=travis-ci
6349

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

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

69-
[micromatch]: http://github.com/jonschlinkert/micromatch
56+
[gitter-url]: https://gitter.im/gulpjs/gulp
57+
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ environment:
1010
- nodejs_version: "5"
1111
- nodejs_version: "6"
1212
- nodejs_version: "8"
13+
- nodejs_version: "10"
1314

1415
install:
1516
- ps: Install-Product node $env:nodejs_version

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ function findFile(cwd, filename, options) {
8080
function tryReaddirSync(fp) {
8181
try {
8282
return fs.readdirSync(fp);
83-
} catch(err) {}
83+
} catch (err) {
84+
// Ignore error
85+
}
8486
return [];
8587
}

package.json

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
{
22
"name": "findup-sync",
3-
"description": "Find the first file matching a given pattern in the current directory or the nearest ancestor directory.",
43
"version": "2.0.0",
5-
"author": "\"Cowboy\" Ben Alman (http://benalman.com)",
6-
"repository": "js-cli/node-findup-sync",
7-
"license": "MIT",
8-
"files": [
9-
"index.js"
4+
"description": "Find the first file matching a given pattern in the current directory or the nearest ancestor directory.",
5+
"author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)",
6+
"contributors": [
7+
"Ben Alman <cowboy@rj3.net>",
8+
"Tyler Kellen <tyler@sleekcode.net>",
9+
"Jon Schlinkert <jon.schlinkert@sellside.com>",
10+
"Blaine Bublitz <blaine.bublitz@gmail.com>"
1011
],
11-
"main": "index.js",
12+
"repository": "gulpjs/findup-sync",
13+
"license": "MIT",
1214
"engines": {
1315
"node": ">= 0.10"
1416
},
17+
"main": "index.js",
18+
"files": [
19+
"index.js",
20+
"LICENSE"
21+
],
1522
"scripts": {
16-
"lint": "jshint index.js test/support/index.js test/test.js",
17-
"test": "npm run lint && mocha"
23+
"lint": "eslint .",
24+
"pretest": "npm run lint",
25+
"test": "mocha --async-only",
26+
"cover": "istanbul cover _mocha --report lcovonly",
27+
"coveralls": "npm run cover && istanbul-coveralls"
1828
},
1929
"dependencies": {
2030
"detect-file": "^1.0.0",
@@ -23,10 +33,13 @@
2333
"resolve-dir": "^1.0.1"
2434
},
2535
"devDependencies": {
36+
"eslint": "^2.13.0",
37+
"eslint-config-gulp": "^3.0.1",
38+
"expect": "^1.20.2",
2639
"homedir-polyfill": "^1.0.1",
27-
"is-absolute": "^1.0.0",
28-
"jshint": "^2.9.5",
29-
"mocha": "^3.5.0",
40+
"istanbul": "^0.4.3",
41+
"istanbul-coveralls": "^1.0.3",
42+
"mocha": "^3.5.3",
3043
"normalize-path": "^2.1.1",
3144
"resolve": "^1.4.0"
3245
},

test/.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "gulp/test"
3+
}

test/support/index.js

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
var path = require('path');
44
var normalizePath = require('normalize-path');
5-
var isAbsolute = require('is-absolute');
65
var resolve = require('resolve');
6+
var expect = require('expect');
77

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

27-
exports.assert = function(assert) {
28-
assert.isPath = function (filepath) {
29-
assert(filepath);
30-
assert.equal(typeof filepath, 'string');
31-
};
32-
33-
assert.isAbsolute = function (filepath) {
34-
assert(filepath);
35-
assert.equal(typeof filepath, 'string');
36-
assert(isAbsolute(filepath));
37-
};
38-
39-
assert.basename = function (filepath, basename) {
40-
assert(filepath);
41-
assert.equal(typeof filepath, 'string');
42-
assert.equal(path.basename(filepath), basename);
43-
};
44-
45-
assert.dirname = function (filepath, dirname) {
46-
assert(filepath);
47-
assert.equal(typeof filepath, 'string');
48-
assert.equal(path.dirname(path.resolve(filepath)), path.resolve(dirname));
49-
};
27+
exports.expectExtras = {
28+
isPath: function() {
29+
var filepath = this.actual;
30+
expect(filepath).toExist();
31+
expect(filepath).toBeA('string');
32+
return this;
33+
},
34+
toHaveBasename: function(basename) {
35+
var filepath = this.actual;
36+
expect(filepath).toExist();
37+
expect(filepath).toBeA('string');
38+
expect(path.basename(filepath)).toEqual(basename);
39+
return this;
40+
},
41+
toHaveDirname: function(dirname) {
42+
var filepath = this.actual;
43+
expect(filepath).toExist();
44+
expect(filepath).toBeA('string');
45+
expect(path.dirname(path.resolve(filepath))).toEqual(path.resolve(dirname));
46+
},
5047
};
5148

0 commit comments

Comments
 (0)