Skip to content

Commit a2c7273

Browse files
committed
feat(edam-cli): add --pull.npm-client-args
1 parent 577e790 commit a2c7273

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

packages/edam-cli/bin/edam.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const constant = require('edam/dist/core/constant').default
55
const meow = require('meow')
66
const pkg = require('../package.json')
77
const tildify = require('tildify')
8+
const get = require('lodash.get')
9+
const set = require('lodash.set')
810
const updateNotify = require('update-notifier')
911
const dbg = require('debug')
1012

@@ -83,9 +85,16 @@ const flags = [
8385
name: 'pull.npm-client',
8486
type: 'string',
8587
desc:
86-
'Appoints to the command when installing package form npmjs.com. [npm|yarn]',
88+
'Appoints to the command when installing package. [npm|yarn]',
8789
default: 'npm'
8890
},
91+
{
92+
name: 'pull.npm-client-args',
93+
type: 'string',
94+
desc:
95+
'Appoints to the command\'s arguments when installing package. eg. --pull.npm-client-args="--registry=http://example.com"',
96+
default: ''
97+
},
8998
{
9099
name: 'pull.git',
91100
type: 'string',
@@ -163,12 +172,13 @@ ${generateFlagHelp(flags, ' ')}
163172
;(function() {
164173
const flags = cli.flags
165174
// parse array input
166-
;['extends', 'plugins', 'includes', 'excludes'].forEach(name => {
167-
if (!Array.isArray(flags[name]) && typeof flags[name] === 'string') {
168-
if (flags[name]) {
169-
flags[name] = flags[name].split(',')
175+
;['extends', 'plugins', 'includes', 'excludes', 'pull.npm-client-args'].forEach(name => {
176+
const value = get(flags, name)
177+
if (!Array.isArray(value) && typeof value === 'string') {
178+
if (value) {
179+
set(flags, name, value.split(','))
170180
} else {
171-
flags[name] = null
181+
set(flags, name, null)
172182
}
173183
}
174184
})
@@ -194,6 +204,7 @@ ${generateFlagHelp(flags, ' ')}
194204
plugins: flags.plugins,
195205
pull: {
196206
npmClient: flags.pull['npm-client'],
207+
npmClientArgs: flags.pull['pull.npm-client-args'],
197208
git: flags.pull['git']
198209
},
199210
yes: flags.yes,

packages/edam-cli/package-lock.json

Lines changed: 16 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/edam-cli/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{
22
"name": "edam-cli",
33
"version": "3.2.0",
4+
"description": "💥 The multifunctional scaffold generator.",
45
"dependencies": {
56
"chalk": "^2.3.2",
67
"cli-width": "^2.2.0",
78
"cliui": "^4.0.0",
89
"debug": "^4.1.0",
910
"edam": "^3.2.0",
11+
"lodash.get": "^4.4.2",
12+
"lodash.set": "^4.3.2",
1013
"meow": "^4.0.0",
1114
"ora": "^2.0.0",
1215
"tildify": "^1.2.0",

0 commit comments

Comments
 (0)