зеркало из https://github.com/microsoft/just.git
Update docs
This commit is contained in:
Родитель
51055a3a2c
Коммит
679f48c938
|
@ -8,23 +8,25 @@ sidebar_label: Command line arguments
|
|||
|
||||
## Reading arguments
|
||||
|
||||
To read the arguments passed in from command line, use the `this.argv` object provided by `yargs`.
|
||||
To read the arguments passed in from command line, use the `argv()` function provided by `yargs`.
|
||||
|
||||
```js
|
||||
const { task, argv } = require('just-task');
|
||||
|
||||
task('pillageMeArgs', function() {
|
||||
logger.info('a bunch of aarrrrrrgs', this.argv);
|
||||
logger.info('a bunch of aarrrrrrgs', argv());
|
||||
});
|
||||
```
|
||||
|
||||
## Describe the task with `option()`
|
||||
|
||||
```js
|
||||
const { task, logger, option } = require('just-task');
|
||||
const { task, logger, option, argv } = require('just-task');
|
||||
|
||||
option('name');
|
||||
|
||||
task('blimey', 'An exclamation of surprise.', function() {
|
||||
logger.info(`blimey! ${this.argv.name}`);
|
||||
logger.info(`blimey! ${argv().name}`);
|
||||
});
|
||||
```
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ 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 `just-task` is made. It simplifies the composition of tasks.
|
||||
Once a project gets 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` was made. It simplifies the composition of tasks.
|
||||
|
||||
## Running tasks in a series
|
||||
|
||||
|
@ -24,7 +24,7 @@ task('build', series('clean', 'babel'));
|
|||
|
||||
When you trigger `just build`, the `clean` task will run and complete before `babel` task is run.
|
||||
|
||||
## Runny tasks in parallel
|
||||
## Running tasks in parallel
|
||||
|
||||
To take advantage of multi-core CPUs on our machines, we can run several tasks in parallel. Simply use the `parallel()` function.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ title: Controlling Task Flow with Conditionals
|
|||
sidebar_label: Conditionals
|
||||
---
|
||||
|
||||
Sometimes a `just-task.js` would include tasks that are skipped depending on the arguments that are given. Use a `condition()` function to decide to run a task or to skip it.
|
||||
Sometimes a `just-task.js` includes tasks that are skipped depending on the arguments that are given. Use a `condition()` function to decide to run a task or to skip it.
|
||||
|
||||
## Running tasks in a series
|
||||
|
||||
|
@ -59,4 +59,4 @@ $ just build --skip-test
|
|||
|
||||
## Next Steps
|
||||
|
||||
Learn about [higher order task function](thunk.md)
|
||||
Learn about [higher order task functions](thunk.md)
|
||||
|
|
|
@ -33,4 +33,4 @@ That's all!
|
|||
|
||||
## Next Steps
|
||||
|
||||
Learn about how to [compose tasks in just-task.js](composition.md)
|
||||
Learn how to [compose tasks in just-task.js](composition.md)
|
||||
|
|
|
@ -12,7 +12,7 @@ Typically, logging tasks look like the following:
|
|||
|
||||
## Usage
|
||||
|
||||
To log within the task, simply use the `logger` object off of `this` inside a task function.
|
||||
To log within the task, simply use the `info()` function off of the `logger` object inside a task function.
|
||||
|
||||
```js
|
||||
const { task, logger } = require('just-task');
|
||||
|
|
|
@ -4,7 +4,7 @@ title: Typescript
|
|||
sidebar_label: Typescript
|
||||
---
|
||||
|
||||
Typescript is a very popular compiler that allows developers to use modern ES6 features as well as a very mature typing system. The benefits are so great that it has become of the first presets supported by the `just-scripts` library.
|
||||
Typescript is a very popular compiler that allows developers to use modern ES6 features as well as a very mature typing system. The benefits are so great that it has become one of the first presets supported by the `just-scripts` library.
|
||||
|
||||
Given a library with Typescript source code, it might be desirable to have multiple output formats for different audiences. By default, the `tscTask()` function looks for the `tsconfig.json` present in the project root. The preset higher order function can take in an option that overrides compilation options. The Typescript compiler options are passed to the `tsc.js` script.
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@ title: Upgrading Repos
|
|||
sidebar_label: Upgrading Repos
|
||||
---
|
||||
|
||||
`just-stack` is unique that it tries to solve the template synchronization problem. When a repository had been scaffolded, generally the repository take on a life of its own. There is no way for the template authors to help the generated repositories to consume any updates. `just-stack` employs a strategy of tracking diffs between template ugprades to be applied to existing repositories.
|
||||
`just-stack` is unique in that it tries to solve the template synchronization problem. When a repository has been scaffolded, generally the repository takes on a life of its own. There is no way for the template authors to help the generated repositories consume any updates. `just-stack` employs a strategy of tracking diffs between template ugprades to be applied to existing repositories.
|
||||
|
||||
For example, suppose there was a repository named `kittens` that was scaffolded from the `just-stack-single-lib`:
|
||||
|
||||
1. Alice scaffolds a `kittens` repo via the `npm init just` command, selecting the `just-stack-single-lib` project type
|
||||
2. Bob, the template author, modifies the `just-stack-single-lib` dependency of `@types/node` to the latest to take advantage of the cool new typings
|
||||
3. Alice sees a change in the stack template, and decided to upgrade. She updates the `just-stack-single-lib` devDependencies inside her `/package.json`
|
||||
3. Alice sees a change in the stack template, and decides to upgrade. She updates the `just-stack-single-lib` devDependencies inside her `/package.json`
|
||||
4. Alice runs an update `npm install`
|
||||
5. Alice then runs `npm run upgrade-repo` command to apply any new changes into her existing repo
|
||||
|
||||
|
@ -18,7 +18,7 @@ This flow is very similar to the scaffolded monorepos:
|
|||
|
||||
1. Alice scaffolds a `kittens` repo via the `npm init just` command, selecting the `just-stack-monorepo` project type
|
||||
2. Bob, the template author, modifies the `just-stack-single-lib` dependency of `@types/node` to the latest to take advantage of the cool new typings
|
||||
3. Alice sees a change in the stack template, and decided to upgrade. She updates the `just-stack-single-lib` devDependencies inside her `/scripts/package.json`
|
||||
3. Alice sees a change in the stack template, and decides to upgrade. She updates the `just-stack-single-lib` devDependencies inside her `/scripts/package.json`
|
||||
4. Alice runs an update `npm run update` at the root
|
||||
5. Alice then runs `npm run upgrade-repo` command to apply any new changes into her existing repo
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ title: Higher Order Task Functions
|
|||
sidebar_label: Higher Order Task Functions
|
||||
---
|
||||
|
||||
When a project truly gets big enough to have multiple variants of a build, a simple task function might be reused as variants. For example, the `just-task-preset` package includes useful collection of task functions like `tscTask`. However, these tasks tend of be very generic. `tscTask()` is a task function factory. Calling it will generate a task function. But sometimes variations of the same preconfigured task function is needed. We will use a concept called `thunk` to create a task function that creates a task function on the fly!
|
||||
When a project truly gets big enough to have multiple variants of a build, a simple task function might be reused as variants. For example, the `just-task-preset` package includes a useful collection of task functions like `tscTask`. However, these tasks tend to be very generic. `tscTask()` is a task function factory. Calling it will generate a task function. But sometimes variations of the same preconfigured task function is needed. We will use a concept called `thunk` to create a task function that creates a task function on the fly!
|
||||
|
||||
Here is an example of a simple usage of a preset task function factory:
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче