5.2.18 • Published 4 years ago

pon v5.2.18

Weekly downloads
387
License
Apache-2.0
Repository
github
Last release
4 years ago

pon

Build Status Build Status npm Version JS Standard

Super simple task runner to call named functions from CLI

Table of Contents

Installation

$ npm install pon --save

Usage

Create runner with tasks and pass task names to run

'use strict'

const pon = require('pon')

const css = require('pon-task-css')
const browser = require('pon-task-browser')

async function tryExample () {
  const run = pon({
    'ui:css': css('ui/stylesheets', 'public'),
    'ui:browser': browser('shim/entrypoints', 'public')
  })

  // Execute task by names
  await run('ui:css', 'ui:browser')
}

tryExample()

Advanced Usage

Defining task in various ways

  • Task is just an async function
  • Task can be a string which is the name of another task
  • Tasks can be nested
  • Task can be array of function (or string)
'use strict'

const pon = require('pon')

async function tryNested () {
  const run = pon({
    // Just pass a async function to define custom task
    async yell () { /* ... */ },
    // Arrayed functions runs sequentially
    swing: [ async function up () { /* ... */ }, async function down () { /* ... */ } ],
    fitness: {
      async walk () { /* ... */ },
      async run () { /* ... */ },
      // Default call
      default: [ 'fitness/walk', 'fitness/run' ]
    },
    // Call another tasks
    yellAndRun: [ 'yell', 'fitness/run' ]
  })

  await run('yell', 'swing') // Runs tasks sequentially
  await run('fitness/*') // By pattern
  await run('fitness') // Same as call `await run('fitness.default')
  await run('yellAndRun') // Call another tasks
}

tryNested()

CLI Usage

Install pon-cli as global module.

$ npm install pon-cli -g

Create Ponfile.js at your project root and define tasks there.

'use strict'

const pon = require('pon')

module.exports = pon({
  'myapp:do-something': async function doSomething () {
    /* ... */
  }
})

Then, call task from command line

pon "myapp:*"

Develop Own Plugin

Use pon-scaffold to generate your own plugin.

Install scaffold CLI

npm i pon-scaffold -g

Task Plugin

Pass the task name to generate

pon-scaffold task "pon-task-my-own"

Then, edit lib/define.js under the generated project.

License

This software is released under the Apache-2.0 License.

Links

5.2.18

4 years ago

5.2.17

4 years ago

5.2.16

4 years ago

5.2.15

5 years ago

5.2.14

5 years ago

5.2.13

5 years ago

5.2.11

6 years ago

5.2.10

6 years ago

5.2.9

6 years ago

5.2.8

6 years ago

5.2.7

6 years ago

5.2.6

6 years ago

5.2.5

6 years ago

5.2.4

6 years ago

5.2.3

6 years ago

5.2.2

6 years ago

5.2.1

6 years ago

5.1.3

7 years ago

5.1.2

7 years ago

5.1.1

7 years ago

5.0.5

7 years ago

5.0.4

7 years ago

5.0.3

7 years ago

5.0.2

7 years ago

5.0.1

7 years ago

4.0.3

7 years ago

4.0.2

7 years ago

4.0.1

7 years ago

3.0.0

7 years ago

1.1.8

8 years ago

1.1.6

9 years ago

1.1.5

9 years ago

1.1.4

9 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago