2.1.18 • Published 3 years ago

@flemist/run-script v2.1.18

Weekly downloads
55
License
CC0-1.0
Repository
github
Last release
3 years ago

Build Status

Description

Run

run-script "console.log(123)"
run-script --config .run-script-rc.js "console.log(123)"
run-script "require(./scripts.js).run({ option1: true, option2: true })"

Script helpers

const {run, singleCall, singleProcess} = require('../helpers/helpers')

// singleCall - Create function that skip all executions except first
const buildMjs = singleCall(() => {
    // run - execute command line
	const {out, err, both} = await run(`babel src -x .js -x .ts`, {
        // see: IRunOptions
        returnOutputs: true,
    })
})

// singleProcess - Create function that wait unlit previous execution is completed before the next one
const build = singleProcess(async appConfigType => {
	await Promise.all([
		common.build(),
		buildMjs(appConfigType),
		buildJs(appConfigType),
	])
})

export interface IRunOptions {
	env?: ProcessEnv,
	cwd? : string,
	timeout?: number,
	notAutoKill?: boolean, // don't auto kill all process tree after error
	stdin?: undefined | null | 'pipe' | 'ipc' | 'ignore' | 'inherit' | Stream,
	shell?: boolean,
	prepareProcess?: (proc: ChildProcess) => void,
	dontSearchErrors?: boolean,
	dontShowOutputs?: boolean,
    returnOutputs?: boolean,
}

See examples here

Config

Default config path is ./.run-script-rc.js

Config type:

type TextPredicate = (text: string, next: TextPredicate) => boolean
type ErrorSearch = (text: string, next: ErrorSearch) => string | void | null | false

type IGlobalConfig = {
	logFilter?: TextPredicate,
	stdOutSearchError?: ErrorSearch,
	stdErrIsError?: TextPredicate,
}

See the config example here

License

CC0-1.0

2.1.16

3 years ago

2.1.17

3 years ago

2.1.14

3 years ago

2.1.15

3 years ago

2.1.18

3 years ago

2.1.13

3 years ago

2.1.9

3 years ago

2.1.12

3 years ago

2.1.10

3 years ago

2.1.11

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.6

3 years ago

2.1.5

3 years ago

2.1.8

3 years ago

2.1.7

3 years ago

2.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

0.3.0

3 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.7

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.6

3 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago