From 7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 28 May 2017 00:38:50 +0200 Subject: add linting (and some initial fixes) --- node_modules/ava-init/index.js | 60 +++++++++++++++ node_modules/ava-init/license | 21 ++++++ .../ava-init/node_modules/find-up/index.js | 48 ++++++++++++ node_modules/ava-init/node_modules/find-up/license | 21 ++++++ .../ava-init/node_modules/find-up/package.json | 53 ++++++++++++++ .../ava-init/node_modules/find-up/readme.md | 85 ++++++++++++++++++++++ .../ava-init/node_modules/path-type/index.js | 26 +++++++ .../ava-init/node_modules/path-type/license | 21 ++++++ .../ava-init/node_modules/path-type/package.json | 48 ++++++++++++ .../ava-init/node_modules/path-type/readme.md | 42 +++++++++++ .../ava-init/node_modules/read-pkg-up/index.js | 26 +++++++ .../ava-init/node_modules/read-pkg-up/license | 21 ++++++ .../ava-init/node_modules/read-pkg-up/package.json | 62 ++++++++++++++++ .../ava-init/node_modules/read-pkg-up/readme.md | 80 ++++++++++++++++++++ .../ava-init/node_modules/read-pkg/index.js | 47 ++++++++++++ .../ava-init/node_modules/read-pkg/license | 21 ++++++ .../ava-init/node_modules/read-pkg/package.json | 45 ++++++++++++ .../ava-init/node_modules/read-pkg/readme.md | 79 ++++++++++++++++++++ node_modules/ava-init/package.json | 50 +++++++++++++ node_modules/ava-init/readme.md | 63 ++++++++++++++++ 20 files changed, 919 insertions(+) create mode 100644 node_modules/ava-init/index.js create mode 100644 node_modules/ava-init/license create mode 100644 node_modules/ava-init/node_modules/find-up/index.js create mode 100644 node_modules/ava-init/node_modules/find-up/license create mode 100644 node_modules/ava-init/node_modules/find-up/package.json create mode 100644 node_modules/ava-init/node_modules/find-up/readme.md create mode 100644 node_modules/ava-init/node_modules/path-type/index.js create mode 100644 node_modules/ava-init/node_modules/path-type/license create mode 100644 node_modules/ava-init/node_modules/path-type/package.json create mode 100644 node_modules/ava-init/node_modules/path-type/readme.md create mode 100644 node_modules/ava-init/node_modules/read-pkg-up/index.js create mode 100644 node_modules/ava-init/node_modules/read-pkg-up/license create mode 100644 node_modules/ava-init/node_modules/read-pkg-up/package.json create mode 100644 node_modules/ava-init/node_modules/read-pkg-up/readme.md create mode 100644 node_modules/ava-init/node_modules/read-pkg/index.js create mode 100644 node_modules/ava-init/node_modules/read-pkg/license create mode 100644 node_modules/ava-init/node_modules/read-pkg/package.json create mode 100644 node_modules/ava-init/node_modules/read-pkg/readme.md create mode 100644 node_modules/ava-init/package.json create mode 100644 node_modules/ava-init/readme.md (limited to 'node_modules/ava-init') diff --git a/node_modules/ava-init/index.js b/node_modules/ava-init/index.js new file mode 100644 index 000000000..9aef769c0 --- /dev/null +++ b/node_modules/ava-init/index.js @@ -0,0 +1,60 @@ +'use strict'; +const fs = require('fs'); +const path = require('path'); +const execa = require('execa'); +const hasYarn = require('has-yarn'); +const readPkgUp = require('read-pkg-up'); +const writePkg = require('write-pkg'); +const arrExclude = require('arr-exclude'); + +const DEFAULT_TEST_SCRIPT = 'echo "Error: no test specified" && exit 1'; + +module.exports = opts => { + opts = opts || {}; + + const ret = readPkgUp.sync({ + cwd: opts.cwd, + normalize: false + }); + const pkg = ret.pkg || {}; + const pkgPath = ret.path || path.resolve(opts.cwd || process.cwd(), 'package.json'); + const pkgCwd = path.dirname(pkgPath); + const cli = opts.args || process.argv.slice(2); + const args = arrExclude(cli, ['--init', '--unicorn']); + const cmd = 'ava' + (args.length > 0 ? ' ' + args.join(' ') : ''); + const s = pkg.scripts = pkg.scripts ? pkg.scripts : {}; + + if (s.test && s.test !== DEFAULT_TEST_SCRIPT) { + s.test = s.test.replace(/\bnode (test\/)?test\.js\b/, cmd); + + if (!/\bava\b/.test(s.test)) { + s.test += ` && ${cmd}`; + } + } else { + s.test = cmd; + } + + writePkg.sync(pkgPath, pkg); + + const post = () => { + // For personal use + if (cli.indexOf('--unicorn') !== -1) { + const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); + pkg.devDependencies.ava = '*'; + writePkg.sync(pkgPath, pkg); + } + }; + + if (opts.skipInstall) { + return Promise.resolve(post); + } + + if (hasYarn(pkgCwd)) { + return execa('yarn', ['add', '--dev', 'ava'], {cwd: pkgCwd}).then(post); + } + + return execa('npm', ['install', '--save-dev', 'ava'], { + cwd: pkgCwd, + stdio: 'inherit' + }).then(post); +}; diff --git a/node_modules/ava-init/license b/node_modules/ava-init/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/ava-init/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/node_modules/ava-init/node_modules/find-up/index.js b/node_modules/ava-init/node_modules/find-up/index.js new file mode 100644 index 000000000..939c9553d --- /dev/null +++ b/node_modules/ava-init/node_modules/find-up/index.js @@ -0,0 +1,48 @@ +'use strict'; +const path = require('path'); +const locatePath = require('locate-path'); + +module.exports = (filename, opts) => { + opts = opts || {}; + + const startDir = path.resolve(opts.cwd || ''); + const root = path.parse(startDir).root; + + const filenames = [].concat(filename); + + return new Promise(resolve => { + (function find(dir) { + locatePath(filenames, {cwd: dir}).then(file => { + if (file) { + resolve(path.join(dir, file)); + } else if (dir === root) { + resolve(null); + } else { + find(path.dirname(dir)); + } + }); + })(startDir); + }); +}; + +module.exports.sync = (filename, opts) => { + opts = opts || {}; + + let dir = path.resolve(opts.cwd || ''); + const root = path.parse(dir).root; + + const filenames = [].concat(filename); + + // eslint-disable-next-line no-constant-condition + while (true) { + const file = locatePath.sync(filenames, {cwd: dir}); + + if (file) { + return path.join(dir, file); + } else if (dir === root) { + return null; + } + + dir = path.dirname(dir); + } +}; diff --git a/node_modules/ava-init/node_modules/find-up/license b/node_modules/ava-init/node_modules/find-up/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/ava-init/node_modules/find-up/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/node_modules/ava-init/node_modules/find-up/package.json b/node_modules/ava-init/node_modules/find-up/package.json new file mode 100644 index 000000000..7ec85bb79 --- /dev/null +++ b/node_modules/ava-init/node_modules/find-up/package.json @@ -0,0 +1,53 @@ +{ + "name": "find-up", + "version": "2.1.0", + "description": "Find a file by walking up parent directories", + "license": "MIT", + "repository": "sindresorhus/find-up", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "package", + "resolve", + "parent", + "parents", + "folder", + "directory", + "dir", + "walk", + "walking", + "path" + ], + "dependencies": { + "locate-path": "^2.0.0" + }, + "devDependencies": { + "ava": "*", + "tempfile": "^1.1.1", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/ava-init/node_modules/find-up/readme.md b/node_modules/ava-init/node_modules/find-up/readme.md new file mode 100644 index 000000000..b5ad69455 --- /dev/null +++ b/node_modules/ava-init/node_modules/find-up/readme.md @@ -0,0 +1,85 @@ +# find-up [![Build Status: Linux and macOS](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/l0cyjmvh5lq72vq2/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/find-up/branch/master) + +> Find a file by walking up parent directories + + +## Install + +``` +$ npm install --save find-up +``` + + +## Usage + +``` +/ +└── Users + └── sindresorhus + ├── unicorn.png + └── foo + └── bar + ├── baz + └── example.js +``` + +```js +// example.js +const findUp = require('find-up'); + +findUp('unicorn.png').then(filepath => { + console.log(filepath); + //=> '/Users/sindresorhus/unicorn.png' +}); + +findUp(['rainbow.png', 'unicorn.png']).then(filepath => { + console.log(filepath); + //=> '/Users/sindresorhus/unicorn.png' +}); +``` + + +## API + +### findUp(filename, [options]) + +Returns a `Promise` for the filepath or `null`. + +### findUp([filenameA, filenameB], [options]) + +Returns a `Promise` for the first filepath found (by respecting the order) or `null`. + +### findUp.sync(filename, [options]) + +Returns a filepath or `null`. + +### findUp.sync([filenameA, filenameB], [options]) + +Returns the first filepath found (by respecting the order) or `null`. + +#### filename + +Type: `string` + +Filename of the file to find. + +#### options + +##### cwd + +Type: `string`
+Default: `process.cwd()` + +Directory to start from. + + +## Related + +- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/ava-init/node_modules/path-type/index.js b/node_modules/ava-init/node_modules/path-type/index.js new file mode 100644 index 000000000..4ac9dd967 --- /dev/null +++ b/node_modules/ava-init/node_modules/path-type/index.js @@ -0,0 +1,26 @@ +'use strict'; +const fs = require('fs'); +const pify = require('pify'); + +function type(fn, fn2, fp) { + if (typeof fp !== 'string') { + return Promise.reject(new TypeError(`Expected a string, got ${typeof fp}`)); + } + + return pify(fs[fn])(fp).then(stats => stats[fn2]()); +} + +function typeSync(fn, fn2, fp) { + if (typeof fp !== 'string') { + throw new TypeError(`Expected a string, got ${typeof fp}`); + } + + return fs[fn](fp)[fn2](); +} + +exports.file = type.bind(null, 'stat', 'isFile'); +exports.dir = type.bind(null, 'stat', 'isDirectory'); +exports.symlink = type.bind(null, 'lstat', 'isSymbolicLink'); +exports.fileSync = typeSync.bind(null, 'statSync', 'isFile'); +exports.dirSync = typeSync.bind(null, 'statSync', 'isDirectory'); +exports.symlinkSync = typeSync.bind(null, 'lstatSync', 'isSymbolicLink'); diff --git a/node_modules/ava-init/node_modules/path-type/license b/node_modules/ava-init/node_modules/path-type/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/ava-init/node_modules/path-type/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/node_modules/ava-init/node_modules/path-type/package.json b/node_modules/ava-init/node_modules/path-type/package.json new file mode 100644 index 000000000..54336f352 --- /dev/null +++ b/node_modules/ava-init/node_modules/path-type/package.json @@ -0,0 +1,48 @@ +{ + "name": "path-type", + "version": "2.0.0", + "description": "Check if a path is a file, directory, or symlink", + "license": "MIT", + "repository": "sindresorhus/path-type", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "fs", + "type", + "is", + "check", + "directory", + "dir", + "file", + "filepath", + "symlink", + "symbolic", + "link", + "stat", + "stats", + "filesystem" + ], + "dependencies": { + "pify": "^2.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/ava-init/node_modules/path-type/readme.md b/node_modules/ava-init/node_modules/path-type/readme.md new file mode 100644 index 000000000..b1ea61fe9 --- /dev/null +++ b/node_modules/ava-init/node_modules/path-type/readme.md @@ -0,0 +1,42 @@ +# path-type [![Build Status](https://travis-ci.org/sindresorhus/path-type.svg?branch=master)](https://travis-ci.org/sindresorhus/path-type) + +> Check if a path is a file, directory, or symlink + + +## Install + +``` +$ npm install --save path-type +``` + + +## Usage + +```js +const pathType = require('path-type'); + +pathType.file('package.json').then(isFile => { + console.log(isFile); + //=> true +}) +``` + + +## API + +### .file(path) +### .dir(path) +### .symlink(path) + +Returns a `Promise` for a `boolean` of whether the path is the checked type. + +### .fileSync(path) +### .dirSync(path) +### .symlinkSync(path) + +Returns a `boolean` of whether the path is the checked type. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/ava-init/node_modules/read-pkg-up/index.js b/node_modules/ava-init/node_modules/read-pkg-up/index.js new file mode 100644 index 000000000..26079760f --- /dev/null +++ b/node_modules/ava-init/node_modules/read-pkg-up/index.js @@ -0,0 +1,26 @@ +'use strict'; +const findUp = require('find-up'); +const readPkg = require('read-pkg'); + +module.exports = opts => { + return findUp('package.json', opts).then(fp => { + if (!fp) { + return {}; + } + + return readPkg(fp, opts).then(pkg => ({pkg, path: fp})); + }); +}; + +module.exports.sync = opts => { + const fp = findUp.sync('package.json', opts); + + if (!fp) { + return {}; + } + + return { + pkg: readPkg.sync(fp, opts), + path: fp + }; +}; diff --git a/node_modules/ava-init/node_modules/read-pkg-up/license b/node_modules/ava-init/node_modules/read-pkg-up/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/ava-init/node_modules/read-pkg-up/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/node_modules/ava-init/node_modules/read-pkg-up/package.json b/node_modules/ava-init/node_modules/read-pkg-up/package.json new file mode 100644 index 000000000..f09bf3c35 --- /dev/null +++ b/node_modules/ava-init/node_modules/read-pkg-up/package.json @@ -0,0 +1,62 @@ +{ + "name": "read-pkg-up", + "version": "2.0.0", + "description": "Read the closest package.json file", + "license": "MIT", + "repository": "sindresorhus/read-pkg-up", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "json", + "read", + "parse", + "file", + "fs", + "graceful", + "load", + "pkg", + "package", + "find", + "up", + "find-up", + "findup", + "look-up", + "look", + "file", + "search", + "match", + "package", + "resolve", + "parent", + "parents", + "folder", + "directory", + "dir", + "walk", + "walking", + "path" + ], + "dependencies": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/ava-init/node_modules/read-pkg-up/readme.md b/node_modules/ava-init/node_modules/read-pkg-up/readme.md new file mode 100644 index 000000000..ba18780f9 --- /dev/null +++ b/node_modules/ava-init/node_modules/read-pkg-up/readme.md @@ -0,0 +1,80 @@ +# read-pkg-up [![Build Status](https://travis-ci.org/sindresorhus/read-pkg-up.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg-up) + +> Read the closest package.json file + + +## Why + +- [Finds the closest package.json](https://github.com/sindresorhus/find-up) +- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs) +- [Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom) +- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json) +- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) + + +## Install + +``` +$ npm install --save read-pkg-up +``` + + +## Usage + +```js +const readPkgUp = require('read-pkg-up'); + +readPkgUp().then(result => { + console.log(result); + /* + { + pkg: { + name: 'awesome-package', + version: '1.0.0', + ... + }, + path: '/Users/sindresorhus/dev/awesome-package/package.json' + } + */ +}); +``` + + +## API + +### readPkgUp([options]) + +Returns a `Promise` for the result object. + +### readPkgUp.sync([options]) + +Returns the result object. + +#### options + +##### cwd + +Type: `string`
+Default: `.` + +Directory to start looking for a package.json file. + +##### normalize + +Type: `boolean`
+Default: `true` + +[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data. + + +## Related + +- [read-pkg](https://github.com/sindresorhus/read-pkg) - Read a package.json file +- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file +- [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories +- [pkg-conf](https://github.com/sindresorhus/pkg-conf) - Get namespaced config from the closest package.json + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/ava-init/node_modules/read-pkg/index.js b/node_modules/ava-init/node_modules/read-pkg/index.js new file mode 100644 index 000000000..dff948b69 --- /dev/null +++ b/node_modules/ava-init/node_modules/read-pkg/index.js @@ -0,0 +1,47 @@ +'use strict'; +const path = require('path'); +const loadJsonFile = require('load-json-file'); +const pathType = require('path-type'); + +module.exports = (fp, opts) => { + if (typeof fp !== 'string') { + opts = fp; + fp = '.'; + } + + opts = opts || {}; + + return pathType.dir(fp) + .then(isDir => { + if (isDir) { + fp = path.join(fp, 'package.json'); + } + + return loadJsonFile(fp); + }) + .then(x => { + if (opts.normalize !== false) { + require('normalize-package-data')(x); + } + + return x; + }); +}; + +module.exports.sync = (fp, opts) => { + if (typeof fp !== 'string') { + opts = fp; + fp = '.'; + } + + opts = opts || {}; + fp = pathType.dirSync(fp) ? path.join(fp, 'package.json') : fp; + + const x = loadJsonFile.sync(fp); + + if (opts.normalize !== false) { + require('normalize-package-data')(x); + } + + return x; +}; diff --git a/node_modules/ava-init/node_modules/read-pkg/license b/node_modules/ava-init/node_modules/read-pkg/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/ava-init/node_modules/read-pkg/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/node_modules/ava-init/node_modules/read-pkg/package.json b/node_modules/ava-init/node_modules/read-pkg/package.json new file mode 100644 index 000000000..b2322191f --- /dev/null +++ b/node_modules/ava-init/node_modules/read-pkg/package.json @@ -0,0 +1,45 @@ +{ + "name": "read-pkg", + "version": "2.0.0", + "description": "Read a package.json file", + "license": "MIT", + "repository": "sindresorhus/read-pkg", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "json", + "read", + "parse", + "file", + "fs", + "graceful", + "load", + "pkg", + "package", + "normalize" + ], + "dependencies": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/ava-init/node_modules/read-pkg/readme.md b/node_modules/ava-init/node_modules/read-pkg/readme.md new file mode 100644 index 000000000..5796008b8 --- /dev/null +++ b/node_modules/ava-init/node_modules/read-pkg/readme.md @@ -0,0 +1,79 @@ +# read-pkg [![Build Status](https://travis-ci.org/sindresorhus/read-pkg.svg?branch=master)](https://travis-ci.org/sindresorhus/read-pkg) + +> Read a package.json file + + +## Why + +- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs) +- [Strips UTF-8 BOM](https://github.com/sindresorhus/strip-bom) +- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json) +- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) + + +## Install + +``` +$ npm install --save read-pkg +``` + + +## Usage + +```js +const readPkg = require('read-pkg'); + +readPkg().then(pkg => { + console.log(pkg); + //=> {name: 'read-pkg', ...} +}); + +readPkg(__dirname).then(pkg => { + console.log(pkg); + //=> {name: 'read-pkg', ...} +}); + +readPkg(path.join('unicorn', 'package.json')).then(pkg => { + console.log(pkg); + //=> {name: 'read-pkg', ...} +}); +``` + + +## API + +### readPkg([path], [options]) + +Returns a `Promise` for the parsed JSON. + +### readPkg.sync([path], [options]) + +Returns the parsed JSON. + +#### path + +Type: `string`
+Default: `.` + +Path to a `package.json` file or its directory. + +#### options + +##### normalize + +Type: `boolean`
+Default: `true` + +[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data. + + +## Related + +- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file +- [write-pkg](https://github.com/sindresorhus/write-pkg) - Write a `package.json` file +- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/ava-init/package.json b/node_modules/ava-init/package.json new file mode 100644 index 000000000..7279dd9b6 --- /dev/null +++ b/node_modules/ava-init/package.json @@ -0,0 +1,50 @@ +{ + "name": "ava-init", + "version": "0.2.0", + "description": "Add AVA to your project", + "license": "MIT", + "repository": "avajs/ava-init", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "init", + "initialize", + "add", + "create", + "setup", + "generate", + "generator", + "scaffold", + "ava", + "test", + "runner" + ], + "dependencies": { + "arr-exclude": "^1.0.0", + "execa": "^0.5.0", + "has-yarn": "^1.0.0", + "read-pkg-up": "^2.0.0", + "write-pkg": "^2.0.0" + }, + "devDependencies": { + "ava": "*", + "dot-prop": "^4.1.0", + "temp-write": "^2.0.1", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/ava-init/readme.md b/node_modules/ava-init/readme.md new file mode 100644 index 000000000..596d098cb --- /dev/null +++ b/node_modules/ava-init/readme.md @@ -0,0 +1,63 @@ +# ava-init [![Build Status: Linux](https://travis-ci.org/avajs/ava-init.svg?branch=master)](https://travis-ci.org/avajs/ava-init) [![Build status: Windows](https://ci.appveyor.com/api/projects/status/abj17qsw0j1rts7l/branch/master?svg=true)](https://ci.appveyor.com/project/ava/ava-init/branch/master) + +> Add [AVA](https://ava.li) to your project + + +## Install + +``` +$ npm install --save ava-init +``` + + +## Usage + +```js +const avaInit = require('ava-init'); + +avaInit().then(() => { + console.log('done'); +}); +``` + + +## API + +### avaInit([options]) + +Returns a `Promise`. + +#### options + +#### cwd + +Type: `string`
+Default: `'.'` + +Current working directory. + +#### args + +Type: `Array`
+Default: CLI arguments *(`process.argv.slice(2)`)* + +For instance, with the arguments `['--foo', '--bar']`, the following will be put in package.json: + +```json +{ + "name": "awesome-package", + "scripts": { + "test": "ava --foo --bar" + } +} +``` + + +## CLI + +Install AVA globally `$ npm install --global ava` and run `$ ava --init []`. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) -- cgit v1.2.3