@supernovaio/cli-next 2.0.25 → 2.0.26

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.
@@ -42,4 +42,4 @@ export default class ImportComponents extends SentryCommand<ImportComponentsConf
42
42
  run(): Promise<void>;
43
43
  }
44
44
  export {};
45
- //# sourceMappingURL=import-components.d.ts.map
45
+ //# sourceMappingURL=components-import.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"import-components.d.ts","sourceRoot":"","sources":["../../src/commands/import-components.ts"],"names":[],"mappings":"AAKA,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;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAElD;IAGY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+ClC"}
1
+ {"version":3,"file":"components-import.d.ts","sourceRoot":"","sources":["../../src/commands/components-import.ts"],"names":[],"mappings":"AAKA,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;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAElD;IAGY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+ClC"}
@@ -88,4 +88,4 @@ __decorate([
88
88
  __metadata("design:paramtypes", []),
89
89
  __metadata("design:returntype", Promise)
90
90
  ], ImportComponents.prototype, "run", null);
91
- //# sourceMappingURL=import-components.js.map
91
+ //# sourceMappingURL=components-import.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"import-components.js","sourceRoot":"","sources":["../../src/commands/import-components.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,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,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC;KACD,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,GAAG,IAAI;IACP,OAAO,EA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,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;gBACxD,MAAM,KAAK,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;gBAE3F,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,QAAQ,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC,CAAA;YACvD,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAA;YACpE,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;QAUvC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,mCAAmC,CAAC,KAAK,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;;AA9CY;IADZ,YAAY,EAAE;;;;2CA+Cd","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\n// eslint-disable-next-line n/no-extraneous-import\nimport { analyzeComponents } from \"@supernovaio/code-analyzer\"\nimport * as process from \"node:process\"\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\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 { importFrom, rootDir } = 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 /*\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 */\n } else {\n this.log(\"\\n⚠️ No components were imported\".green)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"components-import.js","sourceRoot":"","sources":["../../src/commands/components-import.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,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,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC;KACD,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,GAAG,IAAI;IACP,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE;CACvC,CAAC,CAAC,CAAA;AAIL,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,aAAqC;IACjF,MAAM,CAAU,IAAI,GAAG,EAAE,CAAA;IACzB,MAAM,CAAU,WAAW,GAAG,4EAA4E,CAAA;IAC1G,MAAM,CAAU,QAAQ,GAAG;QACzB,qFAAqF;QACrF,gEAAgE;KACjE,CAAA;IACD,MAAM,CAAU,KAAK,GAAG;QACtB,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,4CAA4C,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC3G,UAAU,EAAE,KAA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G,CAAC,2BAA2B,CAAC,CAAA;QAUvC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,mCAAmC,CAAC,KAAK,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;;AA9CY;IADZ,YAAY,EAAE;;;;2CA+Cd","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\n// eslint-disable-next-line n/no-extraneous-import\nimport { analyzeComponents } from \"@supernovaio/code-analyzer\"\nimport * as process from \"node:process\"\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\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 { importFrom, rootDir } = 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 /*\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 */\n } else {\n this.log(\"\\n⚠️ No components were imported\".green)\n }\n }\n}\n"]}
@@ -44,7 +44,7 @@ export default class ImportStorybook extends SentryCommand<ImportStorybookConfig
44
44
  static flags: {
45
45
  brandId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
46
46
  designSystemId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
47
- dir: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
47
+ from: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
48
48
  name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
49
49
  sourceId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
50
50
  };
@@ -59,4 +59,4 @@ export default class ImportStorybook extends SentryCommand<ImportStorybookConfig
59
59
  private validateZipSize;
60
60
  }
61
61
  export {};
62
- //# sourceMappingURL=import-storybook.d.ts.map
62
+ //# sourceMappingURL=storybook-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storybook-import.d.ts","sourceRoot":"","sources":["../../src/commands/storybook-import.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,OAAO,EAA6B,aAAa,EAAyC,MAAM,mBAAmB,CAAA;AAUnH,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW5B,CAAA;AAEL,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAaxE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IAC/E,OAAgB,IAAI,KAAK;IACzB,OAAgB,WAAW,SAAgD;IAC3E,OAAgB,QAAQ,WAA4D;IACpF,OAAgB,KAAK;;;;;;MAWpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAEjD;IAIY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YAiInB,OAAO;IAuBrB,OAAO,CAAC,sBAAsB;IA0E9B,OAAO,CAAC,YAAY;YAYN,wBAAwB;IA4DtC,OAAO,CAAC,0BAA0B;IA6BlC,OAAO,CAAC,eAAe;CAiBxB"}
@@ -44,19 +44,17 @@ const storybookEndpoint = (environment, designSystemId, name, accessToken) => {
44
44
  export default class ImportStorybook extends SentryCommand {
45
45
  static args = {};
46
46
  static description = "Import storybook static export to Supernova";
47
- static examples = [
48
- "<%= config.bin %> <%= command.id %> import-storybook --designSystemId=123 --dir ./storybook-static.zip",
49
- ];
47
+ static examples = ["<%= config.bin %> <%= command.id %> import-storybook "];
50
48
  static flags = {
51
49
  ...commonFlags,
52
50
  brandId: Flags.string({ char: "b", description: "Import storybooks to brand of" }),
53
- designSystemId: Flags.string({ char: "D", description: "Import storybooks to design system of" }),
54
- dir: Flags.string({
55
- char: "d",
56
- default: "./storybook-static",
51
+ designSystemId: Flags.string({ char: "d", description: "Import storybooks to design system of" }),
52
+ from: Flags.string({
53
+ char: "f",
57
54
  description: "Directory with storybook static export to import.",
55
+ required: true,
58
56
  }),
59
- name: Flags.string({ char: "a", description: "Import storybooks with name of" }),
57
+ name: Flags.string({ char: "n", description: "Import storybooks with name of" }),
60
58
  sourceId: Flags.string({ char: "s", description: "Import storybooks to source of" }),
61
59
  };
62
60
  get commandId() {
@@ -81,14 +79,12 @@ export default class ImportStorybook extends SentryCommand {
81
79
  if (!designSystemId) {
82
80
  this.error("Design system ID is required");
83
81
  }
84
- this.saveConfig({ designSystemId });
85
82
  }
86
83
  if (!brandId) {
87
84
  brandId = await this.getBrandId(env, designSystemId, "head");
88
85
  if (!brandId) {
89
86
  this.error("Brand ID is required");
90
87
  }
91
- this.saveConfig({ brandId });
92
88
  }
93
89
  const directoryValidation = this.validateStorybookDirectory(dir);
94
90
  if (!directoryValidation.isValid) {
@@ -152,7 +148,6 @@ export default class ImportStorybook extends SentryCommand {
152
148
  userUrl: storybookUrl,
153
149
  });
154
150
  storiesCount = source.storybook.storiesCount;
155
- this.saveConfig({ sourceId: source.id });
156
151
  }
157
152
  this.log(`✅ Imported ${storiesCount} component stories into Supernova!`.green);
158
153
  this.log(`🔒 Access your Storybook at: ${storybookUrl}`.green);
@@ -186,7 +181,6 @@ export default class ImportStorybook extends SentryCommand {
186
181
  this.exit(0);
187
182
  }
188
183
  const name = choice.name;
189
- this.saveConfig({ name });
190
184
  return name;
191
185
  }
192
186
  createZipFromDirectory(directoryPath) {
@@ -327,4 +321,4 @@ __decorate([
327
321
  __metadata("design:paramtypes", []),
328
322
  __metadata("design:returntype", Promise)
329
323
  ], ImportStorybook.prototype, "run", null);
330
- //# sourceMappingURL=import-storybook.js.map
324
+ //# sourceMappingURL=storybook-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storybook-import.js","sourceRoot":"","sources":["../../src/commands/storybook-import.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,OAAO,MAAM,uBAAuB,CAAA;AAE3C,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,CAAC,EAAW,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,0BAA0B,EAAa,MAAM,mBAAmB,CAAA;AACnH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGhD,MAAM,kBAAkB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAA;AAE5C,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAC9D,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,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CAAC,IAAI;gBACrH,OAAO,EAAE,KAAK;aACf,CAAA;QACH,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IAC1B,CAAC;;AAvVY;IAFZ,YAAY,EAAE;;;;0CAiId","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { action } from \"@oclif/core/ux\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport slugify from \"@sindresorhus/slugify\"\nimport { DTODataSourceStorybook } from \"@supernova-studio/client\"\nimport AdmZip from \"adm-zip\"\nimport axios from \"axios\"\nimport cliProgress from \"cli-progress\"\nimport inquirer from \"inquirer\"\nimport * as fs from \"node:fs\"\nimport path from \"node:path\"\nimport { z, ZodType } from \"zod\"\n\nimport { commonFlags, getTargetEnv, SentryCommand, storybookUrlForEnvironment, TargetEnv } from \"../types/index.js\"\nimport { sleep } from \"../utils/common.js\"\nimport { getApiClient } from \"../utils/index.js\"\n\n// Maximum allowed size for storybook zip file (500MB)\nconst MAX_ZIP_SIZE_BYTES = 500 * 1024 * 1024\n\nconst bytesToKB = (bytes: number) => (bytes / 1024).toFixed(2)\nconst bytesToMB = (bytes: number) => (bytes / (1024 * 1024)).toFixed(2)\n\nconst ImportStorybookConfigSchema = z\n .object({\n brandId: z.string().optional(),\n designSystemId: z.string().optional(),\n dir: z.string().optional(),\n name: z.string().optional(),\n sourceId: z.string().optional(),\n versionId: z.string().optional(),\n })\n .transform(data => ({\n ...data,\n }))\n\ntype ImportStorybookConfig = z.infer<typeof ImportStorybookConfigSchema>\n\nconst storybookEndpoint = (\n environment: TargetEnv,\n designSystemId: string,\n name: string,\n accessToken: string,\n): string => {\n const host = storybookUrlForEnvironment(environment)\n const encodedAccessToken = encodeURIComponent(accessToken)\n return `${host}/design-systems/${designSystemId}/alias/${name}/index.html?storybook_jwt=${encodedAccessToken}`\n}\n\nexport default class ImportStorybook extends SentryCommand<ImportStorybookConfig> {\n static override args = {}\n static override description = \"Import storybook static export to Supernova\"\n static override examples = [\"<%= config.bin %> <%= command.id %> import-storybook \"]\n static override flags = {\n ...commonFlags,\n brandId: Flags.string({ char: \"b\", description: \"Import storybooks to brand of\" }),\n designSystemId: Flags.string({ char: \"d\", description: \"Import storybooks to design system of\" }),\n from: Flags.string({\n char: \"f\",\n description: \"Directory with storybook static export to import.\",\n required: true,\n }),\n name: Flags.string({ char: \"n\", description: \"Import storybooks with name of\" }),\n sourceId: Flags.string({ char: \"s\", description: \"Import storybooks to source of\" }),\n }\n\n get commandId(): string {\n return ImportStorybook.id\n }\n\n get configSchema(): ZodType<ImportStorybookConfig> {\n return ImportStorybookConfigSchema\n }\n\n @SentryTraced()\n // eslint-disable-next-line complexity\n public async run(): Promise<void> {\n const startTime = Date.now()\n const { flags } = await this.parse(ImportStorybook)\n\n const env = getTargetEnv()\n const { brandId: bId, designSystemId: dsId, dir, name: nameInput, sourceId } = flags\n const name = slugify(await this.askName(nameInput), { lowercase: true })\n let designSystemId = dsId\n let brandId = bId\n\n const apiClient = await getApiClient(env)\n const { designSystems } = apiClient\n const { sources, storybookHosting } = designSystems\n\n if (!designSystemId) {\n designSystemId = await this.getDesignSystemId(env, designSystemId)\n\n if (!designSystemId) {\n this.error(\"Design system ID is required\")\n }\n }\n\n if (!brandId) {\n brandId = await this.getBrandId(env, designSystemId, \"head\")\n\n if (!brandId) {\n this.error(\"Brand ID is required\")\n }\n }\n\n const directoryValidation = this.validateStorybookDirectory(dir)\n if (!directoryValidation.isValid) {\n this.error(directoryValidation.error!)\n }\n\n this.log(`Preparing Storybook files from ${dir}...`)\n const { sizeBytes, zipPath } = this.createZipFromDirectory(dir)\n\n const sizeValidation = this.validateZipSize(zipPath, sizeBytes)\n if (!sizeValidation.isValid) {\n this.error(sizeValidation.error!)\n }\n\n const { signedUrl, storybookUploadId } = await storybookHosting.getSignedUploadUrl(designSystemId, { name })\n\n try {\n await this.uploadArchiveToSignedUrl({ designSystemId, name, signedUrl, storybookUploadId, zipPath })\n this.log(\"✅ Upload complete.\")\n this.log(\"Processing Storybook files...\")\n\n let status\n action.start(\"Deploying Storybook to private Supernova hosting service...\")\n\n let unknownStatusCount = 0\n try {\n do {\n // eslint-disable-next-line no-await-in-loop\n await sleep(1000)\n\n // eslint-disable-next-line no-await-in-loop\n status = await storybookHosting.getUploadStatus(designSystemId, storybookUploadId)\n\n if (status.status === \"Failed\") {\n break\n }\n\n if (status.status === \"Unknown\") {\n unknownStatusCount++\n } else {\n unknownStatusCount = 0\n }\n\n if (unknownStatusCount >= 5) {\n this.error(\"Failed to deploy Storybook: Internal server error\")\n }\n } while (status.status !== \"Completed\" || (status.timestamp && status.timestamp < startTime))\n\n if (status.status === \"Failed\") {\n action.stop(\"\\nFailed to deploy Storybook: Internal server error\")\n } else {\n const { accessToken } = await storybookHosting.getAccessToken(designSystemId, name)\n const storybookUrl = storybookEndpoint(env, designSystemId, name, accessToken)\n\n action.stop(\"\\n✅ Private Storybook deployed successfully!\")\n\n try {\n this.log(`Connecting Storybook as a data source in Supernova...`)\n let storiesCount = 0\n // eslint-disable-next-line max-depth\n if (sourceId) {\n const { storiesCount: updatedStoriesCount } = await sources.updateStorybookImport(\n designSystemId,\n \"head\",\n {\n payload: this.getIndexJson(dir),\n sourceId,\n },\n )\n storiesCount = updatedStoriesCount\n } else {\n const { source } = await sources.create(designSystemId, {\n brandPersistentId: brandId,\n description: \"CLI\",\n indexUrl: storybookUrl,\n payload: this.getIndexJson(dir),\n type: \"Storybook\",\n userUrl: storybookUrl,\n })\n\n storiesCount = (source as unknown as DTODataSourceStorybook).storybook.storiesCount\n }\n\n this.log(`✅ Imported ${storiesCount} component stories into Supernova!`.green)\n this.log(`🔒 Access your Storybook at: ${storybookUrl}`.green)\n } catch (error) {\n this.error(\n `Failed to connect Storybook as data source: ${error instanceof Error ? error.message : String(error)}`\n .red,\n )\n }\n }\n } catch (error) {\n action.stop(`\\nFailed to deploy Storybook: ${error instanceof Error ? error.message : String(error)}`.red)\n }\n } catch (error) {\n this.error(`Failed to upload Storybook files: ${error instanceof Error ? error.message : String(error)}`)\n }\n }\n\n private async askName(inputedName?: string) {\n if (inputedName) return inputedName\n const choice = await inquirer.prompt([\n {\n message: \"What's storybook name\",\n name: \"name\",\n type: \"input\",\n },\n ])\n if (choice.name === \"exit\") {\n this.log(\"Exiting...\")\n this.exit(0)\n }\n\n const name = choice.name as string\n return name\n }\n\n /**\n * Creates a zip archive from a directory\n * @param directoryPath Path to the directory to zip\n * @returns Path to the created zip file and its size\n */\n private createZipFromDirectory(directoryPath: string): { sizeBytes: number; zipPath: string } {\n const zip = new AdmZip()\n\n let totalFiles = 0\n let processedFiles = 0\n\n const countFiles = (currentPath: string) => {\n const files = fs.readdirSync(currentPath)\n\n for (const file of files) {\n const filePath = path.join(currentPath, file)\n const stat = fs.statSync(filePath)\n\n if (stat.isDirectory()) {\n countFiles(filePath)\n } else {\n totalFiles++\n }\n }\n }\n\n countFiles(directoryPath)\n\n const progressBar = new cliProgress.SingleBar(\n {\n barCompleteChar: \"\\u2588\",\n barIncompleteChar: \"\\u2591\",\n format: \"Creating zip [{bar}] {percentage}% | {value}/{total} files | Current: {filename}\",\n hideCursor: true,\n },\n cliProgress.Presets.shades_classic,\n )\n\n progressBar.start(totalFiles, 0, {\n filename: \"Initializing...\",\n })\n\n const addFilesToZip = (currentPath: string, relativePath = \"\") => {\n const files = fs.readdirSync(currentPath)\n\n for (const file of files) {\n const filePath = path.join(currentPath, file)\n const stat = fs.statSync(filePath)\n const displayPath = path.join(relativePath, file)\n\n if (stat.isDirectory()) {\n addFilesToZip(filePath, displayPath)\n } else {\n // Update the progress bar with the current file\n processedFiles++\n progressBar.update(processedFiles, {\n filename:\n displayPath.length > 40 ? \"...\" + displayPath.slice(Math.max(0, displayPath.length - 37)) : displayPath,\n })\n\n zip.addLocalFile(filePath, relativePath)\n }\n }\n }\n\n try {\n addFilesToZip(directoryPath)\n } finally {\n progressBar.stop()\n }\n\n const zipPath = `${directoryPath}.zip`\n zip.writeZip(zipPath)\n\n const sizeBytes = fs.statSync(zipPath).size\n\n return { sizeBytes, zipPath }\n }\n\n private getIndexJson(directoryPath: string) {\n const indexJsonPath = path.join(directoryPath, \"index.json\")\n if (!fs.existsSync(indexJsonPath)) {\n return \"{}\"\n }\n\n return JSON.parse(fs.readFileSync(indexJsonPath, \"utf8\"))\n }\n\n /**\n * Uploads the zip archive to the provided signed URL\n */\n private async uploadArchiveToSignedUrl(input: {\n designSystemId: string\n name?: string\n signedUrl: string\n storybookUploadId: string\n zipPath: string\n }): Promise<void> {\n const { designSystemId, name, signedUrl, storybookUploadId, zipPath } = input\n this.log(`Securely uploading ${zipPath} to Supernova...`)\n\n // Create a new progress bar\n const progressBar = new cliProgress.SingleBar(\n {\n barCompleteChar: \"\\u2588\",\n barIncompleteChar: \"\\u2591\",\n format: \"Uploading |{bar}| {percentage}% || {value}/{total} kB\",\n hideCursor: true,\n },\n cliProgress.Presets.shades_classic,\n )\n\n const fileStream = fs.createReadStream(zipPath)\n const stats = fs.statSync(zipPath)\n const fileSize = stats.size\n const fileSizeKB = Number.parseFloat(bytesToKB(fileSize))\n\n // Start the progress bar\n progressBar.start(fileSizeKB, 0)\n\n try {\n await axios.put(signedUrl, fileStream, {\n headers: {\n \"Content-Length\": fileSize,\n \"Content-Type\": \"application/zip\",\n designSystemId,\n storybookUploadId,\n ...(name && { name }),\n },\n onUploadProgress(progressEvent) {\n const loaded = progressEvent.loaded || 0\n const loadedKB = Number.parseFloat(bytesToKB(loaded))\n progressBar.update(loadedKB)\n },\n })\n\n // Complete the progress bar\n progressBar.update(fileSizeKB)\n progressBar.stop()\n } catch (error) {\n // Make sure to stop the progress bar if there's an error\n progressBar.stop()\n throw error\n }\n }\n\n /**\n * Validates if a directory is a valid storybook static export\n * @param directoryPath Path to the storybook directory\n * @returns An object indicating if the directory is valid and an error message if not\n */\n private validateStorybookDirectory(directoryPath: string): { error?: string; isValid: boolean } {\n if (!fs.existsSync(directoryPath)) {\n return { error: `Directory not found: ${directoryPath}`, isValid: false }\n }\n\n if (!fs.statSync(directoryPath).isDirectory()) {\n return { error: `Not a directory: ${directoryPath}`, isValid: false }\n }\n\n // Check for essential storybook files\n const requiredFiles = [\"index.html\", \"iframe.html\"]\n const missingFiles = requiredFiles.filter(file => !fs.existsSync(path.join(directoryPath, file)))\n\n if (missingFiles.length > 0) {\n return {\n error: `Directory does not appear to be a valid Storybook export. Missing files: ${missingFiles.join(\", \")}`,\n isValid: false,\n }\n }\n\n return { isValid: true }\n }\n\n /**\n * Validates if a zip file size is within the allowed limits\n * @param zipPath Path to the zip file\n * @param sizeBytes Size of the zip file in bytes\n * @returns An object indicating if the zip is valid and an error message if not\n */\n private validateZipSize(zipPath: string, sizeBytes: number): { error?: string; isValid: boolean } {\n if (sizeBytes > MAX_ZIP_SIZE_BYTES) {\n // Delete the zip file if it's too large\n try {\n fs.unlinkSync(zipPath)\n } catch {\n // Ignore errors during cleanup\n }\n\n return {\n error: `Zip file is too large: ${bytesToMB(sizeBytes)}MB. Maximum allowed size is ${bytesToMB(MAX_ZIP_SIZE_BYTES)}MB`,\n isValid: false,\n }\n }\n\n return { isValid: true }\n }\n}\n"]}
@@ -1,34 +1,44 @@
1
1
  {
2
2
  "commands": {
3
- "describe-design-system": {
3
+ "components-import": {
4
4
  "aliases": [],
5
5
  "args": {},
6
- "description": "Describe structure of single design system by provided ID",
6
+ "description": "Analyze react components from given package and import them into Supernova",
7
7
  "examples": [
8
- "$ @supernovaio/cli describe-design-system --apiKey=\"{xxx-xxx-xxx}\" --designSystemId=\"{1234}\""
8
+ "<%= config.bin %> <%= command.id %> --importFrom components-package --rootDir ./src",
9
+ "<%= config.bin %> <%= command.id %> --importFrom @mui/material"
9
10
  ],
10
11
  "flags": {
11
- "apiKey": {
12
- "description": "API key to use for accessing Supernova instance",
13
- "name": "apiKey",
12
+ "designSystemId": {
13
+ "description": "Import code components to design system of",
14
+ "name": "designSystemId",
14
15
  "required": true,
15
16
  "hasDynamicHelp": false,
16
17
  "multiple": false,
17
18
  "type": "option"
18
19
  },
19
- "designSystemId": {
20
- "description": "Design System to describe structure of",
21
- "name": "designSystemId",
20
+ "importFrom": {
21
+ "char": "i",
22
+ "description": "Package or directory path to import components from",
23
+ "name": "importFrom",
22
24
  "required": true,
23
25
  "hasDynamicHelp": false,
24
26
  "multiple": false,
25
27
  "type": "option"
26
28
  },
27
- "proxyUrl": {
28
- "description": "When set, CLI will use provided proxy URL for all requests",
29
- "hidden": true,
30
- "name": "proxyUrl",
31
- "required": false,
29
+ "rootDir": {
30
+ "char": "r",
31
+ "description": "Root directory of the package where the import should resolve from. Defaults to the current directory",
32
+ "name": "rootDir",
33
+ "default": "/Users/artemufimtcev/supernova/code/node/cli/packages/cli",
34
+ "hasDynamicHelp": false,
35
+ "multiple": false,
36
+ "type": "option"
37
+ },
38
+ "versionId": {
39
+ "description": "Import code components to version of",
40
+ "name": "versionId",
41
+ "required": true,
32
42
  "hasDynamicHelp": false,
33
43
  "multiple": false,
34
44
  "type": "option"
@@ -36,7 +46,7 @@
36
46
  },
37
47
  "hasDynamicHelp": false,
38
48
  "hiddenAliases": [],
39
- "id": "describe-design-system",
49
+ "id": "components-import",
40
50
  "pluginAlias": "@supernovaio/cli-next",
41
51
  "pluginName": "@supernovaio/cli-next",
42
52
  "pluginType": "core",
@@ -45,15 +55,15 @@
45
55
  "relativePath": [
46
56
  "dist",
47
57
  "commands",
48
- "describe-design-system.js"
58
+ "components-import.js"
49
59
  ]
50
60
  },
51
- "describe-workspaces": {
61
+ "describe-design-system": {
52
62
  "aliases": [],
53
63
  "args": {},
54
- "description": "Describe structure of all workspaces and design systems available under those workspaces available for specified API key",
64
+ "description": "Describe structure of single design system by provided ID",
55
65
  "examples": [
56
- "$ @supernovaio/cli describe-workspaces --apiKey=\"{xxx-xxx-xxx}\""
66
+ "$ @supernovaio/cli describe-design-system --apiKey=\"{xxx-xxx-xxx}\" --designSystemId=\"{1234}\""
57
67
  ],
58
68
  "flags": {
59
69
  "apiKey": {
@@ -64,69 +74,19 @@
64
74
  "multiple": false,
65
75
  "type": "option"
66
76
  },
67
- "proxyUrl": {
68
- "description": "When set, CLI will use provided proxy URL for all requests",
69
- "hidden": true,
70
- "name": "proxyUrl",
71
- "required": false,
72
- "hasDynamicHelp": false,
73
- "multiple": false,
74
- "type": "option"
75
- }
76
- },
77
- "hasDynamicHelp": false,
78
- "hiddenAliases": [],
79
- "id": "describe-workspaces",
80
- "pluginAlias": "@supernovaio/cli-next",
81
- "pluginName": "@supernovaio/cli-next",
82
- "pluginType": "core",
83
- "strict": true,
84
- "isESM": true,
85
- "relativePath": [
86
- "dist",
87
- "commands",
88
- "describe-workspaces.js"
89
- ]
90
- },
91
- "import-components": {
92
- "aliases": [],
93
- "args": {},
94
- "description": "Analyze react components from given package and import them into Supernova",
95
- "examples": [
96
- "<%= config.bin %> <%= command.id %> --importFrom components-package --rootDir ./src",
97
- "<%= config.bin %> <%= command.id %> --importFrom @mui/material"
98
- ],
99
- "flags": {
100
77
  "designSystemId": {
101
- "description": "Import code components to design system of",
78
+ "description": "Design System to describe structure of",
102
79
  "name": "designSystemId",
103
80
  "required": true,
104
81
  "hasDynamicHelp": false,
105
82
  "multiple": false,
106
83
  "type": "option"
107
84
  },
108
- "importFrom": {
109
- "char": "i",
110
- "description": "Package or directory path to import components from",
111
- "name": "importFrom",
112
- "required": true,
113
- "hasDynamicHelp": false,
114
- "multiple": false,
115
- "type": "option"
116
- },
117
- "rootDir": {
118
- "char": "r",
119
- "description": "Root directory of the package where the import should resolve from. Defaults to the current directory",
120
- "name": "rootDir",
121
- "default": "/Users/artemufimtcev/supernova/code/node/cli/packages/cli",
122
- "hasDynamicHelp": false,
123
- "multiple": false,
124
- "type": "option"
125
- },
126
- "versionId": {
127
- "description": "Import code components to version of",
128
- "name": "versionId",
129
- "required": true,
85
+ "proxyUrl": {
86
+ "description": "When set, CLI will use provided proxy URL for all requests",
87
+ "hidden": true,
88
+ "name": "proxyUrl",
89
+ "required": false,
130
90
  "hasDynamicHelp": false,
131
91
  "multiple": false,
132
92
  "type": "option"
@@ -134,7 +94,7 @@
134
94
  },
135
95
  "hasDynamicHelp": false,
136
96
  "hiddenAliases": [],
137
- "id": "import-components",
97
+ "id": "describe-design-system",
138
98
  "pluginAlias": "@supernovaio/cli-next",
139
99
  "pluginName": "@supernovaio/cli-next",
140
100
  "pluginType": "core",
@@ -143,54 +103,30 @@
143
103
  "relativePath": [
144
104
  "dist",
145
105
  "commands",
146
- "import-components.js"
106
+ "describe-design-system.js"
147
107
  ]
148
108
  },
149
- "import-storybook": {
109
+ "describe-workspaces": {
150
110
  "aliases": [],
151
111
  "args": {},
152
- "description": "Import storybook static export to Supernova",
112
+ "description": "Describe structure of all workspaces and design systems available under those workspaces available for specified API key",
153
113
  "examples": [
154
- "<%= config.bin %> <%= command.id %> import-storybook --designSystemId=123 --dir ./storybook-static.zip"
114
+ "$ @supernovaio/cli describe-workspaces --apiKey=\"{xxx-xxx-xxx}\""
155
115
  ],
156
116
  "flags": {
157
- "brandId": {
158
- "char": "b",
159
- "description": "Import storybooks to brand of",
160
- "name": "brandId",
161
- "hasDynamicHelp": false,
162
- "multiple": false,
163
- "type": "option"
164
- },
165
- "designSystemId": {
166
- "char": "D",
167
- "description": "Import storybooks to design system of",
168
- "name": "designSystemId",
169
- "hasDynamicHelp": false,
170
- "multiple": false,
171
- "type": "option"
172
- },
173
- "dir": {
174
- "char": "d",
175
- "description": "Directory with storybook static export to import.",
176
- "name": "dir",
177
- "default": "./storybook-static",
178
- "hasDynamicHelp": false,
179
- "multiple": false,
180
- "type": "option"
181
- },
182
- "name": {
183
- "char": "a",
184
- "description": "Import storybooks with name of",
185
- "name": "name",
117
+ "apiKey": {
118
+ "description": "API key to use for accessing Supernova instance",
119
+ "name": "apiKey",
120
+ "required": true,
186
121
  "hasDynamicHelp": false,
187
122
  "multiple": false,
188
123
  "type": "option"
189
124
  },
190
- "sourceId": {
191
- "char": "s",
192
- "description": "Import storybooks to source of",
193
- "name": "sourceId",
125
+ "proxyUrl": {
126
+ "description": "When set, CLI will use provided proxy URL for all requests",
127
+ "hidden": true,
128
+ "name": "proxyUrl",
129
+ "required": false,
194
130
  "hasDynamicHelp": false,
195
131
  "multiple": false,
196
132
  "type": "option"
@@ -198,7 +134,7 @@
198
134
  },
199
135
  "hasDynamicHelp": false,
200
136
  "hiddenAliases": [],
201
- "id": "import-storybook",
137
+ "id": "describe-workspaces",
202
138
  "pluginAlias": "@supernovaio/cli-next",
203
139
  "pluginName": "@supernovaio/cli-next",
204
140
  "pluginType": "core",
@@ -207,7 +143,7 @@
207
143
  "relativePath": [
208
144
  "dist",
209
145
  "commands",
210
- "import-storybook.js"
146
+ "describe-workspaces.js"
211
147
  ]
212
148
  },
213
149
  "login": {
@@ -324,6 +260,70 @@
324
260
  "publish-documentation.js"
325
261
  ]
326
262
  },
263
+ "storybook-import": {
264
+ "aliases": [],
265
+ "args": {},
266
+ "description": "Import storybook static export to Supernova",
267
+ "examples": [
268
+ "<%= config.bin %> <%= command.id %> import-storybook "
269
+ ],
270
+ "flags": {
271
+ "brandId": {
272
+ "char": "b",
273
+ "description": "Import storybooks to brand of",
274
+ "name": "brandId",
275
+ "hasDynamicHelp": false,
276
+ "multiple": false,
277
+ "type": "option"
278
+ },
279
+ "designSystemId": {
280
+ "char": "d",
281
+ "description": "Import storybooks to design system of",
282
+ "name": "designSystemId",
283
+ "hasDynamicHelp": false,
284
+ "multiple": false,
285
+ "type": "option"
286
+ },
287
+ "from": {
288
+ "char": "f",
289
+ "description": "Directory with storybook static export to import.",
290
+ "name": "from",
291
+ "required": true,
292
+ "hasDynamicHelp": false,
293
+ "multiple": false,
294
+ "type": "option"
295
+ },
296
+ "name": {
297
+ "char": "n",
298
+ "description": "Import storybooks with name of",
299
+ "name": "name",
300
+ "hasDynamicHelp": false,
301
+ "multiple": false,
302
+ "type": "option"
303
+ },
304
+ "sourceId": {
305
+ "char": "s",
306
+ "description": "Import storybooks to source of",
307
+ "name": "sourceId",
308
+ "hasDynamicHelp": false,
309
+ "multiple": false,
310
+ "type": "option"
311
+ }
312
+ },
313
+ "hasDynamicHelp": false,
314
+ "hiddenAliases": [],
315
+ "id": "storybook-import",
316
+ "pluginAlias": "@supernovaio/cli-next",
317
+ "pluginName": "@supernovaio/cli-next",
318
+ "pluginType": "core",
319
+ "strict": true,
320
+ "isESM": true,
321
+ "relativePath": [
322
+ "dist",
323
+ "commands",
324
+ "storybook-import.js"
325
+ ]
326
+ },
327
327
  "sync-tokens": {
328
328
  "aliases": [],
329
329
  "args": {},
@@ -427,5 +427,5 @@
427
427
  ]
428
428
  }
429
429
  },
430
- "version": "2.0.25"
430
+ "version": "2.0.26"
431
431
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@supernovaio/cli-next",
3
3
  "description": "Supernova.io Command Line Interface",
4
- "version": "2.0.25",
4
+ "version": "2.0.26",
5
5
  "author": "Supernova.io",
6
6
  "bin": {
7
7
  "supernova-next": "./bin/run"
@@ -1 +0,0 @@
1
- {"version":3,"file":"import-storybook.d.ts","sourceRoot":"","sources":["../../src/commands/import-storybook.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,OAAO,EAA6B,aAAa,EAAyC,MAAM,mBAAmB,CAAA;AAUnH,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW5B,CAAA;AAEL,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAaxE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IAC/E,OAAgB,IAAI,KAAK;IACzB,OAAgB,WAAW,SAAgD;IAC3E,OAAgB,QAAQ,WAEvB;IACD,OAAgB,KAAK;;;;;;MAWpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAEj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,SAAiB;QACxD,IAAI,SAAS,GAAG,kBAAkB,EAAE,CAAC;YAEnC,IAAI,CAAC;gBACH,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;YACxB,CAAC;YAAC,MAAM,CAAC;YAET,CAAC;YAED,OAAO;gBACL,KAAK,EAAE,0BAA0B,SAAS,CAAC,SAAS,CAAC,+BAA+B,SAAS,CAAC,kBAAkB,CAAC,IAAI;gBACrH,OAAO,EAAE,KAAK;aACf,CAAA;QACH,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IAC1B,CAAC;;AA5VY;IAFZ,YAAY,EAAE;;;;0CAqId","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { action } from \"@oclif/core/ux\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport slugify from \"@sindresorhus/slugify\"\nimport { DTODataSourceStorybook } from \"@supernova-studio/client\"\nimport AdmZip from \"adm-zip\"\nimport axios from \"axios\"\nimport cliProgress from \"cli-progress\"\nimport inquirer from \"inquirer\"\nimport * as fs from \"node:fs\"\nimport path from \"node:path\"\nimport { z, ZodType } from \"zod\"\n\nimport { commonFlags, getTargetEnv, SentryCommand, storybookUrlForEnvironment, TargetEnv } from \"../types/index.js\"\nimport { sleep } from \"../utils/common.js\"\nimport { getApiClient } from \"../utils/index.js\"\n\n// Maximum allowed size for storybook zip file (500MB)\nconst MAX_ZIP_SIZE_BYTES = 500 * 1024 * 1024\n\nconst bytesToKB = (bytes: number) => (bytes / 1024).toFixed(2)\nconst bytesToMB = (bytes: number) => (bytes / (1024 * 1024)).toFixed(2)\n\nconst ImportStorybookConfigSchema = z\n .object({\n brandId: z.string().optional(),\n designSystemId: z.string().optional(),\n dir: z.string().optional(),\n name: z.string().optional(),\n sourceId: z.string().optional(),\n versionId: z.string().optional(),\n })\n .transform(data => ({\n ...data,\n }))\n\ntype ImportStorybookConfig = z.infer<typeof ImportStorybookConfigSchema>\n\nconst storybookEndpoint = (\n environment: TargetEnv,\n designSystemId: string,\n name: string,\n accessToken: string,\n): string => {\n const host = storybookUrlForEnvironment(environment)\n const encodedAccessToken = encodeURIComponent(accessToken)\n return `${host}/design-systems/${designSystemId}/alias/${name}/index.html?storybook_jwt=${encodedAccessToken}`\n}\n\nexport default class ImportStorybook extends SentryCommand<ImportStorybookConfig> {\n static override args = {}\n static override description = \"Import storybook static export to Supernova\"\n static override examples = [\n \"<%= config.bin %> <%= command.id %> import-storybook --designSystemId=123 --dir ./storybook-static.zip\",\n ]\n static override flags = {\n ...commonFlags,\n brandId: Flags.string({ char: \"b\", description: \"Import storybooks to brand of\" }),\n designSystemId: Flags.string({ char: \"D\", description: \"Import storybooks to design system of\" }),\n dir: Flags.string({\n char: \"d\",\n default: \"./storybook-static\",\n description: \"Directory with storybook static export to import.\",\n }),\n name: Flags.string({ char: \"a\", description: \"Import storybooks with name of\" }),\n sourceId: Flags.string({ char: \"s\", description: \"Import storybooks to source of\" }),\n }\n\n get commandId(): string {\n return ImportStorybook.id\n }\n\n get configSchema(): ZodType<ImportStorybookConfig> {\n return ImportStorybookConfigSchema\n }\n\n @SentryTraced()\n // eslint-disable-next-line complexity\n public async run(): Promise<void> {\n const startTime = Date.now()\n const { flags } = await this.parse(ImportStorybook)\n\n const env = getTargetEnv()\n const { brandId: bId, designSystemId: dsId, dir, name: nameInput, sourceId } = flags\n const name = slugify(await this.askName(nameInput), { lowercase: true })\n let designSystemId = dsId\n let brandId = bId\n\n const apiClient = await getApiClient(env)\n const { designSystems } = apiClient\n const { sources, storybookHosting } = designSystems\n\n if (!designSystemId) {\n designSystemId = await this.getDesignSystemId(env, designSystemId)\n\n if (!designSystemId) {\n this.error(\"Design system ID is required\")\n }\n\n this.saveConfig({ designSystemId })\n }\n\n if (!brandId) {\n brandId = await this.getBrandId(env, designSystemId, \"head\")\n\n if (!brandId) {\n this.error(\"Brand ID is required\")\n }\n\n this.saveConfig({ brandId })\n }\n\n const directoryValidation = this.validateStorybookDirectory(dir)\n if (!directoryValidation.isValid) {\n this.error(directoryValidation.error!)\n }\n\n this.log(`Preparing Storybook files from ${dir}...`)\n const { sizeBytes, zipPath } = this.createZipFromDirectory(dir)\n\n const sizeValidation = this.validateZipSize(zipPath, sizeBytes)\n if (!sizeValidation.isValid) {\n this.error(sizeValidation.error!)\n }\n\n const { signedUrl, storybookUploadId } = await storybookHosting.getSignedUploadUrl(designSystemId, { name })\n\n try {\n await this.uploadArchiveToSignedUrl({ designSystemId, name, signedUrl, storybookUploadId, zipPath })\n this.log(\"✅ Upload complete.\")\n this.log(\"Processing Storybook files...\")\n\n let status\n action.start(\"Deploying Storybook to private Supernova hosting service...\")\n\n let unknownStatusCount = 0\n try {\n do {\n // eslint-disable-next-line no-await-in-loop\n await sleep(1000)\n\n // eslint-disable-next-line no-await-in-loop\n status = await storybookHosting.getUploadStatus(designSystemId, storybookUploadId)\n\n if (status.status === \"Failed\") {\n break\n }\n\n if (status.status === \"Unknown\") {\n unknownStatusCount++\n } else {\n unknownStatusCount = 0\n }\n\n if (unknownStatusCount >= 5) {\n this.error(\"Failed to deploy Storybook: Internal server error\")\n }\n } while (status.status !== \"Completed\" || (status.timestamp && status.timestamp < startTime))\n\n if (status.status === \"Failed\") {\n action.stop(\"\\nFailed to deploy Storybook: Internal server error\")\n } else {\n const { accessToken } = await storybookHosting.getAccessToken(designSystemId, name)\n const storybookUrl = storybookEndpoint(env, designSystemId, name, accessToken)\n\n action.stop(\"\\n✅ Private Storybook deployed successfully!\")\n\n try {\n this.log(`Connecting Storybook as a data source in Supernova...`)\n let storiesCount = 0\n // eslint-disable-next-line max-depth\n if (sourceId) {\n const { storiesCount: updatedStoriesCount } = await sources.updateStorybookImport(\n designSystemId,\n \"head\",\n {\n payload: this.getIndexJson(dir),\n sourceId,\n },\n )\n storiesCount = updatedStoriesCount\n } else {\n const { source } = await sources.create(designSystemId, {\n brandPersistentId: brandId,\n description: \"CLI\",\n indexUrl: storybookUrl,\n payload: this.getIndexJson(dir),\n type: \"Storybook\",\n userUrl: storybookUrl,\n })\n storiesCount = (source as unknown as DTODataSourceStorybook).storybook.storiesCount\n this.saveConfig({ sourceId: source.id })\n }\n\n this.log(`✅ Imported ${storiesCount} component stories into Supernova!`.green)\n this.log(`🔒 Access your Storybook at: ${storybookUrl}`.green)\n } catch (error) {\n this.error(\n `Failed to connect Storybook as data source: ${error instanceof Error ? error.message : String(error)}`\n .red,\n )\n }\n }\n } catch (error) {\n action.stop(`\\nFailed to deploy Storybook: ${error instanceof Error ? error.message : String(error)}`.red)\n }\n } catch (error) {\n this.error(`Failed to upload Storybook files: ${error instanceof Error ? error.message : String(error)}`)\n }\n }\n\n private async askName(inputedName?: string) {\n if (inputedName) return inputedName\n const choice = await inquirer.prompt([\n {\n message: \"What's storybook name\",\n name: \"name\",\n type: \"input\",\n },\n ])\n if (choice.name === \"exit\") {\n this.log(\"Exiting...\")\n this.exit(0)\n }\n\n const name = choice.name as string\n this.saveConfig({ name })\n return name\n }\n\n /**\n * Creates a zip archive from a directory\n * @param directoryPath Path to the directory to zip\n * @returns Path to the created zip file and its size\n */\n private createZipFromDirectory(directoryPath: string): { sizeBytes: number; zipPath: string } {\n const zip = new AdmZip()\n\n let totalFiles = 0\n let processedFiles = 0\n\n const countFiles = (currentPath: string) => {\n const files = fs.readdirSync(currentPath)\n\n for (const file of files) {\n const filePath = path.join(currentPath, file)\n const stat = fs.statSync(filePath)\n\n if (stat.isDirectory()) {\n countFiles(filePath)\n } else {\n totalFiles++\n }\n }\n }\n\n countFiles(directoryPath)\n\n const progressBar = new cliProgress.SingleBar(\n {\n barCompleteChar: \"\\u2588\",\n barIncompleteChar: \"\\u2591\",\n format: \"Creating zip [{bar}] {percentage}% | {value}/{total} files | Current: {filename}\",\n hideCursor: true,\n },\n cliProgress.Presets.shades_classic,\n )\n\n progressBar.start(totalFiles, 0, {\n filename: \"Initializing...\",\n })\n\n const addFilesToZip = (currentPath: string, relativePath = \"\") => {\n const files = fs.readdirSync(currentPath)\n\n for (const file of files) {\n const filePath = path.join(currentPath, file)\n const stat = fs.statSync(filePath)\n const displayPath = path.join(relativePath, file)\n\n if (stat.isDirectory()) {\n addFilesToZip(filePath, displayPath)\n } else {\n // Update the progress bar with the current file\n processedFiles++\n progressBar.update(processedFiles, {\n filename:\n displayPath.length > 40 ? \"...\" + displayPath.slice(Math.max(0, displayPath.length - 37)) : displayPath,\n })\n\n zip.addLocalFile(filePath, relativePath)\n }\n }\n }\n\n try {\n addFilesToZip(directoryPath)\n } finally {\n progressBar.stop()\n }\n\n const zipPath = `${directoryPath}.zip`\n zip.writeZip(zipPath)\n\n const sizeBytes = fs.statSync(zipPath).size\n\n return { sizeBytes, zipPath }\n }\n\n private getIndexJson(directoryPath: string) {\n const indexJsonPath = path.join(directoryPath, \"index.json\")\n if (!fs.existsSync(indexJsonPath)) {\n return \"{}\"\n }\n\n return JSON.parse(fs.readFileSync(indexJsonPath, \"utf8\"))\n }\n\n /**\n * Uploads the zip archive to the provided signed URL\n */\n private async uploadArchiveToSignedUrl(input: {\n designSystemId: string\n name?: string\n signedUrl: string\n storybookUploadId: string\n zipPath: string\n }): Promise<void> {\n const { designSystemId, name, signedUrl, storybookUploadId, zipPath } = input\n this.log(`Securely uploading ${zipPath} to Supernova...`)\n\n // Create a new progress bar\n const progressBar = new cliProgress.SingleBar(\n {\n barCompleteChar: \"\\u2588\",\n barIncompleteChar: \"\\u2591\",\n format: \"Uploading |{bar}| {percentage}% || {value}/{total} kB\",\n hideCursor: true,\n },\n cliProgress.Presets.shades_classic,\n )\n\n const fileStream = fs.createReadStream(zipPath)\n const stats = fs.statSync(zipPath)\n const fileSize = stats.size\n const fileSizeKB = Number.parseFloat(bytesToKB(fileSize))\n\n // Start the progress bar\n progressBar.start(fileSizeKB, 0)\n\n try {\n await axios.put(signedUrl, fileStream, {\n headers: {\n \"Content-Length\": fileSize,\n \"Content-Type\": \"application/zip\",\n designSystemId,\n storybookUploadId,\n ...(name && { name }),\n },\n onUploadProgress(progressEvent) {\n const loaded = progressEvent.loaded || 0\n const loadedKB = Number.parseFloat(bytesToKB(loaded))\n progressBar.update(loadedKB)\n },\n })\n\n // Complete the progress bar\n progressBar.update(fileSizeKB)\n progressBar.stop()\n } catch (error) {\n // Make sure to stop the progress bar if there's an error\n progressBar.stop()\n throw error\n }\n }\n\n /**\n * Validates if a directory is a valid storybook static export\n * @param directoryPath Path to the storybook directory\n * @returns An object indicating if the directory is valid and an error message if not\n */\n private validateStorybookDirectory(directoryPath: string): { error?: string; isValid: boolean } {\n if (!fs.existsSync(directoryPath)) {\n return { error: `Directory not found: ${directoryPath}`, isValid: false }\n }\n\n if (!fs.statSync(directoryPath).isDirectory()) {\n return { error: `Not a directory: ${directoryPath}`, isValid: false }\n }\n\n // Check for essential storybook files\n const requiredFiles = [\"index.html\", \"iframe.html\"]\n const missingFiles = requiredFiles.filter(file => !fs.existsSync(path.join(directoryPath, file)))\n\n if (missingFiles.length > 0) {\n return {\n error: `Directory does not appear to be a valid Storybook export. Missing files: ${missingFiles.join(\", \")}`,\n isValid: false,\n }\n }\n\n return { isValid: true }\n }\n\n /**\n * Validates if a zip file size is within the allowed limits\n * @param zipPath Path to the zip file\n * @param sizeBytes Size of the zip file in bytes\n * @returns An object indicating if the zip is valid and an error message if not\n */\n private validateZipSize(zipPath: string, sizeBytes: number): { error?: string; isValid: boolean } {\n if (sizeBytes > MAX_ZIP_SIZE_BYTES) {\n // Delete the zip file if it's too large\n try {\n fs.unlinkSync(zipPath)\n } catch {\n // Ignore errors during cleanup\n }\n\n return {\n error: `Zip file is too large: ${bytesToMB(sizeBytes)}MB. Maximum allowed size is ${bytesToMB(MAX_ZIP_SIZE_BYTES)}MB`,\n isValid: false,\n }\n }\n\n return { isValid: true }\n }\n}\n"]}