ninekit-cli 1.1.0-dev.5 → 1.1.0-dev.6
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/cli-manifest.json +2 -2
- package/dist/index.js +17 -14
- package/package.json +1 -1
package/cli-manifest.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -64714,7 +64714,7 @@ var package_default;
|
|
|
64714
64714
|
var init_package = __esm(() => {
|
|
64715
64715
|
package_default = {
|
|
64716
64716
|
name: "ninekit-cli",
|
|
64717
|
-
version: "1.1.0-dev.
|
|
64717
|
+
version: "1.1.0-dev.6",
|
|
64718
64718
|
description: "CLI tool for bootstrapping and updating NineKit projects",
|
|
64719
64719
|
type: "module",
|
|
64720
64720
|
repository: {
|
|
@@ -93315,7 +93315,7 @@ async function selectKit(defaultKit, accessibleKits) {
|
|
|
93315
93315
|
}
|
|
93316
93316
|
return kit;
|
|
93317
93317
|
}
|
|
93318
|
-
async function selectKits(accessibleKits) {
|
|
93318
|
+
async function selectKits(accessibleKits, initialSelected) {
|
|
93319
93319
|
if (accessibleKits.length < MIN_KITS_FOR_MULTISELECT) {
|
|
93320
93320
|
throw new Error(`selectKits requires at least ${MIN_KITS_FOR_MULTISELECT} accessible kits`);
|
|
93321
93321
|
}
|
|
@@ -93326,6 +93326,7 @@ async function selectKits(accessibleKits) {
|
|
|
93326
93326
|
label: AVAILABLE_KITS[key].name,
|
|
93327
93327
|
hint: AVAILABLE_KITS[key].description
|
|
93328
93328
|
})),
|
|
93329
|
+
initialValues: initialSelected && accessibleKits.includes(initialSelected) ? [initialSelected] : undefined,
|
|
93329
93330
|
required: true
|
|
93330
93331
|
});
|
|
93331
93332
|
if (lD(selected)) {
|
|
@@ -93933,8 +93934,8 @@ class PromptsManager {
|
|
|
93933
93934
|
async selectKit(defaultKit, accessibleKits) {
|
|
93934
93935
|
return selectKit(defaultKit, accessibleKits);
|
|
93935
93936
|
}
|
|
93936
|
-
async selectKits(accessibleKits) {
|
|
93937
|
-
return selectKits(accessibleKits);
|
|
93937
|
+
async selectKits(accessibleKits, initialSelected) {
|
|
93938
|
+
return selectKits(accessibleKits, initialSelected);
|
|
93938
93939
|
}
|
|
93939
93940
|
async selectVersion(versions, defaultVersion) {
|
|
93940
93941
|
return selectVersion(versions, defaultVersion);
|
|
@@ -105778,10 +105779,11 @@ async function handleSelection(ctx) {
|
|
|
105778
105779
|
}
|
|
105779
105780
|
let kitType;
|
|
105780
105781
|
let pendingKits;
|
|
105781
|
-
const
|
|
105782
|
-
|
|
105782
|
+
const explicitKit = ctx.options.kit;
|
|
105783
|
+
const defaultKit = config.defaults?.kit;
|
|
105784
|
+
if (explicitKit) {
|
|
105783
105785
|
const allKitTypes = Object.keys(AVAILABLE_KITS);
|
|
105784
|
-
if (
|
|
105786
|
+
if (explicitKit === "all") {
|
|
105785
105787
|
const kitsToInstall = accessibleKits ?? allKitTypes;
|
|
105786
105788
|
if (kitsToInstall.length === 0) {
|
|
105787
105789
|
logger.error("No kits accessible for installation");
|
|
@@ -105792,8 +105794,8 @@ async function handleSelection(ctx) {
|
|
|
105792
105794
|
pendingKits = kitsToInstall.slice(1);
|
|
105793
105795
|
}
|
|
105794
105796
|
logger.info(`Installing all accessible kits: ${kitsToInstall.map((k3) => AVAILABLE_KITS[k3].name).join(", ")}`);
|
|
105795
|
-
} else if (
|
|
105796
|
-
const rawKits =
|
|
105797
|
+
} else if (explicitKit.includes(",")) {
|
|
105798
|
+
const rawKits = explicitKit.split(",").map((k3) => k3.trim());
|
|
105797
105799
|
const seen = new Set;
|
|
105798
105800
|
const requestedKits = [];
|
|
105799
105801
|
const invalidKits = [];
|
|
@@ -105830,12 +105832,12 @@ async function handleSelection(ctx) {
|
|
|
105830
105832
|
}
|
|
105831
105833
|
logger.info(`Installing kits: ${requestedKits.map((k3) => AVAILABLE_KITS[k3].name).join(", ")}`);
|
|
105832
105834
|
} else {
|
|
105833
|
-
if (!isValidKitType(
|
|
105834
|
-
logger.error(`Invalid kit: ${
|
|
105835
|
+
if (!isValidKitType(explicitKit)) {
|
|
105836
|
+
logger.error(`Invalid kit: ${explicitKit}`);
|
|
105835
105837
|
logger.info(`Valid kits: ${allKitTypes.join(", ")}`);
|
|
105836
105838
|
return { ...ctx, cancelled: true };
|
|
105837
105839
|
}
|
|
105838
|
-
kitType =
|
|
105840
|
+
kitType = explicitKit;
|
|
105839
105841
|
if (accessibleKits && !accessibleKits.includes(kitType)) {
|
|
105840
105842
|
logger.error(`No access to ${AVAILABLE_KITS[kitType].name}`);
|
|
105841
105843
|
logger.info("Purchase at https://ninekit.chiendt.io.vn");
|
|
@@ -105848,13 +105850,14 @@ async function handleSelection(ctx) {
|
|
|
105848
105850
|
if (!accessibleKits || accessibleKits.length === 0) {
|
|
105849
105851
|
throw new Error("Kit must be specified via --kit flag in non-interactive mode (no accessible kits detected)");
|
|
105850
105852
|
}
|
|
105851
|
-
kitType = accessibleKits[0];
|
|
105853
|
+
kitType = defaultKit && isValidKitType(defaultKit) && accessibleKits.includes(defaultKit) ? defaultKit : accessibleKits[0];
|
|
105852
105854
|
logger.info(`Auto-selected: ${AVAILABLE_KITS[kitType].name}`);
|
|
105853
105855
|
} else if (accessibleKits?.length === 1) {
|
|
105854
105856
|
kitType = accessibleKits[0];
|
|
105855
105857
|
logger.info(`Using ${AVAILABLE_KITS[kitType].name} (only accessible kit)`);
|
|
105856
105858
|
} else if (accessibleKits && accessibleKits.length > 1) {
|
|
105857
|
-
const
|
|
105859
|
+
const preselectKit = defaultKit && isValidKitType(defaultKit) && accessibleKits.includes(defaultKit) ? defaultKit : undefined;
|
|
105860
|
+
const selectedKits = await ctx.prompts.selectKits(accessibleKits, preselectKit);
|
|
105858
105861
|
if (selectedKits.length === 0) {
|
|
105859
105862
|
throw new Error("At least one kit must be selected");
|
|
105860
105863
|
}
|