@stackable-labs/cli-app-extension 1.105.0 → 2.0.0
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/index.js +13 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { program } from 'commander';
|
|
3
|
+
import { program, InvalidArgumentError } from 'commander';
|
|
4
4
|
import { render, useApp, Box, Text, useInput, useFocus, useFocusManager } from 'ink';
|
|
5
|
+
import { SURFACE_TARGET, TEMPLATE_FLAVORS } from '@stackable-labs/sdk-extension-contracts';
|
|
5
6
|
import { unlink, readFile, writeFile, mkdir, readdir, rm } from 'fs/promises';
|
|
6
7
|
import { join, dirname } from 'path';
|
|
7
8
|
import Spinner5 from 'ink-spinner';
|
|
8
9
|
import { useState, useCallback, useEffect, useRef, useMemo } from 'react';
|
|
9
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
11
|
import TextInput from 'ink-text-input';
|
|
11
|
-
import { SURFACE_TARGET } from '@stackable-labs/sdk-extension-contracts';
|
|
12
12
|
import { homedir } from 'os';
|
|
13
13
|
import { execFile, spawn, execSync } from 'child_process';
|
|
14
14
|
import { promisify } from 'util';
|
|
@@ -1163,7 +1163,6 @@ var TargetSelect = ({ availableTargets, preSelected, onSubmit, onBack }) => {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
);
|
|
1165
1165
|
};
|
|
1166
|
-
var FLAVORS = ["minimal", "starter", "kitchen-sink"];
|
|
1167
1166
|
var TemplateSelect = ({ onSubmit, onBack }) => {
|
|
1168
1167
|
const [cursor, setCursor] = useState(1);
|
|
1169
1168
|
useInput((_input, key) => {
|
|
@@ -1172,11 +1171,11 @@ var TemplateSelect = ({ onSubmit, onBack }) => {
|
|
|
1172
1171
|
return;
|
|
1173
1172
|
}
|
|
1174
1173
|
if (key.downArrow) {
|
|
1175
|
-
setCursor((c) => Math.min(
|
|
1174
|
+
setCursor((c) => Math.min(TEMPLATE_FLAVORS.length - 1, c + 1));
|
|
1176
1175
|
return;
|
|
1177
1176
|
}
|
|
1178
1177
|
if (key.return) {
|
|
1179
|
-
onSubmit(
|
|
1178
|
+
onSubmit(TEMPLATE_FLAVORS[cursor]);
|
|
1180
1179
|
}
|
|
1181
1180
|
});
|
|
1182
1181
|
return /* @__PURE__ */ jsx(
|
|
@@ -1185,7 +1184,7 @@ var TemplateSelect = ({ onSubmit, onBack }) => {
|
|
|
1185
1184
|
title: "Choose a template",
|
|
1186
1185
|
hint: "\u2191\u2193 to navigate, Enter to select",
|
|
1187
1186
|
onBack,
|
|
1188
|
-
children: /* @__PURE__ */ jsx(Box, { flexDirection: "column", gap: 1, children:
|
|
1187
|
+
children: /* @__PURE__ */ jsx(Box, { flexDirection: "column", gap: 1, children: TEMPLATE_FLAVORS.map((flavor, i) => {
|
|
1189
1188
|
const meta = TEMPLATE_FLAVOR_META[flavor];
|
|
1190
1189
|
const isCursor = i === cursor;
|
|
1191
1190
|
return /* @__PURE__ */ jsxs(Box, { gap: 1, children: [
|
|
@@ -3911,6 +3910,12 @@ var require2 = createRequire(import.meta.url);
|
|
|
3911
3910
|
var { version } = require2("../package.json");
|
|
3912
3911
|
checkForUpdate(version);
|
|
3913
3912
|
var DASHBOARD_URL = process.env.ADMIN_DASHBOARD_URL ?? "https://admin.stackablelabs.com";
|
|
3913
|
+
var parseTemplateFlavor = (value) => {
|
|
3914
|
+
if (!TEMPLATE_FLAVORS.includes(value)) {
|
|
3915
|
+
throw new InvalidArgumentError(`Invalid template flavor "${value}". Valid: ${TEMPLATE_FLAVORS.join(", ")}`);
|
|
3916
|
+
}
|
|
3917
|
+
return value;
|
|
3918
|
+
};
|
|
3914
3919
|
var ensureToken = async () => {
|
|
3915
3920
|
try {
|
|
3916
3921
|
const token = await getToken();
|
|
@@ -3949,7 +3954,7 @@ var ensureToken = async () => {
|
|
|
3949
3954
|
}
|
|
3950
3955
|
};
|
|
3951
3956
|
program.name("stackable-app-extension").description("Stackable Labs - App Extension developer CLI").version(version);
|
|
3952
|
-
program.command("create" /* CREATE */).description("Create a new Extension project").argument("[name]", "Extension project name").option("--app-id <id>", "Skip App selection").option("--project-id <id>", "Studio project ID (fetches files/manifest from Studio)").option("--template <flavor>",
|
|
3957
|
+
program.command("create" /* CREATE */).description("Create a new Extension project").argument("[name]", "Extension project name").option("--app-id <id>", "Skip App selection").option("--project-id <id>", "Studio project ID (fetches files/manifest from Studio)").option("--template <flavor>", `Template flavor: ${TEMPLATE_FLAVORS.join(", ")}`, parseTemplateFlavor).option("--extension-port <port>", "Extension dev server port (default: 6543)").option("--preview-port <port>", "Preview dev server port").option("--skip-install", "Skip package manager install").option("--skip-git", "Skip git initialization").action(async (name, options) => {
|
|
3953
3958
|
const auth2 = await ensureToken();
|
|
3954
3959
|
if (!auth2) {
|
|
3955
3960
|
return;
|
|
@@ -3969,7 +3974,7 @@ program.command("create" /* CREATE */).description("Create a new Extension proje
|
|
|
3969
3974
|
)
|
|
3970
3975
|
);
|
|
3971
3976
|
});
|
|
3972
|
-
program.command("scaffold" /* SCAFFOLD */).description("Scaffold a local project from an existing Extension").argument("[extensionId]", "Extension ID to scaffold from").option("--app-id <id>", "App ID (auto-resolved from extensionId if omitted)").option("--project-id <id>", "Studio project ID (fetches files/manifest from Studio)").option("--template <flavor>",
|
|
3977
|
+
program.command("scaffold" /* SCAFFOLD */).description("Scaffold a local project from an existing Extension").argument("[extensionId]", "Extension ID to scaffold from").option("--app-id <id>", "App ID (auto-resolved from extensionId if omitted)").option("--project-id <id>", "Studio project ID (fetches files/manifest from Studio)").option("--template <flavor>", `Template flavor: ${TEMPLATE_FLAVORS.join(", ")}`, parseTemplateFlavor).option("--extension-port <port>", "Extension dev server port (default: 6543)").option("--preview-port <port>", "Preview dev server port").option("--skip-install", "Skip package manager install").option("--skip-git", "Skip git initialization").action(async (extensionId, options) => {
|
|
3973
3978
|
const auth2 = await ensureToken();
|
|
3974
3979
|
if (!auth2) {
|
|
3975
3980
|
return;
|