Function
Static Public Summary | ||
public |
concurrent(scripts: ConcurrentScripts): string Generates a command that uses |
|
public |
Gets a script that uses the cpy-cli binary. |
|
public |
Gets a script that uses the cross-env binary. |
|
public |
ifNotWindows(script: string, altScript: string): string Simply calls ifWindows(altScript, script) |
|
public |
Takes two scripts and returns the first if the current environment is windows, and the second if the current environment is not windows |
|
public |
Gets a script that uses the mkdirp binary. |
|
public |
Gets a script that uses the opn-cli binary. |
|
public |
Gets a script that uses the rimraf binary. |
|
public |
runInNewWindow(command: string): string EXPERIMENTAL: THIS DOES NOT CURRENTLY WORK FOR ALL TERMINALS Takes a command and returns a version that should run in another tab/window of your terminal. |
|
public |
Accepts any number of scripts, filters out any falsy ones and joins them with ' && ' |
Static Public
public concurrent(scripts: ConcurrentScripts): string source
import {concurrent} from 'nps-utils/src/index.js'
Generates a command that uses concurrently
to run
scripts concurrently. Adds a few flags to make it
behave as you probably want (like --kill-others-on-fail).
In addition, it adds color and labels where the color
can be specified or is defaulted and the label is based
on the key for the script.
Params:
Name | Type | Attribute | Description |
scripts | ConcurrentScripts | the scripts to run note: this function filters out falsy values :) |
Example:
// returns a bit of a long script that can vary slightly
// based on your environment... :)
concurrent({
lint: {
script: 'eslint .',
color: 'bgGreen.white.dim',
},
test: 'jest',
build: {
script: 'webpack'
}
})
public copy(args: string): string source
import {copy} from 'nps-utils/src/index.js'
Gets a script that uses the cpy-cli binary. cpy-cli is a dependency of nps-utils, so you don't need to install it yourself.
Params:
Name | Type | Attribute | Description |
args | string | args to pass to cpy-cli learn more from http://npm.im/cpy-cli |
public crossEnv(args: string): string source
import {crossEnv} from 'nps-utils/src/index.js'
Gets a script that uses the cross-env binary. cross-env is a dependency of nps-utils, so you don't need to install it yourself.
Params:
Name | Type | Attribute | Description |
args | string | args to pass to cross-env learn more from http://npm.im/cross-env |
public ifNotWindows(script: string, altScript: string): string source
import {ifNotWindows} from 'nps-utils/src/index.js'
Simply calls ifWindows(altScript, script)
public ifWindows(script: string, altScript: string): string source
import {ifWindows} from 'nps-utils/src/index.js'
Takes two scripts and returns the first if the current environment is windows, and the second if the current environment is not windows
public mkdirp(args: string): string source
import {mkdirp} from 'nps-utils/src/index.js'
Gets a script that uses the mkdirp binary. mkdirp is a dependency of nps-utils, so you don't need to install it yourself.
Params:
Name | Type | Attribute | Description |
args | string | args to pass to mkdirp learn more from http://npm.im/mkdirp |
public open(args: string): string source
import {open} from 'nps-utils/src/index.js'
Gets a script that uses the opn-cli binary. opn-cli is a dependency of nps-utils, so you don't need to install it yourself.
Params:
Name | Type | Attribute | Description |
args | string | args to pass to opn-cli learn more from http://npm.im/opn-cli |
public rimraf(args: string): string source
import {rimraf} from 'nps-utils/src/index.js'
Gets a script that uses the rimraf binary. rimraf is a dependency of nps-utils, so you don't need to install it yourself.
Params:
Name | Type | Attribute | Description |
args | string | args to pass to rimraf learn more from http://npm.im/rimraf |
public runInNewWindow(command: string): string source
import {runInNewWindow} from 'nps-utils/src/index.js'
EXPERIMENTAL: THIS DOES NOT CURRENTLY WORK FOR ALL TERMINALS Takes a command and returns a version that should run in another tab/window of your terminal. Currently only supports Windows cmd (new window) and Terminal.app (new tab)
Params:
Name | Type | Attribute | Description |
command | string | the command to run in a new tab/window |
Example:
// returns some voodoo magic to make the terminal do what you want
runInNewWindow('echo hello')
public series(scripts: ...string): string source
import {series} from 'nps-utils/src/index.js'
Accepts any number of scripts, filters out any falsy ones and joins them with ' && '
Params:
Name | Type | Attribute | Description |
scripts | ...string | Any number of strings representing commands |
Example:
// returns 'eslint && jest && webpack --env.production'
series('eslint', 'jest', 'webpack --env.production')