1.0.0-beta-13 • Published 9 months ago

ryor v1.0.0-beta-13

Weekly downloads
463
License
MIT
Repository
github
Last release
9 months ago

(R)oll (Y)our (O)wn Task (R)unner for Node.js Projects

license

No system dependencies

Including ryor as a project development dependency is all that's needed to get started.

No plugins

Unlike task runners or pluggable build tools that require often clunky coordination between unevenly maintained 3rd-party plugins (Gulp, Grunt, Webpack, etc.), ryor offers a convenient means of using tools that already do one thing and do it well as CLIs or Node APIs.

Less clutter

Instead of cluttering of a project's root directory and/or package.json file with configuration files/details, runnables can be neatly self-contained.

Concurrency

Similar to shell, npm or NPS scripts, sequences can be composed that run runnables either serially or concurrently.

Get started:

First, install ryor as a project development dependency: npm install -D ryor

Next, create a subdirectory in your project's root directory for your task runner and runnable ES modules ("tasks" is a good option). A runnable module must export a run value, which can be a string, an array or a function (sync or async). Runnable modules should also export a description value describing what the runnable does ("No description provided" is output in the CLI usage information for the runnable otherwise).

Note: "type": "module" in the project's package.json file is required and version 16 or greater of Node.js is recommended.

Create runnables:

A string run value can be used to call a CLI:

tasks/minify.js

export const description = 'Minifies JavaScript'

export const run = 'minifier --option1 --option2 path/to/file'

A configuration file can be included alongside a runnable ES module by simply creating a directory with an index.js file:

tasks/minify/index.js

export const description = 'Minifies JavaScript'

export const run = 'minifier --config tasks/minify/config.js'

An array run value can be used to call other runnables, CLIs or functions in sequence:

tasks/build.js

export const description = 'Creates production build'

export const run = ['transpile', 'minify', () => (...do something), 'echo "Done."',]

An array run value that begins with the flag -c or --concurrent will run anything following it concurrently:

tasks/develop.js

export const description = 'Runs development watchers and server'

export const run = ['-c', 'transpile --watch', 'lint --watch', 'serve', () => (...start some process for development)]

A run function can be passed arguments which are defined in the args export:

tasks/test.js

export const description = 'Runs tester and optionally collects coverage information'

export const args = {
  coverage: {
    alias: 'c',
    description: 'Collect coverage data',
    type: 'boolean'
  }
}

export async function run({ coverage }) {
  const tester = await import('tester')
  const result = await tester.test(coverage)

  console.log(`Tests complete${coverage ? ' and coverage data collected' : ''}`)
}

A run function can return strings, arrays or functions to run:

tasks/build.js

export const description = 'Creates production build'

export const args = {
  quiet: {
    alias: 'q',
    description: 'No output unless errors are encountered',
    type: 'boolean'
  }
}

export function run({ quiet }) {
  const startTime = Date.now()
  const sequence = [`transpile${quiet ? ' -d' : ''}`, `minify${quiet ? ' -d' : ''}`]

  if (!quiet) sequence.push(`echo "Build took ${Date.now() - startTime}ms."`)

  return sequence
}

Create a runner:

Add an index.js file in your runnables directory that specifies your runnables like this:

tasks/index.js

import ryor from 'ryor'

ryor(['build', 'develop', 'test'])

or, if runnables are separated into subdirectories, like this:

import ryor from 'ryor'

ryor([
  ['main', ['build', 'develop', 'test']],
  ['tools', ['eslint', 'jest', 'tsc']],
  ['utilities', ['log']]
])

Usage information:

To output usage information for all runnables, simply run node [directory name].

Example: node tasks

To output usage information for a specific runnable, run node [directory name] <runnable> -h/--help

Example: node tasks develop -h or node tasks develop --help

Note: When defining arguments for a runnable module, note that help and its h alias are both reserved for all modules.

Usage:

To run a single runnable, use node [directory name] <runnable> [...args]

Example: node tasks build -q

To run more than one runnable in a sequence, use +.

Example: node tasks test + build + publish

1.0.0-beta-13

9 months ago

1.0.0-beta-12

9 months ago

1.0.0-beta-10

9 months ago

1.0.0-beta-11

9 months ago

0.11.0-beta-22

11 months ago

0.11.0-beta-23

11 months ago

0.11.0-beta-24

11 months ago

0.11.0-beta-21

11 months ago

1.0.0-beta-1

11 months ago

1.0.0-beta-2

10 months ago

1.0.0-beta-3

10 months ago

1.0.0-beta-4

10 months ago

1.0.0-beta-9

9 months ago

1.0.0-beta-5

10 months ago

1.0.0-beta-6

10 months ago

1.0.0-beta-7

10 months ago

1.0.0-beta-8

10 months ago

0.11.0-beta-20

11 months ago

0.11.0-beta-11

12 months ago

0.11.0-beta-12

12 months ago

0.11.0-beta-13

11 months ago

0.11.0-beta-14

11 months ago

0.11.0-beta-15

11 months ago

0.11.0-beta-16

11 months ago

0.11.0-beta-17

11 months ago

0.11.0-beta-18

11 months ago

0.11.0-beta-19

11 months ago

0.11.0-beta-10

12 months ago

0.11.0-beta

1 year ago

0.11.0-beta-3

1 year ago

0.11.0-beta-2

1 year ago

0.11.0-beta-5

1 year ago

0.11.0-beta-4

1 year ago

0.11.0-beta-7

1 year ago

0.11.0-beta-6

1 year ago

0.11.0-beta-9

12 months ago

0.11.0-beta-8

1 year ago

0.10.5

1 year ago

0.10.4

1 year ago

0.10.2

1 year ago

0.10.1

2 years ago

0.9.26

2 years ago

0.10.0

2 years ago

0.9.25

2 years ago

0.9.23

2 years ago

0.9.24

2 years ago

0.9.20

2 years ago

0.9.21

2 years ago

0.9.22

2 years ago

0.9.18

2 years ago

0.9.19

2 years ago

0.9.17

2 years ago

0.9.15

2 years ago

0.9.16

2 years ago

0.9.14

2 years ago

0.9.12

3 years ago

0.9.13

3 years ago

0.9.9

3 years ago

0.9.10

3 years ago

0.9.11

3 years ago

0.9.8

3 years ago

0.9.7

3 years ago

0.9.6

3 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.5

4 years ago

0.9.0

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.8.2

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.7

4 years ago

0.7.5

5 years ago

0.7.4

5 years ago

0.7.3

5 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.6

5 years ago

0.4.5

5 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.2.22

5 years ago

0.2.21

5 years ago

0.2.19

5 years ago

0.2.18

5 years ago

0.2.17

5 years ago

0.2.16

5 years ago

0.2.15

5 years ago

0.2.14

5 years ago

0.2.13

5 years ago

0.2.12

6 years ago

0.2.11

6 years ago

0.2.10

7 years ago

0.2.9

7 years ago

0.2.8

8 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.1.10

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.77

8 years ago

0.0.76

8 years ago

0.0.75

8 years ago

0.0.74

8 years ago

0.0.73

8 years ago

0.0.72

8 years ago

0.0.71

8 years ago

0.0.70

8 years ago

0.0.69

8 years ago

0.0.68

8 years ago

0.0.67

8 years ago

0.0.66

8 years ago

0.0.65

8 years ago

0.0.64

8 years ago

0.0.63

8 years ago

0.0.62

8 years ago

0.0.61

8 years ago

0.0.60

8 years ago

0.0.59

8 years ago

0.0.58

8 years ago

0.0.57

8 years ago

0.0.56

8 years ago

0.0.55

8 years ago

0.0.54

8 years ago

0.0.53

8 years ago

0.0.52

8 years ago

0.0.51

8 years ago

0.0.50

8 years ago

0.0.49

8 years ago

0.0.48

8 years ago

0.0.47

8 years ago

0.0.46

8 years ago

0.0.45

8 years ago

0.0.44

8 years ago

0.0.43

8 years ago

0.0.42

8 years ago

0.0.41

8 years ago

0.0.40

8 years ago

0.0.39

8 years ago

0.0.38

8 years ago

0.0.37

8 years ago

0.0.36

8 years ago

0.0.35

8 years ago

0.0.34

8 years ago

0.0.33

8 years ago

0.0.32

8 years ago

0.0.31

8 years ago

0.0.30

8 years ago

0.0.29

8 years ago

0.0.28

8 years ago

0.0.27

8 years ago

0.0.26

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.12

8 years ago

0.0.13

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.3

8 years ago

0.0.5

8 years ago

0.0.6

8 years ago

0.0.4

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago