@supernovaio/cli 2.0.0 → 2.0.2

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.
@@ -1 +1 @@
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,UAAQ;IAE9B,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAElD;IAGY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8ClC"}
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"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="251fef71-db0e-5d5c-9a6d-86f98501fcc1")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="dda062fb-0b36-5132-9203-226cc0521c4b")}catch(e){}}();
3
3
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
4
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
5
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -46,7 +46,7 @@ export default class ImportComponents extends SentryCommand {
46
46
  }),
47
47
  versionId: Flags.string({ description: "Import code components to version of", required: true }),
48
48
  };
49
- static hidden = false;
49
+ static hidden = true;
50
50
  get commandId() {
51
51
  return ImportComponents.id;
52
52
  }
@@ -99,4 +99,4 @@ __decorate([
99
99
  __metadata("design:returntype", Promise)
100
100
  ], ImportComponents.prototype, "run", null);
101
101
  //# sourceMappingURL=components-import.js.map
102
- //# debugId=251fef71-db0e-5d5c-9a6d-86f98501fcc1
102
+ //# debugId=dda062fb-0b36-5132-9203-226cc0521c4b
@@ -1 +1 @@
1
- {"version":3,"file":"components-import.js","sources":["../../src/commands/components-import.ts"],"sourceRoot":"","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 = false\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"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,CAAC,EAAW,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,MAAM,4BAA4B,GAAG,CAAC;KACnC,MAAM,CAAC;IACN,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,MA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AAA;QACrD,CAAC;IACH,CAAC;;AA7CY;IADZ,YAAY,EAAE;;;;2CA8Cd","debug_id":"251fef71-db0e-5d5c-9a6d-86f98501fcc1"}
1
+ {"version":3,"file":"components-import.js","sources":["../../src/commands/components-import.ts"],"sourceRoot":"","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"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,CAAC,EAAW,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,MAAM,4BAA4B,GAAG,CAAC;KACnC,MAAM,CAAC;IACN,cAAc,EAAE,CAAC,CAAC,MAAM,EA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AChE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,mCAAmC,CAAC,KAAK,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;;AA7CY;IADZ,YAAY,EAAE;;;;2CA8Cd","debug_id":"dda062fb-0b36-5132-9203-226cc0521c4b"}
@@ -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,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;CAuD3B"}
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"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c4b4f484-adda-596b-b32f-16bc0d7f8e8f")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9ccd262f-d9ef-5fd7-86ce-fee162b22a5b")}catch(e){}}();
3
3
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
4
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
5
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  };
12
12
  import { Flags } from "@oclif/core";
13
13
  import { SentryTraced } from "@sentry/nestjs";
14
- import * as sdkTypes from "@supernovaio/sdk";
14
+ import sdkTypes from "@supernovaio/sdk";
15
15
  import { z } from "zod";
16
16
  import { SentryCommand } from "../types/index.js";
17
17
  import { sleep } from "../utils/common.js";
@@ -65,10 +65,7 @@ export class PublishDocumentation extends SentryCommand {
65
65
  }
66
66
  const { designSystem, id, instance } = await getWritableVersion(flags);
67
67
  this.log(`Queueing documentation publish in ${designSystem.name}...`);
68
- let publishJob = await instance.documentation.publishDrafts(id, environment, {
69
- groupPersistentIds: [],
70
- pagePersistentIds: [],
71
- });
68
+ let publishJob = await instance.documentation.publishDrafts(id, environment, undefined);
72
69
  this.log(`Documentation queued for publishing`.green);
73
70
  if (!flags.awaitPublishJob) {
74
71
  this.log(`Documentation publish await is disabled, exiting before the publish is finished.`.yellow);
@@ -123,4 +120,4 @@ function isJobStatusDone(status) {
123
120
  status === sdkTypes.ExportBuildStatus.Timeout);
124
121
  }
125
122
  //# sourceMappingURL=publish-documentation.js.map
126
- //# debugId=c4b4f484-adda-596b-b32f-16bc0d7f8e8f
123
+ //# debugId=9ccd262f-d9ef-5fd7-86ce-fee162b22a5b
@@ -1 +1 @@
1
- {"version":3,"file":"publish-documentation.js","sources":["../../src/commands/publish-documentation.ts"],"sourceRoot":"","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 * as 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, {\n groupPersistentIds: [],\n pagePersistentIds: [],\n })\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"],"names":[],"mappings":";;;;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAA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AAC,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","debug_id":"c4b4f484-adda-596b-b32f-16bc0d7f8e8f"}
1
+ {"version":3,"file":"publish-documentation.js","sources":["../../src/commands/publish-documentation.ts"],"sourceRoot":"","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"],"names":[],"mappings":";;;;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,g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AC,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","debug_id":"9ccd262f-d9ef-5fd7-86ce-fee162b22a5b"}
@@ -1,5 +1,5 @@
1
- import * as pulsarCoreTypes from "@supernova-studio/pulsar-core";
2
- import * as pulsarLanguageTypes from "@supernova-studio/pulsar-language";
1
+ import pulsarCoreTypes from "@supernova-studio/pulsar-core";
2
+ import pulsarLanguageTypes from "@supernova-studio/pulsar-language";
3
3
  import "colors";
4
4
  import { z } from "zod";
5
5
  import { SentryCommand } from "../types/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"run-local-exporter.d.ts","sourceRoot":"","sources":["../../src/commands/run-local-exporter.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,eAAe,MAAM,+BAA+B,CAAA;AAEhE,OAAO,KAAK,mBAAmB,MAAM,mCAAmC,CAAA;AAMxE,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,MAA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;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"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8f71c462-baa9-5925-86b4-c92aeac29c88")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a8c4f73e-02e8-52a9-8859-155cc944878f")}catch(e){}}();
3
3
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
4
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
5
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  };
12
12
  import { Flags } from "@oclif/core";
13
13
  import { SentryTraced } from "@sentry/nestjs";
14
- import * as pulsarCoreTypes from "@supernova-studio/pulsar-core";
14
+ import pulsarCoreTypes from "@supernova-studio/pulsar-core";
15
15
  import axios from "axios";
16
16
  import * as fs from "node:fs";
17
17
  import { createRequire } from "node:module";
@@ -223,4 +223,4 @@ __decorate([
223
223
  __metadata("design:returntype", Promise)
224
224
  ], RunLocalExporter.prototype, "writeToBuildPath", null);
225
225
  //# sourceMappingURL=run-local-exporter.js.map
226
- //# debugId=8f71c462-baa9-5925-86b4-c92aeac29c88
226
+ //# debugId=a8c4f73e-02e8-52a9-8859-155cc944878f
@@ -1 +1 @@
1
- {"version":3,"file":"run-local-exporter.js","sources":["../../src/commands/run-local-exporter.ts"],"sourceRoot":"","sourcesContent":["//\n// run-exporter.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 pulsarCoreTypes from \"@supernova-studio/pulsar-core\"\n// eslint-disable-next-line n/no-extraneous-import\nimport * as pulsarLanguageTypes from \"@supernova-studio/pulsar-language\"\nimport axios from \"axios\"\nimport * as fs from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport path from \"node:path\"\n// eslint-disable-next-line no-restricted-imports\nimport \"colors\"\nimport { z } from \"zod\"\n\nimport { SentryCommand } from \"../types/index.js\"\nimport { exportConfiguration } from \"../utils/run-exporter/exporter-utils.js\"\nimport { getWritableVersion } from \"../utils/sdk.js\"\n\nconst require = createRequire(import.meta.url)\nconst pulsarCoreProvider = require(\"@supernova-studio/pulsar-core\") as typeof pulsarCoreTypes\nconst pulsarLanguageProvider = require(\"@supernova-studio/pulsar-language\") as typeof pulsarLanguageTypes\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Definition\n\ninterface RunLocalExporterFlags {\n allowOverridingOutput: boolean\n apiKey: string\n brandId?: string\n designSystemId: string\n exporterDir: string\n outputDir: string\n proxyUrl?: string\n themeId?: string\n}\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Configuration\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Tool implementation\n\n/** Command that describes the structure of provided design system */\nexport class RunLocalExporter extends SentryCommand<object> {\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command configuration\n\n // How this command can be run\n static aliases = [\"run-local-exporter\"]\n // Command help description\n static description = \"Run local exporter package\"\n // Examples how to use the command\n static examples = [\n `$ @supernovaio/cli run-local-exporter \\\n --apiKey=\"[API_KEY]\" \\\n --designSystemId=\"[DESIGN_SYSTEM_ID]\" \\\n --themeId=\"[THEME_ID]\" \\\n --brandId=\"[BRAND_ID]\" \\\n --exporterDir=\"[./path/to/exporter/dir]\" \\\n --outputDir=\"[./path/to/output/dir]\" \\\n --allowOverridingOutput\n `,\n ]\n // Static flags to enable / disable features\n static flags = {\n allowOverridingOutput: Flags.boolean({\n default: false,\n description:\n \"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.\",\n required: false,\n }),\n apiKey: Flags.string({ description: \"API key to use for accessing Supernova instance\", required: true }),\n brandId: Flags.string({\n description:\n \"Brand to export. Will only be used when exporter has usesBrands: true, but then it is required to be provided\",\n required: false,\n }),\n designSystemId: Flags.string({ description: \"Design System to export from\", required: true }),\n exporterDir: Flags.string({ description: \"Path to exporter package\", required: true }),\n outputDir: Flags.string({\n description: \"Path to output folder. Must be empty, unless `forceClearOutputDir` is set\",\n required: true,\n }),\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 themeId: Flags.string({\n description: \"Theme to export. Will only be used when exporter has usesThemes: true, and is optional\",\n required: false,\n }),\n }\n\n get commandId(): string {\n return RunLocalExporter.id\n }\n\n get configSchema() {\n return z.object({})\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command runtime\n\n @SentryTraced()\n async executeExporter(\n flags: RunLocalExporterFlags,\n versionId: string,\n ): Promise<{\n logger: pulsarLanguageTypes.PLLogger\n result: Error | pulsarCoreTypes.PCEngineExporterProcessingResult\n success: boolean\n }> {\n // Log engine\n const logger = new pulsarLanguageProvider.PLLogger()\n\n // Initialize pulsar engine and export\n const pulsarEngine = new pulsarCoreProvider.PCPulsar(pulsarCoreTypes.PCPulsarExporterMode.full, logger)\n try {\n // Load pulsar with local URL\n await pulsarEngine.initiateWithLocalFolderURL(flags.exporterDir, pulsarCoreTypes.PCExporterEnvironment.ci)\n\n // Prepare configuration\n const config = exportConfiguration({\n apiKey: flags.apiKey,\n brandId: flags.brandId,\n dsId: flags.designSystemId,\n environment: this.env,\n exportPath: flags.exporterDir,\n logger,\n proxyUrl: flags.proxyUrl,\n themeId: flags.themeId,\n versionId,\n })\n\n // Set logo overrides\n const result = await pulsarEngine.executeExporter(config, false)\n return {\n logger,\n result,\n success: true,\n }\n } catch (error) {\n // Return error\n return {\n logger,\n result: error as Error,\n success: false,\n }\n }\n }\n\n @SentryTraced()\n async run(): Promise<void> {\n const { flags } = await this.parse(RunLocalExporter)\n\n // Execute exporter\n // Get workspace -> design system –> version\n const { version } = await getWritableVersion(flags)\n const result = await this.executeExporter(flags, version.id)\n\n // Log user logs from the execution\n // Note this is currently not used because console.log is directly routed to the stdout and we have no control over it. Pulsar must be updated before this is doable\n if (flags.log) {\n this.logRun(result.logger)\n }\n\n if (result.success) {\n // Write result to output\n await this.writeToBuildPath(result.result as pulsarCoreTypes.PCEngineExporterProcessingResult, flags)\n this.log(\"Export finished successfully\".green)\n } else {\n // Catch write error\n this.error(`Export failed: ${(result.result as Error).message}`.red, {\n code: \"ERR_EXPORT_FAILED\",\n })\n }\n }\n\n /** Download file into memory using Axios */\n @SentryTraced()\n private async downloadFileToMemory(fileUrl: string): Promise<Buffer> {\n const response = await axios({\n method: \"get\",\n responseType: \"arraybuffer\",\n url: fileUrl,\n })\n\n return Buffer.from(response.data)\n }\n\n /** Ensure directory exists - if it doesn't create it, recursively */\n @SentryTraced()\n private ensureDirectoryExists(filePath: string, forceLastFragmentIsDirectory: boolean = false) {\n // If the last fragment of path is forced, even paths without / are treated as dirs\n if (forceLastFragmentIsDirectory && !filePath.endsWith(\"/\")) {\n filePath += \"/\"\n }\n\n // Only make directory if it doesn't exist\n if (fs.existsSync(filePath)) {\n return\n }\n\n fs.mkdirSync(filePath, { recursive: true })\n }\n\n /** Log run to output */\n private logRun(logger: pulsarLanguageTypes.PLLogger) {\n for (const log of logger.logs) {\n let message = log.message.trim()\n if (message.startsWith('\"')) {\n message = message.slice(1)\n }\n\n if (message.endsWith('\"')) {\n message = message.slice(0, Math.max(0, message.length - 1))\n }\n\n console.log(`[user]`.gray + message.white)\n }\n }\n\n @SentryTraced()\n private async writeToBuildPath(\n result: pulsarCoreTypes.PCEngineExporterProcessingResult,\n flags: RunLocalExporterFlags,\n ) {\n // Create build directory if it doesn't exist, otherwise keep as it is. It should never be deleted!\n if (!fs.existsSync(flags.outputDir)) {\n this.ensureDirectoryExists(flags.outputDir)\n }\n\n // If overriding is disabled, test every possible file and if it exists, throw an error\n if (!flags.allowOverridingOutput) {\n for (const file of result.emittedFiles) {\n const destination = path.join(flags.outputDir, file.path)\n if (fs.existsSync(destination)) {\n throw new Error(\n `Exporter produced file for destination ${destination} but that file already exists. Enable --allowOverridingOutput option to allow overriding`,\n )\n }\n }\n }\n\n // Temporary structure to hold file contents\n const filesToWrite: { content: Buffer | string; filePath: string }[] = []\n\n // Function to process a single file\n const processFile = async (file: pulsarCoreTypes.PCEngineFileDescriptor) => {\n const filePath = path.join(flags.outputDir, ...file.path.split(\"/\"))\n const fileDirectory = path.dirname(filePath)\n this.ensureDirectoryExists(fileDirectory)\n\n switch (file.type) {\n case \"copy_file\": {\n const fileContent = fs.readFileSync(file.content)\n filesToWrite.push({ content: fileContent, filePath })\n\n break\n }\n\n case \"copy_file_remote\": {\n const fileContent = await this.downloadFileToMemory(file.content)\n filesToWrite.push({ content: fileContent, filePath })\n\n break\n }\n\n case \"string\": {\n filesToWrite.push({ content: file.content, filePath })\n\n break\n }\n // No default\n }\n }\n\n // Process all files in chunks to speed up the process\n const chunkSize = 4\n for (let i = 0; i < result.emittedFiles.length; i += chunkSize) {\n const chunk = result.emittedFiles.slice(i, i + chunkSize)\n await Promise.all(chunk.map(file => processFile(file)))\n }\n\n // Write all files from the temporary structure to the filesystem as a final step - this is to avoid partial writes\n for (const { content, filePath } of filesToWrite) {\n fs.writeFileSync(filePath, content)\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,eAAe,MAAM,+BAA+B,CAAA;AAGhE,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,QAAQ,CAAA;AACf,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,MAA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AE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAA;oBAEtD,MAAK;gBACP,CAAC;YAEH,CAAC;QACH,CAAC,CAAA;QAGD,MAAM,SAAS,GAAG,CAAC,CAAA;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;YAC/D,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAA;YACzD,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACzD,CAAC;QAGD,KAAK,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,YAAY,EAAE,CAAC;YACjD,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACrC,CAAC;IACH,CAAC;;AAxLK;IADL,YAAY,EAAE;;;;uDA8Cd;AAGK;IADL,YAAY,EAAE;;;;2CAyBd;AAIa;IADb,YAAY,EAAE;;;;4DASd;AAIO;IADP,YAAY,EAAE;;;;6DAad;AAmBa;IADb,YAAY,EAAE;;;;wDAkEd","debug_id":"8f71c462-baa9-5925-86b4-c92aeac29c88"}
1
+ {"version":3,"file":"run-local-exporter.js","sources":["../../src/commands/run-local-exporter.ts"],"sourceRoot":"","sourcesContent":["//\n// run-exporter.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 pulsarCoreTypes from \"@supernova-studio/pulsar-core\"\n// eslint-disable-next-line n/no-extraneous-import\nimport pulsarLanguageTypes from \"@supernova-studio/pulsar-language\"\nimport axios from \"axios\"\nimport * as fs from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport path from \"node:path\"\n// eslint-disable-next-line no-restricted-imports\nimport \"colors\"\nimport { z } from \"zod\"\n\nimport { SentryCommand } from \"../types/index.js\"\nimport { exportConfiguration } from \"../utils/run-exporter/exporter-utils.js\"\nimport { getWritableVersion } from \"../utils/sdk.js\"\n\nconst require = createRequire(import.meta.url)\nconst pulsarCoreProvider = require(\"@supernova-studio/pulsar-core\") as typeof pulsarCoreTypes\nconst pulsarLanguageProvider = require(\"@supernova-studio/pulsar-language\") as typeof pulsarLanguageTypes\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Definition\n\ninterface RunLocalExporterFlags {\n allowOverridingOutput: boolean\n apiKey: string\n brandId?: string\n designSystemId: string\n exporterDir: string\n outputDir: string\n proxyUrl?: string\n themeId?: string\n}\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Configuration\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Tool implementation\n\n/** Command that describes the structure of provided design system */\nexport class RunLocalExporter extends SentryCommand<object> {\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command configuration\n\n // How this command can be run\n static aliases = [\"run-local-exporter\"]\n // Command help description\n static description = \"Run local exporter package\"\n // Examples how to use the command\n static examples = [\n `$ @supernovaio/cli run-local-exporter \\\n --apiKey=\"[API_KEY]\" \\\n --designSystemId=\"[DESIGN_SYSTEM_ID]\" \\\n --themeId=\"[THEME_ID]\" \\\n --brandId=\"[BRAND_ID]\" \\\n --exporterDir=\"[./path/to/exporter/dir]\" \\\n --outputDir=\"[./path/to/output/dir]\" \\\n --allowOverridingOutput\n `,\n ]\n // Static flags to enable / disable features\n static flags = {\n allowOverridingOutput: Flags.boolean({\n default: false,\n description:\n \"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.\",\n required: false,\n }),\n apiKey: Flags.string({ description: \"API key to use for accessing Supernova instance\", required: true }),\n brandId: Flags.string({\n description:\n \"Brand to export. Will only be used when exporter has usesBrands: true, but then it is required to be provided\",\n required: false,\n }),\n designSystemId: Flags.string({ description: \"Design System to export from\", required: true }),\n exporterDir: Flags.string({ description: \"Path to exporter package\", required: true }),\n outputDir: Flags.string({\n description: \"Path to output folder. Must be empty, unless `forceClearOutputDir` is set\",\n required: true,\n }),\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 themeId: Flags.string({\n description: \"Theme to export. Will only be used when exporter has usesThemes: true, and is optional\",\n required: false,\n }),\n }\n\n get commandId(): string {\n return RunLocalExporter.id\n }\n\n get configSchema() {\n return z.object({})\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command runtime\n\n @SentryTraced()\n async executeExporter(\n flags: RunLocalExporterFlags,\n versionId: string,\n ): Promise<{\n logger: pulsarLanguageTypes.PLLogger\n result: Error | pulsarCoreTypes.PCEngineExporterProcessingResult\n success: boolean\n }> {\n // Log engine\n const logger = new pulsarLanguageProvider.PLLogger()\n\n // Initialize pulsar engine and export\n const pulsarEngine = new pulsarCoreProvider.PCPulsar(pulsarCoreTypes.PCPulsarExporterMode.full, logger)\n try {\n // Load pulsar with local URL\n await pulsarEngine.initiateWithLocalFolderURL(flags.exporterDir, pulsarCoreTypes.PCExporterEnvironment.ci)\n\n // Prepare configuration\n const config = exportConfiguration({\n apiKey: flags.apiKey,\n brandId: flags.brandId,\n dsId: flags.designSystemId,\n environment: this.env,\n exportPath: flags.exporterDir,\n logger,\n proxyUrl: flags.proxyUrl,\n themeId: flags.themeId,\n versionId,\n })\n\n // Set logo overrides\n const result = await pulsarEngine.executeExporter(config, false)\n return {\n logger,\n result,\n success: true,\n }\n } catch (error) {\n // Return error\n return {\n logger,\n result: error as Error,\n success: false,\n }\n }\n }\n\n @SentryTraced()\n async run(): Promise<void> {\n const { flags } = await this.parse(RunLocalExporter)\n\n // Execute exporter\n // Get workspace -> design system –> version\n const { version } = await getWritableVersion(flags)\n const result = await this.executeExporter(flags, version.id)\n\n // Log user logs from the execution\n // Note this is currently not used because console.log is directly routed to the stdout and we have no control over it. Pulsar must be updated before this is doable\n if (flags.log) {\n this.logRun(result.logger)\n }\n\n if (result.success) {\n // Write result to output\n await this.writeToBuildPath(result.result as pulsarCoreTypes.PCEngineExporterProcessingResult, flags)\n this.log(\"Export finished successfully\".green)\n } else {\n // Catch write error\n this.error(`Export failed: ${(result.result as Error).message}`.red, {\n code: \"ERR_EXPORT_FAILED\",\n })\n }\n }\n\n /** Download file into memory using Axios */\n @SentryTraced()\n private async downloadFileToMemory(fileUrl: string): Promise<Buffer> {\n const response = await axios({\n method: \"get\",\n responseType: \"arraybuffer\",\n url: fileUrl,\n })\n\n return Buffer.from(response.data)\n }\n\n /** Ensure directory exists - if it doesn't create it, recursively */\n @SentryTraced()\n private ensureDirectoryExists(filePath: string, forceLastFragmentIsDirectory: boolean = false) {\n // If the last fragment of path is forced, even paths without / are treated as dirs\n if (forceLastFragmentIsDirectory && !filePath.endsWith(\"/\")) {\n filePath += \"/\"\n }\n\n // Only make directory if it doesn't exist\n if (fs.existsSync(filePath)) {\n return\n }\n\n fs.mkdirSync(filePath, { recursive: true })\n }\n\n /** Log run to output */\n private logRun(logger: pulsarLanguageTypes.PLLogger) {\n for (const log of logger.logs) {\n let message = log.message.trim()\n if (message.startsWith('\"')) {\n message = message.slice(1)\n }\n\n if (message.endsWith('\"')) {\n message = message.slice(0, Math.max(0, message.length - 1))\n }\n\n console.log(`[user]`.gray + message.white)\n }\n }\n\n @SentryTraced()\n private async writeToBuildPath(\n result: pulsarCoreTypes.PCEngineExporterProcessingResult,\n flags: RunLocalExporterFlags,\n ) {\n // Create build directory if it doesn't exist, otherwise keep as it is. It should never be deleted!\n if (!fs.existsSync(flags.outputDir)) {\n this.ensureDirectoryExists(flags.outputDir)\n }\n\n // If overriding is disabled, test every possible file and if it exists, throw an error\n if (!flags.allowOverridingOutput) {\n for (const file of result.emittedFiles) {\n const destination = path.join(flags.outputDir, file.path)\n if (fs.existsSync(destination)) {\n throw new Error(\n `Exporter produced file for destination ${destination} but that file already exists. Enable --allowOverridingOutput option to allow overriding`,\n )\n }\n }\n }\n\n // Temporary structure to hold file contents\n const filesToWrite: { content: Buffer | string; filePath: string }[] = []\n\n // Function to process a single file\n const processFile = async (file: pulsarCoreTypes.PCEngineFileDescriptor) => {\n const filePath = path.join(flags.outputDir, ...file.path.split(\"/\"))\n const fileDirectory = path.dirname(filePath)\n this.ensureDirectoryExists(fileDirectory)\n\n switch (file.type) {\n case \"copy_file\": {\n const fileContent = fs.readFileSync(file.content)\n filesToWrite.push({ content: fileContent, filePath })\n\n break\n }\n\n case \"copy_file_remote\": {\n const fileContent = await this.downloadFileToMemory(file.content)\n filesToWrite.push({ content: fileContent, filePath })\n\n break\n }\n\n case \"string\": {\n filesToWrite.push({ content: file.content, filePath })\n\n break\n }\n // No default\n }\n }\n\n // Process all files in chunks to speed up the process\n const chunkSize = 4\n for (let i = 0; i < result.emittedFiles.length; i += chunkSize) {\n const chunk = result.emittedFiles.slice(i, i + chunkSize)\n await Promise.all(chunk.map(file => processFile(file)))\n }\n\n // Write all files from the temporary structure to the filesystem as a final step - this is to avoid partial writes\n for (const { content, filePath } of filesToWrite) {\n fs.writeFileSync(filePath, content)\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,eAAe,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
5
  export declare function authUrlForEnvironment(env: TargetEnv): string;
6
6
  export declare function storybookUrlForEnvironment(env: TargetEnv): string;
7
7
  export declare function apiHostForEnvironment(env: TargetEnv): string;
8
- export declare function apiUrlForEnvironment(env: TargetEnv): string;
8
+ export declare function apiUrlForEnvironment(env: TargetEnv, version?: string): string;
9
9
  //# sourceMappingURL=environment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/types/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,SAAS,sEAAwB,CAAA;AAC9C,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAOjD,wBAAgB,YAAY,IAAI,SAAS,CAkBxC;AAUD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAE5D;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAajE;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAa5D;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,SAAS,UAElD"}
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/types/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,SAAS,sEAAwB,CAAA;AAC9C,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAOjD,wBAAgB,YAAY,IAAI,SAAS,CAkBxC;AAUD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAE5D;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAajE;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAa5D;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,SAAQ,UAEnE"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2af79d4c-ae8e-50ef-b9b8-8c0838c50a93")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="af468e50-9d68-5eb5-8f11-468ade254f2f")}catch(e){}}();
3
3
  import { z } from "zod";
4
4
  const allTargetEnvs = ["demo", "development", "local", "production", "staging"];
5
5
  export const TargetEnv = z.enum(allTargetEnvs);
@@ -61,8 +61,8 @@ export function apiHostForEnvironment(env) {
61
61
  return "api.staging.supernova.io";
62
62
  }
63
63
  }
64
- export function apiUrlForEnvironment(env) {
65
- return `https://${apiHostForEnvironment(env)}`;
64
+ export function apiUrlForEnvironment(env, version = "/v2") {
65
+ return `https://${apiHostForEnvironment(env)}/api${version ?? ''}`;
66
66
  }
67
67
  function getLocalStageName() {
68
68
  const parseResult = z.string().safeParse(process.env.SUPERNOVA_STAGE_NAME);
@@ -72,4 +72,4 @@ function getLocalStageName() {
72
72
  return parseResult.data;
73
73
  }
74
74
  //# sourceMappingURL=environment.js.map
75
- //# debugId=2af79d4c-ae8e-50ef-b9b8-8c0838c50a93
75
+ //# debugId=af468e50-9d68-5eb5-8f11-468ade254f2f
@@ -1 +1 @@
1
- {"version":3,"file":"environment.js","sources":["../../src/types/environment.ts"],"sourceRoot":"","sourcesContent":["import { z } from \"zod\"\n\nconst allTargetEnvs = [\"demo\", \"development\", \"local\", \"production\", \"staging\"] as const\n\nexport const TargetEnv = z.enum(allTargetEnvs)\nexport type TargetEnv = z.infer<typeof TargetEnv>\n\nconst DevTargetEnvAlias = z.enum([\"dev\", \"develop\"])\nconst StagingTargetEnvAlias = z.enum([\"stg\"])\n\nconst defaultTargetEnv: TargetEnv = \"production\"\n\nexport function getTargetEnv(): TargetEnv {\n if (process.env.SUPERNOVA_ENV) {\n const raw = process.env.SUPERNOVA_ENV.toLowerCase()\n\n const baseParseResult = TargetEnv.safeParse(raw)\n if (baseParseResult.success) return baseParseResult.data\n\n const devAliasParseResult = DevTargetEnvAlias.safeParse(raw)\n if (devAliasParseResult.success) return \"development\"\n\n const stgAliasParseResult = StagingTargetEnvAlias.safeParse(raw)\n if (stgAliasParseResult.success) return \"staging\"\n\n console.warn(`Incorrect value of SUPERNOVA_ENV variable, allowed options are: [${allTargetEnvs.join(\",\")}] `)\n console.warn(`Using defaut env instead (${defaultTargetEnv})`)\n }\n\n return defaultTargetEnv\n}\n\nconst authServerUrlMap: Record<TargetEnv, string> = {\n demo: \"https://auth-2.demo.supernova.io/api/plugin-oauth\",\n development: \"https://auth-2.dev.supernova.io/api/plugin-oauth\",\n local: `https://auth-2.dev.supernova.io/api/plugin-oauth`,\n production: \"https://auth-2.supernova.io/api/plugin-oauth\",\n staging: \"https://auth-2.staging.supernova.io/api/plugin-oauth\",\n}\n\nexport function authUrlForEnvironment(env: TargetEnv): string {\n return authServerUrlMap[env]\n}\n\nexport function storybookUrlForEnvironment(env: TargetEnv): string {\n switch (env) {\n case \"demo\":\n return \"https://storybook.demo.sst.supernova.io\"\n case \"development\":\n return \"https://storybook.dev.supernova.io\"\n case \"local\":\n return `https://storybook.${getLocalStageName()}.sst.supernova.io`\n case \"production\":\n return \"https://storybook.supernova.io\"\n case \"staging\":\n return \"https://storybook.staging.supernova.io\"\n }\n}\n\nexport function apiHostForEnvironment(env: TargetEnv): string {\n switch (env) {\n case \"demo\":\n return \"api.demo.supernova.io\"\n case \"development\":\n return \"api.dev.supernova.io\"\n case \"local\":\n return `api-5.${getLocalStageName()}.sst.supernova.io`\n case \"production\":\n return \"api.supernova.io\"\n case \"staging\":\n return \"api.staging.supernova.io\"\n }\n}\n\nexport function apiUrlForEnvironment(env: TargetEnv) {\n return `https://${apiHostForEnvironment(env)}`\n}\n\nfunction getLocalStageName() {\n const parseResult = z.string().safeParse(process.env.SUPERNOVA_STAGE_NAME)\n if (!parseResult.success) {\n throw new Error(`To use local environment, SUPERNOVA_STAGE_NAME variable must be set`)\n }\n\n return parseResult.data\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,CAAU,CAAA;AAExF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AAG9C,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAA;AACpD,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;AAE7C,MAAM,gBAAgB,GAAc,YAAY,CAAA;AAEhD,MAAM,UAAU,YAAY;IAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,EAAE,CAAA;QAEnD,MAAM,eAAe,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QAChD,IAAI,eAAe,CAAC,OAAO;YAAE,OAAO,eAAe,CAAC,IAAI,CAAA;QAExD,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QAC5D,IAAI,mBAAmB,CAAC,OAAO;YAAE,OAAO,aAAa,CAAA;QAErD,MAAM,mBAAmB,GAAG,qBAA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ACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAc;IACjD,OAAO,WAAW,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAA;AAChD,CAAC;AAED,SAAS,iBAAiB;IACxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;IAC1E,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAA;IACxF,CAAC;IAED,OAAO,WAAW,CAAC,IAAI,CAAA;AACzB,CAAC","debug_id":"2af79d4c-ae8e-50ef-b9b8-8c0838c50a93"}
1
+ {"version":3,"file":"environment.js","sources":["../../src/types/environment.ts"],"sourceRoot":"","sourcesContent":["import { z } from \"zod\"\n\nconst allTargetEnvs = [\"demo\", \"development\", \"local\", \"production\", \"staging\"] as const\n\nexport const TargetEnv = z.enum(allTargetEnvs)\nexport type TargetEnv = z.infer<typeof TargetEnv>\n\nconst DevTargetEnvAlias = z.enum([\"dev\", \"develop\"])\nconst StagingTargetEnvAlias = z.enum([\"stg\"])\n\nconst defaultTargetEnv: TargetEnv = \"production\"\n\nexport function getTargetEnv(): TargetEnv {\n if (process.env.SUPERNOVA_ENV) {\n const raw = process.env.SUPERNOVA_ENV.toLowerCase()\n\n const baseParseResult = TargetEnv.safeParse(raw)\n if (baseParseResult.success) return baseParseResult.data\n\n const devAliasParseResult = DevTargetEnvAlias.safeParse(raw)\n if (devAliasParseResult.success) return \"development\"\n\n const stgAliasParseResult = StagingTargetEnvAlias.safeParse(raw)\n if (stgAliasParseResult.success) return \"staging\"\n\n console.warn(`Incorrect value of SUPERNOVA_ENV variable, allowed options are: [${allTargetEnvs.join(\",\")}] `)\n console.warn(`Using defaut env instead (${defaultTargetEnv})`)\n }\n\n return defaultTargetEnv\n}\n\nconst authServerUrlMap: Record<TargetEnv, string> = {\n demo: \"https://auth-2.demo.supernova.io/api/plugin-oauth\",\n development: \"https://auth-2.dev.supernova.io/api/plugin-oauth\",\n local: `https://auth-2.dev.supernova.io/api/plugin-oauth`,\n production: \"https://auth-2.supernova.io/api/plugin-oauth\",\n staging: \"https://auth-2.staging.supernova.io/api/plugin-oauth\",\n}\n\nexport function authUrlForEnvironment(env: TargetEnv): string {\n return authServerUrlMap[env]\n}\n\nexport function storybookUrlForEnvironment(env: TargetEnv): string {\n switch (env) {\n case \"demo\":\n return \"https://storybook.demo.sst.supernova.io\"\n case \"development\":\n return \"https://storybook.dev.supernova.io\"\n case \"local\":\n return `https://storybook.${getLocalStageName()}.sst.supernova.io`\n case \"production\":\n return \"https://storybook.supernova.io\"\n case \"staging\":\n return \"https://storybook.staging.supernova.io\"\n }\n}\n\nexport function apiHostForEnvironment(env: TargetEnv): string {\n switch (env) {\n case \"demo\":\n return \"api.demo.supernova.io\"\n case \"development\":\n return \"api.dev.supernova.io\"\n case \"local\":\n return `api-5.${getLocalStageName()}.sst.supernova.io`\n case \"production\":\n return \"api.supernova.io\"\n case \"staging\":\n return \"api.staging.supernova.io\"\n }\n}\n\nexport function apiUrlForEnvironment(env: TargetEnv, version = \"/v2\") {\n return `https://${apiHostForEnvironment(env)}/api${version ?? ''}`\n}\n\nfunction getLocalStageName() {\n const parseResult = z.string().safeParse(process.env.SUPERNOVA_STAGE_NAME)\n if (!parseResult.success) {\n throw new Error(`To use local environment, SUPERNOVA_STAGE_NAME variable must be set`)\n }\n\n return parseResult.data\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,CAAU,CAAA;AAExF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AAG9C,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,K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,GAAG,EAAE,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,yCAAyC,CAAA;QAClD,KAAK,aAAa;YAChB,OAAO,oCAAoC,CAAA;QAC7C,KAAK,OAAO;YACV,OAAO,qBAAqB,iBAAiB,EAAE,mBAAmB,CAAA;QACpE,KAAK,YAAY;YACf,OAAO,gCAAgC,CAAA;QACzC,KAAK,SAAS;YACZ,OAAO,wCAAwC,CAAA;IACnD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,GAAc;IAClD,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,uBAAuB,CAAA;QAChC,KAAK,aAAa;YAChB,OAAO,sBAAsB,CAAA;QAC/B,KAAK,OAAO;YACV,OAAO,SAAS,iBAAiB,EAAE,mBAAmB,CAAA;QACxD,KAAK,YAAY;YACf,OAAO,kBAAkB,CAAA;QAC3B,KAAK,SAAS;YACZ,OAAO,0BAA0B,CAAA;IACrC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAc,EAAE,OAAO,GAAG,KAAK;IAClE,OAAO,WAAW,qBAAqB,CAAC,GAAG,CAAC,OAAO,OAAO,IAAI,EAAE,EAAE,CAAA;AACpE,CAAC;AAED,SAAS,iBAAiB;IACxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;IAC1E,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAA;IACxF,CAAC;IAED,OAAO,WAAW,CAAC,IAAI,CAAA;AACzB,CAAC","debug_id":"af468e50-9d68-5eb5-8f11-468ade254f2f"}
@@ -1,4 +1,4 @@
1
- import * as sdk from "@supernovaio/sdk";
1
+ import sdk from "@supernovaio/sdk";
2
2
  export declare class FigmaTokensDataLoader {
3
3
  loadConfigFromPath(pathToFile: string): {
4
4
  mapping: sdk.DTPluginToSupernovaMapPack;
@@ -1 +1 @@
1
- {"version":3,"file":"figma-tokens-data-loader.d.ts","sourceRoot":"","sources":["../../src/utils/figma-tokens-data-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAA;AAGvC,qBAAa,qBAAqB;IAChC,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG;QACtC,OAAO,EAAE,GAAG,CAAC,0BAA0B,CAAA;QACvC,QAAQ,EAAE,GAAG,CAAC,2BAA2B,CAAA;KAC1C;IAUD,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAC,8BAA8B;IAcxE,uBAAuB,CAAC,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA4CvF,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAc7D,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,SAAS;YAIH,cAAc;IAc5B,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,oBAAoB;IAiC5B,OAAO,CAAC,mBAAmB;CAyE5B"}
1
+ {"version":3,"file":"figma-tokens-data-loader.d.ts","sourceRoot":"","sources":["../../src/utils/figma-tokens-data-loader.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,kBAAkB,CAAA;AAGlC,qBAAa,qBAAqB;IAChC,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG;QACtC,OAAO,EAAE,GAAG,CAAC,0BAA0B,CAAA;QACvC,QAAQ,EAAE,GAAG,CAAC,2BAA2B,CAAA;KAC1C;IAUD,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAC,8BAA8B;IAcxE,uBAAuB,CAAC,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA4CvF,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAc7D,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,SAAS;YAIH,cAAc;IAc5B,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,oBAAoB;IAiC5B,OAAO,CAAC,mBAAmB;CAyE5B"}
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d2f9c508-395f-5904-924b-b7ebb57c9503")}catch(e){}}();
3
- import * as sdk from "@supernovaio/sdk";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c05237d5-38a4-5f7c-aba5-dedba82a2d2e")}catch(e){}}();
3
+ import sdk from "@supernovaio/sdk";
4
4
  import * as fs from "node:fs";
5
5
  export class FigmaTokensDataLoader {
6
6
  loadConfigFromPath(pathToFile) {
@@ -193,4 +193,4 @@ export class FigmaTokensDataLoader {
193
193
  }
194
194
  }
195
195
  //# sourceMappingURL=figma-tokens-data-loader.js.map
196
- //# debugId=d2f9c508-395f-5904-924b-b7ebb57c9503
196
+ //# debugId=c05237d5-38a4-5f7c-aba5-dedba82a2d2e
@@ -1 +1 @@
1
- {"version":3,"file":"figma-tokens-data-loader.js","sources":["../../src/utils/figma-tokens-data-loader.ts"],"sourceRoot":"","sourcesContent":["import * as sdk from \"@supernovaio/sdk\"\nimport * as fs from \"node:fs\"\n\nexport class FigmaTokensDataLoader {\n loadConfigFromPath(pathToFile: string): {\n mapping: sdk.DTPluginToSupernovaMapPack\n settings: sdk.DTPluginToSupernovaSettings\n } {\n try {\n const parsedDefinition = this.loadConfigFromPathAsIs(pathToFile) as sdk.DTPluginToSupernovaMappingFile\n this.weakValidateMapping(parsedDefinition)\n return this.processFileToMapping(parsedDefinition)\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n loadConfigFromPathAsIs(pathToFile: string): sdk.DTPluginToSupernovaMappingFile {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided configuration file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, \"utf8\")\n const parsedDefinition = this.parseDefinition(definition) as sdk.DTPluginToSupernovaMappingFile\n return parsedDefinition\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n async loadTokensFromDirectory(pathToDirectory: string, settingsPath: string): Promise<object> {\n try {\n const fullStructuredObject: Record<string, unknown> = {}\n\n if (!(fs.existsSync(pathToDirectory) && fs.lstatSync(pathToDirectory).isDirectory())) {\n throw new Error(`Provided data directory ${pathToDirectory} is not a directory or doesn't exist`)\n }\n\n const jsonPaths = this.getAllJSONFiles(pathToDirectory)\n for (const path of jsonPaths) {\n if (path.endsWith(\"json\") && path !== settingsPath && !path.includes(\"$\")) {\n // eslint-disable-next-line no-await-in-loop\n const result = await this.loadObjectFile(path)\n if (typeof result === \"object\") {\n // let name = this.getFileNameWithoutExtension(path)\n const name = this.getSetKey(path, pathToDirectory)\n fullStructuredObject[name] = result\n }\n }\n }\n\n // Try to load themes, if any\n // eslint-disable-next-line no-useless-concat\n const themePath = pathToDirectory + \"/\" + \"$themes.json\"\n if (fs.existsSync(themePath)) {\n const themes = await this.loadObjectFile(themePath)\n fullStructuredObject.$themes = themes\n }\n\n // Try to load metadata, if any\n // eslint-disable-next-line no-useless-concat\n const metadataPath = pathToDirectory + \"/\" + \"$metadata.json\"\n if (fs.existsSync(metadataPath)) {\n const metadata = await this.loadObjectFile(metadataPath)\n fullStructuredObject.$metadata = metadata\n }\n\n return fullStructuredObject\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n /** Load token definitions from path */\n async loadTokensFromPath(pathToFile: string): Promise<object> {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided token file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, \"utf8\")\n const parsedDefinition = this.parseDefinition(definition)\n return parsedDefinition\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n private getAllJSONFiles(dir: string): string[] {\n const files = fs.readdirSync(dir)\n const jsonFiles = []\n\n for (const file of files) {\n const filePath = `${dir}/${file}`\n const fileStat = fs.statSync(filePath)\n\n if (fileStat.isDirectory()) {\n jsonFiles.push(...this.getAllJSONFiles(filePath))\n } else if (fileStat.isFile() && filePath.endsWith(\".json\")) {\n jsonFiles.push(filePath)\n }\n }\n\n return jsonFiles\n }\n\n private getSetKey(jsonFilePath: string, loadedDirectory: string): string {\n return jsonFilePath.slice(loadedDirectory.length + 1, -5)\n }\n\n private async loadObjectFile(pathToFile: string): Promise<object> {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided token file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, \"utf8\")\n const parsedDefinition = this.parseDefinition(definition)\n return parsedDefinition\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n private parseDefinition(definition: string): object {\n try {\n const object = JSON.parse(definition)\n if (typeof object !== \"object\") {\n throw new TypeError(\"Invalid Supernova mapping definition JSON file - root level entity must be object\")\n }\n\n return object\n } catch {\n throw new Error(\"Invalid Supernova mapping definition JSON file - file structure invalid\")\n }\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - File Parser\n\n private processFileToMapping(mapping: sdk.DTPluginToSupernovaMappingFile): {\n mapping: sdk.DTPluginToSupernovaMapPack\n settings: sdk.DTPluginToSupernovaSettings\n } {\n const result: sdk.DTPluginToSupernovaMap[] = []\n for (const map of mapping.mapping) {\n result.push({\n bindToBrand: map.supernovaBrand,\n bindToTheme: map.supernovaTheme ?? null,\n nodes: null,\n pluginSets: map.tokenSets ?? null,\n pluginTheme: map.tokensTheme ?? null,\n processedGroups: null,\n processedNodes: null,\n type: map.tokenSets ? sdk.DTPluginToSupernovaMapType.set : sdk.DTPluginToSupernovaMapType.theme,\n })\n }\n\n const settings: sdk.DTPluginToSupernovaSettings = {\n ...mapping.settings,\n dryRun: mapping.settings?.dryRun ?? false,\n preciseCopy: sdk.toPreciseCopyStrategy(mapping.settings?.preciseCopy),\n themeOverridesStrategy:\n mapping.settings?.themeOverridesStrategy ?? (\"default\" as sdk.DTPluginThemeOverrideStrategy),\n verbose: mapping.settings?.verbose ?? false,\n }\n\n return {\n mapping: result,\n settings,\n }\n }\n\n private weakValidateMapping(mapping: sdk.DTPluginToSupernovaMappingFile) {\n if (\n !Object.hasOwn(mapping, \"mode\") ||\n typeof mapping.mode !== \"string\" ||\n (mapping.mode !== \"multi-file\" && mapping.mode !== \"single-file\")\n ) {\n throw new Error(\"Unable to load mapping file: `mode` must be provided [single-file or multi-file]`\")\n }\n\n if (!mapping.mapping || !Array.isArray(mapping.mapping)) {\n throw new Error(\"Unable to load mapping file: `mapping` key must be present and array.\")\n }\n\n const mapPack = mapping.mapping\n for (const map of mapPack) {\n if (typeof map !== \"object\") {\n throw new TypeError(\"Unable to load mapping file: `mapping` must contain objects only\")\n }\n\n if (!map.tokenSets && !map.tokensTheme) {\n throw new Error(\"Unable to load mapping file: `mapping` must contain either `tokensTheme` or `tokenSets`\")\n }\n\n if (map.tokenSets && map.tokensTheme) {\n throw new Error(\"Unable to load mapping file: `mapping` must not contain both `tokensTheme` or `tokenSets`\")\n }\n\n if (map.tokenSets && (!Array.isArray(map.tokenSets) || (map.tokenSets as Array<unknown>).length === 0)) {\n throw new Error(\"Unable to load mapping file: `mapping`.`tokenSets` must be an Array with at least one entry\")\n }\n\n if (\n map.tokensTheme &&\n ((typeof map.tokensTheme !== \"string\" && !Array.isArray(map.tokensTheme)) || map.tokensTheme.length === 0)\n ) {\n throw new Error(\n \"Unable to load mapping file: `mapping`.`tokensTheme` must be a non-empty string or non-empty array of strings\",\n )\n }\n\n if (!map.supernovaBrand || typeof map.supernovaBrand !== \"string\" || map.supernovaBrand.length === 0) {\n throw new Error(\"Unable to load mapping file: `supernovaBrand` must be a non-empty string\")\n }\n\n if (map.supernovaTheme && (typeof map.supernovaTheme !== \"string\" || map.supernovaTheme.length === 0)) {\n throw new Error(\n \"Unable to load mapping file: `supernovaTheme` may be empty but must be non-empty string if not\",\n )\n }\n }\n\n if (mapping.settings) {\n if (typeof mapping.settings !== \"object\") {\n throw new TypeError(\"Unable to load mapping file: `settings` must be an object\")\n }\n\n if (Object.hasOwn(mapping.settings, \"dryRun\") && typeof mapping.settings.dryRun !== \"boolean\") {\n throw new Error(\"Unable to load mapping file: `dryRun` must be of boolean type\")\n }\n\n if (Object.hasOwn(mapping.settings, \"verbose\") && typeof mapping.settings.verbose !== \"boolean\") {\n throw new Error(\"Unable to load mapping file: `verbose` must be of boolean type\")\n }\n\n if (\n Object.hasOwn(mapping.settings, \"preciseCopy\") &&\n typeof mapping.settings.preciseCopy !== \"boolean\" &&\n typeof mapping.settings.preciseCopy !== \"string\"\n ) {\n throw new Error(\"Unable to load mapping file: `preciseCopy` must be of boolean or string type\")\n }\n }\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAA;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAE7B,MAAM,OAAO,qBAAqB;IAChC,kBAAkB,CAAC,UAAkB;QAInC,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAuC,CAAA;YACtG,IAAI,CAAC,mBAAmB,CA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AAE,CAAC;gBACtG,MAAM,IAAI,KAAK,CACb,gGAAgG,CACjG,CAAA;YACH,CAAC;QACH,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrB,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACzC,MAAM,IAAI,SAAS,CAAC,2DAA2D,CAAC,CAAA;YAClF,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC9F,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAClF,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBAChG,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAA;YACnF,CAAC;YAED,IACE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC;gBAC9C,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,KAAK,SAAS;gBACjD,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,KAAK,QAAQ,EAChD,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAA;YACjG,CAAC;QACH,CAAC;IACH,CAAC;CACF","debug_id":"d2f9c508-395f-5904-924b-b7ebb57c9503"}
1
+ {"version":3,"file":"figma-tokens-data-loader.js","sources":["../../src/utils/figma-tokens-data-loader.ts"],"sourceRoot":"","sourcesContent":["import sdk from \"@supernovaio/sdk\"\nimport * as fs from \"node:fs\"\n\nexport class FigmaTokensDataLoader {\n loadConfigFromPath(pathToFile: string): {\n mapping: sdk.DTPluginToSupernovaMapPack\n settings: sdk.DTPluginToSupernovaSettings\n } {\n try {\n const parsedDefinition = this.loadConfigFromPathAsIs(pathToFile) as sdk.DTPluginToSupernovaMappingFile\n this.weakValidateMapping(parsedDefinition)\n return this.processFileToMapping(parsedDefinition)\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n loadConfigFromPathAsIs(pathToFile: string): sdk.DTPluginToSupernovaMappingFile {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided configuration file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, \"utf8\")\n const parsedDefinition = this.parseDefinition(definition) as sdk.DTPluginToSupernovaMappingFile\n return parsedDefinition\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n async loadTokensFromDirectory(pathToDirectory: string, settingsPath: string): Promise<object> {\n try {\n const fullStructuredObject: Record<string, unknown> = {}\n\n if (!(fs.existsSync(pathToDirectory) && fs.lstatSync(pathToDirectory).isDirectory())) {\n throw new Error(`Provided data directory ${pathToDirectory} is not a directory or doesn't exist`)\n }\n\n const jsonPaths = this.getAllJSONFiles(pathToDirectory)\n for (const path of jsonPaths) {\n if (path.endsWith(\"json\") && path !== settingsPath && !path.includes(\"$\")) {\n // eslint-disable-next-line no-await-in-loop\n const result = await this.loadObjectFile(path)\n if (typeof result === \"object\") {\n // let name = this.getFileNameWithoutExtension(path)\n const name = this.getSetKey(path, pathToDirectory)\n fullStructuredObject[name] = result\n }\n }\n }\n\n // Try to load themes, if any\n // eslint-disable-next-line no-useless-concat\n const themePath = pathToDirectory + \"/\" + \"$themes.json\"\n if (fs.existsSync(themePath)) {\n const themes = await this.loadObjectFile(themePath)\n fullStructuredObject.$themes = themes\n }\n\n // Try to load metadata, if any\n // eslint-disable-next-line no-useless-concat\n const metadataPath = pathToDirectory + \"/\" + \"$metadata.json\"\n if (fs.existsSync(metadataPath)) {\n const metadata = await this.loadObjectFile(metadataPath)\n fullStructuredObject.$metadata = metadata\n }\n\n return fullStructuredObject\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n /** Load token definitions from path */\n async loadTokensFromPath(pathToFile: string): Promise<object> {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided token file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, \"utf8\")\n const parsedDefinition = this.parseDefinition(definition)\n return parsedDefinition\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n private getAllJSONFiles(dir: string): string[] {\n const files = fs.readdirSync(dir)\n const jsonFiles = []\n\n for (const file of files) {\n const filePath = `${dir}/${file}`\n const fileStat = fs.statSync(filePath)\n\n if (fileStat.isDirectory()) {\n jsonFiles.push(...this.getAllJSONFiles(filePath))\n } else if (fileStat.isFile() && filePath.endsWith(\".json\")) {\n jsonFiles.push(filePath)\n }\n }\n\n return jsonFiles\n }\n\n private getSetKey(jsonFilePath: string, loadedDirectory: string): string {\n return jsonFilePath.slice(loadedDirectory.length + 1, -5)\n }\n\n private async loadObjectFile(pathToFile: string): Promise<object> {\n try {\n if (!(fs.existsSync(pathToFile) && fs.lstatSync(pathToFile).isFile())) {\n throw new Error(`Provided token file directory ${pathToFile} is not a file or doesn't exist`)\n }\n\n const definition = fs.readFileSync(pathToFile, \"utf8\")\n const parsedDefinition = this.parseDefinition(definition)\n return parsedDefinition\n } catch (error) {\n throw new Error(\"Unable to load JSON definition file: \" + error)\n }\n }\n\n private parseDefinition(definition: string): object {\n try {\n const object = JSON.parse(definition)\n if (typeof object !== \"object\") {\n throw new TypeError(\"Invalid Supernova mapping definition JSON file - root level entity must be object\")\n }\n\n return object\n } catch {\n throw new Error(\"Invalid Supernova mapping definition JSON file - file structure invalid\")\n }\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - File Parser\n\n private processFileToMapping(mapping: sdk.DTPluginToSupernovaMappingFile): {\n mapping: sdk.DTPluginToSupernovaMapPack\n settings: sdk.DTPluginToSupernovaSettings\n } {\n const result: sdk.DTPluginToSupernovaMap[] = []\n for (const map of mapping.mapping) {\n result.push({\n bindToBrand: map.supernovaBrand,\n bindToTheme: map.supernovaTheme ?? null,\n nodes: null,\n pluginSets: map.tokenSets ?? null,\n pluginTheme: map.tokensTheme ?? null,\n processedGroups: null,\n processedNodes: null,\n type: map.tokenSets ? sdk.DTPluginToSupernovaMapType.set : sdk.DTPluginToSupernovaMapType.theme,\n })\n }\n\n const settings: sdk.DTPluginToSupernovaSettings = {\n ...mapping.settings,\n dryRun: mapping.settings?.dryRun ?? false,\n preciseCopy: sdk.toPreciseCopyStrategy(mapping.settings?.preciseCopy),\n themeOverridesStrategy:\n mapping.settings?.themeOverridesStrategy ?? (\"default\" as sdk.DTPluginThemeOverrideStrategy),\n verbose: mapping.settings?.verbose ?? false,\n }\n\n return {\n mapping: result,\n settings,\n }\n }\n\n private weakValidateMapping(mapping: sdk.DTPluginToSupernovaMappingFile) {\n if (\n !Object.hasOwn(mapping, \"mode\") ||\n typeof mapping.mode !== \"string\" ||\n (mapping.mode !== \"multi-file\" && mapping.mode !== \"single-file\")\n ) {\n throw new Error(\"Unable to load mapping file: `mode` must be provided [single-file or multi-file]`\")\n }\n\n if (!mapping.mapping || !Array.isArray(mapping.mapping)) {\n throw new Error(\"Unable to load mapping file: `mapping` key must be present and array.\")\n }\n\n const mapPack = mapping.mapping\n for (const map of mapPack) {\n if (typeof map !== \"object\") {\n throw new TypeError(\"Unable to load mapping file: `mapping` must contain objects only\")\n }\n\n if (!map.tokenSets && !map.tokensTheme) {\n throw new Error(\"Unable to load mapping file: `mapping` must contain either `tokensTheme` or `tokenSets`\")\n }\n\n if (map.tokenSets && map.tokensTheme) {\n throw new Error(\"Unable to load mapping file: `mapping` must not contain both `tokensTheme` or `tokenSets`\")\n }\n\n if (map.tokenSets && (!Array.isArray(map.tokenSets) || (map.tokenSets as Array<unknown>).length === 0)) {\n throw new Error(\"Unable to load mapping file: `mapping`.`tokenSets` must be an Array with at least one entry\")\n }\n\n if (\n map.tokensTheme &&\n ((typeof map.tokensTheme !== \"string\" && !Array.isArray(map.tokensTheme)) || map.tokensTheme.length === 0)\n ) {\n throw new Error(\n \"Unable to load mapping file: `mapping`.`tokensTheme` must be a non-empty string or non-empty array of strings\",\n )\n }\n\n if (!map.supernovaBrand || typeof map.supernovaBrand !== \"string\" || map.supernovaBrand.length === 0) {\n throw new Error(\"Unable to load mapping file: `supernovaBrand` must be a non-empty string\")\n }\n\n if (map.supernovaTheme && (typeof map.supernovaTheme !== \"string\" || map.supernovaTheme.length === 0)) {\n throw new Error(\n \"Unable to load mapping file: `supernovaTheme` may be empty but must be non-empty string if not\",\n )\n }\n }\n\n if (mapping.settings) {\n if (typeof mapping.settings !== \"object\") {\n throw new TypeError(\"Unable to load mapping file: `settings` must be an object\")\n }\n\n if (Object.hasOwn(mapping.settings, \"dryRun\") && typeof mapping.settings.dryRun !== \"boolean\") {\n throw new Error(\"Unable to load mapping file: `dryRun` must be of boolean type\")\n }\n\n if (Object.hasOwn(mapping.settings, \"verbose\") && typeof mapping.settings.verbose !== \"boolean\") {\n throw new Error(\"Unable to load mapping file: `verbose` must be of boolean type\")\n }\n\n if (\n Object.hasOwn(mapping.settings, \"preciseCopy\") &&\n typeof mapping.settings.preciseCopy !== \"boolean\" &&\n typeof mapping.settings.preciseCopy !== \"string\"\n ) {\n throw new Error(\"Unable to load mapping file: `preciseCopy` must be of boolean or string type\")\n }\n }\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,GAAG,MAAM,kBAAkB,CAAA;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAE7B,MAAM,OAAO,qBAAqB;IAChC,kBAAkB,CAAC,UAAkB;QAInC,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAuC,C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c,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;gBACtG,MAAM,IAAI,KAAK,CACb,gGAAgG,CACjG,CAAA;YACH,CAAC;QACH,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrB,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACzC,MAAM,IAAI,SAAS,CAAC,2DAA2D,CAAC,CAAA;YAClF,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC9F,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAClF,CAAC;YAED,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBAChG,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAA;YACnF,CAAC;YAED,IACE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC;gBAC9C,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,KAAK,SAAS;gBACjD,OAAO,OAAO,CAAC,QAAQ,CAAC,WAAW,KAAK,QAAQ,EAChD,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAA;YACjG,CAAC;QACH,CAAC;IACH,CAAC;CACF","debug_id":"c05237d5-38a4-5f7c-aba5-dedba82a2d2e"}
@@ -1,10 +1,10 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="31a1bcaf-d966-564f-9fe6-24f42fdcc499")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9cea29ab-f6af-5e6a-81c9-fd44af720431")}catch(e){}}();
3
3
  import { apiUrlForEnvironment } from "../../types/index.js";
4
4
  export function exportConfiguration(setup) {
5
5
  return {
6
6
  accessToken: setup.apiKey,
7
- apiUrl: `${apiUrlForEnvironment(setup.environment)}/api`,
7
+ apiUrl: `${apiUrlForEnvironment(setup.environment, undefined)}`,
8
8
  apiVersion: "0.2",
9
9
  brandId: setup.brandId,
10
10
  designSystemId: setup.dsId,
@@ -16,4 +16,4 @@ export function exportConfiguration(setup) {
16
16
  };
17
17
  }
18
18
  //# sourceMappingURL=exporter-utils.js.map
19
- //# debugId=31a1bcaf-d966-564f-9fe6-24f42fdcc499
19
+ //# debugId=9cea29ab-f6af-5e6a-81c9-fd44af720431
@@ -1 +1 @@
1
- {"version":3,"file":"exporter-utils.js","sources":["../../../src/utils/run-exporter/exporter-utils.ts"],"sourceRoot":"","sourcesContent":["//\n// exporter-utils.ts\n// Supernova CLI\n//\n// Created by Jiri Trecak.\n// Copyright Ā© Supernova.io. All rights reserved.\n//\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Imports\n\n// eslint-disable-next-line n/no-extraneous-import\nimport * as pulsar from \"@supernova-studio/pulsar-language\"\n\nimport { apiUrlForEnvironment, ExportConfiguration, TargetEnv } from \"../../types/index.js\"\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Utils\n\nexport function exportConfiguration(setup: {\n apiKey: string\n brandId?: string\n dsId: string\n environment: TargetEnv\n exportPath: string\n logger: pulsar.PLLogger\n proxyUrl?: string\n themeId?: string\n versionId: string\n}): ExportConfiguration {\n return {\n accessToken: setup.apiKey,\n apiUrl: `${apiUrlForEnvironment(setup.environment)}/api`,\n apiVersion: \"0.2\",\n brandId: setup.brandId,\n designSystemId: setup.dsId,\n designSystemVersionId: setup.versionId,\n exportPath: setup.exportPath,\n logger: setup.logger,\n proxyUrl: setup.proxyUrl,\n themeId: setup.themeId,\n }\n}\n"],"names":[],"mappings":";;AAcA,OAAO,EAAE,oBAAoB,EAAkC,MAAM,sBAAsB,CAAA;AAK3F,MAAM,UAAU,mBAAmB,CAAC,KAUnC;IACC,OAAO;QACL,WAAW,EAAE,KAAK,CAAC,MAAM;QACzB,MAAM,EAAE,GAAG,oBAAoB,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM;QACxD,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,cAAc,EAAE,KAAK,CAAC,IAAI;QAC1B,qBAAqB,EAAE,KAAK,CAAC,SAAS;QACtC,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAA;AACH,CAAC","debug_id":"31a1bcaf-d966-564f-9fe6-24f42fdcc499"}
1
+ {"version":3,"file":"exporter-utils.js","sources":["../../../src/utils/run-exporter/exporter-utils.ts"],"sourceRoot":"","sourcesContent":["//\n// exporter-utils.ts\n// Supernova CLI\n//\n// Created by Jiri Trecak.\n// Copyright Ā© Supernova.io. All rights reserved.\n//\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Imports\n\n// eslint-disable-next-line n/no-extraneous-import\nimport * as pulsar from \"@supernova-studio/pulsar-language\"\n\nimport { apiUrlForEnvironment, ExportConfiguration, TargetEnv } from \"../../types/index.js\"\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Utils\n\nexport function exportConfiguration(setup: {\n apiKey: string\n brandId?: string\n dsId: string\n environment: TargetEnv\n exportPath: string\n logger: pulsar.PLLogger\n proxyUrl?: string\n themeId?: string\n versionId: string\n}): ExportConfiguration {\n return {\n accessToken: setup.apiKey,\n apiUrl: `${apiUrlForEnvironment(setup.environment, undefined)}`,\n apiVersion: \"0.2\",\n brandId: setup.brandId,\n designSystemId: setup.dsId,\n designSystemVersionId: setup.versionId,\n exportPath: setup.exportPath,\n logger: setup.logger,\n proxyUrl: setup.proxyUrl,\n themeId: setup.themeId,\n }\n}\n"],"names":[],"mappings":";;AAcA,OAAO,EAAE,oBAAoB,EAAkC,MAAM,sBAAsB,CAAA;AAK3F,MAAM,UAAU,mBAAmB,CAAC,KAUnC;IACC,OAAO;QACL,WAAW,EAAE,KAAK,CAAC,MAAM;QACzB,MAAM,EAAE,GAAG,oBAAoB,CAAC,KAAK,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE;QAC/D,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,cAAc,EAAE,KAAK,CAAC,IAAI;QAC1B,qBAAqB,EAAE,KAAK,CAAC,SAAS;QACtC,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAA;AACH,CAAC","debug_id":"9cea29ab-f6af-5e6a-81c9-fd44af720431"}
@@ -45,7 +45,7 @@
45
45
  }
46
46
  },
47
47
  "hasDynamicHelp": false,
48
- "hidden": false,
48
+ "hidden": true,
49
49
  "hiddenAliases": [],
50
50
  "id": "components-import",
51
51
  "pluginAlias": "@supernovaio/cli",
@@ -524,5 +524,5 @@
524
524
  ]
525
525
  }
526
526
  },
527
- "version": "2.0.0"
527
+ "version": "2.0.2"
528
528
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@supernovaio/cli",
3
3
  "description": "Supernova.io Command Line Interface",
4
- "version": "2.0.0",
4
+ "version": "2.0.2",
5
5
  "author": "Supernova.io",
6
6
  "bin": {
7
7
  "supernova": "./bin/run"