plop-actions

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

Usage no npm install needed!

<script type="module">
  import plopActions from 'https://cdn.skypack.dev/plop-actions';
</script>

README

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