Comparing version 3.1.0-beta.0 to 3.1.0
@@ -30,3 +30,3 @@ 'use strict'; | ||
function onScript() { | ||
this.reply(getScripts(config.scripts)); | ||
this.reply(getScripts(config.scripts)); // eslint-disable-line babel/no-invalid-this | ||
} | ||
@@ -33,0 +33,0 @@ } |
@@ -26,6 +26,2 @@ 'use strict'; | ||
var _asciiTree = require('ascii-tree'); | ||
var _asciiTree2 = _interopRequireDefault(_asciiTree); | ||
var _getLogger = require('../get-logger'); | ||
@@ -50,3 +46,2 @@ | ||
var log = (0, _getLogger2.default)(); | ||
var indentCharacter = '#'; | ||
@@ -124,6 +119,5 @@ /** | ||
(function () { | ||
var _program$args = _slicedToArray(program.args, 1); | ||
var _program$args = _slicedToArray(program.args, 1), | ||
scriptsString = _program$args[0]; | ||
var scriptsString = _program$args[0]; | ||
scripts = scriptsString.split(','); | ||
@@ -181,3 +175,4 @@ (0, _lodash.remove)(rawArgs, function (arg) { | ||
function requireDefaultFromModule(modulePath) { | ||
var mod = require(modulePath); // eslint-disable-line global-require | ||
/* eslint global-require:0,import/no-dynamic-require:0 */ | ||
var mod = require(modulePath); | ||
if (mod.__esModule) { | ||
@@ -194,7 +189,9 @@ return mod.default; | ||
var availableScripts = getAvailableScripts(scripts); | ||
var scriptLines = availableScripts.map(function (_ref2) { | ||
var indent = _ref2.indent; | ||
var name = _ref2.name; | ||
var description = _ref2.description; | ||
var script = _ref2.script; | ||
var filteredScripts = availableScripts.filter(function (script) { | ||
return !script.hiddenFromHelp; | ||
}); | ||
var scriptLines = filteredScripts.map(function (_ref2) { | ||
var name = _ref2.name, | ||
description = _ref2.description, | ||
script = _ref2.script; | ||
@@ -209,10 +206,8 @@ var coloredName = _safe2.default.green(name); | ||
} | ||
return indent + line.join(' - ').trim(); | ||
return line.join(' - ').trim(); | ||
}); | ||
if (scriptLines.length) { | ||
var topMessage = indentCharacter + 'Available scripts (camel or kebab case accepted)'; | ||
var scriptString = '' + scriptLines.join('\n'); | ||
var helpString = _asciiTree2.default.generate(topMessage + '\n' + scriptString); | ||
return helpString.replace(/\r\n/g, '\n'); | ||
var topMessage = 'Available scripts (camel or kebab case accepted)'; | ||
var message = topMessage + '\n\n' + scriptLines.join('\n'); | ||
return message; | ||
} else { | ||
@@ -225,3 +220,2 @@ return _safe2.default.yellow('There are no scripts available'); | ||
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
var indentLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2; | ||
@@ -237,11 +231,11 @@ var excluded = ['description', 'script', 'default']; | ||
if (scriptObj) { | ||
var description = scriptObj.description; | ||
var script = scriptObj.script; | ||
var description = scriptObj.description, | ||
script = scriptObj.script, | ||
_scriptObj$hiddenFrom = scriptObj.hiddenFromHelp, | ||
hiddenFromHelp = _scriptObj$hiddenFrom === undefined ? false : _scriptObj$hiddenFrom; | ||
var name = prefixed.join('.'); | ||
var indent = indentCharacter.repeat(indentLevel); | ||
scripts = [].concat(_toConsumableArray(scripts), [{ indent: indent, name: name, description: description, script: script }]); | ||
scripts = [].concat(_toConsumableArray(scripts), [{ name: prefixed.join('.'), description: description, script: script, hiddenFromHelp: hiddenFromHelp }]); | ||
} | ||
if ((0, _lodash.isPlainObject)(val)) { | ||
return [].concat(_toConsumableArray(scripts), _toConsumableArray(getAvailableScripts(val, prefixed, indentLevel + 1))); | ||
return [].concat(_toConsumableArray(scripts), _toConsumableArray(getAvailableScripts(val, prefixed))); | ||
} | ||
@@ -248,0 +242,0 @@ return scripts; |
@@ -25,4 +25,5 @@ 'use strict'; | ||
/* eslint global-require:0,import/no-dynamic-require:0 */ | ||
var packageJsonPath = (0, _findUp.sync)('package.json'); | ||
var packageJson = require(packageJsonPath); // eslint-disable-line global-require | ||
var packageJson = require(packageJsonPath); | ||
var scripts = packageJson.scripts; | ||
@@ -29,0 +30,0 @@ |
@@ -22,2 +22,4 @@ #!/usr/bin/env node | ||
var _readlineSync = require('readline-sync'); | ||
var _index = require('../index'); | ||
@@ -35,7 +37,5 @@ | ||
var _require = require('../../package.json'); | ||
var _require = require('../../package.json'), | ||
version = _require.version; | ||
var version = _require.version; | ||
var log = (0, _getLogger2.default)(); | ||
@@ -104,8 +104,12 @@ var FAIL_CODE = 1; | ||
function onInit() { | ||
if (getPSConfigFilepath()) { | ||
if (!(0, _readlineSync.keyInYN)(_safe2.default.yellow('Do you want to overwrite your existing config file?'))) { | ||
process.exit(FAIL_CODE); | ||
} | ||
} | ||
shouldRun = false; | ||
var _initialize = (0, _binUtils.initialize)(getConfigType()); | ||
var _initialize = (0, _binUtils.initialize)(getConfigType()), | ||
packageScriptsPath = _initialize.packageScriptsPath; | ||
var packageScriptsPath = _initialize.packageScriptsPath; | ||
log.info('Your scripts have been saved at ' + _safe2.default.green(packageScriptsPath)); | ||
@@ -129,6 +133,5 @@ log.info(_safe2.default.gray('Check out your scripts in there. Go ahead and update them and add descriptions to the ones that need it')); | ||
var _process$argv = _slicedToArray(process.argv, 4); | ||
var _process$argv = _slicedToArray(process.argv, 4), | ||
destination = _process$argv[3]; | ||
var destination = _process$argv[3]; | ||
if (destination) { | ||
@@ -135,0 +138,0 @@ log.info('Installing p-s autocomplete into ' + destination); |
@@ -21,7 +21,5 @@ 'use strict'; | ||
var _require = require('../package.json'); | ||
var _require = require('../package.json'), | ||
version = _require.version; | ||
var version = _require.version; | ||
var shouldLog = { | ||
@@ -28,0 +26,0 @@ error: getShouldLogFn('error'), |
@@ -42,8 +42,6 @@ 'use strict'; | ||
function getScriptString(config, input) { | ||
var _prefixMatches = (0, _prefixMatches4.default)(input, config); | ||
var _prefixMatches = (0, _prefixMatches4.default)(input, config), | ||
_prefixMatches2 = _slicedToArray(_prefixMatches, 1), | ||
script = _prefixMatches2[0]; | ||
var _prefixMatches2 = _slicedToArray(_prefixMatches, 1); | ||
var script = _prefixMatches2[0]; | ||
return (0, _resolveScriptObjectToString2.default)(script); | ||
@@ -50,0 +48,0 @@ } |
@@ -51,7 +51,7 @@ 'use strict'; | ||
function runPackageScripts(_ref) { | ||
var scriptConfig = _ref.scriptConfig; | ||
var scripts = _ref.scripts; | ||
var args = _ref.args; | ||
var _ref$options = _ref.options; | ||
var options = _ref$options === undefined ? {} : _ref$options; | ||
var scriptConfig = _ref.scriptConfig, | ||
scripts = _ref.scripts, | ||
args = _ref.args, | ||
_ref$options = _ref.options, | ||
options = _ref$options === undefined ? {} : _ref$options; | ||
@@ -115,6 +115,6 @@ if (scripts.length === 0) { | ||
function runPackageScript(_ref2) { | ||
var scriptConfig = _ref2.scriptConfig; | ||
var options = _ref2.options; | ||
var scriptName = _ref2.scriptName; | ||
var args = _ref2.args; | ||
var scriptConfig = _ref2.scriptConfig, | ||
options = _ref2.options, | ||
scriptName = _ref2.scriptName, | ||
args = _ref2.args; | ||
@@ -170,4 +170,4 @@ var scripts = (0, _getScriptsFromConfig2.default)(scriptConfig, scriptName); | ||
function getLogLevel(_ref3) { | ||
var silent = _ref3.silent; | ||
var logLevel = _ref3.logLevel; | ||
var silent = _ref3.silent, | ||
logLevel = _ref3.logLevel; | ||
@@ -174,0 +174,0 @@ if (logLevel) { |
@@ -32,5 +32,2 @@ 'use strict'; | ||
function resolvePlainObjectToScript(script) { | ||
if (script.hiddenFromHelp) { | ||
return undefined; | ||
} | ||
if (!(0, _lodash.isUndefined)(script.script)) { | ||
@@ -37,0 +34,0 @@ return script; |
{ | ||
"name": "p-s", | ||
"version": "3.1.0-beta.0", | ||
"version": "3.1.0", | ||
"description": "All the benefits of npm scripts without the cost of a bloated package.json and limits of json", | ||
@@ -25,12 +25,12 @@ "main": "dist/index", | ||
"arrify": "1.0.1", | ||
"ascii-tree": "0.3.0", | ||
"bluebird": "3.4.6", | ||
"bluebird": "3.4.7", | ||
"colors": "1.1.2", | ||
"commander": "2.9.0", | ||
"find-up": "1.1.2", | ||
"js-yaml": "3.6.1", | ||
"lodash": "4.14.0", | ||
"find-up": "2.1.0", | ||
"js-yaml": "3.7.0", | ||
"lodash": "4.17.4", | ||
"manage-path": "2.0.0", | ||
"omelette": "0.3.1", | ||
"prefix-matches": "0.0.9", | ||
"readline-sync": "1.4.5", | ||
"shell-escape": "0.2.0", | ||
@@ -40,25 +40,26 @@ "spawn-command-with-kill": "1.0.0" | ||
"devDependencies": { | ||
"all-contributors-cli": "3.0.6", | ||
"babel-cli": "6.11.4", | ||
"babel-eslint": "6.1.2", | ||
"babel-jest": "15.0.0", | ||
"babel-preset-es2015": "6.9.0", | ||
"babel-preset-stage-2": "6.11.0", | ||
"babel-register": "6.11.5", | ||
"cli-tester": "1.0.0", | ||
"all-contributors-cli": "3.0.7", | ||
"babel-cli": "6.18.0", | ||
"babel-eslint": "7.1.1", | ||
"babel-jest": "18.0.0", | ||
"babel-plugin-module-resolver": "2.4.0", | ||
"babel-preset-es2015": "6.18.0", | ||
"babel-preset-stage-2": "6.18.0", | ||
"babel-register": "6.18.0", | ||
"cli-tester": "2.0.0", | ||
"codecov": "1.0.1", | ||
"commitizen": "2.8.2", | ||
"commitizen": "2.9.3", | ||
"condition-node-version": "1.3.0", | ||
"cross-env": "2.0.0", | ||
"cz-conventional-changelog": "1.1.6", | ||
"eslint": "3.4.0", | ||
"eslint-config-kentcdodds": "10.1.0", | ||
"husky": "0.11.7", | ||
"jest-cli": "15.1.1", | ||
"cross-env": "3.1.4", | ||
"cz-conventional-changelog": "1.2.0", | ||
"eslint": "3.12.2", | ||
"eslint-config-kentcdodds": "11.1.0", | ||
"husky": "0.12.0", | ||
"jest-cli": "18.1.0", | ||
"opt-cli": "1.5.1", | ||
"p-s": "*", | ||
"rimraf": "2.5.4", | ||
"semantic-release": "4.3.5", | ||
"sinon": "1.17.4", | ||
"validate-commit-msg": "2.6.1" | ||
"semantic-release": "6.3.2", | ||
"sinon": "1.17.7", | ||
"validate-commit-msg": "2.8.2" | ||
}, | ||
@@ -71,13 +72,2 @@ "eslintConfig": { | ||
}, | ||
"jest": { | ||
"cacheDirectory": "./node_modules/.cache", | ||
"coverageThreshold": { | ||
"global": { | ||
"branches": 100, | ||
"functions": 100, | ||
"lines": 100, | ||
"statements": 100 | ||
} | ||
} | ||
}, | ||
"release": { | ||
@@ -102,2 +92,2 @@ "verifyConditions": { | ||
"homepage": "https://github.com/kentcdodds/p-s#readme" | ||
} | ||
} |
@@ -14,3 +14,3 @@ # p-s | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors) | ||
[![PRs Welcome][prs-badge]][prs] | ||
@@ -159,3 +159,3 @@ [![Donate][donate-badge]][donate] | ||
You don't have to use the `start` script if you don't want. Note that if you're writing a node application, you're | ||
likely using `nps` for starting your server. In that case, you can create a `default` script which will be run | ||
likely using `start` for starting your server. In that case, you can create a `default` script which will be run | ||
when `nps` is run without arguments (so effectively it'll work just the same). But if you'd prefer, you can use whatever | ||
@@ -264,3 +264,3 @@ you wish. For example you could easily create a `nps` script and do: `npm run nps b`. | ||
Normally, `npss` will look for a `package-scripts.js` file and load that to get the scripts. Generally you'll want to | ||
Normally, `nps` will look for a `package-scripts.js` file and load that to get the scripts. Generally you'll want to | ||
have this at the root of your project (next to the `package.json`). But by specifying `-c` or `--config`, `nps` will | ||
@@ -390,6 +390,6 @@ use that file instead. | ||
1. `npm run test` === `npm test` === `npm t` | ||
2. `npm run start` === `nps` | ||
2. `npm run start` === `npm start` | ||
So, while you could use a script called `script` and run `npm run script build`, I just think it reads more clearly to | ||
just use the `start` script and run `nps build`. It's also nice that it's fewer things to type. You could also use | ||
just use the `start` script and run `npm start build`. It's also nice that it's fewer things to type. You could also use | ||
the `test` script and then type even less: `npm t build`, but thats just... odd. | ||
@@ -437,3 +437,3 @@ | ||
| [<img src="https://avatars.githubusercontent.com/u/1972567?v=3" width="100px;"/><br /><sub>Tommy</sub>](http://www.tommyleunen.com)<br />[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Atleunen) [💻](https://github.com/kentcdodds/p-s/commits?author=tleunen) [⚠️](https://github.com/kentcdodds/p-s/commits?author=tleunen) 👀 | [<img src="https://avatars.githubusercontent.com/u/509946?v=3" width="100px;"/><br /><sub>Jayson Harshbarger</sub>](http://www.hypercubed.com)<br />💡 👀 | [<img src="https://avatars.githubusercontent.com/u/1355481?v=3" width="100px;"/><br /><sub>JD Isaacks</sub>](http://www.jisaacks.com)<br />[💻](https://github.com/kentcdodds/p-s/commits?author=jisaacks) [⚠️](https://github.com/kentcdodds/p-s/commits?author=jisaacks) | [<img src="https://avatars.githubusercontent.com/u/924465?v=3" width="100px;"/><br /><sub>Christopher Hiller</sub>](https://boneskull.com)<br />👀 | [<img src="https://avatars.githubusercontent.com/u/1834413?v=3" width="100px;"/><br /><sub>Robin Malfait</sub>](https://robinmalfait.com)<br />💡 | [<img src="https://avatars.githubusercontent.com/u/622118?v=3" width="100px;"/><br /><sub>Eric McCormick</sub>](https://ericmccormick.io)<br />👀 [📖](https://github.com/kentcdodds/p-s/commits?author=edm00se) | [<img src="https://avatars.githubusercontent.com/u/1913805?v=3" width="100px;"/><br /><sub>Sam Verschueren</sub>](https://twitter.com/SamVerschueren)<br />👀 | | ||
| [<img src="https://avatars.githubusercontent.com/u/1155589?v=3" width="100px;"/><br /><sub>Sorin Muntean</sub>](https://github.com/sxn)<br />[💻](https://github.com/kentcdodds/p-s/commits?author=sxn) [⚠️](https://github.com/kentcdodds/p-s/commits?author=sxn) [📖](https://github.com/kentcdodds/p-s/commits?author=sxn) | [<img src="https://avatars.githubusercontent.com/u/1970063?v=3" width="100px;"/><br /><sub>Keith Gunn</sub>](https://github.com/gunnx)<br />[💻](https://github.com/kentcdodds/p-s/commits?author=gunnx) [⚠️](https://github.com/kentcdodds/p-s/commits?author=gunnx) | | ||
| [<img src="https://avatars.githubusercontent.com/u/1155589?v=3" width="100px;"/><br /><sub>Sorin Muntean</sub>](https://github.com/sxn)<br />[💻](https://github.com/kentcdodds/p-s/commits?author=sxn) [⚠️](https://github.com/kentcdodds/p-s/commits?author=sxn) [📖](https://github.com/kentcdodds/p-s/commits?author=sxn) | [<img src="https://avatars.githubusercontent.com/u/1970063?v=3" width="100px;"/><br /><sub>Keith Gunn</sub>](https://github.com/gunnx)<br />[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Agunnx) [💻](https://github.com/kentcdodds/p-s/commits?author=gunnx) [⚠️](https://github.com/kentcdodds/p-s/commits?author=gunnx) | [<img src="https://avatars.githubusercontent.com/u/1019478?v=3" width="100px;"/><br /><sub>Joe Martella</sub>](http://martellaj.github.io)<br />[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Amartellaj) [💻](https://github.com/kentcdodds/p-s/commits?author=martellaj) [⚠️](https://github.com/kentcdodds/p-s/commits?author=martellaj) | [<img src="https://avatars.githubusercontent.com/u/1887854?v=3" width="100px;"/><br /><sub>Martin Segado</sub>](https://github.com/msegado)<br />[📖](https://github.com/kentcdodds/p-s/commits?author=msegado) | [<img src="https://avatars.githubusercontent.com/u/36491?v=3" width="100px;"/><br /><sub>Bram Borggreve</sub>](http://colmena.io/)<br />[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Abeeman) [💻](https://github.com/kentcdodds/p-s/commits?author=beeman) | [<img src="https://avatars.githubusercontent.com/u/86454?v=3" width="100px;"/><br /><sub>Elijah Manor</sub>](http://elijahmanor.com)<br />📹 | | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
@@ -440,0 +440,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
56609
765
0
24
+ Addedreadline-sync@1.4.5
+ Addedbluebird@3.4.7(transitive)
+ Addedfind-up@2.1.0(transitive)
+ Addedjs-yaml@3.7.0(transitive)
+ Addedlocate-path@2.0.0(transitive)
+ Addedlodash@4.17.4(transitive)
+ Addedp-limit@1.3.0(transitive)
+ Addedp-locate@2.0.0(transitive)
+ Addedp-try@1.0.0(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedreadline-sync@1.4.5(transitive)
- Removedascii-tree@0.3.0
- Removedascii-tree@0.3.0(transitive)
- Removedbluebird@3.4.6(transitive)
- Removedfind-up@1.1.2(transitive)
- Removedfreetree@0.2.2(transitive)
- Removedjs-yaml@3.6.1(transitive)
- Removedlodash@4.14.0(transitive)
- Removedpath-exists@2.1.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
Updatedbluebird@3.4.7
Updatedfind-up@2.1.0
Updatedjs-yaml@3.7.0
Updatedlodash@4.17.4