p-s
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -24,2 +24,4 @@ 'use strict'; | ||
var _commonTags = require('common-tags'); | ||
var _getLogger = require('../get-logger'); | ||
@@ -42,3 +44,4 @@ | ||
/** | ||
* Attempts to load the given module. This is used for the --require functionality of the CLI | ||
* Attempts to load the given module. This is used for the | ||
* --require functionality of the CLI | ||
* @param {String} moduleName The module to attempt to require | ||
@@ -49,3 +52,6 @@ * @return {*} The required module | ||
log.warn({ | ||
message: _chalk2.default.yellow(`Unable to preload "${moduleName}". Attempted to require as "${requirePath}"`), | ||
message: _chalk2.default.yellow(_commonTags.oneLine` | ||
Unable to preload "${moduleName}". | ||
Attempted to require as "${requirePath}" | ||
`), | ||
ref: 'unable-to-preload-module' | ||
@@ -58,3 +64,6 @@ }); | ||
log.error({ | ||
message: _chalk2.default.red(`Unable to find JS config at "${configPath}". Attempted to require as "${requirePath}"`), | ||
message: _chalk2.default.red(_commonTags.oneLine` | ||
Unable to find JS config at "${configPath}". | ||
Attempted to require as "${requirePath}" | ||
`), | ||
ref: 'unable-to-find-config' | ||
@@ -84,3 +93,6 @@ }); | ||
config = config(input); | ||
typeMessage = `Your config was a function that returned a data type of "${(0, _typeDetect2.default)(config)}"`; | ||
typeMessage = _commonTags.oneLine` | ||
Your config was a function that returned | ||
a data type of "${(0, _typeDetect2.default)(config)}" | ||
`; | ||
} else { | ||
@@ -91,3 +103,7 @@ typeMessage = `Your config data type was "${(0, _typeDetect2.default)(config)}"`; | ||
log.error({ | ||
message: _chalk2.default.red(`The package-scripts configuration ("${configPath}") ` + 'must be an object or a function that returns an object.'), | ||
message: _chalk2.default.red(_commonTags.oneLine` | ||
The package-scripts configuration | ||
("${configPath}") must be an object | ||
or a function that returns an object. | ||
`), | ||
ref: 'config-must-be-an-object' | ||
@@ -124,3 +140,4 @@ }); | ||
/** | ||
* Determines the proper require path for a module. If the path starts with `.` then it is resolved with process.cwd() | ||
* Determines the proper require path for a module. | ||
* If the path starts with `.` then it is resolved with process.cwd() | ||
* @param {String} moduleName The module path | ||
@@ -127,0 +144,0 @@ * @return {String} the module path to require |
@@ -79,3 +79,4 @@ 'use strict'; | ||
}, {}); | ||
// traverse the object and replace all objects that only have `default` with just the script itself. | ||
// traverse the object and replace all objects that | ||
// only have `default` with just the script itself. | ||
traverse(defaultedScripts, removeDefaultOnly); | ||
@@ -122,3 +123,3 @@ return defaultedScripts; | ||
function escapeSingleQuote(string) { | ||
return string.replace(/'/g, '\\\''); | ||
return string.replace(/'/g, "\\'"); | ||
} | ||
@@ -125,0 +126,0 @@ |
@@ -23,2 +23,4 @@ 'use strict'; | ||
var _commonTags = require('common-tags'); | ||
var _getLogger = require('../get-logger'); | ||
@@ -48,3 +50,6 @@ | ||
var configOption = { | ||
describe: 'Config file to use (defaults to nearest package-scripts.yml or package-scripts.js)', | ||
describe: _commonTags.oneLine` | ||
Config file to use (defaults to nearest package-scripts.yml | ||
or package-scripts.js) | ||
`, | ||
alias: 'c', | ||
@@ -77,3 +82,6 @@ default: getPSConfigFilepath() | ||
var parser = (_yargsInstance$usage$ = yargsInstance.usage('Usage: $0 [options] <script>...').example('$0 test build', 'Runs the `test` script then the `build` script').example('$0 "test --cover" "build --prod"', 'Runs the `test` script and forwards the "--cover" flag then the `build` script and forwards the "--prod" flag').help(false).alias('h', 'help').version().alias('v', 'version').options(baseOptions)).command.apply(_yargsInstance$usage$, _toConsumableArray(getInitCommand())).completion('completion', completionHandler).exitProcess(shouldExitProcess()); | ||
var parser = (_yargsInstance$usage$ = yargsInstance.usage('Usage: $0 [options] <script>...').example('$0 test build', 'Runs the `test` script then the `build` script').example('$0 "test --cover" "build --prod"', _commonTags.oneLine` | ||
Runs the \`test\` script and forwards the "--cover" flag | ||
then the \`build\` script and forwards the "--prod" flag | ||
`).help(false).alias('h', 'help').version().alias('v', 'version').options(baseOptions)).command.apply(_yargsInstance$usage$, _toConsumableArray(getInitCommand())).completion('completion', completionHandler).exitProcess(shouldExitProcess()); | ||
@@ -89,3 +97,7 @@ var parsedArgv = parser.parse(rawArgv); | ||
log.error({ | ||
message: _chalk2.default.red(`You provided one or more invalid flags: ${invalidFlags.join(', ')}\n` + 'Did you forget to put your command in quotes?'), | ||
message: _chalk2.default.red(_commonTags.oneLine` | ||
You provided one or more invalid flags: | ||
${invalidFlags.join(', ')}\n | ||
Did you forget to put your command in quotes? | ||
`), | ||
ref: 'invalid-flags' | ||
@@ -110,3 +122,2 @@ }); | ||
function showHelp(specifiedScripts) { | ||
@@ -132,3 +143,3 @@ if (parsedArgv.help) { | ||
var command = 'init'; | ||
var description = 'automatically migrate from npm scripts to p-s'; | ||
var description = 'automatically migrate from npm scripts to nps'; | ||
return [command, description, getConfig, onInit]; | ||
@@ -162,5 +173,17 @@ | ||
log.info(`Your scripts have been saved at ${_chalk2.default.green(packageScriptsPath)}`); | ||
log.info(_chalk2.default.gray('Check out your scripts in there. Go ahead and update them and add descriptions to the ones that need it')); | ||
log.info(_chalk2.default.gray('Your package.json scripts have also been updated. Run `npm start help` for help')); | ||
log.info(_chalk2.default.gray('You may also want to install the package globally and installing autocomplete script. You can do so by running\n' + ' npm install --global p-s\n' + ' nps completion >> <your-bash-profile-file>')); | ||
log.info(_chalk2.default.gray(_commonTags.oneLine` | ||
Check out your scripts in there. Go ahead and | ||
update them and add descriptions to the ones | ||
that need it | ||
`)); | ||
log.info(_chalk2.default.gray(_commonTags.oneLine` | ||
Your package.json scripts have also been updated. Run | ||
\`npm start help\` for help | ||
`)); | ||
log.info(_chalk2.default.gray(_commonTags.oneLine` | ||
You may also want to install the package globally and | ||
installing autocomplete script. You can do so by running | ||
\n npm install --global nps | ||
\n nps completion >> <your-bash-profile-file> | ||
`)); | ||
} | ||
@@ -167,0 +190,0 @@ } |
@@ -40,3 +40,6 @@ #!/usr/bin/env node | ||
}, function (error) { | ||
var logLevel = (0, _getLogger.getLogLevel)({ silent: argv.silent, logLevel: argv.logLevel }); | ||
var logLevel = (0, _getLogger.getLogLevel)({ | ||
silent: argv.silent, | ||
logLevel: argv.logLevel | ||
}); | ||
var log = (0, _getLogger2.default)(logLevel); | ||
@@ -43,0 +46,0 @@ log.error(error); |
@@ -16,2 +16,4 @@ 'use strict'; | ||
var _commonTags = require('common-tags'); | ||
var _lodash = require('lodash'); | ||
@@ -33,9 +35,2 @@ | ||
// eslint-disable-next-line func-style | ||
var getLogLevel = function getLogLevel(_ref) { | ||
var silent = _ref.silent, | ||
logLevel = _ref.logLevel; | ||
return silent ? 'disable' : logLevel; | ||
}; | ||
exports.default = getLogger; | ||
@@ -77,3 +72,8 @@ exports.getLogLevel = getLogLevel; | ||
function getLink(ref) { | ||
return `https://github.com/kentcdodds/p-s/blob/v${version}/other/ERRORS_AND_WARNINGS.md#${ref}`; | ||
return _commonTags.oneLineTrim` | ||
https://github.com/kentcdodds/nps/blob/v | ||
${version} | ||
/other/ERRORS_AND_WARNINGS.md# | ||
${ref} | ||
`; | ||
} | ||
@@ -92,2 +92,9 @@ | ||
}; | ||
} | ||
function getLogLevel(_ref) { | ||
var silent = _ref.silent, | ||
logLevel = _ref.logLevel; | ||
return silent ? 'disable' : logLevel; | ||
} |
@@ -30,3 +30,4 @@ 'use strict'; | ||
config = (0, _kebabAndCamelCasify2.default)(config); | ||
// remove the default objects/strings so we can check if the prefix works with another script first | ||
// remove the default objects/strings so we cancheck | ||
// if the prefix works with another script first | ||
var defaultlessConfig = removeDefaults((0, _lodash.cloneDeep)(config)); | ||
@@ -37,3 +38,4 @@ var scriptString = getScriptString(defaultlessConfig, input); | ||
} else { | ||
// fallback to the defaults if no other script was found with the given input | ||
// fallback to the defaults if no other script was | ||
// found with the given input | ||
return getScriptString(config, input); | ||
@@ -40,0 +42,0 @@ } |
@@ -15,2 +15,4 @@ 'use strict'; | ||
var _commonTags = require('common-tags'); | ||
var _lodash = require('lodash'); | ||
@@ -83,3 +85,6 @@ | ||
return Promise.reject({ | ||
message: _chalk2.default.red(`Scripts must resolve to strings. There is no script that can be resolved from "${scriptPrefix}"`), | ||
message: _chalk2.default.red(_commonTags.oneLine` | ||
Scripts must resolve to strings. | ||
There is no script that can be resolved from "${scriptPrefix}" | ||
`), | ||
ref: 'missing-script' | ||
@@ -97,3 +102,6 @@ }); | ||
reject({ | ||
message: _chalk2.default.red(`The script called "${scriptPrefix}" which runs "${command}" emitted an error`), | ||
message: _chalk2.default.red(_commonTags.oneLine` | ||
The script called "${scriptPrefix}" | ||
which runs "${command}" emitted an error | ||
`), | ||
ref: 'emitted-an-error', | ||
@@ -109,3 +117,6 @@ error | ||
reject({ | ||
message: _chalk2.default.red(`The script called "${scriptPrefix}" which runs "${command}" failed with exit code ${code}`), | ||
message: _chalk2.default.red(_commonTags.oneLine` | ||
The script called "${scriptPrefix}" | ||
which runs "${command}" failed with exit code ${code} | ||
`), | ||
ref: 'failed-with-exit-code', | ||
@@ -112,0 +123,0 @@ code |
{ | ||
"name": "p-s", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "All the benefits of npm scripts without the cost of a bloated package.json and limits of json", | ||
@@ -14,4 +14,3 @@ "main": "dist/index", | ||
"bin": { | ||
"nps": "./dist/bin/nps.js", | ||
"p-s": "./dist/bin/nps.js" | ||
"nps": "./dist/bin/nps.js" | ||
}, | ||
@@ -27,2 +26,3 @@ "files": [ | ||
"chalk": "^1.1.3", | ||
"common-tags": "^1.4.0", | ||
"find-up": "^2.1.0", | ||
@@ -33,2 +33,3 @@ "js-yaml": "^3.7.0", | ||
"prefix-matches": "^0.0.9", | ||
"prettier-eslint-cli": "^1.1.1", | ||
"readline-sync": "^1.4.6", | ||
@@ -52,3 +53,2 @@ "spawn-command-with-kill": "^1.0.0", | ||
"concurrently": "^3.3.0", | ||
"condition-node-version": "^1.3.0", | ||
"cross-env": "^3.1.4", | ||
@@ -60,4 +60,5 @@ "cz-conventional-changelog": "^1.2.0", | ||
"jest-cli": "^18.1.0", | ||
"lint-staged": "^3.3.0", | ||
"opt-cli": "^1.5.1", | ||
"p-s": "*", | ||
"nps": "*", | ||
"rimraf": "^2.5.4", | ||
@@ -72,10 +73,16 @@ "semantic-release": "^6.3.6", | ||
"kentcdodds/jest" | ||
], | ||
"rules": { | ||
"max-len": [ | ||
"error", | ||
80 | ||
] | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"prettier-eslint --write --ignore \"**/fixtures/**\"", | ||
"git add" | ||
] | ||
}, | ||
"release": { | ||
"verifyConditions": { | ||
"path": "condition-node-version", | ||
"node": "^6" | ||
} | ||
}, | ||
"config": { | ||
@@ -88,8 +95,8 @@ "commitizen": { | ||
"type": "git", | ||
"url": "https://github.com/kentcdodds/p-s.git" | ||
"url": "https://github.com/kentcdodds/nps.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/kentcdodds/p-s/issues" | ||
"url": "https://github.com/kentcdodds/nps/issues" | ||
}, | ||
"homepage": "https://github.com/kentcdodds/p-s#readme" | ||
"homepage": "https://github.com/kentcdodds/nps#readme" | ||
} |
463
README.md
# p-s | ||
> aka npm-package-scripts or `nps` for short | ||
All the benefits of npm scripts without the cost of a bloated package.json and limits of json | ||
[![Build Status][build-badge]][build] | ||
[![Code Coverage][coverage-badge]][coverage] | ||
[![Dependencies][dependencyci-badge]][dependencyci] | ||
[![version][version-badge]][package] | ||
[![downloads][downloads-badge]][npm-stat] | ||
[![MIT License][license-badge]][LICENSE] | ||
## Renamed | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-23-orange.svg?style=flat-square)](#contributors) | ||
[![PRs Welcome][prs-badge]][prs] | ||
[![Donate][donate-badge]][donate] | ||
[![Code of Conduct][coc-badge]][coc] | ||
[![Roadmap][roadmap-badge]][roadmap] | ||
[![Examples][examples-badge]][examples] | ||
## Quick Video Intro :tv: | ||
<a href="http://kcd.im/p-s-video" title="Pull out npm scripts into another file with p-s"> | ||
<img src="other/video-screenshot.png" alt="Video Screenshot" title="Video Screenshot" width="700" /> | ||
</a> | ||
[Pull out npm scripts into another file with p-s][video] by [Elijah Manor](https://github.com/elijahmanor) (5:53) | ||
## The problem | ||
Even though npm scripts have a ton of advantages ([learn more][scripts-advantages]), it can grow into an | ||
[unmaintainable mess][mess] in your `package.json` file. Part of the problem is we're configuring scripts in `json` | ||
which has fundamental issues (like no comments). | ||
## This solution | ||
`p-s` is a package that solves this problem by allowing you to move your scripts to a `package-scripts.js` file. Because | ||
this file is a JavaScript file, you can do a lot more with your project scripts. Here's an example of a | ||
`package-scripts.js` file: | ||
```javascript | ||
module.exports = { | ||
scripts: { | ||
default: 'node index.js', | ||
lint: 'eslint .', | ||
test: { | ||
// learn more about Jest here: https://facebook.github.io/jest | ||
default: 'jest', | ||
watch: { | ||
script: 'jest --watch', | ||
description: 'run in the amazingly intelligent Jest watch mode' | ||
} | ||
}, | ||
build: { | ||
// learn more about Webpack here: https://webpack.js.org/ | ||
default: 'webpack', | ||
prod: 'webpack -p', | ||
}, | ||
// learn more about concurrently here: https://npm.im/concurrently | ||
validate: 'concurrently "nps lint" "nps test" "nps build"', | ||
// concurrently script too verbose for your liking? Check out other/EXAMPLES.md! | ||
}, | ||
} | ||
``` | ||
Or in case you prefer YAML, here's an example of how that would look in a `package-scripts.yml` file: | ||
```yml | ||
scripts: | ||
default: node index.js | ||
lint: eslint . | ||
test: | ||
# learn more about Jest here: https://kcd.im/egghead-jest | ||
default: jest | ||
watch: | ||
script: jest --watch | ||
description: run in the amazingly intelligent Jest watch mode | ||
build: | ||
default: webpack | ||
prod: webpack -p | ||
validate: concurrently "nps lint" "nps test" "nps build" | ||
``` | ||
To use `p-s`, it's recommended that you either install it globally (`npm i -g p-s`) or add `./node_modules/bin` to your | ||
`$PATH` (be careful that you know what you're doing when doing this, find out how [here](https://youtu.be/2WZ5iS_3Jgs)). | ||
Then you can run: | ||
```console | ||
nps help | ||
``` | ||
Which will output: | ||
```console | ||
Usage: nps [options] <script>... | ||
Commands: | ||
init automatically migrate from npm scripts to p-s | ||
completion generate bash completion script | ||
Options: | ||
--config, -c Config file to use (defaults to nearest package-scripts.yml | ||
or package-scripts.js) | ||
[default: "<path-to-your-project>/package-scripts.js"] | ||
--silent, -s Silent nps output [boolean] [default: false] | ||
--log-level, -l The log level to use | ||
[choices: "error", "warn", "info", "debug"] [default: "info"] | ||
--require, -r Module to preload | ||
-h, --help Show help [boolean] | ||
-v, --version Show version number [boolean] | ||
Examples: | ||
nps.js test build Runs the `test` script then the | ||
`build` script | ||
nps.js "test --cover" "build --prod" Runs the `test` script and forwards | ||
the "--cover" flag then the `build` | ||
script and forwards the "--prod" | ||
flag | ||
Available scripts (camel or kebab case accepted) | ||
lint - eslint . | ||
test - jest | ||
test.watch - run in the amazingly intelligent Jest watch mode - jest --watch | ||
build - webpack | ||
build.prod - webpack -p | ||
validate - concurrently "nps lint" "nps test" "nps build" | ||
``` | ||
**Because `p-s` is harder to type, it is recommended that you use the alias `nps` to interact with `p-s`, which is much | ||
easier to type and the rest of the documentation will use `nps`** | ||
Now, to run a script, you can run: | ||
```console | ||
nps lint | ||
nps test.watch | ||
# etc. | ||
``` | ||
But the fun doesn't end there! You can use a prefix: | ||
```console | ||
nps b # will run the build script | ||
``` | ||
And these prefixes can go as deep as you like! | ||
```console | ||
nps b.p # will run the production build script | ||
``` | ||
Cool stuff right? And there's more on [the roadmap][roadmap]. | ||
**Also** check out the [examples][examples]. You'll find some good stuff in there (including how to deal with windows | ||
and other cross-platform issues). | ||
**Note:** If you don't like installing things globally and don't want to muck with your `$PATH` (or don't want to | ||
require that your co-workers or project contributors to do so), then you can add a single script to your `package.json`. | ||
We recommend that you use the `start` script because it requires less typing: | ||
**package.json** | ||
```json | ||
{ | ||
"scripts": { | ||
"start": "nps" | ||
} | ||
} | ||
``` | ||
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 `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 | ||
you wish. For example you could easily create a `nps` script and do: `npm run nps b`. | ||
## Installation | ||
This module is distributed via [npm][npm] which is bundled with [node][node] and should | ||
be installed as one of your project's `devDependencies`: | ||
``` | ||
npm install --save-dev p-s | ||
``` | ||
### global installation | ||
You can install this module globally also (this is recommended): | ||
``` | ||
npm install --global p-s | ||
``` | ||
From here you can use `p-s` on the command line via one of the installed aliases: `nps` or `p-s`. | ||
If you do this, you may also be interested in installing the shell autocompletion script. See more about this below. | ||
## Getting started | ||
If you're already using npm scripts, you can get up and going really quickly with the `init` command: | ||
``` | ||
./node_modules/.bin/nps init | ||
``` | ||
or | ||
``` | ||
./node_modules/.bin/nps init --type yaml | ||
``` | ||
This will use your `package.json` `scripts` to generate a `package-scripts.js` (respectively a `package-scripts.yml`) | ||
file and update your `scripts` to utilize the `nps` binary. | ||
## API | ||
### CLI | ||
#### Commands | ||
##### help | ||
If you have a `help` script, then your `help` script will be run. Otherwise, this will output the help. | ||
> Note: you can do this with `nps --help`, but if you're using the `start` script in your `package.json` this allows you | ||
> to run `npm start help` rather than `npm start -- --help` | ||
##### init | ||
As indicated above, this will migrate your npm scripts to package-scripts. | ||
##### completion | ||
```console | ||
nps completion >> <your-bash-profile-file> | ||
``` | ||
Normally `<your-bash-profile-file>` will be `~/.bash_profile`, `~/.bashrc`, or `~/.zshrc`. | ||
Note: you should probably only do this if you have the package installed globally. In that case you should probably also | ||
normally use the `nps` alias rather than `p-s` because it's easier to type. | ||
#### CLI options | ||
##### -h, --help | ||
Will print out the help you see above (the available scripts are colored 🌈 and come from the config specified/default | ||
config). | ||
##### -s, --silent | ||
By default, `nps` will log out to the console before running the command. You can add `-s` to your command to silence | ||
this. | ||
##### -c, --config | ||
Use a different config | ||
``` | ||
nps -c ./other/package-scripts.js lint | ||
``` | ||
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 | ||
use that file instead. | ||
##### -l, --log-level | ||
Specify the log level to use | ||
##### -r, --require | ||
You can specify a module which will be loaded before the config file is loaded. This allows you to preload for example | ||
babel-register so you can use all babel presets you like. | ||
##### scripts | ||
To run a script, you simply provide the name of the script like so: | ||
```console | ||
nps cover | ||
``` | ||
And you can run multiple scripts in series by simply adding more space-separated arguments. | ||
```console | ||
nps cover check-coverage | ||
``` | ||
And you can pass arguments to scripts by putting the scripts in quotes: | ||
```console | ||
nps "test --cover" check-coverage | ||
``` | ||
That's all for the CLI. | ||
### package-scripts.js | ||
> Remember, this file is JavaScript, so you can write functions to make things more simple! | ||
> See other/EXAMPLES.md for examples of cool things you can do with this. | ||
`nps` expects to your `package-scripts.js` file to `module.exports` an object with the following properties: | ||
#### scripts | ||
This can be an object or a function that returns an object. See the annotated example below for what this object can | ||
look like (and different ways to run them): | ||
```javascript | ||
module.exports = { | ||
scripts: { | ||
default: 'echo "This runs on `nps`"', // nps | ||
// you can assign a script property to a string | ||
simple: 'echo "this is easy"', // nps simple | ||
// you can specify whether some scripts should be excluded from the help list | ||
hidden: { | ||
script: 'debugging script', | ||
hiddenFromHelp: true, | ||
}, | ||
test: { | ||
default: { | ||
script: 'jest', // nps test | ||
description: 'Run tests with jest', | ||
// your scripts will be run with node_modules/.bin in the PATH, so you can use locally installed packages. | ||
// this is done in a cross-platform way, so your scripts will work on Mac and Windows :) | ||
// NOTE: if you need to set environment variables, I recommend you check out the cross-env package, which works | ||
// great with p-s | ||
}, | ||
otherStuff: { | ||
// this one can be executed two different ways: | ||
// 1. nps test.otherStuff | ||
// 2. nps test.other-stuff | ||
script: 'echo "testing other things"', | ||
description: 'this is a handy description', | ||
}, | ||
}, | ||
// this one can be executed a few different ways: | ||
// 1. nps k | ||
// 2. nps kebab-case | ||
// 3. nps kebabCase | ||
'kebab-case': 'echo "kebab-case"', | ||
series: 'nps simple,test,kebabCase', // runs these other scripts in series | ||
}, | ||
} | ||
``` | ||
```console | ||
nps k # runs nps kebab-case | ||
``` | ||
#### options | ||
This object is used to configure `nps` with the following options: | ||
##### silent | ||
Setting this to `true` will prevent `nps` from outputting anything for your script (normally you'll get simple output | ||
indicating the command that's being executed). This effectively sets the `logLevel` to `disable`. | ||
##### logLevel | ||
This sets the logLevel of `nps`. | ||
## ENV variables | ||
### LOG_LEVEL | ||
By setting `LOG_LEVEL` environment variable you can control the log level for `nps` | ||
## Log level | ||
Log levels available: | ||
- `error` - errors only | ||
- `warn` - errors and warnings only | ||
- `info` - info, errors, and warnings (default) | ||
## FAQ | ||
### How do I do ___ ? | ||
Have you looked at the examples in [other/EXAMPLES.md][examples]? | ||
### Why `npm start`? | ||
_Just to be clear:_ You do **not** have to use the `start` script. You can use whatever you like. But I recommend using | ||
the `start`. [npm scripts][npm scripts] are generally run with `npm run <script-name>`. There are some exceptions to | ||
this. For example: | ||
1. `npm run test` === `npm test` === `npm t` | ||
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 `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. | ||
Note, often servers are configured to run `npm start` by default to start the server. To allow for this case, you can | ||
provide a `default` script at the root of your scripts which will be run when `npm start` is run without any arguments. | ||
Effectively this will allow you to have a script run when `npm start` is executed. | ||
## Inspiration | ||
This was inspired by [a tweet][tweet] by [@sindresorhus][sindre]. | ||
## Other Solutions | ||
- [scripty][scripty] has a solution for this problem as well. The reason I didn't go with that though is you still need | ||
a line for every script (one of the pains I'm trying to solve) and a each script requires its own file (one of the | ||
benefits of npm scripts I wanted to keep). | ||
## Contributors | ||
Thanks goes to these people ([emoji key][emojis]): | ||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](http://kent.doddsfamily.us)<br />[💻](https://github.com/kentcdodds/p-s/commits?author=kentcdodds) [📖](https://github.com/kentcdodds/p-s/commits?author=kentcdodds) 🚇 💡 📹 👀 | [<img src="https://avatars.githubusercontent.com/u/532272?v=3" width="100px;"/><br /><sub>David Wells</sub>](http://davidwells.io)<br />[💻](https://github.com/kentcdodds/p-s/commits?author=DavidWells) | [<img src="https://avatars.githubusercontent.com/u/802242?v=3" width="100px;"/><br /><sub>Abhishek Shende</sub>](https://twitter.com/abhishekisnot)<br />[💻](https://github.com/kentcdodds/p-s/commits?author=abhishekisnot) [⚠️](https://github.com/kentcdodds/p-s/commits?author=abhishekisnot) | [<img src="https://avatars.githubusercontent.com/u/185649?v=3" width="100px;"/><br /><sub>Rowan Oulton</sub>](http://travelog.io)<br />[💻](https://github.com/kentcdodds/p-s/commits?author=rowanoulton) [📖](https://github.com/kentcdodds/p-s/commits?author=rowanoulton) [⚠️](https://github.com/kentcdodds/p-s/commits?author=rowanoulton) | [<img src="https://avatars.githubusercontent.com/u/1915716?v=3" width="100px;"/><br /><sub>Gilad Goldberg</sub>](https://github.com/giladgo)<br />[💻](https://github.com/kentcdodds/p-s/commits?author=giladgo) | [<img src="https://avatars.githubusercontent.com/u/14267457?v=3" width="100px;"/><br /><sub>Tim McGee</sub>](https://github.com/tim-mcgee)<br />[💻](https://github.com/kentcdodds/p-s/commits?author=tim-mcgee) [📖](https://github.com/kentcdodds/p-s/commits?author=tim-mcgee) | [<img src="https://avatars.githubusercontent.com/u/175264?v=3" width="100px;"/><br /><sub>Nik Butenko</sub>](http://butenko.me)<br />💡 [💻](https://github.com/kentcdodds/p-s/commits?author=nkbt) | | ||
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | | ||
| [<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/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 />📹 | [<img src="https://avatars.githubusercontent.com/u/10691183?v=3" width="100px;"/><br /><sub>Ragu Ramaswamy</sub>](https://github.com/rrag)<br />[💻](https://github.com/kentcdodds/p-s/commits?author=rrag) [⚠️](https://github.com/kentcdodds/p-s/commits?author=rrag) | | ||
| [<img src="https://avatars.githubusercontent.com/u/2915616?v=3" width="100px;"/><br /><sub>Erik Fox</sub>](http://www.erikfox.co/)<br />[🐛](https://github.com/kentcdodds/p-s/issues?q=author%3Aerikfox) | [<img src="https://avatars.githubusercontent.com/u/5351262?v=3" width="100px;"/><br /><sub>Aditya Pratap Singh</sub>](http://blog.adityapsingh.com)<br />👀 | | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
This project follows the [all-contributors][all-contributors] specification. | ||
Contributions of any kind welcome! | ||
## LICENSE | ||
MIT | ||
[scripts-advantages]: https://medium.freecodecamp.com/why-i-left-gulp-and-grunt-for-npm-scripts-3d6853dd22b8#.9qghcfdr9 | ||
[mess]: https://github.com/ReactiveX/rxjs/blob/a3ec89605a24a6f54e577d21773dad11f22fdb14/package.json#L14-L96 | ||
[roadmap]: https://github.com/kentcdodds/p-s/blob/master/other/ROADMAP.md | ||
[examples]: https://github.com/kentcdodds/p-s/blob/master/other/EXAMPLES.md | ||
[quick-run]: https://npmjs.com/package/npm-quick-run | ||
[npm]: https://www.npmjs.com/ | ||
[node]: https://nodejs.org | ||
[build-badge]: https://img.shields.io/travis/kentcdodds/p-s/master.svg?style=flat-square | ||
[build]: https://travis-ci.org/kentcdodds/p-s | ||
[coverage-badge]: https://img.shields.io/codecov/c/github/kentcdodds/p-s.svg?style=flat-square | ||
[coverage]: https://codecov.io/github/kentcdodds/p-s | ||
[dependencyci-badge]: https://dependencyci.com/github/kentcdodds/p-s/badge?style=flat-square | ||
[dependencyci]: https://dependencyci.com/github/kentcdodds/p-s | ||
[version-badge]: https://img.shields.io/npm/v/p-s.svg?style=flat-square | ||
[package]: https://www.npmjs.com/package/p-s | ||
[downloads-badge]: https://img.shields.io/npm/dm/p-s.svg?style=flat-square | ||
[npm-stat]: http://npm-stat.com/charts.html?package=p-s&from=2016-04-01 | ||
[license-badge]: https://img.shields.io/npm/l/p-s.svg?style=flat-square | ||
[license]: https://github.com/kentcdodds/p-s/blob/master/LICENSE | ||
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square | ||
[prs]: http://makeapullrequest.com | ||
[donate-badge]: https://img.shields.io/badge/%EF%BC%84-support-green.svg?style=flat-square | ||
[donate]: http://kcd.im/donate | ||
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square | ||
[coc]: https://github.com/kentcdodds/p-s/blob/master/other/CODE_OF_CONDUCT.md | ||
[roadmap-badge]: https://img.shields.io/badge/%F0%9F%93%94-roadmap-CD9523.svg?style=flat-square | ||
[examples-badge]: https://img.shields.io/badge/%F0%9F%92%A1-examples-8C8E93.svg?style=flat-square | ||
[tweet]: https://twitter.com/sindresorhus/status/724259780676575232 | ||
[sindre]: https://github.com/sindresorhus | ||
[emojis]: https://github.com/kentcdodds/all-contributors#emoji-key | ||
[all-contributors]: https://github.com/kentcdodds/all-contributors | ||
[clarity]: https://github.com/kentcdodds/p-s/issues/1 | ||
[scripty]: https://npmjs.com/package/scripty | ||
[npm scripts]: https://docs.npmjs.com/misc/scripts | ||
[video]: http://kcd.im/p-s-video | ||
This package has been renamed to [`nps`](https://github.com/kentcdodds/nps). | ||
Please use that one instead! |
881
37724
13
9
+ Addedcommon-tags@^1.4.0
+ Addedprettier-eslint-cli@^1.1.1
+ Addedabbrev@1.1.1(transitive)
+ Addedacorn@3.3.05.7.4(transitive)
+ Addedacorn-jsx@3.0.1(transitive)
+ Addedajv@4.11.8(transitive)
+ Addedajv-keywords@1.5.1(transitive)
+ Addedansi-escapes@1.4.0(transitive)
+ Addedansi-regex@3.0.1(transitive)
+ Addedast-types@0.8.180.9.4(transitive)
+ Addedbabel-code-frame@6.22.06.26.0(transitive)
+ Addedbabel-runtime@6.26.0(transitive)
+ Addedbabylon@6.15.0(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcaller-path@0.1.0(transitive)
+ Addedcallsites@0.2.0(transitive)
+ Addedcircular-json@0.3.3(transitive)
+ Addedcli-cursor@1.0.2(transitive)
+ Addedcli-width@2.2.1(transitive)
+ Addedco@4.6.0(transitive)
+ Addedcolors@1.4.0(transitive)
+ Addedcommon-tags@1.8.2(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconcat-stream@1.6.2(transitive)
+ Addedcore-js@2.6.12(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedd@1.0.2(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddeep-is@0.1.4(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddlv@1.1.3(transitive)
+ Addeddoctrine@2.1.0(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes5-ext@0.10.64(transitive)
+ Addedes6-iterator@2.0.3(transitive)
+ Addedes6-map@0.1.5(transitive)
+ Addedes6-set@0.1.6(transitive)
+ Addedes6-symbol@3.1.4(transitive)
+ Addedes6-weak-map@2.0.3(transitive)
+ Addedescope@3.6.0(transitive)
+ Addedeslint@3.19.0(transitive)
+ Addedesniff@2.0.1(transitive)
+ Addedespree@3.5.4(transitive)
+ Addedesquery@1.5.0(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@4.3.05.3.0(transitive)
+ Addedesutils@2.0.22.0.3(transitive)
+ Addedevent-emitter@0.3.5(transitive)
+ Addedexit-hook@1.1.1(transitive)
+ Addedext@1.7.0(transitive)
+ Addedfast-levenshtein@2.0.6(transitive)
+ Addedfigures@1.7.0(transitive)
+ Addedfile-entry-cache@2.0.0(transitive)
+ Addedflat-cache@1.3.4(transitive)
+ Addedflow-parser@0.38.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addedgenerate-object-property@1.2.0(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedget-stdin@5.0.1(transitive)
+ Addedglob@7.0.67.1.17.2.3(transitive)
+ Addedglobals@9.18.0(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedignore@3.3.10(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedinquirer@0.12.0(transitive)
+ Addedinterpret@1.4.0(transitive)
+ Addedis-fullwidth-code-point@2.0.0(transitive)
+ Addedis-my-ip-valid@1.0.1(transitive)
+ Addedis-my-json-valid@2.20.6(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedis-resolvable@1.1.0(transitive)
+ Addedisarray@1.0.02.0.5(transitive)
+ Addedjest-matcher-utils@18.1.0(transitive)
+ Addedjest-validate@18.2.0(transitive)
+ Addedjs-tokens@3.0.2(transitive)
+ Addedjson-stable-stringify@1.1.1(transitive)
+ Addedjsonify@0.0.1(transitive)
+ Addedjsonpointer@5.0.1(transitive)
+ Addedleven@2.1.0(transitive)
+ Addedlevn@0.3.0(transitive)
+ Addedmake-plural@4.3.0(transitive)
+ Addedmessageformat@1.1.1(transitive)
+ Addedmessageformat-parser@1.1.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.01.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedms@2.0.0(transitive)
+ Addedmute-stream@0.0.5(transitive)
+ Addednatural-compare@1.4.0(transitive)
+ Addednext-tick@1.1.0(transitive)
+ Addednopt@3.0.6(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedonetime@1.1.0(transitive)
+ Addedoptionator@0.8.3(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-is-inside@1.0.2(transitive)
+ Addedpluralize@1.2.1(transitive)
+ Addedprelude-ls@1.1.2(transitive)
+ Addedprettier@0.18.0(transitive)
+ Addedprettier-eslint@3.0.5(transitive)
+ Addedprettier-eslint-cli@1.2.0(transitive)
+ Addedpretty-format@18.1.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedprogress@1.1.8(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedreadline2@1.0.1(transitive)
+ Addedrechoir@0.6.2(transitive)
+ Addedregenerator-runtime@0.11.1(transitive)
+ Addedrequire-relative@0.8.7(transitive)
+ Addedrequire-uncached@1.0.3(transitive)
+ Addedreserved-words@0.1.2(transitive)
+ Addedresolve-from@1.0.1(transitive)
+ Addedrestore-cursor@1.0.1(transitive)
+ Addedrimraf@2.6.3(transitive)
+ Addedrun-async@0.1.0(transitive)
+ Addedrx-lite@3.1.2(transitive)
+ Addedrxjs@5.5.12(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedshelljs@0.7.8(transitive)
+ Addedslice-ansi@0.0.4(transitive)
+ Addedstring-width@2.1.1(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedstrip-ansi@4.0.0(transitive)
+ Addedstrip-bom@3.0.0(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedsymbol-observable@1.0.1(transitive)
+ Addedtable@3.8.3(transitive)
+ Addedtext-table@0.2.0(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedtype@2.7.3(transitive)
+ Addedtype-check@0.3.2(transitive)
+ Addedtypedarray@0.0.6(transitive)
+ Addeduser-home@2.0.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedword-wrap@1.2.5(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedwrite@0.2.1(transitive)
+ Addedxtend@4.0.2(transitive)