Skip to content

Commit

Permalink
chore: udpate dev dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rkr00t committed Mar 20, 2022
1 parent a8d005c commit 370c233
Show file tree
Hide file tree
Showing 15 changed files with 804 additions and 1,046 deletions.
7 changes: 7 additions & 0 deletions .changeset/good-badgers-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@opaline/core": patch
"@opaline/help-theme-default": patch
"@opaline/runner": patch
---

update dev dependencies
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"examples/*"
],
"dependencies": {
"@changesets/cli": "^2.14.1",
"ava": "^3.15.0",
"lint-staged": "^10.5.4",
"@changesets/cli": "^2.21.1",
"ava": "^4.1.0",
"lint-staged": "^12.3.7",
"nyc": "^15.1.0",
"pre-commit": "^1.2.2",
"prettier": "^2.2.1",
"ts-node": "^9.1.1",
"typescript": "^4.2.3"
"prettier": "^2.6.0",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
},
"lint-staged": {
"*.{js,ts}": [
Expand Down
3 changes: 2 additions & 1 deletion packages/core/cli/commands/messages-841eed31.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,5 @@ exports.OP004_errorEmptyCommandsFolder = OP004_errorEmptyCommandsFolder;
exports.OP005_errorSrcEqDest = OP005_errorSrcEqDest;
exports.OP006_errorProjectNameIsRequired = OP006_errorProjectNameIsRequired;
exports.OP007_errorProjectFolderExists = OP007_errorProjectFolderExists;
exports.OP008_warningInputsNotArrayOrString = OP008_warningInputsNotArrayOrString;
exports.OP008_warningInputsNotArrayOrString =
OP008_warningInputsNotArrayOrString;
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ The actual snapshot is saved in `commands-parser.test.ts.snap`.

Generated by [AVA](https://avajs.dev).

## parseCommands should be able to parse jsdoc from a command file

> Snapshot 1
[
{
commandName: 'index',
meta: {
description: '',
examples: [
'$ example --name john',
],
options: {
name: {
alias: undefined,
default: 'john',
title: 'Some important flag',
type: 'string',
},
},
shouldPassInputs: true,
title: 'Prints inputs and flags',
usage: '$ example --name john',
},
},
]

## parseCommands should be able to parse jsdoc from multiple files file

> Snapshot 1
Expand Down Expand Up @@ -67,30 +94,3 @@ Generated by [AVA](https://avajs.dev).
},
},
]

## parseCommands should be able to parse jsdoc from a command file

> Snapshot 1
[
{
commandName: 'index',
meta: {
description: '',
examples: [
'$ example --name john',
],
options: {
name: {
alias: undefined,
default: 'john',
title: 'Some important flag',
type: 'string',
},
},
shouldPassInputs: true,
title: 'Prints inputs and flags',
usage: '$ example --name john',
},
},
]
Binary file not shown.
Binary file not shown.
13 changes: 9 additions & 4 deletions packages/core/dist/handlers/help.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatOptions = exports.singleCommandCliHelp = exports.subCommandHelp = exports.multiCommandCliHelp = exports.helpCommand = void 0;
exports.formatOptions =
exports.singleCommandCliHelp =
exports.subCommandHelp =
exports.multiCommandCliHelp =
exports.helpCommand =
void 0;
const print_1 = require("../utils/print");
/**
* Help command handler
*/
function helpCommand(args) {
if (args.config.isSingleCommand) {
print_1.print(singleCommandCliHelp(args));
(0, print_1.print)(singleCommandCliHelp(args));
} else if (args.commandName && args.commandName !== "index") {
print_1.print(subCommandHelp(args));
(0, print_1.print)(subCommandHelp(args));
} else {
print_1.print(multiCommandCliHelp(args));
(0, print_1.print)(multiCommandCliHelp(args));
}
}
exports.helpCommand = helpCommand;
Expand Down
17 changes: 11 additions & 6 deletions packages/core/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ var __importDefault =
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.printWarning = exports.printInfo = exports.printError = exports.print = exports.OpalineError = void 0;
exports.printWarning =
exports.printInfo =
exports.printError =
exports.print =
exports.OpalineError =
void 0;
const help_theme_default_1 = __importDefault(
require("@opaline/help-theme-default")
);
Expand Down Expand Up @@ -67,11 +72,11 @@ async function opaline(rawArgv, config) {
return error(`Need to add at least 1 command...`);
}
// # 1
if (args_1.isVersion(argv) && !isCommand) {
if ((0, args_1.isVersion)(argv) && !isCommand) {
return version(config.cliVersion);
}
// # 2
else if (args_1.isHelp(argv)) {
else if ((0, args_1.isHelp)(argv)) {
if (!isCommand) {
return help({
helpFormatter,
Expand Down Expand Up @@ -153,7 +158,7 @@ async function run({ config, commandName, argv, isCommand }) {
.load()
.apply(null, command.meta.shouldPassInputs ? [inputs, ...args] : args);
} catch (error) {
print_1.printError(error);
(0, print_1.printError)(error);
if (error instanceof error_1.OpalineError) {
process.exit(error.code);
} else {
Expand All @@ -166,11 +171,11 @@ function version(v) {
process.exit(0);
}
function error(msg) {
print_1.printError(msg);
(0, print_1.printError)(msg);
process.exit(1);
}
function help({ helpFormatter, config, commandName }) {
help_1.helpCommand({
(0, help_1.helpCommand)({
helpFormatter,
config,
commandName,
Expand Down
13 changes: 9 additions & 4 deletions packages/core/dist/utils/print.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.printInfo = exports.printError = exports.printWarning = exports.print = exports.indent = void 0;
exports.printInfo =
exports.printError =
exports.printWarning =
exports.print =
exports.indent =
void 0;
const colorette_1 = require("colorette");
function indent(text, level = 1) {
return `${"".padStart(level * 2, " ")}${text}`;
Expand All @@ -21,22 +26,22 @@ function print(text, level = 0) {
}
exports.print = print;
function printWarning(text) {
print(colorette_1.yellow("[WARN] ") + text);
print((0, colorette_1.yellow)("[WARN] ") + text);
}
exports.printWarning = printWarning;
function printError(err, verbose = false) {
if (typeof err === "string") {
print(err);
} else {
print(
[colorette_1.red(`${err.message}`)]
[(0, colorette_1.red)(`${err.message}`)]
.concat(err.hint ? err.hint : [])
.concat(verbose && err.stack ? err.stack.split("\n") : [])
);
}
}
exports.printError = printError;
function printInfo(text) {
print(colorette_1.blue("[INFO] ") + text);
print((0, colorette_1.blue)("[INFO] ") + text);
}
exports.printInfo = printInfo;
2 changes: 1 addition & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ async function run({
await command
.load()
.apply(null, command.meta.shouldPassInputs ? [inputs, ...args] : args);
} catch (error) {
} catch (error: any) {
printError(error);

if (error instanceof OpalineError) {
Expand Down
28 changes: 15 additions & 13 deletions packages/help-theme-default/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ function formatSubCommandHelpData(help) {
output.push("", help.title);
}
if (help.usage) {
output.push("", colorette_1.bold("USAGE"), [help.usage]);
output.push("", (0, colorette_1.bold)("USAGE"), [help.usage]);
}
if (help.options && help.options.length) {
output.push(
"",
colorette_1.bold("OPTIONS"),
(0, colorette_1.bold)("OPTIONS"),
formatList(help.options.map(formatOption)).map(
(opt) => `${opt[0]} ${opt[1]}`
)
);
}
if (help.description) {
output.push("", colorette_1.bold("DESCRIPTION"), [
output.push("", (0, colorette_1.bold)("DESCRIPTION"), [
capFirst(help.description),
]);
}
if (help.examples && help.examples.length) {
output.push("", colorette_1.bold("EXAMPLES"), help.examples);
output.push("", (0, colorette_1.bold)("EXAMPLES"), help.examples);
}
return output;
}
Expand All @@ -43,24 +43,24 @@ function formatHelpData(help) {
if (help.cliDescription) {
output.push("", help.cliDescription);
}
output.push("", colorette_1.bold("VERSION"), [
output.push("", (0, colorette_1.bold)("VERSION"), [
`${help.cliName}/${help.cliVersion}`,
]);
if (help.usage) {
output.push("", colorette_1.bold("USAGE"), [help.usage]);
output.push("", (0, colorette_1.bold)("USAGE"), [help.usage]);
}
if (help.commands && help.commands.length) {
output.push(
"",
colorette_1.bold("COMMANDS"),
(0, colorette_1.bold)("COMMANDS"),
formatList(
help.commands.map((c) => [c.name, capFirst(c.title || "")])
).map((c) => `${c[0]} ${c[1]}`),
"",
join(
[
colorette_1.yellow("> NOTE:"),
colorette_1.dim(
(0, colorette_1.yellow)("> NOTE:"),
(0, colorette_1.dim)(
`To view the usage information for a specific command, run '${help.cliName} [COMMAND] --help'`
),
],
Expand All @@ -71,14 +71,14 @@ function formatHelpData(help) {
if (help.options && help.options.length) {
output.push(
"",
colorette_1.bold("OPTIONS"),
(0, colorette_1.bold)("OPTIONS"),
formatList(help.options.map(formatOption)).map(
(opt) => `${opt[0]} ${opt[1]}`
)
);
}
if (help.examples && help.examples.length) {
output.push("", colorette_1.bold("EXAMPLES"), help.examples);
output.push("", (0, colorette_1.bold)("EXAMPLES"), help.examples);
}
return output;
}
Expand All @@ -105,8 +105,10 @@ function formatOption(option) {
join(
[
capFirst(option.title || ""),
option.type ? colorette_1.dim(`[${option.type}]`) : "",
option.default ? colorette_1.dim(`[default: ${option.default}]`) : "",
option.type ? (0, colorette_1.dim)(`[${option.type}]`) : "",
option.default
? (0, colorette_1.dim)(`[default: ${option.default}]`)
: "",
],
" "
),
Expand Down
16 changes: 9 additions & 7 deletions packages/runner/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,23 @@ class TaskWrapper {
typeof task.title === "string"
? task.title
: task.title(this.sharedCtx, params);
this.spinner = ora_1.default(this._title);
this.spinner = (0, ora_1.default)(this._title);
}
skip() {
this.spinner.info(colorette_1.dim(`[skip] ${this.title}`));
this.spinner.info((0, colorette_1.dim)(`[skip] ${this.title}`));
}
abort() {
this.isAborted = true;
}
progress(text) {
this.spinner.text = `${this.title} ${colorette_1.dim("[" + text + "]")}`;
this.spinner.text = `${this.title} ${(0, colorette_1.dim)(
"[" + text + "]"
)}`;
}
stopAndClearSpinner() {
this.spinner.stop();
}
format(text, formatter = (item) => colorette_1.dim(`→ ${item}`)) {
format(text, formatter = (item) => (0, colorette_1.dim)(`→ ${item}`)) {
if (Array.isArray(text)) {
return text.map((item) => {
if (Array.isArray(item)) {
Expand Down Expand Up @@ -77,7 +79,7 @@ class TaskWrapper {
}
prompt(text) {
this.spinner.stop();
return console_1.prompt(text).then((result) => {
return (0, console_1.prompt)(text).then((result) => {
this.spinner.start();
return result;
});
Expand All @@ -102,7 +104,7 @@ class TaskWrapper {
(await this.task.abort(this.sharedCtx, this.params, this))
) {
this.abort();
this.spinner.text = colorette_1.yellow(`[exit] ${this.title}`);
this.spinner.text = (0, colorette_1.yellow)(`[exit] ${this.title}`);
this.spinner.warn();
return;
}
Expand All @@ -114,7 +116,7 @@ class TaskWrapper {
this
);
if (this.isAborted) {
this.spinner.text = colorette_1.yellow(`[exit] ${this.title}`);
this.spinner.text = (0, colorette_1.yellow)(`[exit] ${this.title}`);
this.spinner.warn();
} else {
this.spinner.text = this.title;
Expand Down
Loading

0 comments on commit 370c233

Please sign in to comment.