This commit is contained in:
Ken 2018-12-05 13:48:33 -08:00
Родитель 0fd2750110
Коммит aea9ab7890
46 изменённых файлов: 141 добавлений и 139 удалений

Просмотреть файл

@ -15,12 +15,12 @@ Build Rig is a build task definition library. It stands on the shoulders of two
The core concept of this library is that related tasks are grouped together and exported via npm packages. Each project will have a `rig.js` that imports tasks from those packages and also defines custom tasks for the project itself.
For example, the `build-rig-typescript` package is installable from [npmjs.org](https://npmjs.org/build-rig-typescript) and exports `typescript` and `typescript:watch` tasks. A rig file can then import and use them it like this:
For example, the `just-task-typescript` package is installable from [npmjs.org](https://npmjs.org/just-task-typescript) and exports `typescript` and `typescript:watch` tasks. A rig file can then import and use them it like this:
```js
require('build-rig-typescript');
require('just-task-typescript');
const { task, series } = require('build-rig');
const { task, series } = require('just-task');
task('clean', function() {
// do the cleaning task stuff here
@ -47,7 +47,7 @@ rig build --production
### Synchronous tasks
While `gulp@4` got rid of the capability of having synchronous tasks. `build-rig` augments `undertaker` to allow this style of task.
While `gulp@4` got rid of the capability of having synchronous tasks. `just-task` augments `undertaker` to allow this style of task.
```ts
task('sync-task', function() {
@ -55,11 +55,11 @@ task('sync-task', function() {
});
```
> As you can see, lambda's are NOT supported. This is because the functions are bound to a context for `this` so the tasks can gain access to `build-rig`-provided things like logger. Another thing that can be accessed from the context is the `argv` which is parsed by yargs.
> As you can see, lambda's are NOT supported. This is because the functions are bound to a context for `this` so the tasks can gain access to `just-task`-provided things like logger. Another thing that can be accessed from the context is the `argv` which is parsed by yargs.
### Asynchronous tasks with promises
`build-rig` supports asynchronous tasks with promises. Simply return a promise in a task function and `build-rig` will do the right thing.
`just-task` supports asynchronous tasks with promises. Simply return a promise in a task function and `just-task` will do the right thing.
```ts
// Async / Await automatically returns a promise
@ -78,7 +78,7 @@ task('async-task-promise', function() {
### Asynchronous tasks with callback
There are times when a callback-based async task is desired. There are times when the task is waiting on the completion of an asynchronous procedure from Node.js. Since most long-running Node.js function expects a callback to notify completion, `build-rig` supports this feature.
There are times when a callback-based async task is desired. There are times when the task is waiting on the completion of an asynchronous procedure from Node.js. Since most long-running Node.js function expects a callback to notify completion, `just-task` supports this feature.
```ts
task('async-task-callback', function(cb) {

Просмотреть файл

@ -119,15 +119,15 @@
"allowedCategories": [ "production" ]
},
{
"name": "build-rig",
"name": "just-task",
"allowedCategories": [ "docs", "production" ]
},
{
"name": "build-rig-typescript",
"name": "just-task-typescript",
"allowedCategories": [ "docs" ]
},
{
"name": "build-rig-webpack",
"name": "just-task-webpack",
"allowedCategories": [ "docs" ]
},
{

Просмотреть файл

@ -1,5 +1,5 @@
{
"name": "build-rig",
"name": "just-task",
"version": "1.0.0",
"description": "",
"main": "index.js",

Просмотреть файл

@ -1,8 +0,0 @@
#!/usr/bin/env node
try {
const localCmd = require.resolve('build-rig/lib/cli.js', { paths: [process.cwd()] });
require(localCmd);
} catch (e) {
console.error('Please install a local copy of build-rig.');
}

Просмотреть файл

@ -4,7 +4,7 @@ title: Command line arguments
sidebar_label: Command line arguments
---
`build-rig` uses the best pirate themed command line argument library ever: `yargs`, matey! So, rigs get documented pretty much automatically. However, tasks can customize the arguments that are accepted. `build-rig` exposes these via `this.argv` inside a task function.
`just-task` uses the best pirate themed command line argument library ever: `yargs`, matey! So, rigs get documented pretty much automatically. However, tasks can customize the arguments that are accepted. `just-task` exposes these via `this.argv` inside a task function.
## Reading arguments

Просмотреть файл

@ -4,14 +4,14 @@ title: Composition of tasks
sidebar_label: Composition of tasks
---
Once a project get to be a bit more complex, a build step might consist of multiple sub tasks. This can be achieved with composition. This is the main reason `build-rig` is made. It simplifies the composition of tasks.
Once a project get to be a bit more complex, a build step might consist of multiple sub tasks. This can be achieved with composition. This is the main reason `just-task` is made. It simplifies the composition of tasks.
## Running tasks in a series
```js
// rig.js
const { task, series } = require('build-rig');
const { task, series } = require('just-task');
task('clean', function() {
// clean stuff
@ -33,7 +33,7 @@ To take advantage of multi-core CPUs on our machines, we can run several tasks i
```js
// rig.js
const { task, parallel } = require('build-rig');
const { task, parallel } = require('just-task');
task('babel', function() {
// run babel babel over some files
@ -48,12 +48,12 @@ task('build', parallel('babel', 'lint'));
## Nesting tasks in series and parallel
The most powerful feature of `build-rig` is its ability to compose tasks by nesting tasks in series and parallel. Let's combine the previous examples.
The most powerful feature of `just-task` is its ability to compose tasks by nesting tasks in series and parallel. Let's combine the previous examples.
```js
// rig.js
const { task, parallel, series } = require('build-rig');
const { task, parallel, series } = require('just-task');
task('babel', function() {
// run babel babel over some files

Просмотреть файл

@ -4,16 +4,16 @@ title: Getting Started with Build
sidebar_label: Getting Started
---
Build Rig is a build task definition library. It stands on the shoulders of two excellent and well tested libraries: undertaker and yargs.
`Just` is a build task definition library. It stands on the shoulders of two excellent and well tested libraries: undertaker and yargs.
```sh
npm i -g build-rig
npm i -g just-task
```
Place some task definitions inside `rig.js` in your root folder (next to package.json):
Place some task definitions inside `just-task.js` in your root folder (next to package.json):
```js
const { task } = require('build-rig');
const { task } = require('just-task');
task('hello', function() {
this.logger.info('world');

Просмотреть файл

@ -4,7 +4,7 @@ title: Logging
sidebar_label: Logging
---
`build-rig` is simple, but it is opinionated. One of the built-in capabilities of `build-rig` is logging. We feel that this is an important enough of a feature to be available inside a task within its own context.
`just-task` is simple, but it is opinionated. One of the built-in capabilities of `just-task` is logging. We feel that this is an important enough of a feature to be available inside a task within its own context.
Typically, logging tasks look like the following:

Просмотреть файл

@ -1,10 +1,10 @@
{
"name": "build-rig-docs",
"name": "just-task-docs",
"version": "0.0.1",
"scripts": {
"examples": "docusaurus-examples",
"start": "docusaurus-start",
"build": "docusaurus-build && cpx \"build/build-rig/**/*\" ../../../docs",
"build": "docusaurus-build && cpx \"build/just-task/**/*\" ../../../docs",
"version": "docusaurus-version",
"rename-version": "docusaurus-rename-version"
},

Просмотреть файл

@ -21,11 +21,11 @@ const users = [
];
const siteConfig = {
title: 'Build Rig', // Title for your website.
tagline: 'Documentation on Build Rig',
title: 'Just ____', // Title for your website.
tagline: 'Documentation on Just',
url: 'https://kenotron.github.io', // Your website URL
baseUrl: '/build-rig/', // Base URL for your project */
projectName: 'build-rig',
baseUrl: '/just-task/', // Base URL for your project */
projectName: 'just-task',
organizationName: 'kenotron',
// For no header links in the top nav bar -> headerLinks: [],
@ -73,7 +73,7 @@ const siteConfig = {
// You may provide arbitrary config keys to be used as needed by your
// template. For example, if you need your repo's URL...
editUrl: 'https://github.com/kenotron/build-rig/tree/master/packages/documentation/docs/'
editUrl: 'https://github.com/kenotron/just-task/tree/master/packages/documentation/docs/'
};
module.exports = siteConfig;

Просмотреть файл

@ -4,14 +4,14 @@
"description": "",
"main": "index.js",
"scripts": {
"build": "node ../build-rig/lib/cli.js build"
"build": "node ../just-task/lib/cli.js build"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"build-rig": "1.2.6",
"build-rig-typescript": "1.0.9",
"build-rig-webpack": "1.0.9"
"just-task": "1.2.6",
"just-task-typescript": "1.0.9",
"just-task-webpack": "1.0.9"
}
}

Просмотреть файл

@ -1,7 +1,7 @@
const { task, series, parallel } = require('build-rig');
const { task, series, parallel } = require('just-task');
require('build-rig-typescript');
require('build-rig-webpack');
require('just-task-typescript');
require('just-task-webpack');
task('build', series('typescript', 'webpack'));
task('watch', parallel('typescript:watch'));

Просмотреть файл

@ -1,122 +1,122 @@
{
"name": "build-rig-typescript",
"name": "just-task-typescript",
"entries": [
{
"version": "1.0.9",
"tag": "build-rig-typescript_v1.0.9",
"tag": "just-task-typescript_v1.0.9",
"date": "Tue, 04 Dec 2018 06:13:37 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.5` to `1.2.6`"
"comment": "Updating dependency \"just-task\" from `1.2.5` to `1.2.6`"
}
]
}
},
{
"version": "1.0.8",
"tag": "build-rig-typescript_v1.0.8",
"tag": "just-task-typescript_v1.0.8",
"date": "Tue, 04 Dec 2018 05:15:26 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.4` to `1.2.5`"
"comment": "Updating dependency \"just-task\" from `1.2.4` to `1.2.5`"
}
]
}
},
{
"version": "1.0.7",
"tag": "build-rig-typescript_v1.0.7",
"tag": "just-task-typescript_v1.0.7",
"date": "Mon, 03 Dec 2018 22:48:20 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.3` to `1.2.4`"
"comment": "Updating dependency \"just-task\" from `1.2.3` to `1.2.4`"
}
]
}
},
{
"version": "1.0.6",
"tag": "build-rig-typescript_v1.0.6",
"tag": "just-task-typescript_v1.0.6",
"date": "Mon, 03 Dec 2018 22:24:03 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.2` to `1.2.3`"
"comment": "Updating dependency \"just-task\" from `1.2.2` to `1.2.3`"
}
]
}
},
{
"version": "1.0.5",
"tag": "build-rig-typescript_v1.0.5",
"tag": "just-task-typescript_v1.0.5",
"date": "Mon, 03 Dec 2018 22:04:01 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.1` to `1.2.2`"
"comment": "Updating dependency \"just-task\" from `1.2.1` to `1.2.2`"
}
]
}
},
{
"version": "1.0.4",
"tag": "build-rig-typescript_v1.0.4",
"tag": "just-task-typescript_v1.0.4",
"date": "Mon, 03 Dec 2018 18:39:51 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.0` to `1.2.1`"
"comment": "Updating dependency \"just-task\" from `1.2.0` to `1.2.1`"
}
]
}
},
{
"version": "1.0.3",
"tag": "build-rig-typescript_v1.0.3",
"tag": "just-task-typescript_v1.0.3",
"date": "Mon, 03 Dec 2018 06:31:09 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.1.0` to `1.2.0`"
"comment": "Updating dependency \"just-task\" from `1.1.0` to `1.2.0`"
}
]
}
},
{
"version": "1.0.2",
"tag": "build-rig-typescript_v1.0.2",
"tag": "just-task-typescript_v1.0.2",
"date": "Mon, 03 Dec 2018 05:18:13 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.0.1` to `1.1.0`"
"comment": "Updating dependency \"just-task\" from `1.0.1` to `1.1.0`"
}
]
}
},
{
"version": "1.0.1",
"tag": "build-rig-typescript_v1.0.1",
"tag": "just-task-typescript_v1.0.1",
"date": "Mon, 03 Dec 2018 00:54:11 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.0.0` to `1.0.1`"
"comment": "Updating dependency \"just-task\" from `1.0.0` to `1.0.1`"
}
]
}
},
{
"version": "1.0.0",
"tag": "build-rig-typescript_v1.0.0",
"tag": "just-task-typescript_v1.0.0",
"date": "Sun, 02 Dec 2018 03:50:30 GMT",
"comments": {
"dependency": [
{
"comment": "Dependency build-rig version bump from * to 1.0.0."
"comment": "Dependency just-task version bump from * to 1.0.0."
}
]
}

Просмотреть файл

@ -1,4 +1,4 @@
# Change Log - build-rig-typescript
# Change Log - just-task-typescript
This log was last generated on Tue, 04 Dec 2018 06:13:37 GMT and should not be manually modified.

Просмотреть файл

@ -1,5 +1,5 @@
{
"name": "build-rig-typescript",
"name": "just-task-typescript",
"version": "1.0.9",
"description": "",
"main": "lib/index.js",
@ -8,7 +8,7 @@
"dev": "tsc -w --preserveWatchOutput"
},
"dependencies": {
"build-rig": "1.2.6",
"just-task": "1.2.6",
"typescript": "^3.1.6",
"resolve": "^1.8.1"
},

Просмотреть файл

@ -1,4 +1,4 @@
import { task, series, parallel, logger } from 'build-rig';
import { task, series, parallel, logger } from 'just-task';
import { spawn } from 'child_process';
import path from 'path';
import os from 'os';

Просмотреть файл

@ -1,122 +1,122 @@
{
"name": "build-rig-webpack",
"name": "just-task-webpack",
"entries": [
{
"version": "1.0.9",
"tag": "build-rig-webpack_v1.0.9",
"tag": "just-task-webpack_v1.0.9",
"date": "Tue, 04 Dec 2018 06:13:37 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.5` to `1.2.6`"
"comment": "Updating dependency \"just-task\" from `1.2.5` to `1.2.6`"
}
]
}
},
{
"version": "1.0.8",
"tag": "build-rig-webpack_v1.0.8",
"tag": "just-task-webpack_v1.0.8",
"date": "Tue, 04 Dec 2018 05:15:26 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.4` to `1.2.5`"
"comment": "Updating dependency \"just-task\" from `1.2.4` to `1.2.5`"
}
]
}
},
{
"version": "1.0.7",
"tag": "build-rig-webpack_v1.0.7",
"tag": "just-task-webpack_v1.0.7",
"date": "Mon, 03 Dec 2018 22:48:20 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.3` to `1.2.4`"
"comment": "Updating dependency \"just-task\" from `1.2.3` to `1.2.4`"
}
]
}
},
{
"version": "1.0.6",
"tag": "build-rig-webpack_v1.0.6",
"tag": "just-task-webpack_v1.0.6",
"date": "Mon, 03 Dec 2018 22:24:03 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.2` to `1.2.3`"
"comment": "Updating dependency \"just-task\" from `1.2.2` to `1.2.3`"
}
]
}
},
{
"version": "1.0.5",
"tag": "build-rig-webpack_v1.0.5",
"tag": "just-task-webpack_v1.0.5",
"date": "Mon, 03 Dec 2018 22:04:01 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.1` to `1.2.2`"
"comment": "Updating dependency \"just-task\" from `1.2.1` to `1.2.2`"
}
]
}
},
{
"version": "1.0.4",
"tag": "build-rig-webpack_v1.0.4",
"tag": "just-task-webpack_v1.0.4",
"date": "Mon, 03 Dec 2018 18:39:51 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.2.0` to `1.2.1`"
"comment": "Updating dependency \"just-task\" from `1.2.0` to `1.2.1`"
}
]
}
},
{
"version": "1.0.3",
"tag": "build-rig-webpack_v1.0.3",
"tag": "just-task-webpack_v1.0.3",
"date": "Mon, 03 Dec 2018 06:31:09 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.1.0` to `1.2.0`"
"comment": "Updating dependency \"just-task\" from `1.1.0` to `1.2.0`"
}
]
}
},
{
"version": "1.0.2",
"tag": "build-rig-webpack_v1.0.2",
"tag": "just-task-webpack_v1.0.2",
"date": "Mon, 03 Dec 2018 05:18:13 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.0.1` to `1.1.0`"
"comment": "Updating dependency \"just-task\" from `1.0.1` to `1.1.0`"
}
]
}
},
{
"version": "1.0.1",
"tag": "build-rig-webpack_v1.0.1",
"tag": "just-task-webpack_v1.0.1",
"date": "Mon, 03 Dec 2018 00:54:11 GMT",
"comments": {
"dependency": [
{
"comment": "Updating dependency \"build-rig\" from `1.0.0` to `1.0.1`"
"comment": "Updating dependency \"just-task\" from `1.0.0` to `1.0.1`"
}
]
}
},
{
"version": "1.0.0",
"tag": "build-rig-webpack_v1.0.0",
"tag": "just-task-webpack_v1.0.0",
"date": "Sun, 02 Dec 2018 03:50:30 GMT",
"comments": {
"dependency": [
{
"comment": "Dependency build-rig version bump from * to 1.0.0."
"comment": "Dependency just-task version bump from * to 1.0.0."
}
]
}

Просмотреть файл

@ -1,4 +1,4 @@
# Change Log - build-rig-webpack
# Change Log - just-task-webpack
This log was last generated on Tue, 04 Dec 2018 06:13:37 GMT and should not be manually modified.

Просмотреть файл

@ -1,5 +1,5 @@
{
"name": "build-rig-webpack",
"name": "just-task-webpack",
"version": "1.0.9",
"description": "",
"main": "lib/index.js",
@ -8,7 +8,7 @@
"dev": "tsc -w --preserveWatchOutput"
},
"dependencies": {
"build-rig": "1.2.6",
"just-task": "1.2.6",
"resolve": "^1.8.1",
"webpack": "^4.26.1",
"css-loader": "^1.0.1",

Просмотреть файл

@ -1,4 +1,4 @@
import { task, series, parallel, logger } from 'build-rig';
import { task, series, parallel, logger } from 'just-task';
import path from 'path';
import resolve from 'resolve';
import webpack from 'webpack';

Просмотреть файл

@ -1,21 +1,21 @@
{
"name": "build-rig",
"name": "just-task",
"entries": [
{
"version": "1.2.6",
"tag": "build-rig_v1.2.6",
"tag": "just-task_v1.2.6",
"date": "Tue, 04 Dec 2018 06:13:37 GMT",
"comments": {
"patch": [
{
"comment": "Fixes globally installed build-rig to check for local copy"
"comment": "Fixes globally installed just-task to check for local copy"
}
]
}
},
{
"version": "1.2.5",
"tag": "build-rig_v1.2.5",
"tag": "just-task_v1.2.5",
"date": "Tue, 04 Dec 2018 05:15:26 GMT",
"comments": {
"patch": [
@ -27,7 +27,7 @@
},
{
"version": "1.2.4",
"tag": "build-rig_v1.2.4",
"tag": "just-task_v1.2.4",
"date": "Mon, 03 Dec 2018 22:48:20 GMT",
"comments": {
"patch": [
@ -39,7 +39,7 @@
},
{
"version": "1.2.3",
"tag": "build-rig_v1.2.3",
"tag": "just-task_v1.2.3",
"date": "Mon, 03 Dec 2018 22:24:03 GMT",
"comments": {
"patch": [
@ -51,7 +51,7 @@
},
{
"version": "1.2.2",
"tag": "build-rig_v1.2.2",
"tag": "just-task_v1.2.2",
"date": "Mon, 03 Dec 2018 22:04:01 GMT",
"comments": {
"patch": [
@ -63,7 +63,7 @@
},
{
"version": "1.2.1",
"tag": "build-rig_v1.2.1",
"tag": "just-task_v1.2.1",
"date": "Mon, 03 Dec 2018 18:39:51 GMT",
"comments": {
"patch": [
@ -75,7 +75,7 @@
},
{
"version": "1.2.0",
"tag": "build-rig_v1.2.0",
"tag": "just-task_v1.2.0",
"date": "Mon, 03 Dec 2018 06:31:09 GMT",
"comments": {
"minor": [
@ -87,7 +87,7 @@
},
{
"version": "1.1.0",
"tag": "build-rig_v1.1.0",
"tag": "just-task_v1.1.0",
"date": "Mon, 03 Dec 2018 05:18:13 GMT",
"comments": {
"minor": [
@ -99,7 +99,7 @@
},
{
"version": "1.0.1",
"tag": "build-rig_v1.0.1",
"tag": "just-task_v1.0.1",
"date": "Mon, 03 Dec 2018 00:54:11 GMT",
"comments": {
"patch": [
@ -111,7 +111,7 @@
},
{
"version": "1.0.0",
"tag": "build-rig_v1.0.0",
"tag": "just-task_v1.0.0",
"date": "Sun, 02 Dec 2018 03:50:30 GMT",
"comments": {}
}

Просмотреть файл

@ -1,4 +1,4 @@
# Change Log - build-rig
# Change Log - just-task
This log was last generated on Tue, 04 Dec 2018 06:13:37 GMT and should not be manually modified.
@ -7,7 +7,7 @@ Tue, 04 Dec 2018 06:13:37 GMT
### Patches
- Fixes globally installed build-rig to check for local copy
- Fixes globally installed just-task to check for local copy
## 1.2.5
Tue, 04 Dec 2018 05:15:26 GMT

Просмотреть файл

@ -15,12 +15,12 @@ Build Rig is a build task definition library. It stands on the shoulders of two
The core concept of this library is that related tasks are grouped together and exported via npm packages. Each project will have a `rig.js` that imports tasks from those packages and also defines custom tasks for the project itself.
For example, the `build-rig-typescript` package is installable from [npmjs.org](https://npmjs.org/build-rig-typescript) and exports `typescript` and `typescript:watch` tasks. A rig file can then import and use them it like this:
For example, the `just-task-typescript` package is installable from [npmjs.org](https://npmjs.org/just-task-typescript) and exports `typescript` and `typescript:watch` tasks. A rig file can then import and use them it like this:
```js
require('build-rig-typescript');
require('just-task-typescript');
const { task, series } = require('build-rig');
const { task, series } = require('just-task');
task('clean', function() {
// do the cleaning task stuff here
@ -47,7 +47,7 @@ rig build --production
### Synchronous tasks
While `gulp@4` got rid of the capability of having synchronous tasks. `build-rig` augments `undertaker` to allow this style of task.
While `gulp@4` got rid of the capability of having synchronous tasks. `just-task` augments `undertaker` to allow this style of task.
```ts
task('sync-task', function() {
@ -55,11 +55,11 @@ task('sync-task', function() {
});
```
> As you can see, lambda's are NOT supported. This is because the functions are bound to a context for `this` so the tasks can gain access to `build-rig`-provided things like logger. Another thing that can be accessed from the context is the `argv` which is parsed by yargs.
> As you can see, lambda's are NOT supported. This is because the functions are bound to a context for `this` so the tasks can gain access to `just-task`-provided things like logger. Another thing that can be accessed from the context is the `argv` which is parsed by yargs.
### Asynchronous tasks with promises
`build-rig` supports asynchronous tasks with promises. Simply return a promise in a task function and `build-rig` will do the right thing.
`just-task` supports asynchronous tasks with promises. Simply return a promise in a task function and `just-task` will do the right thing.
```ts
// Async / Await automatically returns a promise
@ -78,7 +78,7 @@ task('async-task-promise', function() {
### Asynchronous tasks with callback
There are times when a callback-based async task is desired. There are times when the task is waiting on the completion of an asynchronous procedure from Node.js. Since most long-running Node.js function expects a callback to notify completion, `build-rig` supports this feature.
There are times when a callback-based async task is desired. There are times when the task is waiting on the completion of an asynchronous procedure from Node.js. Since most long-running Node.js function expects a callback to notify completion, `just-task` supports this feature.
```ts
task('async-task-callback', function(cb) {

8
packages/just-task/bin/rig.js Executable file
Просмотреть файл

@ -0,0 +1,8 @@
#!/usr/bin/env node
try {
const localCmd = require.resolve('just-task/lib/cli.js', { paths: [process.cwd()] });
require(localCmd);
} catch (e) {
console.error('Please install a local copy of just-task.');
}

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,5 +1,5 @@
{
"name": "build-rig",
"name": "just-task",
"version": "1.2.6",
"description": "",
"main": "lib/index.js",

Просмотреть файл

@ -13,7 +13,7 @@ interface WithTaskMap {
_tasks: { [task: string]: any };
}
export class RigRegistry extends UndertakerRegistry {
export class JustTaskRegistry extends UndertakerRegistry {
public argv: yargs.Argv;
private hasDefault: boolean = false;
private taker: Undertaker | undefined;
@ -24,17 +24,19 @@ export class RigRegistry extends UndertakerRegistry {
}
init(taker: Undertaker) {
// uses a separate instance of yargs to first parse the config (without the --help in the way) so we can parse the rigfile first regardless
let rigFile = yargsFn(process.argv.slice(1).filter(a => a !== '--help')).argv.config || 'rig.js';
// uses a separate instance of yargs to first parse the config (without the --help in the way) so we can parse the configFile first regardless
let configFile = yargsFn(process.argv.slice(1).filter(a => a !== '--help')).argv.config || 'just-task.js';
if (!path.isAbsolute(rigFile)) {
rigFile = path.join(process.cwd(), rigFile);
if (!path.isAbsolute(configFile)) {
configFile = path.join(process.cwd(), configFile);
}
if (fs.existsSync(rigFile)) {
require(rigFile);
if (fs.existsSync(configFile)) {
require(configFile);
} else {
logger.error(`Cannot find '${rigFile}'. Please create one called "rig.js" in the root of the project next to "package.json"`);
logger.error(
`Cannot find '${configFile}'. Please create one called "just-task.js" in the root of the project next to "package.json"`
);
}
if (!this.hasDefault) {
@ -44,7 +46,7 @@ export class RigRegistry extends UndertakerRegistry {
this.taker = taker;
}
set<TTaskFunction>(this: RigRegistry & WithTaskMap, taskName: string, fn: TTaskFunction): TTaskFunction {
set<TTaskFunction>(this: JustTaskRegistry & WithTaskMap, taskName: string, fn: TTaskFunction): TTaskFunction {
if (taskName === 'default') {
this.hasDefault = true;
}

Просмотреть файл

@ -1,6 +1,6 @@
import { task } from '../task';
import { parallel, undertaker } from '../undertaker';
import { RigRegistry } from '../rigRegistry';
import { JustTaskRegistry } from '../JustTaskRegistry';
import yargs from 'yargs';
import path from 'path';
@ -8,7 +8,7 @@ describe('task', () => {
beforeEach(() => {
const yargsBuilder = yargs;
yargsBuilder.option('config', { default: path.resolve(__dirname, 'mock/rig.js') });
undertaker.registry(new RigRegistry(yargsBuilder));
undertaker.registry(new JustTaskRegistry(yargsBuilder));
});
it('allows synchronous tasks to be defined and be run', done => {

Просмотреть файл

@ -1,10 +1,10 @@
import { undertaker } from './undertaker';
import { RigRegistry } from './RigRegistry';
import { JustTaskRegistry } from './JustTaskRegistry';
import yargs from 'yargs';
const yargsBuilder = yargs.option({ config: { describe: 'path to a rig file, defaults to rig.js' } }).usage('rig <cmd> [options]');
const registry = new RigRegistry(yargsBuilder);
const registry = new JustTaskRegistry(yargsBuilder);
undertaker.registry(registry);

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -70,25 +70,25 @@
"projects": [
{
"packageName": "build-rig",
"projectFolder": "packages/build-rig",
"packageName": "just-task",
"projectFolder": "packages/just-task",
"reviewCategory": "production",
"versionPolicyName": "RepoPolicy"
},
{
"packageName": "build-rig-typescript",
"projectFolder": "packages/build-rig-typescript",
"packageName": "just-task-typescript",
"projectFolder": "packages/just-task-typescript",
"reviewCategory": "production",
"versionPolicyName": "RepoPolicy"
},
{
"packageName": "build-rig-webpack",
"projectFolder": "packages/build-rig-webpack",
"packageName": "just-task-webpack",
"projectFolder": "packages/just-task-webpack",
"reviewCategory": "production",
"versionPolicyName": "RepoPolicy"
},
{
"packageName": "build-rig-docs",
"packageName": "just-task-docs",
"projectFolder": "packages/documentation/website",
"reviewCategory": "docs",
"shouldPublish": false
@ -100,7 +100,7 @@
"shouldPublish": false
},
{
"packageName": "build-rig-scripts",
"packageName": "just-task-scripts",
"projectFolder": "scripts",
"reviewCategory": "tools",
"shouldPublish": false

Просмотреть файл

@ -1,4 +1,4 @@
const cpx = require('cpx');
const path = require('path');
cpx.copySync(path.resolve(__dirname, '../README.md'), path.resolve(__dirname, '../packages/build-rig'));
cpx.copySync(path.resolve(__dirname, '../README.md'), path.resolve(__dirname, '../packages/just-task'));

Просмотреть файл

@ -1,5 +1,5 @@
{
"name": "build-rig-scripts",
"name": "just-task-scripts",
"version": "1.0.0",
"description": "",
"main": "watch.js",