Skip to content

Latest commit

 

History

History
97 lines (59 loc) · 2.54 KB

.verb.md

File metadata and controls

97 lines (59 loc) · 2.54 KB

Examples

Update an existing .eslintrc.json file

![{%= name %} demo](https://raw.githubusercontent.com/{%= repo %}/master/demo-update.gif)

Add a new .eslintrc.json file

![{%= name %} demo](https://raw.githubusercontent.com/{%= repo %}/master/demo-create.gif)

What is "Update"?

{%= include('update/what-is-update') %}

Usage

Heads up!: Always make sure your work is committed before running update.

Install

Install Update's CLI and {%= name %}:

{%= include("updater-install") %}

Running updater-eslint

You should now be able to run {%= name %} with the following command:

$ update {%= alias %}

What will this do?

This updater's default task will replace the .eslintrc.json file in the current working directory with either ~/templates/_eslintrc.json (defined by you in user home), or if a template does not exist in user home the default template will be used.

Running tasks

Tasks on {%= name %} are by run using the syntax eslint:foo, where foo is the task name:

Example

The following will run the bar task from updater foo:

$ update foo:bar
          ^   ^
    updater  task

Default task

If a task is not explicitly passed Update's CLI will run the default task.

Tasks

{%= apidocs('index.js') %}

Visit Update's task documentation.

Plugin usage

Use {%= name %} as a plugin{plugins.md} in your own updater{updaters.md}.

Install

{%= include("install-npm", {save: true}) %}

Register

Inside your own updater{updaters.md}:

module.exports = function(app) {
  // register {%= name %} as a plugin
  app.use(require('{%= name %}'));

  // run the `default` task on {%= name %}
  app.task('{%= strip("updater-", name) %}', function(cb) {
    app.update('{%= name %}', cb);
  });

  // run a specific task on {%= name %} 
  // (where `foo` is the name of the task to run)
  app.task('{%= strip("updater-", name) %}', function(cb) {
    app.update('{%= name %}:foo', cb);
  });
};

Visit the updater docs{updaters.md} to learn more about creating, installing, using and publishing updaters.

Customization

Overriding templates

You can override a template by adding a template of the same name to the templates directory in user home. For example, to override the _eslintrc.json template, add a template at the following path ~/templates/_eslintrc.json.