5.2.18 • Published 5 years ago

pon v5.2.18

Weekly downloads
387
License
Apache-2.0
Repository
github
Last release
5 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

5 years ago

5.2.17

5 years ago

5.2.16

5 years ago

5.2.15

6 years ago

5.2.14

6 years ago

5.2.13

6 years ago

5.2.11

7 years ago

5.2.10

7 years ago

5.2.9

7 years ago

5.2.8

7 years ago

5.2.7

7 years ago

5.2.6

7 years ago

5.2.5

7 years ago

5.2.4

7 years ago

5.2.3

7 years ago

5.2.2

8 years ago

5.2.1

8 years ago

5.1.3

8 years ago

5.1.2

8 years ago

5.1.1

8 years ago

5.0.5

8 years ago

5.0.4

8 years ago

5.0.3

8 years ago

5.0.2

8 years ago

5.0.1

8 years ago

4.0.3

8 years ago

4.0.2

8 years ago

4.0.1

8 years ago

3.0.0

8 years ago

1.1.8

9 years ago

1.1.6

10 years ago

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago