Skip to content

Commit

Permalink
feat(edam-cli): add --pull.npm-client-args
Browse files Browse the repository at this point in the history
  • Loading branch information
imcuttle committed Feb 20, 2019
1 parent 577e790 commit a2c7273
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
23 changes: 17 additions & 6 deletions packages/edam-cli/bin/edam.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const constant = require('edam/dist/core/constant').default
const meow = require('meow')
const pkg = require('../package.json')
const tildify = require('tildify')
const get = require('lodash.get')
const set = require('lodash.set')
const updateNotify = require('update-notifier')
const dbg = require('debug')

Expand Down Expand Up @@ -83,9 +85,16 @@ const flags = [
name: 'pull.npm-client',
type: 'string',
desc:
'Appoints to the command when installing package form npmjs.com. [npm|yarn]',
'Appoints to the command when installing package. [npm|yarn]',
default: 'npm'
},
{
name: 'pull.npm-client-args',
type: 'string',
desc:
'Appoints to the command\'s arguments when installing package. eg. --pull.npm-client-args="--registry=http://example.com"',
default: ''
},
{
name: 'pull.git',
type: 'string',
Expand Down Expand Up @@ -163,12 +172,13 @@ ${generateFlagHelp(flags, ' ')}
;(function() {
const flags = cli.flags
// parse array input
;['extends', 'plugins', 'includes', 'excludes'].forEach(name => {
if (!Array.isArray(flags[name]) && typeof flags[name] === 'string') {
if (flags[name]) {
flags[name] = flags[name].split(',')
;['extends', 'plugins', 'includes', 'excludes', 'pull.npm-client-args'].forEach(name => {
const value = get(flags, name)
if (!Array.isArray(value) && typeof value === 'string') {
if (value) {
set(flags, name, value.split(','))
} else {
flags[name] = null
set(flags, name, null)
}
}
})
Expand All @@ -194,6 +204,7 @@ ${generateFlagHelp(flags, ' ')}
plugins: flags.plugins,
pull: {
npmClient: flags.pull['npm-client'],
npmClientArgs: flags.pull['pull.npm-client-args'],
git: flags.pull['git']
},
yes: flags.yes,
Expand Down
18 changes: 16 additions & 2 deletions packages/edam-cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/edam-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"name": "edam-cli",
"version": "3.2.0",
"description": "💥 The multifunctional scaffold generator.",
"dependencies": {
"chalk": "^2.3.2",
"cli-width": "^2.2.0",
"cliui": "^4.0.0",
"debug": "^4.1.0",
"edam": "^3.2.0",
"lodash.get": "^4.4.2",
"lodash.set": "^4.3.2",
"meow": "^4.0.0",
"ora": "^2.0.0",
"tildify": "^1.2.0",
Expand Down

0 comments on commit a2c7273

Please sign in to comment.