@ikas/component-cli 1.4.0-beta.161 → 1.4.0-beta.163
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/build-tools.d.ts +7 -0
- package/dist/build-tools.d.ts.map +1 -1
- package/dist/build-tools.js +7 -0
- package/dist/build-tools.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +13 -1
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +21 -1
- package/dist/commands/publish.js.map +1 -1
- package/dist/utils/esm-transform.d.ts +30 -0
- package/dist/utils/esm-transform.d.ts.map +1 -1
- package/dist/utils/esm-transform.js +151 -0
- package/dist/utils/esm-transform.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/create.d.ts +0 -4
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -228
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/get-available-values.d.ts +0 -3
- package/dist/commands/get-available-values.d.ts.map +0 -1
- package/dist/commands/get-available-values.js +0 -49
- package/dist/commands/get-available-values.js.map +0 -1
- package/dist/commands/proxy.d.ts +0 -39
- package/dist/commands/proxy.d.ts.map +0 -1
- package/dist/commands/proxy.js +0 -210
- package/dist/commands/proxy.js.map +0 -1
- package/dist/commands/search-categories.d.ts +0 -3
- package/dist/commands/search-categories.d.ts.map +0 -1
- package/dist/commands/search-categories.js +0 -26
- package/dist/commands/search-categories.js.map +0 -1
- package/dist/commands/set-dynamic-value.d.ts +0 -3
- package/dist/commands/set-dynamic-value.d.ts.map +0 -1
- package/dist/commands/set-dynamic-value.js +0 -54
- package/dist/commands/set-dynamic-value.js.map +0 -1
- package/dist/commands/update-section-props.d.ts +0 -3
- package/dist/commands/update-section-props.d.ts.map +0 -1
- package/dist/commands/update-section-props.js +0 -43
- package/dist/commands/update-section-props.js.map +0 -1
- package/dist/utils/theme-source-archive.d.ts +0 -25
- package/dist/utils/theme-source-archive.d.ts.map +0 -1
- package/dist/utils/theme-source-archive.js +0 -70
- package/dist/utils/theme-source-archive.js.map +0 -1
- package/dist/utils/upload-theme-source.d.ts +0 -32
- package/dist/utils/upload-theme-source.d.ts.map +0 -1
- package/dist/utils/upload-theme-source.js +0 -21
- package/dist/utils/upload-theme-source.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-categories.d.ts","sourceRoot":"","sources":["../../src/commands/search-categories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BpC,wBAAgB,6BAA6B,IAAI,OAAO,CAUvD"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
-
async function runSearchCategories(options) {
|
|
4
|
-
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
5
|
-
try {
|
|
6
|
-
const result = await runEditorAction("search-categories", {
|
|
7
|
-
...(options.query ? { query: options.query } : {}),
|
|
8
|
-
},
|
|
9
|
-
// The host fetches from the store API, so allow more than the default 10s.
|
|
10
|
-
{ ...(port ? { port } : {}), timeoutMs: 20_000 });
|
|
11
|
-
printResultAndExit(result);
|
|
12
|
-
}
|
|
13
|
-
catch (e) {
|
|
14
|
-
printErrorAndExit(e);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export function createSearchCategoriesCommand() {
|
|
18
|
-
const cmd = new Command("search-categories");
|
|
19
|
-
cmd
|
|
20
|
-
.description("Search the connected store's product categories and return each category's id (categoryId), name, slug, and parentId. Use the categoryId to fill a CATEGORY prop value via `ikas-component update-section-prop`. Requires the editor embedded in the ikas admin panel (the host runs the search).")
|
|
21
|
-
.option("--query <text>", "Free-text search query (category name, slug)")
|
|
22
|
-
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
23
|
-
.action(runSearchCategories);
|
|
24
|
-
return cmd;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=search-categories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-categories.js","sourceRoot":"","sources":["../../src/commands/search-categories.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,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,mBAAmB,EACnB;YACE,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,6BAA6B;IAC3C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC7C,GAAG;SACA,WAAW,CACV,mSAAmS,CACpS;SACA,MAAM,CAAC,gBAAgB,EAAE,8CAA8C,CAAC;SACxE,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAC/B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set-dynamic-value.d.ts","sourceRoot":"","sources":["../../src/commands/set-dynamic-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsDpC,wBAAgB,4BAA4B,IAAI,OAAO,CActD"}
|
|
@@ -1,54 +0,0 @@
|
|
|
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 runSetDynamicValue(options) {
|
|
19
|
-
if (!options.elementId)
|
|
20
|
-
printErrorAndExit(new Error("--element-id is required"));
|
|
21
|
-
if (!options.propId)
|
|
22
|
-
printErrorAndExit(new Error("--prop-id is required (the prop to bind)"));
|
|
23
|
-
if (!options.ref)
|
|
24
|
-
printErrorAndExit(new Error("--ref is required (a value's `ref` from get-available-values)"));
|
|
25
|
-
const listPath = parseListPath(options.listPath);
|
|
26
|
-
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
27
|
-
try {
|
|
28
|
-
const result = await runEditorAction("set-dynamic-value", {
|
|
29
|
-
...(options.pageId ? { pageId: options.pageId } : {}),
|
|
30
|
-
elementId: options.elementId,
|
|
31
|
-
propId: options.propId,
|
|
32
|
-
ref: options.ref,
|
|
33
|
-
...(listPath ? { listPath } : {}),
|
|
34
|
-
}, port ? { port } : {});
|
|
35
|
-
printResultAndExit(result);
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
printErrorAndExit(e);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export function createSetDynamicValueCommand() {
|
|
42
|
-
const cmd = new Command("set-dynamic-value");
|
|
43
|
-
cmd
|
|
44
|
-
.description("Bind a prop to a DYNAMIC value (a variable / loop item field) instead of a static value. --ref is a value's `ref` from `get-available-values`. For a prop of a component inside a COMPONENT_LIST, pass the same --list-path you used for get-available-values. Replaces any static value on that prop.")
|
|
45
|
-
.requiredOption("--element-id <id>", "Placed section elementId (from `list-page-sections`)")
|
|
46
|
-
.requiredOption("--prop-id <id>", "Prop id to bind")
|
|
47
|
-
.requiredOption("--ref <ref>", "A value `ref` from `get-available-values`")
|
|
48
|
-
.option("--page-id <id>", "Page id (from `list-pages`)")
|
|
49
|
-
.option("--list-path <json>", 'JSON path into a COMPONENT_LIST, e.g. \'[{"propId":"<listPropId>","index":0}]\'')
|
|
50
|
-
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
51
|
-
.action(runSetDynamicValue);
|
|
52
|
-
return cmd;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=set-dynamic-value.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"set-dynamic-value.js","sourceRoot":"","sources":["../../src/commands/set-dynamic-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAW1C,SAAS,aAAa,CAAC,GAAY;IACjC,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IA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EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClC,EACD,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,4BAA4B;IAC1C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC7C,GAAG;SACA,WAAW,CACV,wSAAwS,CACzS;SACA,cAAc,CAAC,mBAAmB,EAAE,sDAAsD,CAAC;SAC3F,cAAc,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;SACnD,cAAc,CAAC,aAAa,EAAE,2CAA2C,CAAC;SAC1E,MAAM,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;SACvD,MAAM,CAAC,oBAAoB,EAAE,iFAAiF,CAAC;SAC/G,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAC9B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-section-props.d.ts","sourceRoot":"","sources":["../../src/commands/update-section-props.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoDpC,wBAAgB,+BAA+B,IAAI,OAAO,CAezD"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { printErrorAndExit, printResultAndExit, runEditorAction, } from "../utils/editor-action-client.js";
|
|
3
|
-
async function runUpdateSectionProps(options) {
|
|
4
|
-
if (!options.pageId || typeof options.pageId !== "string") {
|
|
5
|
-
printErrorAndExit(new Error("--page-id is required (use `ikas-component list-pages`)"));
|
|
6
|
-
}
|
|
7
|
-
if (!options.elementId || typeof options.elementId !== "string") {
|
|
8
|
-
printErrorAndExit(new Error("--element-id is required (use `ikas-component list-page-sections`)"));
|
|
9
|
-
}
|
|
10
|
-
if (options.updates === undefined) {
|
|
11
|
-
printErrorAndExit(new Error('--updates is required: a JSON array, e.g. \'[{"propName":"heading","value":{"value":"Hi"}}]\''));
|
|
12
|
-
}
|
|
13
|
-
let updates;
|
|
14
|
-
try {
|
|
15
|
-
updates = JSON.parse(options.updates);
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
printErrorAndExit(new Error(`--updates must be valid JSON. Received: ${options.updates}`));
|
|
19
|
-
}
|
|
20
|
-
if (!Array.isArray(updates) || updates.length === 0) {
|
|
21
|
-
printErrorAndExit(new Error('--updates must be a non-empty JSON array of { propId|propName, value } objects.'));
|
|
22
|
-
}
|
|
23
|
-
const port = options.port ? parseInt(options.port, 10) : undefined;
|
|
24
|
-
try {
|
|
25
|
-
const result = await runEditorAction("update-section-props", { pageId: options.pageId, elementId: options.elementId, updates }, { ...(port ? { port } : {}), timeoutMs: 30_000 });
|
|
26
|
-
printResultAndExit(result);
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
printErrorAndExit(e);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export function createUpdateSectionPropsCommand() {
|
|
33
|
-
const cmd = new Command("update-section-props");
|
|
34
|
-
cmd
|
|
35
|
-
.description("Set MANY prop values on one placed section in a single call (batch update-section-prop). --updates is a JSON array of { propId|propName, value }, each value using the same per-type shape as update-section-prop. All-or-nothing: every entry is resolved and validated before any is written.")
|
|
36
|
-
.requiredOption("--page-id <id>", "Page id (from `ikas-component list-pages`)")
|
|
37
|
-
.requiredOption("--element-id <id>", "Placed section elementId (from `ikas-component list-page-sections`)")
|
|
38
|
-
.requiredOption("--updates <json>", 'JSON array, e.g. \'[{"propName":"heading","value":{"value":"Hi"}},{"propName":"image","value":{"id":"<asset-id>"}}]\'')
|
|
39
|
-
.option("--port <port>", "Dev server WebSocket port", "5201")
|
|
40
|
-
.action(runUpdateSectionProps);
|
|
41
|
-
return cmd;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=update-section-props.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-section-props.js","sourceRoot":"","sources":["../../src/commands/update-section-props.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,qBAAqB,CAAC,OAAkC;IACrE,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,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChE,iBAAiB,CAAC,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC,CAAC;IACrG,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAClC,iBAAiB,CACf,IAAI,KAAK,CAAC,+FAA+F,CAAC,CAC3G,CAAC;IACJ,CAAC;IAED,IAAI,OAAgB,CAAC;IACrB,IAAI,CAAC;QACH,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB,CAAC,IAAI,KAAK,CAAC,2CAA2C,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7F,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,iBAAiB,CACf,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAC7F,CAAC;IACJ,CAAC;IAED,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,sBAAsB,EACtB,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,EACjE,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,+BAA+B;IAC7C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAChD,GAAG;SACA,WAAW,CACV,iSAAiS,CAClS;SACA,cAAc,CAAC,gBAAgB,EAAE,4CAA4C,CAAC;SAC9E,cAAc,CAAC,mBAAmB,EAAE,qEAAqE,CAAC;SAC1G,cAAc,CACb,kBAAkB,EAClB,uHAAuH,CACxH;SACA,MAAM,CAAC,eAAe,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAC5D,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface ThemeSourceArchiveResult {
|
|
2
|
-
/** Absolute path of the zip file that was written. */
|
|
3
|
-
filePath: string;
|
|
4
|
-
/** Number of files written into the archive. */
|
|
5
|
-
fileCount: number;
|
|
6
|
-
/** Compressed size of the archive, in bytes. */
|
|
7
|
-
sizeBytes: number;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Zip the developer's theme source code — everything under `projectRoot` that
|
|
11
|
-
* isn't a dependency, build artifact, or dotfile — into a zip file on disk at
|
|
12
|
-
* `outputPath`.
|
|
13
|
-
*
|
|
14
|
-
* Uses the same `archiver` library the code-generator relies on, streaming
|
|
15
|
-
* straight to a write stream so large themes don't have to be buffered whole.
|
|
16
|
-
* The caller is responsible for deleting `outputPath` once it has been uploaded.
|
|
17
|
-
*
|
|
18
|
-
* @param projectRoot Absolute path to the theme project root (the directory
|
|
19
|
-
* containing `ikas.config.json`).
|
|
20
|
-
* @param outputPath Absolute path of the zip file to create.
|
|
21
|
-
* @param extraIgnore Additional glob patterns to exclude, merged with the
|
|
22
|
-
* defaults above.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createThemeSourceZipFile(projectRoot: string, outputPath: string, extraIgnore?: string[]): Promise<ThemeSourceArchiveResult>;
|
|
25
|
-
//# sourceMappingURL=theme-source-archive.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"theme-source-archive.d.ts","sourceRoot":"","sources":["../../src/utils/theme-source-archive.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,wBAAwB;IACvC,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,WAAW,GAAE,MAAM,EAAO,GACzB,OAAO,CAAC,wBAAwB,CAAC,CAqCnC"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import archiver from "archiver";
|
|
2
|
-
import * as fs from "fs";
|
|
3
|
-
/**
|
|
4
|
-
* Glob patterns never included in the theme source archive: dependencies, build
|
|
5
|
-
* artifacts, VCS metadata and incidental junk. Dotfiles are excluded separately
|
|
6
|
-
* via `dot: false` (so `.env`, `.git`, etc. never leak into the upload).
|
|
7
|
-
*/
|
|
8
|
-
const DEFAULT_IGNORE = [
|
|
9
|
-
"node_modules/**",
|
|
10
|
-
"dist/**",
|
|
11
|
-
"build/**",
|
|
12
|
-
".turbo/**",
|
|
13
|
-
// Output of `ikas-component publish` (compiled bundle, not source).
|
|
14
|
-
"ikas-components.json",
|
|
15
|
-
"**/*.zip",
|
|
16
|
-
"**/*.log",
|
|
17
|
-
"**/.DS_Store",
|
|
18
|
-
];
|
|
19
|
-
/**
|
|
20
|
-
* Zip the developer's theme source code — everything under `projectRoot` that
|
|
21
|
-
* isn't a dependency, build artifact, or dotfile — into a zip file on disk at
|
|
22
|
-
* `outputPath`.
|
|
23
|
-
*
|
|
24
|
-
* Uses the same `archiver` library the code-generator relies on, streaming
|
|
25
|
-
* straight to a write stream so large themes don't have to be buffered whole.
|
|
26
|
-
* The caller is responsible for deleting `outputPath` once it has been uploaded.
|
|
27
|
-
*
|
|
28
|
-
* @param projectRoot Absolute path to the theme project root (the directory
|
|
29
|
-
* containing `ikas.config.json`).
|
|
30
|
-
* @param outputPath Absolute path of the zip file to create.
|
|
31
|
-
* @param extraIgnore Additional glob patterns to exclude, merged with the
|
|
32
|
-
* defaults above.
|
|
33
|
-
*/
|
|
34
|
-
export async function createThemeSourceZipFile(projectRoot, outputPath, extraIgnore = []) {
|
|
35
|
-
return new Promise((resolve, reject) => {
|
|
36
|
-
const output = fs.createWriteStream(outputPath);
|
|
37
|
-
const archive = archiver("zip", { zlib: { level: 9 } });
|
|
38
|
-
let fileCount = 0;
|
|
39
|
-
// `close` fires once all bytes have been flushed to disk — only then is the
|
|
40
|
-
// pointer (total size) final and the file safe to upload.
|
|
41
|
-
output.on("close", () => {
|
|
42
|
-
resolve({
|
|
43
|
-
filePath: outputPath,
|
|
44
|
-
fileCount,
|
|
45
|
-
sizeBytes: archive.pointer(),
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
output.on("error", reject);
|
|
49
|
-
archive.on("entry", () => {
|
|
50
|
-
fileCount += 1;
|
|
51
|
-
});
|
|
52
|
-
// A file vanishing mid-walk (ENOENT) is non-fatal; anything else is a real
|
|
53
|
-
// failure and should reject.
|
|
54
|
-
archive.on("warning", (err) => {
|
|
55
|
-
if (err?.code === "ENOENT")
|
|
56
|
-
return;
|
|
57
|
-
reject(err);
|
|
58
|
-
});
|
|
59
|
-
archive.on("error", reject);
|
|
60
|
-
archive.pipe(output);
|
|
61
|
-
archive.glob("**/*", {
|
|
62
|
-
cwd: projectRoot,
|
|
63
|
-
dot: false,
|
|
64
|
-
nodir: true,
|
|
65
|
-
ignore: [...DEFAULT_IGNORE, ...extraIgnore],
|
|
66
|
-
});
|
|
67
|
-
void archive.finalize();
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=theme-source-archive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"theme-source-archive.js","sourceRoot":"","sources":["../../src/utils/theme-source-archive.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB;;;;GAIG;AACH,MAAM,cAAc,GAAG;IACrB,iBAAiB;IACjB,SAAS;IACT,UAAU;IACV,WAAW;IACX,oEAAoE;IACpE,sBAAsB;IACtB,UAAU;IACV,UAAU;IACV,cAAc;CACf,CAAC;AAWF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,WAAmB,EACnB,UAAkB,EAClB,cAAwB,EAAE;IAE1B,OAAO,IAAI,OAAO,CAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC/D,MAAM,MAAM,GAAG,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,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.json (may be absent on legacy projects). */
|
|
3
|
-
projectId?: string;
|
|
4
|
-
/** Human-readable theme name from ikas.config.json. */
|
|
5
|
-
name: string;
|
|
6
|
-
/** Theme version from ikas.config.json. */
|
|
7
|
-
version: string;
|
|
8
|
-
/** Absolute path to the zipped theme source code on disk. */
|
|
9
|
-
zipPath: string;
|
|
10
|
-
/** Compressed size of the zip, in bytes. */
|
|
11
|
-
sizeBytes: number;
|
|
12
|
-
/** Number of files inside the zip. */
|
|
13
|
-
fileCount: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Send the zipped theme source code to the theme-source API.
|
|
17
|
-
*
|
|
18
|
-
* TODO(API): intentionally left unimplemented — this is the seam where the
|
|
19
|
-
* actual upload goes. Read the file at `input.zipPath` (e.g.
|
|
20
|
-
* `fs.createReadStream(input.zipPath)`) and POST it together with `projectId` /
|
|
21
|
-
* `name` / `version`. Throw on a non-2xx response so the caller can surface a
|
|
22
|
-
* warning. The caller deletes `input.zipPath` after this resolves or rejects,
|
|
23
|
-
* so don't delete it here.
|
|
24
|
-
*
|
|
25
|
-
* Reference fields available:
|
|
26
|
-
* - input.zipPath string absolute path to the zip to upload
|
|
27
|
-
* - input.sizeBytes number compressed size
|
|
28
|
-
* - input.fileCount number files in the archive
|
|
29
|
-
* - input.projectId / input.name / input.version
|
|
30
|
-
*/
|
|
31
|
-
export declare function uploadThemeSource(input: ThemeSourceUploadInput): Promise<void>;
|
|
32
|
-
//# sourceMappingURL=upload-theme-source.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload-theme-source.d.ts","sourceRoot":"","sources":["../../src/utils/upload-theme-source.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Send the zipped theme source code to the theme-source API.
|
|
3
|
-
*
|
|
4
|
-
* TODO(API): intentionally left unimplemented — this is the seam where the
|
|
5
|
-
* actual upload goes. Read the file at `input.zipPath` (e.g.
|
|
6
|
-
* `fs.createReadStream(input.zipPath)`) and POST it together with `projectId` /
|
|
7
|
-
* `name` / `version`. Throw on a non-2xx response so the caller can surface a
|
|
8
|
-
* warning. The caller deletes `input.zipPath` after this resolves or rejects,
|
|
9
|
-
* so don't delete it here.
|
|
10
|
-
*
|
|
11
|
-
* Reference fields available:
|
|
12
|
-
* - input.zipPath string absolute path to the zip to upload
|
|
13
|
-
* - input.sizeBytes number compressed size
|
|
14
|
-
* - input.fileCount number files in the archive
|
|
15
|
-
* - input.projectId / input.name / input.version
|
|
16
|
-
*/
|
|
17
|
-
export async function uploadThemeSource(input) {
|
|
18
|
-
// Intentionally empty. Implement the API call here.
|
|
19
|
-
void input;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=upload-theme-source.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload-theme-source.js","sourceRoot":"","sources":["../../src/utils/upload-theme-source.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAA6B;IAE7B,oDAAoD;IACpD,KAAK,KAAK,CAAC;AACb,CAAC"}
|