@ikas/component-cli 1.4.0-beta.40 → 1.4.0-beta.43
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/commands/add-sections-to-page.d.ts +3 -0
- package/dist/commands/add-sections-to-page.d.ts.map +1 -0
- package/dist/commands/add-sections-to-page.js +39 -0
- package/dist/commands/add-sections-to-page.js.map +1 -0
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +168 -5
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/create-page.d.ts +3 -0
- package/dist/commands/create-page.d.ts.map +1 -0
- package/dist/commands/create-page.js +31 -0
- package/dist/commands/create-page.js.map +1 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +118 -66
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/get-available-values.d.ts +3 -0
- package/dist/commands/get-available-values.d.ts.map +1 -0
- package/dist/commands/get-available-values.js +49 -0
- package/dist/commands/get-available-values.js.map +1 -0
- package/dist/commands/get-component-props.d.ts +3 -0
- package/dist/commands/get-component-props.d.ts.map +1 -0
- package/dist/commands/get-component-props.js +32 -0
- package/dist/commands/get-component-props.js.map +1 -0
- package/dist/commands/get-page-by-type.d.ts +3 -0
- package/dist/commands/get-page-by-type.d.ts.map +1 -0
- package/dist/commands/get-page-by-type.js +25 -0
- package/dist/commands/get-page-by-type.js.map +1 -0
- package/dist/commands/get-section-values.d.ts +3 -0
- package/dist/commands/get-section-values.d.ts.map +1 -0
- package/dist/commands/get-section-values.js +39 -0
- package/dist/commands/get-section-values.js.map +1 -0
- package/dist/commands/list-entities.d.ts +3 -0
- package/dist/commands/list-entities.d.ts.map +1 -0
- package/dist/commands/list-entities.js +32 -0
- package/dist/commands/list-entities.js.map +1 -0
- package/dist/commands/list-page-sections.d.ts +3 -0
- package/dist/commands/list-page-sections.d.ts.map +1 -0
- package/dist/commands/list-page-sections.js +25 -0
- package/dist/commands/list-page-sections.js.map +1 -0
- package/dist/commands/proxy.d.ts +39 -0
- package/dist/commands/proxy.d.ts.map +1 -0
- package/dist/commands/proxy.js +210 -0
- package/dist/commands/proxy.js.map +1 -0
- package/dist/commands/publish-theme.d.ts +3 -0
- package/dist/commands/publish-theme.d.ts.map +1 -0
- package/dist/commands/publish-theme.js +29 -0
- package/dist/commands/publish-theme.js.map +1 -0
- package/dist/commands/search-products.d.ts +3 -0
- package/dist/commands/search-products.d.ts.map +1 -0
- package/dist/commands/search-products.js +40 -0
- package/dist/commands/search-products.js.map +1 -0
- package/dist/commands/set-dynamic-value.d.ts +3 -0
- package/dist/commands/set-dynamic-value.d.ts.map +1 -0
- package/dist/commands/set-dynamic-value.js +54 -0
- package/dist/commands/set-dynamic-value.js.map +1 -0
- package/dist/commands/update-page-sections.d.ts +3 -0
- package/dist/commands/update-page-sections.d.ts.map +1 -0
- package/dist/commands/update-page-sections.js +39 -0
- package/dist/commands/update-page-sections.js.map +1 -0
- package/dist/commands/update-section-prop.d.ts +3 -0
- package/dist/commands/update-section-prop.d.ts.map +1 -0
- package/dist/commands/update-section-prop.js +59 -0
- package/dist/commands/update-section-prop.js.map +1 -0
- package/dist/commands/update-section-props.d.ts +3 -0
- package/dist/commands/update-section-props.d.ts.map +1 -0
- package/dist/commands/update-section-props.js +43 -0
- package/dist/commands/update-section-props.js.map +1 -0
- package/dist/commands/upload-image.d.ts +3 -0
- package/dist/commands/upload-image.d.ts.map +1 -0
- package/dist/commands/upload-image.js +38 -0
- package/dist/commands/upload-image.js.map +1 -0
- package/dist/commands/upload-images.d.ts +3 -0
- package/dist/commands/upload-images.d.ts.map +1 -0
- package/dist/commands/upload-images.js +48 -0
- package/dist/commands/upload-images.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/compile.d.ts +1 -4
- package/dist/utils/compile.d.ts.map +1 -1
- package/dist/utils/compile.js +40 -500
- package/dist/utils/compile.js.map +1 -1
- package/dist/utils/editor-action-client.d.ts +1 -1
- package/dist/utils/editor-action-client.d.ts.map +1 -1
- package/dist/utils/editor-action-client.js +23 -8
- package/dist/utils/editor-action-client.js.map +1 -1
- package/dist/utils/load-image.d.ts +16 -0
- package/dist/utils/load-image.d.ts.map +1 -0
- package/dist/utils/load-image.js +50 -0
- package/dist/utils/load-image.js.map +1 -0
- package/dist/utils/websocket-server.d.ts +2 -2
- package/dist/utils/websocket-server.d.ts.map +1 -1
- package/dist/utils/websocket-server.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAS3E,KAAK,UAAU,aAAa,CAAC,WAAmB,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BACjG;iBACF;aACF,CAAC,CAAC;YACH,QAAQ,GAAG,OAAO,CAAC,QAAwB,CAAC;QAC9C,CAAC;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;gBACpC;oBACE,IAAI,EAAE,OAAO;oBACb,IAAI,EAAE,aAAa;oBACnB,OAAO,EAAE,4BAA4B;oBACrC,OAAO,EAAE,oBAAoB;oBAC7B,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE;wBAC1B,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;4BAAE,OAAO,0BAA0B,CAAC;wBACrD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;4BAClC,OAAO,0EAA0E,CAAC;wBACpF,CAAC;wBACD,OAAO,IAAI,CAAC;oBACd,CAAC;iBACF;aACF,CAAC,CAAC;YACH,WAAW,GAAG,OAAO,CAAC,WAAqB,CAAC;QAC9C,CAAC;QAED,MAAM,aAAa,CAAC,WAAY,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-available-values.d.ts","sourceRoot":"","sources":["../../src/commands/get-available-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoDpC,wBAAgB,+BAA+B,IAAI,OAAO,CAazD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
+
function parseListPath(raw) {
|
|
4
|
+
if (!raw)
|
|
5
|
+
return undefined;
|
|
6
|
+
let parsed;
|
|
7
|
+
try {
|
|
8
|
+
parsed = JSON.parse(raw);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
printErrorAndExit(new Error('--list-path must be JSON, e.g. \'[{"propId":"<listPropId>","index":0}]\''));
|
|
12
|
+
}
|
|
13
|
+
if (!Array.isArray(parsed)) {
|
|
14
|
+
printErrorAndExit(new Error("--list-path must be a JSON array of { propId, index }."));
|
|
15
|
+
}
|
|
16
|
+
return parsed;
|
|
17
|
+
}
|
|
18
|
+
async function runGetAvailableValues(options) {
|
|
19
|
+
if (!options.elementId) {
|
|
20
|
+
printErrorAndExit(new Error("--element-id is required (from `ikas-component list-page-sections`)"));
|
|
21
|
+
}
|
|
22
|
+
const listPath = parseListPath(options.listPath);
|
|
23
|
+
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
24
|
+
try {
|
|
25
|
+
const result = await runEditorAction("get-available-values", {
|
|
26
|
+
...(options.pageId ? { pageId: options.pageId } : {}),
|
|
27
|
+
elementId: options.elementId,
|
|
28
|
+
...(options.propId ? { propId: options.propId } : {}),
|
|
29
|
+
...(listPath ? { listPath } : {}),
|
|
30
|
+
}, port ? { port } : {});
|
|
31
|
+
printResultAndExit(result);
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
printErrorAndExit(e);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function createGetAvailableValuesCommand() {
|
|
38
|
+
const cmd = new Command("get-available-values");
|
|
39
|
+
cmd
|
|
40
|
+
.description("List the dynamic values that can be BOUND to a prop (store/global/parent/section variables, or the per-item loop variables of a COMPONENT_LIST). Pass --prop-id to filter to that prop's type. For a prop of a component placed inside a COMPONENT_LIST, pass --list-path (JSON, e.g. '[{\"propId\":\"<listPropId>\",\"index\":0}]'). Returns each value's `ref` (pass it as a `ref` in an `update-page-sections` update to bind the prop), displayName, typeId, groupType.")
|
|
41
|
+
.requiredOption("--element-id <id>", "Placed section elementId (from `list-page-sections`)")
|
|
42
|
+
.option("--page-id <id>", "Page id (from `list-pages`)")
|
|
43
|
+
.option("--prop-id <id>", "Target prop id to filter values by its type")
|
|
44
|
+
.option("--list-path <json>", 'JSON path into a COMPONENT_LIST, e.g. \'[{"propId":"<listPropId>","index":0}]\'')
|
|
45
|
+
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
46
|
+
.action(runGetAvailableValues);
|
|
47
|
+
return cmd;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=get-available-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-available-values.js","sourceRoot":"","sources":["../../src/commands/get-available-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAU1C,SAAS,aAAa,CAAC,GAAY;IACjC,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB,CAAC,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC,CAAC;IAC3G,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,iBAAiB,CAAC,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,MAAkD,CAAC;AAC5D,CAAC;AAED,KAAK,UAAU,qBAAqB,CAAC,OAAkC;IACrE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACvB,iBAAiB,CAAC,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC,CAAC;IACtG,CAAC;IACD,MAAM,QAAQ,GAAG,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI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AC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-component-props.d.ts","sourceRoot":"","sources":["../../src/commands/get-component-props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoCpC,wBAAgB,8BAA8B,IAAI,OAAO,CAWxD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
+
async function runGetComponentProps(options) {
|
|
4
|
+
const componentIds = options.componentIds
|
|
5
|
+
? options.componentIds
|
|
6
|
+
.split(",")
|
|
7
|
+
.map(s => s.trim())
|
|
8
|
+
.filter(Boolean)
|
|
9
|
+
: undefined;
|
|
10
|
+
if (!componentIds?.length && !options.componentId) {
|
|
11
|
+
printErrorAndExit(new Error("--component-id or --component-ids is required"));
|
|
12
|
+
}
|
|
13
|
+
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
14
|
+
try {
|
|
15
|
+
const result = await runEditorAction("get-component-props", componentIds?.length ? { componentIds } : { componentId: options.componentId }, port ? { port } : {});
|
|
16
|
+
printResultAndExit(result);
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
printErrorAndExit(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function createGetComponentPropsCommand() {
|
|
23
|
+
const cmd = new Command("get-component-props");
|
|
24
|
+
cmd
|
|
25
|
+
.description("Get prop blueprints from the editor (the source of truth) for one or many components: each prop's id, name, type, required, default, ENUM `options` (valid values), and for COMPONENT/COMPONENT_LIST the `allowedComponentIds` (which children it permits). Works for any section OR child code component id — use it to learn a COMPONENT_LIST child's props and valid enum values instead of grepping ikas.config.json. Returns { components: [...] }.")
|
|
26
|
+
.option("--component-id <id>", "A single code component id (section or child) — or a section id")
|
|
27
|
+
.option("--component-ids <ids>", "Comma-separated component ids (batch — resolve many schemas in one call)")
|
|
28
|
+
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
29
|
+
.action(runGetComponentProps);
|
|
30
|
+
return cmd;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=get-component-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-component-props.js","sourceRoot":"","sources":["../../src/commands/get-component-props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAQ1C,KAAK,UAAU,oBAAoB,CAAC,OAAiC;IACnE,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY;QACvC,CAAC,CAAC,OAAO,CAAC,YAAY;aACjB,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;aAClB,MAAM,CAAC,OAAO,CAAC;QACpB,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAClD,iBAAiB,CAAC,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC,CAAC;IAChF,CAAC;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,eAAe,CAClC,qBAAqB,EACrB,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,EAC9E,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CACrB,CAAC;QACF,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,8BAA8B;IAC5C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC/C,GAAG;SACA,WAAW,CACV,0bAA0b,CAC3b;SACA,MAAM,CAAC,qBAAqB,EAAE,iEAAiE,CAAC;SAChG,MAAM,CAAC,uBAAuB,EAAE,0EAA0E,CAAC;SAC3G,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-page-by-type.d.ts","sourceRoot":"","sources":["../../src/commands/get-page-by-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BpC,wBAAgB,0BAA0B,IAAI,OAAO,CAUpD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
+
async function runGetPageByType(options) {
|
|
4
|
+
if (!options.pageType || typeof options.pageType !== "string") {
|
|
5
|
+
printErrorAndExit(new Error("--page-type is required (e.g. CATEGORY, PRODUCT, BRAND, BLOG, BLOG_CATEGORY, INDEX)"));
|
|
6
|
+
}
|
|
7
|
+
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
8
|
+
try {
|
|
9
|
+
const result = await runEditorAction("get-page-by-type", { pageType: options.pageType }, port ? { port } : {});
|
|
10
|
+
printResultAndExit(result);
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
printErrorAndExit(e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function createGetPageByTypeCommand() {
|
|
17
|
+
const cmd = new Command("get-page-by-type");
|
|
18
|
+
cmd
|
|
19
|
+
.description("Resolve a theme page id from its pageType (CATEGORY, PRODUCT, BRAND, BLOG, BLOG_CATEGORY, INDEX, …). Use the returned pageId together with an entity id (from list-entities) to build a PAGE link to that entity. Returns pageId: null with a note if no page of that type exists yet.")
|
|
20
|
+
.requiredOption("--page-type <type>", "Page type to resolve (e.g. CATEGORY)")
|
|
21
|
+
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
22
|
+
.action(runGetPageByType);
|
|
23
|
+
return cmd;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=get-page-by-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-page-by-type.js","sourceRoot":"","sources":["../../src/commands/get-page-by-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAO1C,KAAK,UAAU,gBAAgB,CAAC,OAA6B;IAC3D,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9D,iBAAiB,CAAC,IAAI,KAAK,CAAC,qFAAqF,CAAC,CAAC,CAAC;IACtH,CAAC;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,eAAe,CAClC,kBAAkB,EAClB,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,EAC9B,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CACrB,CAAC;QACF,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0BAA0B;IACxC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC5C,GAAG;SACA,WAAW,CACV,wRAAwR,CACzR;SACA,cAAc,CAAC,oBAAoB,EAAE,sCAAsC,CAAC;SAC5E,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAC5B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-section-values.d.ts","sourceRoot":"","sources":["../../src/commands/get-section-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2CpC,wBAAgB,6BAA6B,IAAI,OAAO,CAYvD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
+
async function runGetSectionValues(options) {
|
|
4
|
+
if (!options.pageId || typeof options.pageId !== "string") {
|
|
5
|
+
printErrorAndExit(new Error("--page-id is required (use `ikas-component list-pages`)"));
|
|
6
|
+
}
|
|
7
|
+
const elementIds = options.elementIds
|
|
8
|
+
? options.elementIds
|
|
9
|
+
.split(",")
|
|
10
|
+
.map(s => s.trim())
|
|
11
|
+
.filter(Boolean)
|
|
12
|
+
: undefined;
|
|
13
|
+
if (!elementIds?.length && !options.elementId) {
|
|
14
|
+
printErrorAndExit(new Error("--element-id or --element-ids is required (use `ikas-component list-page-sections`)"));
|
|
15
|
+
}
|
|
16
|
+
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
17
|
+
try {
|
|
18
|
+
const result = await runEditorAction("get-section-values", {
|
|
19
|
+
pageId: options.pageId,
|
|
20
|
+
...(elementIds?.length ? { elementIds } : { elementId: options.elementId }),
|
|
21
|
+
}, port ? { port } : {});
|
|
22
|
+
printResultAndExit(result);
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
printErrorAndExit(e);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function createGetSectionValuesCommand() {
|
|
29
|
+
const cmd = new Command("get-section-values");
|
|
30
|
+
cmd
|
|
31
|
+
.description("Get the current prop values of placed section(s) (full propValues + blueprint props). Use for read-modify-write of a COMPONENT_LIST or to inspect an existing value's shape. `list-page-sections` is lean and omits values; this fetches them. Returns { sections: [...] }.")
|
|
32
|
+
.requiredOption("--page-id <id>", "Page id (from `ikas-component list-pages`)")
|
|
33
|
+
.option("--element-id <id>", "A single placed-section elementId (from `ikas-component list-page-sections`)")
|
|
34
|
+
.option("--element-ids <ids>", "Comma-separated elementIds (batch)")
|
|
35
|
+
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
36
|
+
.action(runGetSectionValues);
|
|
37
|
+
return cmd;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=get-section-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-section-values.js","sourceRoot":"","sources":["../../src/commands/get-section-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAS1C,KAAK,UAAU,mBAAmB,CAAC,OAAgC;IACjE,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1D,iBAAiB,CAAC,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC,CAAC;IAC1F,CAAC;IACD,MAAM,UAAU,GAAG,OAAO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AAqB,EAAE,oCAAoC,CAAC;SACnE,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC/B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-entities.d.ts","sourceRoot":"","sources":["../../src/commands/list-entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoCpC,wBAAgB,yBAAyB,IAAI,OAAO,CAWnD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
+
const VALID_KINDS = ["category", "brand", "blog", "blog-category"];
|
|
4
|
+
async function runListEntities(options) {
|
|
5
|
+
if (!options.kind || !VALID_KINDS.includes(options.kind)) {
|
|
6
|
+
printErrorAndExit(new Error(`--kind must be one of: ${VALID_KINDS.join(", ")}`));
|
|
7
|
+
}
|
|
8
|
+
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
9
|
+
try {
|
|
10
|
+
const result = await runEditorAction("list-entities", {
|
|
11
|
+
kind: options.kind,
|
|
12
|
+
...(options.query ? { query: options.query } : {}),
|
|
13
|
+
},
|
|
14
|
+
// The host fetches from the store API, so allow more than the default 10s.
|
|
15
|
+
{ ...(port ? { port } : {}), timeoutMs: 20_000 });
|
|
16
|
+
printResultAndExit(result);
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
printErrorAndExit(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function createListEntitiesCommand() {
|
|
23
|
+
const cmd = new Command("list-entities");
|
|
24
|
+
cmd
|
|
25
|
+
.description("List store entities (category, brand, blog, blog-category) and their ids, for filling the corresponding entity prop value via `ikas-component update-section-prop`. Requires the editor embedded in the ikas admin panel (the host runs the lookup). Note: category and brand return all entries (no query); blog and blog-category accept --query.")
|
|
26
|
+
.requiredOption("--kind <kind>", `Entity kind: ${VALID_KINDS.join(" | ")}`)
|
|
27
|
+
.option("--query <text>", "Free-text search (blog / blog-category only)")
|
|
28
|
+
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
29
|
+
.action(runListEntities);
|
|
30
|
+
return cmd;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=list-entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-entities.js","sourceRoot":"","sources":["../../src/commands/list-entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAE1C,MAAM,WAAW,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;AAQnE,KAAK,UAAU,eAAe,CAAC,OAA4B;IACzD,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACzD,iBAAiB,CAAC,IAAI,KAAK,CAAC,0BAA0B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACnF,CAAC;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,eAAe,CAClC,eAAe,EACf;YACE,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnD;QACD,2EAA2E;QAC3E,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CACjD,CAAC;QACF,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;IACzC,GAAG;SACA,WAAW,CACV,qVAAqV,CACtV;SACA,cAAc,CAAC,eAAe,EAAE,gBAAgB,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;SAC1E,MAAM,CAAC,gBAAgB,EAAE,8CAA8C,CAAC;SACxE,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,eAAe,CAAC,CAAC;IAC3B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-page-sections.d.ts","sourceRoot":"","sources":["../../src/commands/list-page-sections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BpC,wBAAgB,6BAA6B,IAAI,OAAO,CAUvD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
+
async function runListPageSections(options) {
|
|
4
|
+
if (!options.pageId || typeof options.pageId !== "string") {
|
|
5
|
+
printErrorAndExit(new Error("--page-id is required (use `ikas-component list-pages` to discover ids)"));
|
|
6
|
+
}
|
|
7
|
+
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
8
|
+
try {
|
|
9
|
+
const result = await runEditorAction("list-page-sections", { pageId: options.pageId }, port ? { port } : {});
|
|
10
|
+
printResultAndExit(result);
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
printErrorAndExit(e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function createListPageSectionsCommand() {
|
|
17
|
+
const cmd = new Command("list-page-sections");
|
|
18
|
+
cmd
|
|
19
|
+
.description("List the sections placed on a page, each with its per-placement elementId, sectionId, current prop values, and blueprint props. Use the elementId with `ikas-component update-section-prop`.")
|
|
20
|
+
.requiredOption("--page-id <id>", "Page id (from `ikas-component list-pages`)")
|
|
21
|
+
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
22
|
+
.action(runListPageSections);
|
|
23
|
+
return cmd;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=list-page-sections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-page-sections.js","sourceRoot":"","sources":["../../src/commands/list-page-sections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAO1C,KAAK,UAAU,mBAAmB,CAAC,OAAgC;IACjE,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1D,iBAAiB,CAAC,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC,CAAC;IAC1G,CAAC;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,eAAe,CAClC,oBAAoB,EACpB,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EAC1B,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CACrB,CAAC;QACF,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,6BAA6B;IAC3C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9C,GAAG;SACA,WAAW,CACV,8LAA8L,CAC/L;SACA,cAAc,CAAC,gBAAgB,EAAE,4CAA4C,CAAC;SAC9E,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC/B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { type ViteDevServer } from "vite";
|
|
3
|
+
export declare const DEFAULT_ADMIN_PORT = 3002;
|
|
4
|
+
export declare const DEFAULT_EDITOR_PORT = 3003;
|
|
5
|
+
export declare const PROD_EDITOR_URL = "https://studio.ikasapps.com";
|
|
6
|
+
export declare const PROD_ADMIN_DOMAIN = "myikas.com";
|
|
7
|
+
export declare const DEV_EDITOR_URL = "https://studio-dev.ikasapps.com";
|
|
8
|
+
export declare const DEV_ADMIN_DOMAIN = "myikas.dev";
|
|
9
|
+
export declare const DEFAULT_EDITOR_URL = "https://studio.ikasapps.com";
|
|
10
|
+
export declare const DEFAULT_ADMIN_DOMAIN = "myikas.com";
|
|
11
|
+
export declare const DEFAULT_PROXY_PORT = 3002;
|
|
12
|
+
export interface StartProxyOptions {
|
|
13
|
+
store: string;
|
|
14
|
+
adminPort?: number;
|
|
15
|
+
editorPort?: number;
|
|
16
|
+
editorUrl?: string;
|
|
17
|
+
adminDomain?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ProxyHandle {
|
|
20
|
+
adminVite: ViteDevServer;
|
|
21
|
+
editorVite: ViteDevServer;
|
|
22
|
+
adminTarget: string;
|
|
23
|
+
editorTarget: string;
|
|
24
|
+
adminUrl: string;
|
|
25
|
+
editorUrl: string;
|
|
26
|
+
adminPort: number;
|
|
27
|
+
editorPort: number;
|
|
28
|
+
/** Close both underlying Vite servers. */
|
|
29
|
+
close(): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export declare function startProxy(opts: StartProxyOptions): Promise<ProxyHandle>;
|
|
32
|
+
export declare function printProxyBanner(handle: ProxyHandle): void;
|
|
33
|
+
export declare function promptForStore(): Promise<string>;
|
|
34
|
+
export declare function resolveEnvironmentDefaults(dev: boolean): {
|
|
35
|
+
editorUrl: string;
|
|
36
|
+
adminDomain: string;
|
|
37
|
+
};
|
|
38
|
+
export declare function createProxyCommand(): Command;
|
|
39
|
+
//# sourceMappingURL=proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/commands/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAoC,KAAK,aAAa,EAAE,MAAM,MAAM,CAAC;AAE5E,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC,eAAO,MAAM,eAAe,gCAAgC,CAAC;AAC7D,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAE9C,eAAO,MAAM,cAAc,oCAAoC,CAAC;AAChE,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAG7C,eAAO,MAAM,kBAAkB,gCAAkB,CAAC;AAClD,eAAO,MAAM,oBAAoB,eAAoB,CAAC;AAGtD,eAAO,MAAM,kBAAkB,OAAqB,CAAC;AAErD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IAEnB,0CAA0C;IAC1C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CA8E9E;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,QAQnD;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CActD;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO;;;EAItD;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAiC5C"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import inquirer from "inquirer";
|
|
4
|
+
import { createServer as createViteServer } from "vite";
|
|
5
|
+
export const DEFAULT_ADMIN_PORT = 3002;
|
|
6
|
+
export const DEFAULT_EDITOR_PORT = 3003;
|
|
7
|
+
export const PROD_EDITOR_URL = "https://studio.ikasapps.com";
|
|
8
|
+
export const PROD_ADMIN_DOMAIN = "myikas.com";
|
|
9
|
+
export const DEV_EDITOR_URL = "https://studio-dev.ikasapps.com";
|
|
10
|
+
export const DEV_ADMIN_DOMAIN = "myikas.dev";
|
|
11
|
+
// Default environment = prod. `--dev` flips to dev.
|
|
12
|
+
export const DEFAULT_EDITOR_URL = PROD_EDITOR_URL;
|
|
13
|
+
export const DEFAULT_ADMIN_DOMAIN = PROD_ADMIN_DOMAIN;
|
|
14
|
+
// Kept for the legacy single-port fallback (no longer used by default).
|
|
15
|
+
export const DEFAULT_PROXY_PORT = DEFAULT_ADMIN_PORT;
|
|
16
|
+
export async function startProxy(opts) {
|
|
17
|
+
const adminPort = opts.adminPort ?? DEFAULT_ADMIN_PORT;
|
|
18
|
+
const editorPort = opts.editorPort ?? DEFAULT_EDITOR_PORT;
|
|
19
|
+
const editorTarget = opts.editorUrl ?? DEFAULT_EDITOR_URL;
|
|
20
|
+
const adminDomain = opts.adminDomain ?? DEFAULT_ADMIN_DOMAIN;
|
|
21
|
+
const adminTarget = `https://${opts.store}.${adminDomain}`;
|
|
22
|
+
const adminUrl = `http://localhost:${adminPort}`;
|
|
23
|
+
const editorUrl = `http://localhost:${editorPort}`;
|
|
24
|
+
// Editor proxy: dedicated port so the editor's absolute asset paths
|
|
25
|
+
// (e.g. `/assets/index-*.js`) resolve correctly against its own origin.
|
|
26
|
+
const editorVite = await createViteServer({
|
|
27
|
+
configFile: false,
|
|
28
|
+
appType: "custom",
|
|
29
|
+
logLevel: "warn",
|
|
30
|
+
server: {
|
|
31
|
+
port: editorPort,
|
|
32
|
+
strictPort: true,
|
|
33
|
+
host: "localhost",
|
|
34
|
+
cors: true,
|
|
35
|
+
proxy: {
|
|
36
|
+
"/": {
|
|
37
|
+
target: editorTarget,
|
|
38
|
+
changeOrigin: true,
|
|
39
|
+
secure: true,
|
|
40
|
+
ws: true,
|
|
41
|
+
configure: (proxy) => {
|
|
42
|
+
stripSecurityHeaders(proxy);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
await editorVite.listen();
|
|
49
|
+
// Admin proxy: rewrites the deployed editor origin to our editor proxy URL
|
|
50
|
+
// in any text response so bundled iframe srcs point at localhost.
|
|
51
|
+
const adminVite = await createViteServer({
|
|
52
|
+
configFile: false,
|
|
53
|
+
appType: "custom",
|
|
54
|
+
logLevel: "warn",
|
|
55
|
+
server: {
|
|
56
|
+
port: adminPort,
|
|
57
|
+
strictPort: true,
|
|
58
|
+
host: "localhost",
|
|
59
|
+
cors: true,
|
|
60
|
+
proxy: {
|
|
61
|
+
"/": {
|
|
62
|
+
target: adminTarget,
|
|
63
|
+
changeOrigin: true,
|
|
64
|
+
secure: true,
|
|
65
|
+
ws: true,
|
|
66
|
+
selfHandleResponse: true,
|
|
67
|
+
configure: (proxy) => {
|
|
68
|
+
stripSecurityHeaders(proxy);
|
|
69
|
+
disableCompression(proxy);
|
|
70
|
+
rewriteAdminBody(proxy, editorTarget, editorUrl);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
await adminVite.listen();
|
|
77
|
+
return {
|
|
78
|
+
adminVite,
|
|
79
|
+
editorVite,
|
|
80
|
+
adminTarget,
|
|
81
|
+
editorTarget,
|
|
82
|
+
adminUrl,
|
|
83
|
+
editorUrl,
|
|
84
|
+
adminPort,
|
|
85
|
+
editorPort,
|
|
86
|
+
async close() {
|
|
87
|
+
try {
|
|
88
|
+
await adminVite.close();
|
|
89
|
+
}
|
|
90
|
+
catch { /* ignore */ }
|
|
91
|
+
try {
|
|
92
|
+
await editorVite.close();
|
|
93
|
+
}
|
|
94
|
+
catch { /* ignore */ }
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export function printProxyBanner(handle) {
|
|
99
|
+
console.log("");
|
|
100
|
+
console.log(chalk.green(` Admin proxied: ${handle.adminUrl} -> ${handle.adminTarget}`));
|
|
101
|
+
console.log(chalk.green(` Editor proxied: ${handle.editorUrl} -> ${handle.editorTarget}`));
|
|
102
|
+
console.log("");
|
|
103
|
+
console.log(chalk.cyan(" Open your admin panel:"));
|
|
104
|
+
console.log(chalk.yellow(` ${handle.adminUrl}/admin/storefront`));
|
|
105
|
+
console.log("");
|
|
106
|
+
}
|
|
107
|
+
export async function promptForStore() {
|
|
108
|
+
const answer = await inquirer.prompt([
|
|
109
|
+
{
|
|
110
|
+
type: "input",
|
|
111
|
+
name: "store",
|
|
112
|
+
message: "Which store do you want to proxy? (e.g. 'storename' for storename.myikas.com)",
|
|
113
|
+
validate: (v) => v && /^[a-z0-9-]+$/i.test(v)
|
|
114
|
+
? true
|
|
115
|
+
: "Store name must be non-empty alphanumeric (dashes allowed)"
|
|
116
|
+
}
|
|
117
|
+
]);
|
|
118
|
+
return answer.store;
|
|
119
|
+
}
|
|
120
|
+
export function resolveEnvironmentDefaults(dev) {
|
|
121
|
+
return dev
|
|
122
|
+
? { editorUrl: DEV_EDITOR_URL, adminDomain: DEV_ADMIN_DOMAIN }
|
|
123
|
+
: { editorUrl: PROD_EDITOR_URL, adminDomain: PROD_ADMIN_DOMAIN };
|
|
124
|
+
}
|
|
125
|
+
export function createProxyCommand() {
|
|
126
|
+
const command = new Command("proxy");
|
|
127
|
+
command
|
|
128
|
+
.description("Run localhost proxies for the ikas admin panel + editor so local code components can connect without HTTPS/mixed-content issues")
|
|
129
|
+
.option("-s, --store <name>", "Store name (e.g. 'storename' for storename.myikas.com)")
|
|
130
|
+
.option("-p, --port <port>", `Admin port (default: ${DEFAULT_ADMIN_PORT})`, String(DEFAULT_ADMIN_PORT))
|
|
131
|
+
.option("--editor-port <port>", `Editor port (default: ${DEFAULT_EDITOR_PORT})`, String(DEFAULT_EDITOR_PORT))
|
|
132
|
+
.option("--dev", "Use ikas dev environment (.myikas.dev + studio-dev.ikasapps.com) instead of prod")
|
|
133
|
+
.option("-e, --editor <url>", "Override editor URL to proxy")
|
|
134
|
+
.option("-d, --domain <domain>", "Override admin domain suffix")
|
|
135
|
+
.action(async (opts) => {
|
|
136
|
+
const storeName = opts.store || (await promptForStore());
|
|
137
|
+
const envDefaults = resolveEnvironmentDefaults(Boolean(opts.dev));
|
|
138
|
+
const handle = await startProxy({
|
|
139
|
+
store: storeName,
|
|
140
|
+
adminPort: Number(opts.port) || DEFAULT_ADMIN_PORT,
|
|
141
|
+
editorPort: Number(opts.editorPort) || DEFAULT_EDITOR_PORT,
|
|
142
|
+
editorUrl: opts.editor || envDefaults.editorUrl,
|
|
143
|
+
adminDomain: opts.domain || envDefaults.adminDomain
|
|
144
|
+
});
|
|
145
|
+
printProxyBanner(handle);
|
|
146
|
+
console.log(chalk.gray(" Keep `ikas-component dev` running in another terminal for the WS server."));
|
|
147
|
+
});
|
|
148
|
+
return command;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Strip headers that prevent the proxied pages from running in an HTTP context
|
|
152
|
+
* (e.g. strict CSPs, framing rules). We need this because the admin/editor are
|
|
153
|
+
* normally loaded over HTTPS and may ship headers that are hostile to being
|
|
154
|
+
* served over http://localhost.
|
|
155
|
+
*/
|
|
156
|
+
function stripSecurityHeaders(proxy) {
|
|
157
|
+
proxy.on("proxyRes", (proxyRes) => {
|
|
158
|
+
delete proxyRes.headers["content-security-policy"];
|
|
159
|
+
delete proxyRes.headers["content-security-policy-report-only"];
|
|
160
|
+
delete proxyRes.headers["strict-transport-security"];
|
|
161
|
+
delete proxyRes.headers["cross-origin-opener-policy"];
|
|
162
|
+
delete proxyRes.headers["cross-origin-embedder-policy"];
|
|
163
|
+
delete proxyRes.headers["cross-origin-resource-policy"];
|
|
164
|
+
delete proxyRes.headers["x-frame-options"];
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Force identity encoding so response bodies arrive uncompressed and can be
|
|
169
|
+
* string-rewritten. Without this, admin responses come back gzip/brotli and
|
|
170
|
+
* the rewriter below would corrupt them.
|
|
171
|
+
*/
|
|
172
|
+
function disableCompression(proxy) {
|
|
173
|
+
proxy.on("proxyReq", (proxyReq) => {
|
|
174
|
+
proxyReq.setHeader("accept-encoding", "identity");
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* For text responses from the admin target, swap the deployed editor origin
|
|
179
|
+
* with the local editor proxy URL so the iframe src in the admin's bundled JS
|
|
180
|
+
* points at localhost instead of the HTTPS origin. That keeps everything on
|
|
181
|
+
* http://localhost, which is what unblocks ws://localhost:5201.
|
|
182
|
+
*/
|
|
183
|
+
function rewriteAdminBody(proxy, fromUrl, toUrl) {
|
|
184
|
+
proxy.on("proxyRes", (proxyRes, _req, res) => {
|
|
185
|
+
const contentType = String(proxyRes.headers["content-type"] || "");
|
|
186
|
+
const isText = /text\/|application\/(javascript|json|xml|xhtml)/i.test(contentType);
|
|
187
|
+
for (const [k, v] of Object.entries(proxyRes.headers)) {
|
|
188
|
+
if (k.toLowerCase() === "content-length")
|
|
189
|
+
continue;
|
|
190
|
+
if (v !== undefined)
|
|
191
|
+
res.setHeader(k, v);
|
|
192
|
+
}
|
|
193
|
+
res.statusCode = proxyRes.statusCode || 200;
|
|
194
|
+
if (!isText) {
|
|
195
|
+
proxyRes.pipe(res);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const chunks = [];
|
|
199
|
+
proxyRes.on("data", (c) => chunks.push(c));
|
|
200
|
+
proxyRes.on("end", () => {
|
|
201
|
+
let body = Buffer.concat(chunks).toString("utf8");
|
|
202
|
+
body = body.split(fromUrl).join(toUrl);
|
|
203
|
+
const out = Buffer.from(body, "utf8");
|
|
204
|
+
res.setHeader("content-length", String(out.length));
|
|
205
|
+
res.end(out);
|
|
206
|
+
});
|
|
207
|
+
proxyRes.on("error", () => res.end());
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/commands/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,YAA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