generate-assemblefile

    0.1.0 • Public • Published

    generate-assemblefile NPM version NPM downloads Build Status

    Generate an assemblefile.js for assemble in the current working directory or specified --dest.


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

    Table of Contents

    (TOC generated by verb using markdown-toc)

    What is "Generate"?

    Generate is a command line tool and developer framework for scaffolding out new GitHub projects using generators and tasks. Answers to prompts and the user's environment can be used to determine the templates, directories, files and contents to build. Support for gulp, base and assemble plugins, and much more.

    For more information about Generate:

    Command line usage

    Install

    Installing the CLI

    To run the assemblefile generator from the command line, you'll need to install generate globally first. You can do that now with the following command:

    $ npm install --global generate

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

    Install generate-assemblefile

    You may now install this module with the following command:

    $ npm install --global generate-assemblefile

    Run

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

    $ gen assemblefile

    What will happen?

    Running $ gen assemblefile will run the generator's default task, 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 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:

    [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.

    Help

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

    $ gen help

    CLI Usage

    Running tasks

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

    $ gen assemblefile:foo
           ^       ^
    generator     task

    Example

    The following will run generator foo, task bar:

    $ gen foo:bar

    Default task

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

    Available tasks

    assemblefile

    Generate an assemblefile.js file to the current working directory.

    Example

    $ gen assemblefile
    $ gen assemblefile --dest ./docs

    Visit Generate's documentation for tasks.

    API usage

    Use generate-assemblefile as a plugin in your own generator.

    Install locally

    Install with npm:

    $ npm install --save generate-assemblefile

    Use as a plugin

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

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

    Running tasks

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

    module.exports = function(app) {
      app.use(require('generate-assemblefile'));
     
      app.task('foo', function(cb) {
        // do task stuff
        cb();
      });
     
      // run the `mit` task from `generate-assemblefile`
      app.task('default', ['foo', 'mit']);
    };

    Register as a generator

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

    module.exports = function(app) {
      app.register('foo', require('generate-assemblefile'));
      // 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:

    module.exports = function(app) {
      app.register('foo', require('generate-assemblefile'));
     
      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:

    module.exports = function(app) {
      app.register('foo', require('generate-assemblefile'));
     
      app.task('bar', function(cb) {
        app.generate('foo:bar', cb);
      });
    };

    More information

    Visit the generator docs 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-assemblefile.

    generate-install

    Run generate-install after this generator to prompt to install any dependencies or devDependencies necessary for the generated files.

    Example

    generate-assemblefile generate-install example

    generate-dest

    Run generate-dest before this generator to prompt for the destination directory to use for generated files.

    Example

    generate-assemblefile generate-dest example

    Customization

    The following instructions can be used to override settings in generate-assemblefile. Visit the Generate documentation to learn about other ways to override defaults.

    Destination directory

    To customize the destination directory, install 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-assemblefile:

    $ gen dest assemblefile

    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-assemblefile/templates/foo.tmpl, where ~/ is the user-home directory that os.homedir() resolves to on your system.

    Next steps

    About

    Related projects

    • assemble: Get the rocks out of your socks! Assemble makes you fast at creating web projects… more | homepage
    • generate: Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the… more | homepage

    Contributing

    Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

    Running tests

    Install dev dependencies:

    $ npm install -d && npm test

    Author

    Jon Schlinkert

    License

    Copyright © 2016, Jon Schlinkert. Released under the MIT license.


    This file was generated by verb, v0.9.0, on July 15, 2016.

    Install

    npm i generate-assemblefile

    DownloadsWeekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • jonschlinkert