Comparing version 6.0.0-alpha.1 to 6.0.0-alpha.2
@@ -14,3 +14,3 @@ "use strict"; | ||
chalk_1.default.whiteBright.bold('npm init'); | ||
function run(helper, args) { | ||
function run(helper, args = {}) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
@@ -23,3 +23,3 @@ const cwd = process.cwd(); | ||
} | ||
const dojoRcPath = path_1.join(rootDir, '.dojorc'); | ||
const dojoRcPath = path_1.join(rootDir, args.config || '.dojorc'); | ||
const file = fs_1.existsSync(dojoRcPath) && fs_1.readFileSync(dojoRcPath, 'utf8'); | ||
@@ -44,3 +44,3 @@ let json = {}; | ||
fs_1.writeFileSync(dojoRcPath, JSON.stringify(json, null, indent)); | ||
console.log(chalk_1.default.white(`Successfully wrote .dojorc to ${dojoRcPath}`)); | ||
console.log(chalk_1.default.white(`Successfully wrote ${args.config} to ${dojoRcPath}`)); | ||
}); | ||
@@ -47,0 +47,0 @@ } |
@@ -10,2 +10,15 @@ "use strict"; | ||
const appPath = pkgDir.sync(process.cwd()); | ||
function getDojoRcConfigOption() { | ||
const defaultDojoRc = '.dojorc'; | ||
const configIndex = process.argv.indexOf('--config'); | ||
if (configIndex !== -1 && appPath) { | ||
const customDojoRc = process.argv[configIndex + 1]; | ||
if (customDojoRc && fs_1.existsSync(path_1.join(appPath, customDojoRc))) { | ||
return customDojoRc; | ||
} | ||
console.warn(chalk_1.default.yellow(`Specified dojorc file '${customDojoRc}' does not exist, using '.dojorc'`)); | ||
} | ||
return defaultDojoRc; | ||
} | ||
exports.getDojoRcConfigOption = getDojoRcConfigOption; | ||
let dojoRcPath; | ||
@@ -80,3 +93,4 @@ let packageJsonPath; | ||
const hasDojoRcConfig = typeof dojoRcConfig === 'object'; | ||
if (hasPackageConfig && hasDojoRcConfig) { | ||
const usingDefaultojoRcConfig = getDojoRcConfigOption() === '.dojorc'; | ||
if (hasPackageConfig && hasDojoRcConfig && usingDefaultojoRcConfig) { | ||
warnAboutMultiConfig(); | ||
@@ -125,2 +139,8 @@ } | ||
sandbox(groupName, commandName) { | ||
if (!this._dojoRcName) { | ||
this._dojoRcName = getDojoRcConfigOption(); | ||
if (appPath) { | ||
dojoRcPath = path_1.join(appPath, this._dojoRcName); | ||
} | ||
} | ||
return new SingleCommandConfigurationHelper(groupName, commandName); | ||
@@ -127,0 +147,0 @@ } |
@@ -113,3 +113,3 @@ "use strict"; | ||
} | ||
register((key, options) => { | ||
function formatOption(key, options) { | ||
let optionKeys = `${addOptionPrefix(chalk_1.default.greenBright(key))}`; | ||
@@ -145,3 +145,5 @@ if (options.alias) { | ||
} | ||
}, null); | ||
} | ||
register(formatOption, null); | ||
formatOption('config', { default: '.dojorc', type: 'string', description: 'The dojorc config file' }); | ||
return commandOptionHelp; | ||
@@ -148,0 +150,0 @@ } |
{ | ||
"name": "@dojo/cli", | ||
"version": "6.0.0-alpha.1", | ||
"version": "6.0.0-alpha.2", | ||
"description": "Dojo CLI utility", | ||
@@ -5,0 +5,0 @@ "homepage": "https://dojo.io", |
@@ -110,2 +110,3 @@ "use strict"; | ||
}) | ||
.option('config', { default: '.dojorc', type: 'string', description: 'The dojorc config file' }) | ||
.showHelpOnFail(false, help_1.formatHelp({ _: [groupName] }, groupMap)) | ||
@@ -141,3 +142,6 @@ .strict(); | ||
}, helper.sandbox(groupName, name)); | ||
return optionsYargs.showHelpOnFail(false, help_1.formatHelp({ _: [groupName, name] }, groupMap)).strict(); | ||
return optionsYargs | ||
.option('config', { default: '.dojorc', type: 'string', description: 'The dojorc config file' }) | ||
.showHelpOnFail(false, help_1.formatHelp({ _: [groupName, name] }, groupMap)) | ||
.strict(); | ||
}, (argv) => tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
@@ -144,0 +148,0 @@ if (argv.h || argv.help) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
207114
1878
0