plop-actions
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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
      })
    }
  })
}

Readme

Keywords

none

Package Sidebar

Install

npm i plop-actions

Weekly Downloads

3

Version

0.1.0

License

MIT

Unpacked Size

4.29 kB

Total Files

5

Last publish

Collaborators

  • amwmedia
  • crutchcorn