@supernovaio/cli-next 2.3.6 → 2.3.7
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/components-import.d.ts +1 -0
- package/dist/commands/components-import.d.ts.map +1 -1
- package/dist/commands/components-import.js +10 -2
- package/dist/commands/components-import.js.map +1 -1
- package/dist/commands/describe-design-system.d.ts +1 -1
- package/dist/commands/describe-design-system.d.ts.map +1 -1
- package/dist/commands/describe-design-system.js +1 -1
- package/dist/commands/describe-design-system.js.map +1 -1
- package/dist/commands/describe-workspaces.d.ts +1 -1
- package/dist/commands/describe-workspaces.d.ts.map +1 -1
- package/dist/commands/describe-workspaces.js +1 -3
- package/dist/commands/describe-workspaces.js.map +1 -1
- package/dist/commands/publish-documentation.d.ts +1 -1
- package/dist/commands/publish-documentation.d.ts.map +1 -1
- package/dist/commands/publish-documentation.js +3 -6
- package/dist/commands/publish-documentation.js.map +1 -1
- package/dist/commands/run-local-exporter.d.ts +44 -0
- package/dist/commands/run-local-exporter.d.ts.map +1 -0
- package/dist/commands/run-local-exporter.js +223 -0
- package/dist/commands/run-local-exporter.js.map +1 -0
- package/dist/commands/storybook-import.d.ts +9 -3
- package/dist/commands/storybook-import.d.ts.map +1 -1
- package/dist/commands/storybook-import.js +57 -42
- package/dist/commands/storybook-import.js.map +1 -1
- package/dist/commands/sync-tokens.d.ts +1 -1
- package/dist/commands/sync-tokens.d.ts.map +1 -1
- package/dist/commands/sync-tokens.js +1 -1
- package/dist/commands/sync-tokens.js.map +1 -1
- package/dist/commands/template-upload.d.ts +28 -0
- package/dist/commands/template-upload.d.ts.map +1 -0
- package/dist/commands/template-upload.js +225 -0
- package/dist/commands/template-upload.js.map +1 -0
- package/dist/docker-scripts/extract-private-packages.js +72 -0
- package/dist/services/auth.service.d.ts.map +1 -1
- package/dist/services/auth.service.js +6 -1
- package/dist/services/auth.service.js.map +1 -1
- package/dist/services/user.service.d.ts +17 -2
- package/dist/services/user.service.d.ts.map +1 -1
- package/dist/services/vault.service.d.ts.map +1 -1
- package/dist/services/vault.service.js +0 -1
- package/dist/services/vault.service.js.map +1 -1
- package/dist/types/base-command.d.ts.map +1 -1
- package/dist/types/base-command.js +6 -2
- package/dist/types/base-command.js.map +1 -1
- package/dist/types/config.d.ts +7 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -1
- package/dist/types/environment.d.ts +1 -1
- package/dist/types/environment.d.ts.map +1 -1
- package/dist/types/environment.js +2 -2
- package/dist/types/environment.js.map +1 -1
- package/dist/types/sentry-command.d.ts.map +1 -1
- package/dist/types/sentry-command.js +23 -1
- package/dist/types/sentry-command.js.map +1 -1
- package/dist/types/types.d.ts +14 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/types.js.map +1 -1
- package/dist/utils/figma-tokens-data-loader.d.ts +1 -1
- package/dist/utils/figma-tokens-data-loader.d.ts.map +1 -1
- package/dist/utils/figma-tokens-data-loader.js +1 -1
- package/dist/utils/figma-tokens-data-loader.js.map +1 -1
- package/dist/utils/run-exporter/exporter-utils.d.ts +13 -1
- package/dist/utils/run-exporter/exporter-utils.d.ts.map +1 -1
- package/dist/utils/run-exporter/exporter-utils.js +15 -1
- package/dist/utils/run-exporter/exporter-utils.js.map +1 -1
- package/dist/utils/sdk.d.ts.map +1 -1
- package/dist/utils/sdk.js +4 -2
- package/dist/utils/sdk.js.map +1 -1
- package/oclif.manifest.json +168 -5
- package/package.json +15 -10
|
@@ -37,6 +37,7 @@ export default class ImportComponents extends SentryCommand<ImportComponentsConf
|
|
|
37
37
|
rootDir: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
38
38
|
versionId: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
39
39
|
};
|
|
40
|
+
static hidden: boolean;
|
|
40
41
|
get commandId(): string;
|
|
41
42
|
get configSchema(): ZodType<ImportComponentsConfig>;
|
|
42
43
|
run(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-import.d.ts","sourceRoot":"","sources":["../../src/commands/components-import.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components-import.d.ts","sourceRoot":"","sources":["../../src/commands/components-import.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;EAU7B,CAAA;AAEL,KAAK,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAE1E,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,aAAa,CAAC,sBAAsB,CAAC;IACjF,OAAgB,IAAI,KAAK;IACzB,OAAgB,WAAW,SAA+E;IAC1G,OAAgB,QAAQ,WAGvB;IACD,OAAgB,KAAK;;;;;MAcpB;IACD,OAAgB,MAAM,UAAO;IAE7B,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAElD;IAGY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8ClC"}
|
|
@@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
import { Flags } from "@oclif/core";
|
|
11
11
|
import { SentryTraced } from "@sentry/nestjs";
|
|
12
12
|
import { analyzeComponents } from "@supernovaio/code-analyzer";
|
|
13
|
-
import * as process from "node:process";
|
|
14
13
|
import { z } from "zod";
|
|
15
14
|
import { SentryCommand } from "../types/index.js";
|
|
16
15
|
const ImportComponentsConfigSchema = z
|
|
@@ -45,6 +44,7 @@ export default class ImportComponents extends SentryCommand {
|
|
|
45
44
|
}),
|
|
46
45
|
versionId: Flags.string({ description: "Import code components to version of", required: true }),
|
|
47
46
|
};
|
|
47
|
+
static hidden = true;
|
|
48
48
|
get commandId() {
|
|
49
49
|
return ImportComponents.id;
|
|
50
50
|
}
|
|
@@ -53,7 +53,7 @@ export default class ImportComponents extends SentryCommand {
|
|
|
53
53
|
}
|
|
54
54
|
async run() {
|
|
55
55
|
const { flags } = await this.parse(ImportComponents);
|
|
56
|
-
const { importFrom, rootDir } = flags;
|
|
56
|
+
const { designSystemId, importFrom, rootDir, versionId } = flags;
|
|
57
57
|
this.log("📦 Component Import Summary".green);
|
|
58
58
|
this.log("========================");
|
|
59
59
|
this.log(`Source: ${importFrom}`);
|
|
@@ -76,6 +76,14 @@ export default class ImportComponents extends SentryCommand {
|
|
|
76
76
|
}
|
|
77
77
|
this.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
78
78
|
this.log("Importing to Supernova...");
|
|
79
|
+
const client = await this.apiClient();
|
|
80
|
+
const result = await client.designSystems.versions.codeComponents.import(designSystemId, versionId, {
|
|
81
|
+
codeComponents: components.map(c => ({
|
|
82
|
+
...c,
|
|
83
|
+
persistentId: `${designSystemId}-${versionId}${c.exportName}}`,
|
|
84
|
+
})),
|
|
85
|
+
});
|
|
86
|
+
this.log(`Total: ${result.created} components imported`.green);
|
|
79
87
|
}
|
|
80
88
|
else {
|
|
81
89
|
this.log("\n⚠️ No components were imported".green);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-import.js","sourceRoot":"","sources":["../../src/commands/components-import.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"components-import.js","sourceRoot":"","sources":["../../src/commands/components-import.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,E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Ac,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBACnC,GAAG,CAAC;oBACJ,YAAY,EAAE,GAAG,cAAc,IAAI,SAAS,GAAG,CAAC,CAAC,UAAU,GAAG;iBAC/D,CAAC,CAAC;aACJ,CAAC,CAAA;YACF,IAAI,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAA;QAChE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,mCAAmC,CAAC,KAAK,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;;AA7CY;IADZ,YAAY,EAAE;;;;2CA8Cd","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport { analyzeComponents } from \"@supernovaio/code-analyzer\"\nimport { z, ZodType } from \"zod\"\n\nimport { SentryCommand } from \"../types/index.js\"\n\nconst ImportComponentsConfigSchema = z\n .object({\n designSystemId: z.string(),\n importFrom: z.string(),\n rootDir: z.string(),\n versionId: z.string(),\n })\n .transform(data => ({\n ...data,\n rootDir: data.rootDir ?? process.cwd(),\n }))\n\ntype ImportComponentsConfig = z.infer<typeof ImportComponentsConfigSchema>\n\nexport default class ImportComponents extends SentryCommand<ImportComponentsConfig> {\n static override args = {}\n static override description = \"Analyze react components from given package and import them into Supernova\"\n static override examples = [\n \"<%= config.bin %> <%= command.id %> --importFrom components-package --rootDir ./src\",\n \"<%= config.bin %> <%= command.id %> --importFrom @mui/material\",\n ]\n static override flags = {\n designSystemId: Flags.string({ description: \"Import code components to design system of\", required: true }),\n importFrom: Flags.string({\n char: \"i\",\n description: \"Package or directory path to import components from\",\n required: true,\n }),\n rootDir: Flags.string({\n char: \"r\",\n default: process.cwd(), // Defaults to the current directory\n description:\n \"Root directory of the package where the import should resolve from. Defaults to the current directory\",\n }),\n versionId: Flags.string({ description: \"Import code components to version of\", required: true }),\n }\n static override hidden = true\n\n get commandId(): string {\n return ImportComponents.id\n }\n\n get configSchema(): ZodType<ImportComponentsConfig> {\n return ImportComponentsConfigSchema\n }\n\n @SentryTraced()\n public async run(): Promise<void> {\n const { flags } = await this.parse(ImportComponents)\n\n const { designSystemId, importFrom, rootDir, versionId } = flags\n\n this.log(\"📦 Component Import Summary\".green)\n this.log(\"========================\")\n this.log(`Source: ${importFrom}`)\n this.log(`Root Directory: ${rootDir}`)\n\n const components = await analyzeComponents({ importFrom, rootDir })\n\n if (components.length > 0) {\n this.log(\"\\nComponent Summary Table:\")\n this.log(\"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\")\n this.log(\"Component Name Props.Num Required Props Names \")\n this.log(\"──────────────────────────────────────────────────────────\")\n\n for (const component of components) {\n const propsCount = Object.keys(component.properties).length\n const requiredCount = Object.values(component.properties).filter(prop => prop.required).length\n const propsNames = new Set(Object.values(component.properties).map(prop => prop.name))\n\n // Format each row with fixed width columns\n const name = component.exportName.padEnd(16, \" \").slice(0, 16)\n const propsNum = String(propsCount).padStart(5, \" \")\n const required = String(requiredCount).padStart(10, \" \")\n const props = [...propsNames].slice(0, 2).join(\", \") + (propsNames.size > 2 ? \", ...\" : \"\")\n\n this.log(`${name} ${propsNum} ${required} ${props}`)\n }\n\n this.log(\"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\")\n this.log(\"Importing to Supernova...\")\n const client = await this.apiClient()\n const result = await client.designSystems.versions.codeComponents.import(designSystemId, versionId, {\n codeComponents: components.map(c => ({\n ...c,\n persistentId: `${designSystemId}-${versionId}${c.exportName}}`,\n })),\n })\n this.log(`Total: ${result.created} components imported`.green)\n } else {\n this.log(\"\\n⚠️ No components were imported\".green)\n }\n }\n}\n"]}
|
|
@@ -23,7 +23,7 @@ declare const DescribeDesignSystemConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
23
23
|
}>;
|
|
24
24
|
type DescribeDesignSystemConfig = z.infer<typeof DescribeDesignSystemConfigSchema>;
|
|
25
25
|
export declare class DescribeDesignSystem extends SentryCommand<DescribeDesignSystemConfig> {
|
|
26
|
-
static aliases: [
|
|
26
|
+
static aliases: string[];
|
|
27
27
|
static description: string;
|
|
28
28
|
static examples: string[];
|
|
29
29
|
static flags: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe-design-system.d.ts","sourceRoot":"","sources":["../../src/commands/describe-design-system.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAe,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAY9D,QAAA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;EAQjC,CAAA;AAEL,KAAK,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAGlF,qBAAa,oBAAqB,SAAQ,aAAa,CAAC,0BAA0B,CAAC;IAKjF,OAAgB,OAAO,
|
|
1
|
+
{"version":3,"file":"describe-design-system.d.ts","sourceRoot":"","sources":["../../src/commands/describe-design-system.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAe,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAY9D,QAAA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;EAQjC,CAAA;AAEL,KAAK,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAGlF,qBAAa,oBAAqB,SAAQ,aAAa,CAAC,0BAA0B,CAAC;IAKjF,OAAgB,OAAO,WAA6B;IAEpD,OAAgB,WAAW,SAA8D;IAEzF,OAAgB,QAAQ,WAEvB;IAED,OAAgB,KAAK;;;;MASpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAExD;IAMK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAyB3B"}
|
|
@@ -22,7 +22,7 @@ const DescribeDesignSystemConfigSchema = z
|
|
|
22
22
|
...data,
|
|
23
23
|
}));
|
|
24
24
|
export class DescribeDesignSystem extends SentryCommand {
|
|
25
|
-
static aliases;
|
|
25
|
+
static aliases = ["describe-design-system"];
|
|
26
26
|
static description = "Describe structure of single design system by provided ID";
|
|
27
27
|
static examples = [
|
|
28
28
|
`$ @supernovaio/cli describe-design-system --apiKey="{xxx-xxx-xxx}" --designSystemId="{1234}"`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe-design-system.js","sourceRoot":"","sources":["../../src/commands/describe-design-system.ts"],"names":[],"mappings":";;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAWpD,MAAM,gCAAgC,GAAG,CAAC;KACvC,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC;KACD,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,GAAG,IAAI;CACR,CAAC,CAAC,CAAA;AAKL,MAAM,OAAO,oBAAqB,SAAQ,aAAyC;IAKjF,MAAM,CAAU,OAAO,
|
|
1
|
+
{"version":3,"file":"describe-design-system.js","sourceRoot":"","sources":["../../src/commands/describe-design-system.ts"],"names":[],"mappings":";;;;;;;;;AAWA,OAAO,E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AAC;;AAxBK;IADL,YAAY,EAAE;;;;+CAyBd","sourcesContent":["//\n// describe-design-system.ts\n// Supernova CLI\n//\n// Created by Jiri Trecak.\n// Copyright © Supernova.io. All rights reserved.\n//\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Imports\n\nimport { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport { z } from \"zod\"\n\nimport { commonFlags, SentryCommand } from \"../types/index.js\"\nimport { getWritableVersion } from \"../utils/sdk.js\"\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Definition\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Configuration\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Tool implementation\n\nconst DescribeDesignSystemConfigSchema = z\n .object({\n apiKey: z.string(),\n designSystemId: z.string(),\n proxyUrl: z.string().url().optional(),\n })\n .transform(data => ({\n ...data,\n }))\n\ntype DescribeDesignSystemConfig = z.infer<typeof DescribeDesignSystemConfigSchema>\n\n/** Command that describes the structure of provided design system */\nexport class DescribeDesignSystem extends SentryCommand<DescribeDesignSystemConfig> {\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command configuration\n\n // How this command can be run\n static override aliases = [\"describe-design-system\"]\n // Command help description\n static override description = \"Describe structure of single design system by provided ID\"\n // Examples how to use the command\n static override examples = [\n `$ @supernovaio/cli describe-design-system --apiKey=\"{xxx-xxx-xxx}\" --designSystemId=\"{1234}\"`,\n ]\n // Static flags to enable / disable features\n static override flags = {\n ...commonFlags,\n apiKey: Flags.string({ description: \"API key to use for accessing Supernova instance\", required: true }),\n designSystemId: Flags.string({ description: \"Design System to describe structure of\", required: true }),\n proxyUrl: Flags.string({\n description: \"When set, CLI will use provided proxy URL for all requests\",\n hidden: true,\n required: false,\n }),\n }\n\n get commandId(): string {\n return DescribeDesignSystem.id\n }\n\n get configSchema(): z.ZodType<DescribeDesignSystemConfig> {\n return DescribeDesignSystemConfigSchema\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command runtime\n\n @SentryTraced()\n async run(): Promise<void> {\n const { flags } = await this.parse(DescribeDesignSystem)\n\n // Get workspace -> design system –> version\n const { designSystem, id, instance } = await getWritableVersion(flags)\n\n // Get brands and themes\n const brands = await instance.brands.getBrands(id)\n const themes = await instance.tokens.getTokenThemes(id)\n\n this.log(`\\n↳ Design system \"${designSystem.name}\", id: ${designSystem.id}`.cyan)\n for (const brand of brands) {\n this.log(` ↳ Brand: \"${brand.name}\", id: ${brand.id}`)\n const brandThemes = themes.filter(t => t.brandId === brand.id)\n if (brandThemes.length > 0) {\n for (const theme of brandThemes) {\n this.log(` ↳ Theme: \"${theme.name}\", id: ${theme.id}`)\n }\n } else {\n this.log(` ↳ No themes defined in this brand`.gray)\n }\n }\n\n this.log(\"\\nDone\".green)\n }\n}\n"]}
|
|
@@ -28,7 +28,7 @@ declare const DescribeWorkspaceConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
28
28
|
}>;
|
|
29
29
|
type DescribeWorkspaceConfig = z.infer<typeof DescribeWorkspaceConfigSchema>;
|
|
30
30
|
export declare class DescribeWorkspaces extends SentryCommand<DescribeWorkspaceConfig> {
|
|
31
|
-
static aliases: [
|
|
31
|
+
static aliases: string[];
|
|
32
32
|
static description: string;
|
|
33
33
|
static examples: string[];
|
|
34
34
|
static flags: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe-workspaces.d.ts","sourceRoot":"","sources":["../../src/commands/describe-workspaces.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,QAAQ,MAAM,kBAAkB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EAAE,uBAAuB,GAAG,OAAO,CAAC;QAC3D,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAA;QAC5B,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;KACtC,CAAC;IAmBI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAwC3B"}
|
|
@@ -24,7 +24,7 @@ const DescribeWorkspaceConfigSchema = z
|
|
|
24
24
|
...data,
|
|
25
25
|
}));
|
|
26
26
|
export class DescribeWorkspaces extends SentryCommand {
|
|
27
|
-
static aliases;
|
|
27
|
+
static aliases = ["describe-workspaces"];
|
|
28
28
|
static description = "Describe structure of all workspaces and design systems available under those workspaces available for specified API key";
|
|
29
29
|
static examples = [`$ @supernovaio/cli describe-workspaces --apiKey="{xxx-xxx-xxx}"`];
|
|
30
30
|
static flags = {
|
|
@@ -49,8 +49,6 @@ export class DescribeWorkspaces extends SentryCommand {
|
|
|
49
49
|
const apiUrl = apiUrlForEnvironment(getTargetEnv());
|
|
50
50
|
const sdkInstance = new sdkProvider.Supernova(flags.apiKey, {
|
|
51
51
|
apiUrl,
|
|
52
|
-
bypassEnvFetch: true,
|
|
53
|
-
proxyUrl: flags.proxyUrl,
|
|
54
52
|
});
|
|
55
53
|
const user = await sdkInstance.me.me();
|
|
56
54
|
const workspaces = await sdkInstance.workspaces.workspaces(user.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe-workspaces.js","sourceRoot":"","sources":["../../src/commands/describe-workspaces.ts"],"names":[],"mappings":";;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,CAAC,EAAW,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MA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,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;gBAClD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;gBACvD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;oBAC3B,IAAI,CAAC,GAAG,CAAC,iBAAiB,KAAK,CAAC,IAAI,UAAU,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;oBACzD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,CAAC,EAAE,CAAC,CAAA;oBAC9D,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAE3B,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;4BAChC,IAAI,CAAC,GAAG,CAAC,mBAAmB,KAAK,CAAC,IAAI,UAAU,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;wBAClE,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,GAAG,CAAC,yCAAyC,CAAC,IAAI,CAAC,CAAA;oBAC1D,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;;AA7DK;IADL,YAAY,EAAE;;;;uDAoBd;AAGK;IADL,YAAY,EAAE;;;;6CAwCd","sourcesContent":["//\n// describe-workspaces.ts\n// Supernova CLI\n//\n// Created by Jiri Trecak.\n// Copyright © Supernova.io. All rights reserved.\n//\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Imports\n\nimport { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport * as sdkTypes from \"@supernovaio/sdk\"\nimport { createRequire } from \"node:module\"\nimport { z, ZodType } from \"zod\"\n\nimport { apiUrlForEnvironment, commonFlags, getTargetEnv, SentryCommand } from \"../types/index.js\"\n\nconst require = createRequire(import.meta.url)\nconst sdkProvider = require(\"@supernovaio/sdk\") as typeof sdkTypes\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Definition\n\ninterface DescribeWorkspacesFlags {\n apiKey: string\n proxyUrl?: string\n}\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Configuration\n\nconst DescribeWorkspaceConfigSchema = z\n .object({\n apiKey: z.string(),\n proxyUrl: z.string().url().optional(),\n workspaceId: z.string(),\n })\n .transform(data => ({\n ...data,\n }))\n\ntype DescribeWorkspaceConfig = z.infer<typeof DescribeWorkspaceConfigSchema>\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Tool implementation\n\n/** Command that describes the structure of provided design system */\nexport class DescribeWorkspaces extends SentryCommand<DescribeWorkspaceConfig> {\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command configuration\n\n // How this command can be run\n static aliases = [\"describe-workspaces\"]\n // Command help description\n static description =\n \"Describe structure of all workspaces and design systems available under those workspaces available for specified API key\"\n // Examples how to use the command\n static examples = [`$ @supernovaio/cli describe-workspaces --apiKey=\"{xxx-xxx-xxx}\"`]\n // Static flags to enable / disable features\n static flags = {\n ...commonFlags,\n apiKey: Flags.string({ description: \"API key to use for accessing Supernova instance\", required: true }),\n proxyUrl: Flags.string({\n description: \"When set, CLI will use provided proxy URL for all requests\",\n hidden: true,\n required: false,\n }),\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command runtime\n\n get commandId(): string {\n return DescribeWorkspaces.id\n }\n\n get configSchema(): ZodType<DescribeWorkspaceConfig> {\n return DescribeWorkspaceConfigSchema\n }\n\n @SentryTraced()\n async getWorkspaces(flags: DescribeWorkspacesFlags): Promise<{\n instance: sdkTypes.Supernova\n workspaces: Array<sdkTypes.Workspace>\n }> {\n if (!flags.apiKey || flags.apiKey.length === 0) {\n throw new Error(`API key must not be empty`)\n }\n\n // Create instance for prod / dev\n const apiUrl = apiUrlForEnvironment(getTargetEnv())\n const sdkInstance = new sdkProvider.Supernova(flags.apiKey, {\n apiUrl,\n })\n const user = await sdkInstance.me.me()\n const workspaces = await sdkInstance.workspaces.workspaces(user.id)\n return {\n instance: sdkInstance,\n workspaces,\n }\n }\n\n @SentryTraced()\n async run(): Promise<void> {\n const { flags } = await this.parse(DescribeWorkspaces)\n\n // Get workspaces\n const { instance, workspaces } = await this.getWorkspaces(flags)\n this.log(`\\n`)\n\n for (const workspace of workspaces) {\n // Get design systems and log\n const designSystems = await instance.designSystems.designSystems(workspace.id)\n this.log(`↳ Workspace \"${workspace.profile.name}\", id: ${workspace.id}`.magenta)\n for (const designSystem of designSystems) {\n this.log(` ↳ Design system \"${designSystem.name}\", id: ${designSystem.id}`.cyan)\n\n const version = await instance.versions.getActiveVersion(designSystem.id)\n if (!version) {\n this.log(`Design system ${designSystem.id} active version not found or not available under provided API key`)\n continue\n }\n\n const id: sdkTypes.RemoteVersionIdentifier = { designSystemId: designSystem.id, versionId: version.id }\n const brands = await instance.brands.getBrands(id)\n const themes = await instance.tokens.getTokenThemes(id)\n for (const brand of brands) {\n this.log(` ↳ Brand: \"${brand.name}\", id: ${brand.id}`)\n const brandThemes = themes.filter(t => t.brandId === brand.id)\n if (brandThemes.length > 0) {\n // eslint-disable-next-line max-depth\n for (const theme of brandThemes) {\n this.log(` ↳ Theme: \"${theme.name}\", id: ${theme.id}`.gray)\n }\n } else {\n this.log(` ↳ No themes defined in this brand`.gray)\n }\n }\n }\n }\n\n this.log(\"\\nDone\".green)\n }\n}\n"]}
|
|
@@ -24,7 +24,7 @@ declare const PublishDocumentationConfigSchema: z.ZodObject<{
|
|
|
24
24
|
}>;
|
|
25
25
|
type PublishDocumentationConfig = z.infer<typeof PublishDocumentationConfigSchema>;
|
|
26
26
|
export declare class PublishDocumentation extends SentryCommand<PublishDocumentationConfig> {
|
|
27
|
-
static aliases: [
|
|
27
|
+
static aliases: string[];
|
|
28
28
|
static description: string;
|
|
29
29
|
static examples: string[];
|
|
30
30
|
static flags: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-documentation.d.ts","sourceRoot":"","sources":["../../src/commands/publish-documentation.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAUjD,QAAA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;EAOpC,CAAA;AAEF,KAAK,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAMlF,qBAAa,oBAAqB,SAAQ,aAAa,CAAC,0BAA0B,CAAC;IAKjF,MAAM,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"publish-documentation.d.ts","sourceRoot":"","sources":["../../src/commands/publish-documentation.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAUjD,QAAA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;EAOpC,CAAA;AAEF,KAAK,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAMlF,qBAAa,oBAAqB,SAAQ,aAAa,CAAC,0BAA0B,CAAC;IAKjF,MAAM,CAAC,OAAO,WAA4B;IAE1C,MAAM,CAAC,WAAW,SAAgD;IAElE,MAAM,CAAC,QAAQ,WAAkG;IAEjH,MAAM,CAAC,KAAK;;;;;;;MAsBX;IAKD,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAEtD;IAGK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAoD3B"}
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { Flags } from "@oclif/core";
|
|
11
11
|
import { SentryTraced } from "@sentry/nestjs";
|
|
12
|
-
import
|
|
12
|
+
import sdkTypes from "@supernovaio/sdk";
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
import { SentryCommand } from "../types/index.js";
|
|
15
15
|
import { sleep } from "../utils/common.js";
|
|
@@ -23,7 +23,7 @@ const PublishDocumentationConfigSchema = z.object({
|
|
|
23
23
|
target: z.string(),
|
|
24
24
|
});
|
|
25
25
|
export class PublishDocumentation extends SentryCommand {
|
|
26
|
-
static aliases;
|
|
26
|
+
static aliases = ["publish-documentation"];
|
|
27
27
|
static description = "Publish latest version of the documentation";
|
|
28
28
|
static examples = [`$ @supernovaio/cli publish-documentation --apiKey="{xxx-xxx-xxx}" --designSystemId="{1234}"`];
|
|
29
29
|
static flags = {
|
|
@@ -63,10 +63,7 @@ export class PublishDocumentation extends SentryCommand {
|
|
|
63
63
|
}
|
|
64
64
|
const { designSystem, id, instance } = await getWritableVersion(flags);
|
|
65
65
|
this.log(`Queueing documentation publish in ${designSystem.name}...`);
|
|
66
|
-
let publishJob = await instance.documentation.publishDrafts(id, environment,
|
|
67
|
-
groupPersistentIds: [],
|
|
68
|
-
pagePersistentIds: [],
|
|
69
|
-
});
|
|
66
|
+
let publishJob = await instance.documentation.publishDrafts(id, environment, undefined);
|
|
70
67
|
this.log(`Documentation queued for publishing`.green);
|
|
71
68
|
if (!flags.awaitPublishJob) {
|
|
72
69
|
this.log(`Documentation publish await is disabled, exiting before the publish is finished.`.yellow);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-documentation.js","sourceRoot":"","sources":["../../src/commands/publish-documentation.ts"],"names":[],"mappings":";;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"publish-documentation.js","sourceRoot":"","sources":["../../src/commands/publish-documentation.ts"],"names":[],"mappings":";;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,QAAQ,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,CAAC,EAAW,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAQpD,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;IAC5B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACrC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAA;AAQF,MAAM,OAAO,oBAAqB,SAAQ,aAAyC;IAKjF,MAAM,CAAC,OAAO,GAAG,CAAC,uBAAuB,CAAC,CAAA;IAE1C,MAAM,CAAC,WAAW,GAAG,6CAA6C,CAAA;IAElE,MAAM,CAAC,QAAQ,GAAG,CAAC,6FAA6F,CAAC,CAAA;IAEjH,MAAM,CAAC,KAAK,GAAG;QACb,MA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AAA;YACjD,CAAC;YAED,KAAK,SAAS,CAAC,CAAC,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;YACpD,CAAC;YAED,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;YAC/C,CAAC;QACH,CAAC;IACH,CAAC;;AAnDK;IADL,YAAY,EAAE;;;;+CAoDd;AAGH,SAAS,uBAAuB,CAAC,SAAiB;IAChD,QAAQ,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;QAChC,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,OAAO,QAAQ,CAAC,wBAAwB,CAAC,IAAI,CAAA;QAC/C,CAAC;QAED,KAAK,SAAS,CAAC,CAAC,CAAC;YACf,OAAO,QAAQ,CAAC,wBAAwB,CAAC,OAAO,CAAA;QAClD,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACR,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,MAAkC;IACzD,OAAO,CACL,MAAM,KAAK,QAAQ,CAAC,iBAAiB,CAAC,MAAM;QAC5C,MAAM,KAAK,QAAQ,CAAC,iBAAiB,CAAC,OAAO;QAC7C,MAAM,KAAK,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAC9C,CAAA;AACH,CAAC","sourcesContent":["//\n// publish-documentation.ts\n// Supernova CLI\n//\n// Created by Jiri Trecak.\n// Copyright © Supernova.io. All rights reserved.\n//\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Imports\n\nimport { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport sdkTypes from \"@supernovaio/sdk\"\nimport { z, ZodType } from \"zod\"\n\nimport { SentryCommand } from \"../types/index.js\"\nimport { sleep } from \"../utils/common.js\"\nimport { getWritableVersion } from \"../utils/sdk.js\"\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Definition\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Configuration\n\nconst PublishDocumentationConfigSchema = z.object({\n apiKey: z.string(),\n awaitPublishJob: z.boolean(),\n designSystemId: z.string(),\n dev: z.boolean(),\n proxyUrl: z.string().url().optional(),\n target: z.string(),\n})\n\ntype PublishDocumentationConfig = z.infer<typeof PublishDocumentationConfigSchema>\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Tool implementation\n\n/** Command that publishes documentation */\nexport class PublishDocumentation extends SentryCommand<PublishDocumentationConfig> {\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command configuration\n\n // How this command can be run\n static aliases = [\"publish-documentation\"]\n // Command help description\n static description = \"Publish latest version of the documentation\"\n // Examples how to use the command\n static examples = [`$ @supernovaio/cli publish-documentation --apiKey=\"{xxx-xxx-xxx}\" --designSystemId=\"{1234}\"`]\n // Static flags to enable / disable features\n static flags = {\n apiKey: Flags.string({ description: \"API key to use for accessing Supernova instance\", required: true }),\n awaitPublishJob: Flags.boolean({\n default: true,\n description:\n \"Whether to block the process until the publishing is done. \" +\n \"Setting the flag to false will exit with success as long as documentation publish was successfully triggered, \" +\n \"but before the publish is completed. Setting the flag to true will exit once the publish is complete and will \" +\n \"throw if documentation publish is not successful.\",\n }),\n designSystemId: Flags.string({ description: \"Design System to publish the documentation\", required: true }),\n dev: Flags.boolean({ default: false, description: \"When enabled, CLI will target dev server\", hidden: true }),\n proxyUrl: Flags.string({\n description: \"When set, CLI will use provided proxy URL for all requests\",\n hidden: true,\n required: false,\n }),\n target: Flags.string({\n default: \"Live\",\n description: \"Environment to use for publishing: Live or Preview\",\n required: false,\n }),\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command runtime\n\n get commandId(): string {\n return PublishDocumentation.id\n }\n\n get configSchema(): ZodType<PublishDocumentationConfig> {\n return PublishDocumentationConfigSchema\n }\n\n @SentryTraced()\n async run(): Promise<void> {\n const { flags } = await this.parse(PublishDocumentation)\n\n const environment = tryParseDocsEnvironment(flags.target)\n if (!environment) {\n const supportedEnvs = [sdkTypes.DocumentationEnvironment.live, sdkTypes.DocumentationEnvironment.preview]\n this.error(`Unknown target ${flags.target}, must be one of [${supportedEnvs.join(\", \")}]`)\n }\n\n // Get workspace -> design system –> version\n const { designSystem, id, instance } = await getWritableVersion(flags)\n\n this.log(`Queueing documentation publish in ${designSystem.name}...`)\n\n let publishJob = await instance.documentation.publishDrafts(id, environment, undefined)\n\n this.log(`Documentation queued for publishing`.green)\n\n if (!flags.awaitPublishJob) {\n this.log(`Documentation publish await is disabled, exiting before the publish is finished.`.yellow)\n return\n }\n\n this.log(`Waiting for the documentation publish to be finished...`)\n\n // Timeout is roughly 30 minutes\n for (let i = 0; i < 30 * 60; i++) {\n await sleep(1000)\n publishJob = await instance.documentation.getDocumentationBuild(designSystem.workspaceId, publishJob.id)\n if (isJobStatusDone(publishJob.status)) break\n }\n\n switch (publishJob.status) {\n case \"Success\": {\n this.log(\"\\nDone: Documentation queued for publishing\".green)\n\n break\n }\n\n case \"Failed\": {\n throw new Error(`Documentation publish failed`)\n }\n\n case \"Timeout\": {\n throw new Error(`Documentation publish timed out`)\n }\n\n default: {\n throw new Error(`Error awaiting publish job`)\n }\n }\n }\n}\n\nfunction tryParseDocsEnvironment(targetArg: string) {\n switch (targetArg.toLowerCase()) {\n case \"live\": {\n return sdkTypes.DocumentationEnvironment.live\n }\n\n case \"preview\": {\n return sdkTypes.DocumentationEnvironment.preview\n }\n\n default: {\n return null\n }\n }\n}\n\nfunction isJobStatusDone(status: sdkTypes.ExportBuildStatus): boolean {\n return (\n status === sdkTypes.ExportBuildStatus.Failed ||\n status === sdkTypes.ExportBuildStatus.Success ||\n status === sdkTypes.ExportBuildStatus.Timeout\n )\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import pulsarCoreTypes from "@supernova-studio/pulsar-core";
|
|
2
|
+
import pulsarLanguageTypes from "@supernova-studio/pulsar-language";
|
|
3
|
+
import "colors";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { SentryCommand } from "../types/index.js";
|
|
6
|
+
interface RunLocalExporterFlags {
|
|
7
|
+
allowOverridingOutput: boolean;
|
|
8
|
+
apiKey: string;
|
|
9
|
+
brandId?: string;
|
|
10
|
+
designSystemId: string;
|
|
11
|
+
exporterDir: string;
|
|
12
|
+
outputDir: string;
|
|
13
|
+
proxyUrl?: string;
|
|
14
|
+
themeId?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class RunLocalExporter extends SentryCommand<object> {
|
|
17
|
+
static aliases: string[];
|
|
18
|
+
static description: string;
|
|
19
|
+
static examples: string[];
|
|
20
|
+
static flags: {
|
|
21
|
+
allowOverridingOutput: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
22
|
+
apiKey: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
brandId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
|
+
designSystemId: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
|
+
exporterDir: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
|
+
outputDir: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
proxyUrl: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
themeId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
|
+
};
|
|
30
|
+
get commandId(): string;
|
|
31
|
+
get configSchema(): z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
32
|
+
executeExporter(flags: RunLocalExporterFlags, versionId: string): Promise<{
|
|
33
|
+
logger: pulsarLanguageTypes.PLLogger;
|
|
34
|
+
result: Error | pulsarCoreTypes.PCEngineExporterProcessingResult;
|
|
35
|
+
success: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
run(): Promise<void>;
|
|
38
|
+
private downloadFileToMemory;
|
|
39
|
+
private ensureDirectoryExists;
|
|
40
|
+
private logRun;
|
|
41
|
+
private writeToBuildPath;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=run-local-exporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-local-exporter.d.ts","sourceRoot":"","sources":["../../src/commands/run-local-exporter.ts"],"names":[],"mappings":"AAaA,OAAO,eAAe,MAAM,+BAA+B,CAAA;AAE3D,OAAO,mBAAmB,MAAM,mCAAmC,CAAA;AAMnE,OAAO,QAAQ,CAAA;AACf,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAWjD,UAAU,qBAAqB;IAC7B,qBAAqB,EAAE,OAAO,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AASD,qBAAa,gBAAiB,SAAQ,aAAa,CAAC,MAAM,CAAC;IAKzD,MAAM,CAAC,OAAO,WAAyB;IAEvC,MAAM,CAAC,WAAW,SAA+B;IAEjD,MAAM,CAAC,QAAQ,WAUd;IAED,MAAM,CAAC,KAAK;;;;;;;;;MA4BX;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,mDAEf;IAMK,eAAe,CACnB,KAAK,EAAE,qBAAqB,EAC5B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QACT,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAA;QACpC,MAAM,EAAE,KAAK,GAAG,eAAe,CAAC,gCAAgC,CAAA;QAChE,OAAO,EAAE,OAAO,CAAA;KACjB,CAAC;IAyCI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YA4BZ,oBAAoB;IAYlC,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,MAAM;YAgBA,gBAAgB;CAkE/B"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Flags } from "@oclif/core";
|
|
11
|
+
import { SentryTraced } from "@sentry/nestjs";
|
|
12
|
+
import pulsarCoreTypes from "@supernova-studio/pulsar-core";
|
|
13
|
+
import axios from "axios";
|
|
14
|
+
import * as fs from "node:fs";
|
|
15
|
+
import { createRequire } from "node:module";
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import "colors";
|
|
18
|
+
import { z } from "zod";
|
|
19
|
+
import { SentryCommand } from "../types/index.js";
|
|
20
|
+
import { exportConfiguration } from "../utils/run-exporter/exporter-utils.js";
|
|
21
|
+
import { getWritableVersion } from "../utils/sdk.js";
|
|
22
|
+
const require = createRequire(import.meta.url);
|
|
23
|
+
const pulsarCoreProvider = require("@supernova-studio/pulsar-core");
|
|
24
|
+
const pulsarLanguageProvider = require("@supernova-studio/pulsar-language");
|
|
25
|
+
export class RunLocalExporter extends SentryCommand {
|
|
26
|
+
static aliases = ["run-local-exporter"];
|
|
27
|
+
static description = "Run local exporter package";
|
|
28
|
+
static examples = [
|
|
29
|
+
`$ @supernovaio/cli run-local-exporter \
|
|
30
|
+
--apiKey="[API_KEY]" \
|
|
31
|
+
--designSystemId="[DESIGN_SYSTEM_ID]" \
|
|
32
|
+
--themeId="[THEME_ID]" \
|
|
33
|
+
--brandId="[BRAND_ID]" \
|
|
34
|
+
--exporterDir="[./path/to/exporter/dir]" \
|
|
35
|
+
--outputDir="[./path/to/output/dir]" \
|
|
36
|
+
--allowOverridingOutput
|
|
37
|
+
`,
|
|
38
|
+
];
|
|
39
|
+
static flags = {
|
|
40
|
+
allowOverridingOutput: Flags.boolean({
|
|
41
|
+
default: false,
|
|
42
|
+
description: "When enabled, CLI will override output in the output directory if same files where present. When disabled, encountering the same file with throw an error.",
|
|
43
|
+
required: false,
|
|
44
|
+
}),
|
|
45
|
+
apiKey: Flags.string({ description: "API key to use for accessing Supernova instance", required: true }),
|
|
46
|
+
brandId: Flags.string({
|
|
47
|
+
description: "Brand to export. Will only be used when exporter has usesBrands: true, but then it is required to be provided",
|
|
48
|
+
required: false,
|
|
49
|
+
}),
|
|
50
|
+
designSystemId: Flags.string({ description: "Design System to export from", required: true }),
|
|
51
|
+
exporterDir: Flags.string({ description: "Path to exporter package", required: true }),
|
|
52
|
+
outputDir: Flags.string({
|
|
53
|
+
description: "Path to output folder. Must be empty, unless `forceClearOutputDir` is set",
|
|
54
|
+
required: true,
|
|
55
|
+
}),
|
|
56
|
+
proxyUrl: Flags.string({
|
|
57
|
+
description: "When set, CLI will use provided proxy URL for all requests",
|
|
58
|
+
hidden: true,
|
|
59
|
+
required: false,
|
|
60
|
+
}),
|
|
61
|
+
themeId: Flags.string({
|
|
62
|
+
description: "Theme to export. Will only be used when exporter has usesThemes: true, and is optional",
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
get commandId() {
|
|
67
|
+
return RunLocalExporter.id;
|
|
68
|
+
}
|
|
69
|
+
get configSchema() {
|
|
70
|
+
return z.object({});
|
|
71
|
+
}
|
|
72
|
+
async executeExporter(flags, versionId) {
|
|
73
|
+
const logger = new pulsarLanguageProvider.PLLogger();
|
|
74
|
+
const pulsarEngine = new pulsarCoreProvider.PCPulsar(pulsarCoreTypes.PCPulsarExporterMode.full, logger);
|
|
75
|
+
try {
|
|
76
|
+
await pulsarEngine.initiateWithLocalFolderURL(flags.exporterDir, pulsarCoreTypes.PCExporterEnvironment.ci);
|
|
77
|
+
const config = exportConfiguration({
|
|
78
|
+
apiKey: flags.apiKey,
|
|
79
|
+
brandId: flags.brandId,
|
|
80
|
+
dsId: flags.designSystemId,
|
|
81
|
+
environment: this.env,
|
|
82
|
+
exportPath: flags.exporterDir,
|
|
83
|
+
logger,
|
|
84
|
+
proxyUrl: flags.proxyUrl,
|
|
85
|
+
themeId: flags.themeId,
|
|
86
|
+
versionId,
|
|
87
|
+
});
|
|
88
|
+
const result = await pulsarEngine.executeExporter(config, false);
|
|
89
|
+
return {
|
|
90
|
+
logger,
|
|
91
|
+
result,
|
|
92
|
+
success: true,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
return {
|
|
97
|
+
logger,
|
|
98
|
+
result: error,
|
|
99
|
+
success: false,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async run() {
|
|
104
|
+
const { flags } = await this.parse(RunLocalExporter);
|
|
105
|
+
const { version } = await getWritableVersion(flags);
|
|
106
|
+
const result = await this.executeExporter(flags, version.id);
|
|
107
|
+
if (flags.log) {
|
|
108
|
+
this.logRun(result.logger);
|
|
109
|
+
}
|
|
110
|
+
if (result.success) {
|
|
111
|
+
await this.writeToBuildPath(result.result, flags);
|
|
112
|
+
this.log("Export finished successfully".green);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
this.error(`Export failed: ${result.result.message}`.red, {
|
|
116
|
+
code: "ERR_EXPORT_FAILED",
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async downloadFileToMemory(fileUrl) {
|
|
121
|
+
const response = await axios({
|
|
122
|
+
method: "get",
|
|
123
|
+
responseType: "arraybuffer",
|
|
124
|
+
url: fileUrl,
|
|
125
|
+
});
|
|
126
|
+
return Buffer.from(response.data);
|
|
127
|
+
}
|
|
128
|
+
ensureDirectoryExists(filePath, forceLastFragmentIsDirectory = false) {
|
|
129
|
+
if (forceLastFragmentIsDirectory && !filePath.endsWith("/")) {
|
|
130
|
+
filePath += "/";
|
|
131
|
+
}
|
|
132
|
+
if (fs.existsSync(filePath)) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
fs.mkdirSync(filePath, { recursive: true });
|
|
136
|
+
}
|
|
137
|
+
logRun(logger) {
|
|
138
|
+
for (const log of logger.logs) {
|
|
139
|
+
let message = log.message.trim();
|
|
140
|
+
if (message.startsWith('"')) {
|
|
141
|
+
message = message.slice(1);
|
|
142
|
+
}
|
|
143
|
+
if (message.endsWith('"')) {
|
|
144
|
+
message = message.slice(0, Math.max(0, message.length - 1));
|
|
145
|
+
}
|
|
146
|
+
console.log(`[user]`.gray + message.white);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
async writeToBuildPath(result, flags) {
|
|
150
|
+
if (!fs.existsSync(flags.outputDir)) {
|
|
151
|
+
this.ensureDirectoryExists(flags.outputDir);
|
|
152
|
+
}
|
|
153
|
+
if (!flags.allowOverridingOutput) {
|
|
154
|
+
for (const file of result.emittedFiles) {
|
|
155
|
+
const destination = path.join(flags.outputDir, file.path);
|
|
156
|
+
if (fs.existsSync(destination)) {
|
|
157
|
+
throw new Error(`Exporter produced file for destination ${destination} but that file already exists. Enable --allowOverridingOutput option to allow overriding`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const filesToWrite = [];
|
|
162
|
+
const processFile = async (file) => {
|
|
163
|
+
const filePath = path.join(flags.outputDir, ...file.path.split("/"));
|
|
164
|
+
const fileDirectory = path.dirname(filePath);
|
|
165
|
+
this.ensureDirectoryExists(fileDirectory);
|
|
166
|
+
switch (file.type) {
|
|
167
|
+
case "copy_file": {
|
|
168
|
+
const fileContent = fs.readFileSync(file.content);
|
|
169
|
+
filesToWrite.push({ content: fileContent, filePath });
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
case "copy_file_remote": {
|
|
173
|
+
const fileContent = await this.downloadFileToMemory(file.content);
|
|
174
|
+
filesToWrite.push({ content: fileContent, filePath });
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
case "string": {
|
|
178
|
+
filesToWrite.push({ content: file.content, filePath });
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
const chunkSize = 4;
|
|
184
|
+
for (let i = 0; i < result.emittedFiles.length; i += chunkSize) {
|
|
185
|
+
const chunk = result.emittedFiles.slice(i, i + chunkSize);
|
|
186
|
+
await Promise.all(chunk.map(file => processFile(file)));
|
|
187
|
+
}
|
|
188
|
+
for (const { content, filePath } of filesToWrite) {
|
|
189
|
+
fs.writeFileSync(filePath, content);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
__decorate([
|
|
194
|
+
SentryTraced(),
|
|
195
|
+
__metadata("design:type", Function),
|
|
196
|
+
__metadata("design:paramtypes", [Object, String]),
|
|
197
|
+
__metadata("design:returntype", Promise)
|
|
198
|
+
], RunLocalExporter.prototype, "executeExporter", null);
|
|
199
|
+
__decorate([
|
|
200
|
+
SentryTraced(),
|
|
201
|
+
__metadata("design:type", Function),
|
|
202
|
+
__metadata("design:paramtypes", []),
|
|
203
|
+
__metadata("design:returntype", Promise)
|
|
204
|
+
], RunLocalExporter.prototype, "run", null);
|
|
205
|
+
__decorate([
|
|
206
|
+
SentryTraced(),
|
|
207
|
+
__metadata("design:type", Function),
|
|
208
|
+
__metadata("design:paramtypes", [String]),
|
|
209
|
+
__metadata("design:returntype", Promise)
|
|
210
|
+
], RunLocalExporter.prototype, "downloadFileToMemory", null);
|
|
211
|
+
__decorate([
|
|
212
|
+
SentryTraced(),
|
|
213
|
+
__metadata("design:type", Function),
|
|
214
|
+
__metadata("design:paramtypes", [String, Boolean]),
|
|
215
|
+
__metadata("design:returntype", void 0)
|
|
216
|
+
], RunLocalExporter.prototype, "ensureDirectoryExists", null);
|
|
217
|
+
__decorate([
|
|
218
|
+
SentryTraced(),
|
|
219
|
+
__metadata("design:type", Function),
|
|
220
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
221
|
+
__metadata("design:returntype", Promise)
|
|
222
|
+
], RunLocalExporter.prototype, "writeToBuildPath", null);
|
|
223
|
+
//# sourceMappingURL=run-local-exporter.js.map
|