An open API service indexing awesome lists of open source software.

https://github.com/generate/generate-updatefile

Generate an updatefile.js in the current working directory or specified `--dest`.
https://github.com/generate/generate-updatefile

Last synced: 8 months ago
JSON representation

Generate an updatefile.js in the current working directory or specified `--dest`.

Awesome Lists containing this project

README

          

# generate-updatefile [![NPM version](https://img.shields.io/npm/v/generate-updatefile.svg?style=flat)](https://www.npmjs.com/package/generate-updatefile) [![NPM downloads](https://img.shields.io/npm/dm/generate-updatefile.svg?style=flat)](https://npmjs.org/package/generate-updatefile) [![Build Status](https://img.shields.io/travis/generate/generate-updatefile.svg?style=flat)](https://travis-ci.org/generate/generate-updatefile)

> Generate an updatefile.js for [update](https://github.com/update/update) in the current working directory or specified `--dest`.



![generate-updatefile demo](https://raw.githubusercontent.com/generate/generate-updatefile/master/demo.gif)

## Table of Contents

- [What is "Generate"?](#what-is-generate)
- [Command line usage](#command-line-usage)
* [Install](#install)
* [Run](#run)
* [Help](#help)
- [CLI Usage](#cli-usage)
* [Running tasks](#running-tasks)
* [Available tasks](#available-tasks)
- [API usage](#api-usage)
* [Install locally](#install-locally)
* [Use as a plugin](#use-as-a-plugin)
* [Register as a generator](#register-as-a-generator)
- [Running multiple generators](#running-multiple-generators)
* [generate-install](#generate-install)
* [generate-dest](#generate-dest)
- [Customization](#customization)
* [Destination directory](#destination-directory)
* [Overriding templates](#overriding-templates)
- [Next steps](#next-steps)
- [About](#about)
* [Related projects](#related-projects)
* [Contributing](#contributing)
* [Running tests](#running-tests)
* [Author](#author)
* [License](#license)

_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_

## What is "Generate"?

Generate is a command line tool and developer framework for scaffolding out new GitHub projects using [generators](https://github.com/generate/generate/blob/master/docs/generators.md) and [tasks](https://github.com/generate/generate/blob/master/docs/tasks.md). Answers to prompts and the user's environment can be used to determine the templates, directories, files and contents to build. Support for [gulp](http://gulpjs.com), [base](https://github.com/node-base/base) and [assemble](https://github.com/assemble/assemble) plugins, and much more.

For more information about Generate:

* Visit the [generate project](https://github.com/generate/generate)
* Visit the [generate documentation](https://github.com/generate/generate/blob/master/docs/)
* Find [generators on npm](https://www.npmjs.com/browse/keyword/generate-generator) (help us [author generators](https://github.com/generate/generate/blob/master/docs/micro-generators.md))

## Command line usage

### Install

**Installing the CLI**

To run the `updatefile` generator from the command line, you'll need to install [generate](https://github.com/generate/generate) globally first. You can do that now with the following command:

```sh
$ npm install --global generate
```

This adds the `gen` command to your system path, allowing it to be run from any directory.

**Install generate-updatefile**

You may now install this module with the following command:

```sh
$ npm install --global generate-updatefile
```

### Run

You should now be able to run `generate-updatefile` with the following command:

```sh
$ gen updatefile
```

**What will happen?**

Running `$ gen updatefile` will run the generator's [default task](#default), which will:

1. prompt you for any information that's missing
2. render the necessary template(s) using your answers
3. write [the resulting files](#available-tasks) to the current working directory

**What you should see in the terminal**

If completed successfully, you should see both `starting` and `finished` events in the terminal, like the following:

```sh
[00:44:21] starting ...
...
[00:44:22] finished ✔
```

If you do not see one or both of those events, please [let us know about it](../../issues).

### Help

To see a general help menu and available commands for Generate's CLI, run:

```sh
$ gen help
```

## CLI Usage

### Running tasks

Tasks on `generate-updatefile` are run by passing the name of the task to run after the generator name, delimited by a comma:

```sh
$ gen updatefile:foo
^ ^
generator task
```

**Example**

The following will run generator `foo`, task `bar`:

```sh
$ gen foo:bar
```

**Default task**

When a task name is not explicitly passed on the command line, Generate's CLI will run the [default](#default) task.

### Available tasks

#### [updatefile](generator.js#L19)

Generate an `updatefile.js` file to the current working directory.

**Example**

```sh
$ gen updatefile
$ gen updatefile --dest ./docs
```

Visit Generate's [documentation for tasks](https://github.com/generate/generate/blob/master/docs/tasks.md).

## API usage

Use `generate-updatefile` as a [plugin](https://github.com/generate/generate/blob/master/docs/plugins.md) in your own [generator](https://github.com/generate/generate/blob/master/docs/generators.md).

### Install locally

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save generate-updatefile
```

### Use as a plugin

When used as a plugin, tasks from `generate-updatefile` are added to your generator's instance.

```js
module.exports = function(app) {
app.use(require('generate-updatefile'));
// do generator stuff
};
```

**Running tasks**

You can now run any tasks from `generate-updatefile` as if they were part of your own generator.

```js
module.exports = function(app) {
app.use(require('generate-updatefile'));

app.task('foo', function(cb) {
// do task stuff
cb();
});

// run the `mit` task from `generate-updatefile`
app.task('default', ['foo', 'mit']);
};
```

### Register as a generator

When registered as a generator, tasks from `generate-updatefile` are added to the "namespace" you give to the generator.

```js
module.exports = function(app) {
app.register('foo', require('generate-updatefile'));
// generate
};
```

**Running tasks**

Pass the names of one or more tasks to run to the `.generate` method, prefixed with the namespace of the sub-generator (`foo`, in our example):

**Examples**

Run the `bar` task from generator `foo`:

```js
module.exports = function(app) {
app.register('foo', require('generate-updatefile'));

app.generate('foo:bar', function(err) {
if (err) console.log(err);
});
};
```

Wrap the call to `.generate` in a task, so it can be called on demand:

```js
module.exports = function(app) {
app.register('foo', require('generate-updatefile'));

app.task('bar', function(cb) {
app.generate('foo:bar', cb);
});
};
```

**More information**

Visit the [generator docs](https://github.com/generate/generate/blob/master/docs/generators.md) to learn more about creating, installing, using and publishing generators.

## Running multiple generators

Generate supports running multiple generators at once. Here are some examples of other generators that work well with `generate-updatefile`.

### generate-install

Run [generate-install](https://github.com/generate/generate-install) **after** this generator to prompt to install any `dependencies` or `devDependencies` necessary for the generated files.

**Example**

![generate-updatefile generate-install example](https://raw.githubusercontent.com/generate/generate-updatefile/master/docs/demo-install.gif)

### generate-dest

Run [generate-dest](https://github.com/generate/generate-dest) **before** this generator to prompt for the destination directory to use for generated files.

**Example**

![generate-updatefile generate-dest example](https://raw.githubusercontent.com/generate/generate-updatefile/master/docs/demo-dest.gif)

## Customization

The following instructions can be used to override settings in `generate-updatefile`. Visit the [Generate documentation](https://github.com/generate/generate/blob/master/docs/overriding-defaults.md) to learn about other ways to override defaults.

### Destination directory

To customize the destination directory, install [generate-dest](https://github.com/generate/generate-dest) globally, then in the command line prefix `dest` before any other generator names.

For example, the following will prompt you for the destination path to use, then pass the result to `generate-updatefile`:

```sh
$ gen dest updatefile
```

### 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 `foo.tmp` template, add a template at the following path `~/generate/generate-updatefile/templates/foo.tmpl`, where `~/` is the user-home directory that `os.homedir()` resolves to on your system.

## Next steps

* [docs.md](docs.md): additional documentation for this generator
* [Generate documentation](https://github.com/generate/generate/blob/master/docs/): visit the Generate docs
* [Generate repo](https://github.com/generate/generate): visit the Generate repository

## About

### Related projects

* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit")
* [generate](https://www.npmjs.com/package/generate): Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the… [more](https://github.com/generate/generate) | [homepage](https://github.com/generate/generate "Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either.")
* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.")

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Running tests

Install dev dependencies:

```sh
$ npm install -d && npm test
```

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

### License

Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/generate/generate-updatefile/blob/master/LICENSE).

***

_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on July 15, 2016._