neutrinos-cli 2.0.0-beta.11 → 2.0.0-beta.12
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/bin/cli.js +5 -0
- package/dist/commands/migrate.js +15 -8
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -278,6 +278,11 @@ export const createProgram = () => {
|
|
|
278
278
|
exit(1);
|
|
279
279
|
}
|
|
280
280
|
});
|
|
281
|
+
program.addHelpText('after', `
|
|
282
|
+
Tip: Enable shell completions with:
|
|
283
|
+
neutrinos completion bash >> ~/.bashrc
|
|
284
|
+
neutrinos completion zsh >> ~/.zshrc
|
|
285
|
+
`);
|
|
281
286
|
return program;
|
|
282
287
|
};
|
|
283
288
|
// Only parse when run directly (not when imported for testing/introspection)
|
package/dist/commands/migrate.js
CHANGED
|
@@ -70,16 +70,14 @@ export async function migrate(wsPath, opts) {
|
|
|
70
70
|
}
|
|
71
71
|
process.exit(exitCode);
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Builds the grouped choices array for the version prompt.
|
|
75
|
+
* Exported for testing.
|
|
76
|
+
*/
|
|
77
|
+
export function buildVersionChoices(versions, wsVersion) {
|
|
76
78
|
let available = wsVersion
|
|
77
79
|
? versions.filter((v) => compareVersions(v, wsVersion) > 0)
|
|
78
80
|
: versions;
|
|
79
|
-
if (available.length === 0) {
|
|
80
|
-
_log(greenBright('\nAlready up to date.\n'));
|
|
81
|
-
process.exit(0);
|
|
82
|
-
}
|
|
83
81
|
// Sort descending (newest first)
|
|
84
82
|
available = available.sort((a, b) => compareVersions(b, a));
|
|
85
83
|
// Group: stable vs prerelease
|
|
@@ -96,9 +94,18 @@ async function promptForVersion(wsPath, versions) {
|
|
|
96
94
|
for (const v of prerelease)
|
|
97
95
|
choices.push({ name: v, value: v });
|
|
98
96
|
}
|
|
97
|
+
return { available, choices };
|
|
98
|
+
}
|
|
99
|
+
async function promptForVersion(wsPath, versions) {
|
|
100
|
+
const wsVersion = readLocalCliVersion(wsPath);
|
|
101
|
+
const { available, choices } = buildVersionChoices(versions, wsVersion);
|
|
102
|
+
if (available.length === 0) {
|
|
103
|
+
_log(greenBright('\nAlready up to date.\n'));
|
|
104
|
+
process.exit(0);
|
|
105
|
+
}
|
|
99
106
|
const { version } = await inquirer.prompt([
|
|
100
107
|
{
|
|
101
|
-
type: '
|
|
108
|
+
type: 'select',
|
|
102
109
|
name: 'version',
|
|
103
110
|
message: 'Select target version:',
|
|
104
111
|
choices,
|