0.1.0 • Published 4 years ago

plop-actions v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Plop Actions

Useful to have actions for PlopJS. There are currently two actions as part of this package:

  • npmInstall
  • gitInit

npmInstall

This action runs npm install on the respective path passed to it.

Example

const {npmInstall} = require('plop-actions');

module.exports = function(plop) {
  plop.setActionType('npmInstall', gitInit);

  plop.setGenerator('generate', {
    prompts: [
        // ...
    ],
    actions: function(data) {
      const actions = [];

      actions.push({
        type: 'npmInstall',
        path: `${process.cwd()}/project-name/`,
        // By default is false, but if "true" will log the output of commands
        verbose: true
      })
    }
  })
}

gitInit

This action runs the following commands on the respective path passed to it:

git init
git add -A
git commit -m "Initial commit"

Example

const {gitInit} = require('plop-actions');

module.exports = function(plop) {
  plop.setActionType('gitInit', gitInit);

  plop.setGenerator('generate', {
    prompts: [
        // ...
    ],
    actions: function(data) {
      const actions = [];

      actions.push({
        type: 'gitInit',
        path: `${process.cwd()}/project-name/`,
        // By default is false, but if "true" will log the output of commands
        verbose: true
      })
    }
  })
}