Home

Awesome

Plop Pack Azure NPM

npm

Useful to have action for PlopJS. This action helps users setup their Azure DevOps NPMRC file

Installation

npm i plop-pack-azure-npm

Config

{
    projectName: 'PROJ_NAME',
    registryUrl: 'pkgs.dev.azure.com/PROJ_NAME/project-uuid-999-999/_packaging/package-name/npm'
}

Your registryUrl must not contain a tailing / nor the registry/ postfix or https:// prefix

There's also an optional property you can pass to config: progressSpinner. It's required to use this property when using plop instead of node-plop, as otherwise the spinner will cause problems with the input.

const {progressSpinner} = require('plop');

const azureConfig = {
    projectName: '',
    registryUrl: '',
    progressSpinner
}

Example

module.exports = function(plop) {
  // Loads the npmInstall action type
  plop.load('plop-pack-azure-npm');

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