@clabs/packages-publisher
Advanced tools
Comparing version 0.0.1-alpha.1 to 0.0.1-alpha.2
@@ -21,2 +21,3 @@ "use strict"; | ||
ARG_NAMES["outputPath"] = "outputPath"; | ||
ARG_NAMES["json"] = "json"; | ||
})(ARG_NAMES = exports.ARG_NAMES || (exports.ARG_NAMES = {})); | ||
@@ -52,5 +53,10 @@ var commandName = 'publish'; | ||
}, | ||
_a[ARG_NAMES.json] = { | ||
type: 'boolean', | ||
desc: 'Print result to a JSON file. To skip logging to console use `--no-verbose`', | ||
demandOption: false | ||
}, | ||
_a[ARG_NAMES.outputPath] = { | ||
type: 'string', | ||
desc: 'Path where the results file will be written to. Default is the process cwd.', | ||
desc: 'Path where the JSON file will be written to. Default is the process cwd.', | ||
alias: 'output-path', | ||
@@ -57,0 +63,0 @@ demandOption: false |
@@ -202,3 +202,8 @@ "use strict"; | ||
if (enabled2FA && otp.isEmpty()) { | ||
throw new Error('2FA is enabled, but one-time password was not provided with `--otp`'); | ||
if (!dryRun) { | ||
throw new Error('2FA is enabled, but one-time password was not provided with `--otp`'); | ||
} | ||
logger_1.logger.logSpacer(); | ||
logger_1.logger.warn('Account requires 2FA, but no `--otp` flag was provided.\nThis is only accepted in dry-run mode.'); | ||
otp.setNew('123456'); | ||
} | ||
@@ -209,2 +214,3 @@ packages = (0, get_package_jsons_1.getAllPackageJsons)(path); | ||
if (!skipBuild) return [3 /*break*/, 2]; | ||
logger_1.logger.logSpacer(); | ||
logger_1.logger.warn('Building was skipped'); | ||
@@ -248,6 +254,8 @@ return [3 /*break*/, 4]; | ||
case 4: | ||
outputPath = args.outputPath | ||
? path_1["default"].join(args.outputPath, exports.OUTPUT_FILE_NAME) | ||
: path_1["default"].join(process.cwd(), exports.OUTPUT_FILE_NAME); | ||
fs_1["default"].writeFileSync(outputPath, JSON.stringify(resultCollector.getResult())); | ||
if (args.json) { | ||
outputPath = args.outputPath | ||
? path_1["default"].join(args.outputPath, exports.OUTPUT_FILE_NAME) | ||
: path_1["default"].join(process.cwd(), exports.OUTPUT_FILE_NAME); | ||
fs_1["default"].writeFileSync(outputPath, JSON.stringify(resultCollector.getResult())); | ||
} | ||
if (error) { | ||
@@ -254,0 +262,0 @@ (0, error_utils_1.exitWithError)(error); |
@@ -53,6 +53,6 @@ "use strict"; | ||
var versionAndTag = version | ||
? "version \"".concat((0, kleur_1.bold)(version.number), "\" (tag: ").concat(version.tag, ")") | ||
? "version \"".concat((0, kleur_1.bold)((0, kleur_1.underline)(version.number)), "\" (tag: ").concat((0, kleur_1.bold)((0, kleur_1.underline)(version.tag)), ")") | ||
: ''; | ||
var defaultSuccessText = "\"".concat(packageName, "\" published with ").concat(versionAndTag); | ||
var dryRunSuccess = "\"".concat(packageName, "\" would be successfully published with ").concat(versionAndTag); | ||
var dryRunSuccess = "\"".concat(packageName, "\" would be published with ").concat(versionAndTag); | ||
switch (status) { | ||
@@ -59,0 +59,0 @@ case 'success': |
@@ -41,3 +41,3 @@ "use strict"; | ||
* This function needs to be called at the very beginning of the process | ||
* to effectively toggle logging. If that's nto done, nothing will be logged | ||
* to effectively toggle logging. If that's not done, nothing will be logged | ||
* whenever a `logger[method]` is called. | ||
@@ -44,0 +44,0 @@ */ |
{ | ||
"version": "0.0.1-alpha.1", | ||
"version": "0.0.1-alpha.2", | ||
"name": "@clabs/packages-publisher", | ||
@@ -4,0 +4,0 @@ "repository": "celo-org/packages-publisher", |
@@ -10,2 +10,3 @@ import { Argv, PositionalOptionsType } from 'yargs'; | ||
outputPath = 'outputPath', | ||
json = 'json', | ||
} | ||
@@ -19,2 +20,3 @@ | ||
[ARG_NAMES.outputPath]?: string; | ||
[ARG_NAMES.json]: boolean; | ||
}; | ||
@@ -51,5 +53,10 @@ | ||
}, | ||
[ARG_NAMES.json]: { | ||
type: 'boolean' as PositionalOptionsType, | ||
desc: 'Print result to a JSON file. To skip logging to console use `--no-verbose`', | ||
demandOption: false, | ||
}, | ||
[ARG_NAMES.outputPath]: { | ||
type: 'string' as PositionalOptionsType, | ||
desc: 'Path where the results file will be written to. Default is the process cwd.', | ||
desc: 'Path where the JSON file will be written to. Default is the process cwd.', | ||
alias: 'output-path', | ||
@@ -56,0 +63,0 @@ demandOption: false, |
@@ -130,5 +130,14 @@ import { ArgumentsCamelCase } from 'yargs'; | ||
if (enabled2FA && otp.isEmpty()) { | ||
throw new Error( | ||
'2FA is enabled, but one-time password was not provided with `--otp`' | ||
if (!dryRun) { | ||
throw new Error( | ||
'2FA is enabled, but one-time password was not provided with `--otp`' | ||
); | ||
} | ||
logger.logSpacer(); | ||
logger.warn( | ||
'Account requires 2FA, but no `--otp` flag was provided.\nThis is only accepted in dry-run mode.' | ||
); | ||
otp.setNew('123456'); | ||
} | ||
@@ -142,2 +151,3 @@ | ||
if (skipBuild) { | ||
logger.logSpacer(); | ||
logger.warn('Building was skipped'); | ||
@@ -163,7 +173,9 @@ } else { | ||
const outputPath = args.outputPath | ||
? path.join(args.outputPath, OUTPUT_FILE_NAME) | ||
: path.join(process.cwd(), OUTPUT_FILE_NAME); | ||
if (args.json) { | ||
const outputPath = args.outputPath | ||
? path.join(args.outputPath, OUTPUT_FILE_NAME) | ||
: path.join(process.cwd(), OUTPUT_FILE_NAME); | ||
fs.writeFileSync(outputPath, JSON.stringify(resultCollector.getResult())); | ||
fs.writeFileSync(outputPath, JSON.stringify(resultCollector.getResult())); | ||
} | ||
@@ -170,0 +182,0 @@ if (error) { |
import { ExecaError } from 'execa'; | ||
import { bold } from 'kleur'; | ||
import { bold, underline } from 'kleur'; | ||
import { logger } from '../../common/logging/logger'; | ||
@@ -70,6 +70,8 @@ import { ARG_NAMES } from './arguments'; | ||
const versionAndTag = version | ||
? `version "${bold(version.number)}" (tag: ${version.tag})` | ||
? `version "${bold(underline(version.number))}" (tag: ${bold( | ||
underline(version.tag) | ||
)})` | ||
: ''; | ||
const defaultSuccessText = `"${packageName}" published with ${versionAndTag}`; | ||
const dryRunSuccess = `"${packageName}" would be successfully published with ${versionAndTag}`; | ||
const dryRunSuccess = `"${packageName}" would be published with ${versionAndTag}`; | ||
@@ -76,0 +78,0 @@ switch (status) { |
@@ -42,3 +42,3 @@ import { black, green, red, underline, yellow, bgCyan } from 'kleur'; | ||
* This function needs to be called at the very beginning of the process | ||
* to effectively toggle logging. If that's nto done, nothing will be logged | ||
* to effectively toggle logging. If that's not done, nothing will be logged | ||
* whenever a `logger[method]` is called. | ||
@@ -45,0 +45,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
135028
3559