@kaynooo/cli-pkg 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +12 -19
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -555,18 +555,14 @@ import process8 from "process";
|
|
|
555
555
|
function usageLine(usage, colors = paint(process8.stdout)) {
|
|
556
556
|
return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
|
|
557
557
|
}
|
|
558
|
-
function helpText(usage, options, colors = paint(process8.stdout), { examples = [],
|
|
559
|
-
return [usageLine(usage, colors),
|
|
558
|
+
function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
|
|
559
|
+
return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
|
|
560
560
|
`);
|
|
561
561
|
}
|
|
562
562
|
function exitRows(exits, colors = paint(process8.stdout)) {
|
|
563
563
|
if (exits.length === 0)
|
|
564
564
|
return [];
|
|
565
|
-
|
|
566
|
-
return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
|
|
567
|
-
}
|
|
568
|
-
function replacesRows(replaces, colors = paint(process8.stdout)) {
|
|
569
|
-
return replaces === undefined || outputMode() === "agent" ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
|
|
565
|
+
return ["", `${colors.bold("Exit codes:")} ${exits.map(([code, meaning]) => `${colors.cyan(String(code))} ${meaning}`).join(", ")}`];
|
|
570
566
|
}
|
|
571
567
|
function wantsHelpJson(env = process8.env) {
|
|
572
568
|
return env.KIT_HELP === "json";
|
|
@@ -1339,7 +1335,6 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
|
|
|
1339
1335
|
header(colors, summary),
|
|
1340
1336
|
"",
|
|
1341
1337
|
usageLine(`${prefix} ${defaultCommand === undefined ? colors.cyan("<command>") : `[${colors.cyan("<command>")}]`} [options]`, colors),
|
|
1342
|
-
...replacesRows(replaces, colors),
|
|
1343
1338
|
"",
|
|
1344
1339
|
...await commandRows(commands, colors),
|
|
1345
1340
|
...own.length === 0 ? [] : ["", `${colors.bold(`Options of ${defaultCommand}:`)} ${colors.dim("the command run when none is named")}`, ...optionRows(Object.fromEntries(own), colors)],
|
|
@@ -3719,7 +3714,7 @@ async function choosePlan(name, version, settings, chooser = terminalChooser, ho
|
|
|
3719
3714
|
return { chosen: chosen.map((plan) => plan.dir), declined };
|
|
3720
3715
|
}
|
|
3721
3716
|
async function bump(args) {
|
|
3722
|
-
const { values, positionals: [name, asked] } = parse(args, usage5, options4, { positionals: ["<name>", "[version]"] });
|
|
3717
|
+
const { values, positionals: [name, asked] } = parse(args, usage5, options4, { exits: EXITS4, positionals: ["<name>", "[version]"] });
|
|
3723
3718
|
const settings = {
|
|
3724
3719
|
root: workspaceRoot({ given: values.root }),
|
|
3725
3720
|
configs: await loadConfigs(),
|
|
@@ -3752,9 +3747,7 @@ A version the vetting blocks is refused before any folder is touched, unless --f
|
|
|
3752
3747
|
A dependency declared through an alias of the package (\`"kay": "npm:@kaynooo/kayjs@~1.77.0"\`) is bumped under its own key, keeping the \`~\` or \`^\` of its range; --only and --except narrow the folders by name or glob (\`app\`, \`kay-*\`, a path relative to --root).
|
|
3753
3748
|
A dependency that is not a registry version (workspace:, link:, file:, git, a URL, an npm: alias of another package, catalog:), a peer range, a folder already on the version and one whose lockfile pins another manager are left as they are, each said so.
|
|
3754
3749
|
On a terminal with no --only or --except, a checklist asks which consumers to bump (those left out last time are unchecked, and what is unchecked is remembered in ~/.config/kaynooo-cli/pkg-excluded.json), then the plan is printed and confirmed; --yes skips both, as a pipe or --dry-run does.
|
|
3755
|
-
With --all-consumers a folder whose package.json or lockfile already has uncommitted changes is left alone, and each folder whose install went through then runs its own \`check\` (the check bin) and is committed with \`gc 'chore(deps): bump <name> to <version>' -- package.json <lockfile>\` only when that passes; a failing one is left uncommitted and listed in the summary with the skipped ones, and nothing is ever pushed
|
|
3756
|
-
|
|
3757
|
-
Exits 0 when every install ran or was left as it is (with --all-consumers, and every check passed and every commit landed), 1 when the vetting refuses the version, an install, a check or a commit fails or the registry has no such package, 2 when the version never shows within the timeout (a registry that cannot be reached is retried until then) or on a usage error.`, ROOT_OPTION, options4, POLL = 5000, terminalChooser;
|
|
3750
|
+
With --all-consumers a folder whose package.json or lockfile already has uncommitted changes is left alone, and each folder whose install went through then runs its own \`check\` (the check bin) and is committed with \`gc 'chore(deps): bump <name> to <version>' -- package.json <lockfile>\` only when that passes; a failing one is left uncommitted and listed in the summary with the skipped ones, and nothing is ever pushed.`, EXITS4, ROOT_OPTION, options4, POLL = 5000, terminalChooser;
|
|
3758
3751
|
var init_bump = __esm(() => {
|
|
3759
3752
|
init_src();
|
|
3760
3753
|
init_progress();
|
|
@@ -3766,6 +3759,7 @@ var init_bump = __esm(() => {
|
|
|
3766
3759
|
init_registry();
|
|
3767
3760
|
init_semver();
|
|
3768
3761
|
init_check();
|
|
3762
|
+
EXITS4 = [[0, "every install ran or was left as it is (with --all-consumers, and every check passed and every commit landed)"], [1, "the vetting refuses the version, an install, a check or a commit fails or the registry has no such package"], [2, "the version never shows within the timeout (a registry that cannot be reached is retried until then) or a usage error"]];
|
|
3769
3763
|
ROOT_OPTION = { type: "string", description: "the folder holding the repositories (the workspace of the user config or KAYNOOO_WORKSPACE, ~/Workspace by default)" };
|
|
3770
3764
|
options4 = {
|
|
3771
3765
|
root: ROOT_OPTION,
|
|
@@ -3790,7 +3784,7 @@ __export(exports_consumers, {
|
|
|
3790
3784
|
consumers: () => consumers
|
|
3791
3785
|
});
|
|
3792
3786
|
function consumers(args) {
|
|
3793
|
-
const { values, positionals: [name] } = parse(args, usage6, options5, { positionals: ["<name>"] });
|
|
3787
|
+
const { values, positionals: [name] } = parse(args, usage6, options5, { exits: EXITS5, positionals: ["<name>"] });
|
|
3794
3788
|
const root = workspaceRoot({ given: values.root });
|
|
3795
3789
|
const { shown, footer } = capped(findConsumers(name, root), limitOf(values, CONSUMERS_LIMIT));
|
|
3796
3790
|
if (values.json === true) {
|
|
@@ -3806,13 +3800,12 @@ function consumers(args) {
|
|
|
3806
3800
|
}
|
|
3807
3801
|
var usage6 = `pkg consumers <name>
|
|
3808
3802
|
|
|
3809
|
-
Lists the folders under --root whose package.json depends on the package, by its own name or through an \`npm:\` alias of it (the alias key is shown after the kind): the folder, the kind of dependency, the version it asks for and the manager its lockfile pins, 30 at most with the count of the rest after them (--limit <n>, --full for all; --json is never cut unless --limit is given)
|
|
3810
|
-
|
|
3811
|
-
Exits 0 when it listed them, 2 on a usage error.`, CONSUMERS_LIMIT = 30, options5;
|
|
3803
|
+
Lists the folders under --root whose package.json depends on the package, by its own name or through an \`npm:\` alias of it (the alias key is shown after the kind): the folder, the kind of dependency, the version it asks for and the manager its lockfile pins, 30 at most with the count of the rest after them (--limit <n>, --full for all; --json is never cut unless --limit is given).`, EXITS5, CONSUMERS_LIMIT = 30, options5;
|
|
3812
3804
|
var init_consumers2 = __esm(() => {
|
|
3813
3805
|
init_src();
|
|
3814
3806
|
init_consumers();
|
|
3815
3807
|
init_bump();
|
|
3808
|
+
EXITS5 = [[0, "it listed them"], [2, "a usage error"]];
|
|
3816
3809
|
options5 = {
|
|
3817
3810
|
root: ROOT_OPTION,
|
|
3818
3811
|
...limitOptions(CONSUMERS_LIMIT),
|
|
@@ -3860,6 +3853,7 @@ __export(exports_manager, {
|
|
|
3860
3853
|
import process21 from "process";
|
|
3861
3854
|
function manager(args) {
|
|
3862
3855
|
const { values, positionals } = parse(args, usage7, options6, {
|
|
3856
|
+
exits: EXITS6,
|
|
3863
3857
|
positionals: ["<action>"],
|
|
3864
3858
|
candidates: { "<action>": () => [...ACTIONS2] },
|
|
3865
3859
|
replaces: "telling bun, yarn, pnpm, npm, composer and uv apart by their lockfile before typing an add, remove or dlx",
|
|
@@ -3876,12 +3870,11 @@ function manager(args) {
|
|
|
3876
3870
|
}
|
|
3877
3871
|
var usage7 = `pkg manager <install|dev|remove|update|exec>
|
|
3878
3872
|
|
|
3879
|
-
Prints the command the package manager of this folder runs for the action: install is the add or install of a package, dev adds one as a dev dependency, remove drops one, update upgrades them and exec runs a package's bin without installing it. The manager is the one whose lockfile (bun.lock, bun.lockb, yarn.lock, pnpm-lock.yaml, package-lock.json, uv.lock) or composer.json is nearest, here or in a parent folder, bun when none is found
|
|
3880
|
-
|
|
3881
|
-
Exits 0 when it printed the command, 2 on a usage error.`, options6;
|
|
3873
|
+
Prints the command the package manager of this folder runs for the action: install is the add or install of a package, dev adds one as a dev dependency, remove drops one, update upgrades them and exec runs a package's bin without installing it. The manager is the one whose lockfile (bun.lock, bun.lockb, yarn.lock, pnpm-lock.yaml, package-lock.json, uv.lock) or composer.json is nearest, here or in a parent folder, bun when none is found.`, EXITS6, options6;
|
|
3882
3874
|
var init_manager2 = __esm(() => {
|
|
3883
3875
|
init_src();
|
|
3884
3876
|
init_manager();
|
|
3877
|
+
EXITS6 = [[0, "it printed the command"], [2, "a usage error"]];
|
|
3885
3878
|
options6 = {
|
|
3886
3879
|
json: jsonOption("{manager, action, command}")
|
|
3887
3880
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-pkg",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.15.
|
|
4
|
+
"version": "0.15.1",
|
|
5
5
|
"description": "pkg: check an npm package before it is added, for a guessed name, a version under two weeks old and install scripts.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
"@kaynooo/utils": "3.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@kaynooo/cli-kit": "0.38.
|
|
36
|
+
"@kaynooo/cli-kit": "0.38.3"
|
|
37
37
|
}
|
|
38
38
|
}
|