@supernovaio/cli 2.0.37 → 2.0.39

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.
Files changed (55) hide show
  1. package/README.md +1 -0
  2. package/dist/commands/analyze/adoption.d.ts +15 -0
  3. package/dist/commands/analyze/adoption.d.ts.map +1 -0
  4. package/dist/commands/analyze/adoption.js +34 -0
  5. package/dist/commands/analyze/adoption.js.map +1 -0
  6. package/dist/commands/analyze/components.d.ts +15 -0
  7. package/dist/commands/analyze/components.d.ts.map +1 -0
  8. package/dist/commands/analyze/components.js +34 -0
  9. package/dist/commands/analyze/components.js.map +1 -0
  10. package/dist/commands/analyze/status.d.ts +24 -0
  11. package/dist/commands/analyze/status.d.ts.map +1 -0
  12. package/dist/commands/analyze/status.js +54 -0
  13. package/dist/commands/analyze/status.js.map +1 -0
  14. package/dist/commands/analyze.d.ts +15 -0
  15. package/dist/commands/analyze.d.ts.map +1 -0
  16. package/dist/commands/analyze.js +34 -0
  17. package/dist/commands/analyze.js.map +1 -0
  18. package/dist/commands/components-import.d.ts +3 -3
  19. package/dist/commands/components-import.d.ts.map +1 -1
  20. package/dist/commands/components-import.js +8 -2
  21. package/dist/commands/components-import.js.map +1 -1
  22. package/dist/commands/template-upload.d.ts +4 -2
  23. package/dist/commands/template-upload.d.ts.map +1 -1
  24. package/dist/commands/template-upload.js +47 -17
  25. package/dist/commands/template-upload.js.map +1 -1
  26. package/dist/types/config.d.ts +36 -0
  27. package/dist/types/config.d.ts.map +1 -1
  28. package/dist/types/config.js +9 -2
  29. package/dist/types/config.js.map +1 -1
  30. package/dist/utils/analyze-command.d.ts +42 -0
  31. package/dist/utils/analyze-command.d.ts.map +1 -0
  32. package/dist/utils/analyze-command.js +606 -0
  33. package/dist/utils/analyze-command.js.map +1 -0
  34. package/dist/utils/analyze-status.d.ts +7 -0
  35. package/dist/utils/analyze-status.d.ts.map +1 -0
  36. package/dist/utils/analyze-status.js +94 -0
  37. package/dist/utils/analyze-status.js.map +1 -0
  38. package/dist/utils/config.service.d.ts +1 -2
  39. package/dist/utils/config.service.d.ts.map +1 -1
  40. package/dist/utils/config.service.js +5 -7
  41. package/dist/utils/config.service.js.map +1 -1
  42. package/dist/utils/discover.d.ts +21 -0
  43. package/dist/utils/discover.d.ts.map +1 -0
  44. package/dist/utils/discover.js +305 -0
  45. package/dist/utils/discover.js.map +1 -0
  46. package/dist/utils/http-client.d.ts +4 -0
  47. package/dist/utils/http-client.d.ts.map +1 -0
  48. package/dist/utils/http-client.js +18 -0
  49. package/dist/utils/http-client.js.map +1 -0
  50. package/dist/utils/validate-templates.d.ts +16 -0
  51. package/dist/utils/validate-templates.d.ts.map +1 -0
  52. package/dist/utils/validate-templates.js +140 -0
  53. package/dist/utils/validate-templates.js.map +1 -0
  54. package/oclif.manifest.json +233 -3
  55. package/package.json +5 -2
package/README.md CHANGED
@@ -205,6 +205,7 @@ See the additional use cases section for more information about available comman
205
205
  Following is the list of use cases for Supernova CLI. We will be adding more over time, stay tuned!
206
206
 
207
207
  - [Host private storybook](./docs/storybook-hosting.md)
208
+ - [Analyze code and push snapshots](./docs/code-analysis.md)
208
209
  - [Synchronize Figma Token Plugin data](./docs/figma-tokens-sync.md)
209
210
  - [List workspaces, design systems, brands and themes](./docs/list-workspaces.md)
210
211
 
@@ -0,0 +1,15 @@
1
+ import { AnalyzeCommandBase } from "../../utils/analyze-command.js";
2
+ export default class AnalyzeAdoption extends AnalyzeCommandBase {
3
+ static hidden: boolean;
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ designSystemId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ package: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ exclude: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ dryRun: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ noWait: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=adoption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adoption.d.ts","sourceRoot":"","sources":["../../../src/commands/analyze/adoption.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAgB,MAAM,gCAAgC,CAAA;AAEjF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,kBAAkB;IAC7D,OAAgB,MAAM,UAAO;IAC7B,OAAgB,WAAW,SAAsE;IACjG,OAAgB,QAAQ,WAGvB;IACD,OAAgB,KAAK;;;;;;MAAe;IAGvB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAIlC"}
@@ -0,0 +1,34 @@
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]="1312306f-3ab0-5d68-a8b3-7bccb1df5b10")}catch(e){}}();
3
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ };
9
+ var __metadata = (this && this.__metadata) || function (k, v) {
10
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11
+ };
12
+ import { SentryTraced } from "@sentry/nestjs";
13
+ import { AnalyzeCommandBase, analyzeFlags } from "../../utils/analyze-command.js";
14
+ export default class AnalyzeAdoption extends AnalyzeCommandBase {
15
+ static hidden = true;
16
+ static description = "Analyze package adoption and push adoption snapshots to Supernova";
17
+ static examples = [
18
+ "<%= config.bin %> <%= command.id %> --designSystemId 123 --package @acme/ds",
19
+ "<%= config.bin %> <%= command.id %> --package @acme/ds --dry-run",
20
+ ];
21
+ static flags = analyzeFlags;
22
+ async run() {
23
+ const { flags } = await this.parse(AnalyzeAdoption);
24
+ await this.executeAnalyze(flags, "usage");
25
+ }
26
+ }
27
+ __decorate([
28
+ SentryTraced(),
29
+ __metadata("design:type", Function),
30
+ __metadata("design:paramtypes", []),
31
+ __metadata("design:returntype", Promise)
32
+ ], AnalyzeAdoption.prototype, "run", null);
33
+ //# sourceMappingURL=adoption.js.map
34
+ //# debugId=1312306f-3ab0-5d68-a8b3-7bccb1df5b10
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adoption.js","sources":["../../../src/commands/analyze/adoption.ts"],"sourceRoot":"","sourcesContent":["import { SentryTraced } from \"@sentry/nestjs\"\n\nimport { AnalyzeCommandBase, analyzeFlags } from \"../../utils/analyze-command.js\"\n\nexport default class AnalyzeAdoption extends AnalyzeCommandBase {\n static override hidden = true\n static override description = \"Analyze package adoption and push adoption snapshots to Supernova\"\n static override examples = [\n \"<%= config.bin %> <%= command.id %> --designSystemId 123 --package @acme/ds\",\n \"<%= config.bin %> <%= command.id %> --package @acme/ds --dry-run\",\n ]\n static override flags = analyzeFlags\n\n @SentryTraced()\n public async run(): Promise<void> {\n const { flags } = await this.parse(AnalyzeAdoption)\n await this.executeAnalyze(flags, \"usage\")\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAEjF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,kBAAkB;IAC7D,MAAM,CAAU,MAAM,GAAG,IAAI,CAAA;IAC7B,MAAM,CAAU,WAAW,GAAG,mEAAmE,CAAA;IACjG,MAAM,CAAU,QAAQ,GAAG;QACzB,6EAA6E;QAC7E,kEAAkE;KACnE,CAAA;IACD,MAAM,CAAU,KAAK,GAAG,YAAY,CAAA;IAGvB,AAAN,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QACnD,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC;;AAHY;IADZ,YAAY,EAAE;;;;0CAId","debug_id":"1312306f-3ab0-5d68-a8b3-7bccb1df5b10"}
@@ -0,0 +1,15 @@
1
+ import { AnalyzeCommandBase } from "../../utils/analyze-command.js";
2
+ export default class AnalyzeComponents extends AnalyzeCommandBase {
3
+ static hidden: boolean;
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ designSystemId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ package: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ exclude: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ dryRun: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ noWait: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/commands/analyze/components.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAgB,MAAM,gCAAgC,CAAA;AAEjF,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,kBAAkB;IAC/D,OAAgB,MAAM,UAAO;IAC7B,OAAgB,WAAW,SAA+E;IAC1G,OAAgB,QAAQ,WAGvB;IACD,OAAgB,KAAK;;;;;;MAAe;IAGvB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAIlC"}
@@ -0,0 +1,34 @@
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]="e15aba56-cfab-5cc4-84bf-1599ee1cfdb8")}catch(e){}}();
3
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ };
9
+ var __metadata = (this && this.__metadata) || function (k, v) {
10
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11
+ };
12
+ import { SentryTraced } from "@sentry/nestjs";
13
+ import { AnalyzeCommandBase, analyzeFlags } from "../../utils/analyze-command.js";
14
+ export default class AnalyzeComponents extends AnalyzeCommandBase {
15
+ static hidden = true;
16
+ static description = "Analyze design system components and push component snapshots to Supernova";
17
+ static examples = [
18
+ "<%= config.bin %> <%= command.id %> --designSystemId 123 --package @acme/ds",
19
+ "<%= config.bin %> <%= command.id %> --package @acme/ds --dry-run",
20
+ ];
21
+ static flags = analyzeFlags;
22
+ async run() {
23
+ const { flags } = await this.parse(AnalyzeComponents);
24
+ await this.executeAnalyze(flags, "components");
25
+ }
26
+ }
27
+ __decorate([
28
+ SentryTraced(),
29
+ __metadata("design:type", Function),
30
+ __metadata("design:paramtypes", []),
31
+ __metadata("design:returntype", Promise)
32
+ ], AnalyzeComponents.prototype, "run", null);
33
+ //# sourceMappingURL=components.js.map
34
+ //# debugId=e15aba56-cfab-5cc4-84bf-1599ee1cfdb8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sources":["../../../src/commands/analyze/components.ts"],"sourceRoot":"","sourcesContent":["import { SentryTraced } from \"@sentry/nestjs\"\n\nimport { AnalyzeCommandBase, analyzeFlags } from \"../../utils/analyze-command.js\"\n\nexport default class AnalyzeComponents extends AnalyzeCommandBase {\n static override hidden = true\n static override description = \"Analyze design system components and push component snapshots to Supernova\"\n static override examples = [\n \"<%= config.bin %> <%= command.id %> --designSystemId 123 --package @acme/ds\",\n \"<%= config.bin %> <%= command.id %> --package @acme/ds --dry-run\",\n ]\n static override flags = analyzeFlags\n\n @SentryTraced()\n public async run(): Promise<void> {\n const { flags } = await this.parse(AnalyzeComponents)\n await this.executeAnalyze(flags, \"components\")\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAEjF,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,kBAAkB;IAC/D,MAAM,CAAU,MAAM,GAAG,IAAI,CAAA;IAC7B,MAAM,CAAU,WAAW,GAAG,4EAA4E,CAAA;IAC1G,MAAM,CAAU,QAAQ,GAAG;QACzB,6EAA6E;QAC7E,kEAAkE;KACnE,CAAA;IACD,MAAM,CAAU,KAAK,GAAG,YAAY,CAAA;IAGvB,AAAN,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACrD,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;IAChD,CAAC;;AAHY;IADZ,YAAY,EAAE;;;;4CAId","debug_id":"e15aba56-cfab-5cc4-84bf-1599ee1cfdb8"}
@@ -0,0 +1,24 @@
1
+ import { z, ZodType } from "zod";
2
+ import { SentryCommand } from "../../types/index.js";
3
+ declare const AnalyzeStatusConfig: z.ZodObject<{
4
+ designSystemId: z.ZodOptional<z.ZodString>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ designSystemId?: string | undefined;
7
+ }, {
8
+ designSystemId?: string | undefined;
9
+ }>;
10
+ type AnalyzeStatusConfig = z.infer<typeof AnalyzeStatusConfig>;
11
+ export default class AnalyzeStatus extends SentryCommand<AnalyzeStatusConfig> {
12
+ static hidden: boolean;
13
+ static args: {};
14
+ static description: string;
15
+ static examples: string[];
16
+ static flags: {
17
+ designSystemId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ };
19
+ get commandId(): string;
20
+ get configSchema(): ZodType<AnalyzeStatusConfig>;
21
+ run(): Promise<void>;
22
+ }
23
+ export {};
24
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/analyze/status.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAIpD,QAAA,MAAM,mBAAmB;;;;;;EAEvB,CAAA;AAEF,KAAK,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE9D,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,aAAa,CAAC,mBAAmB,CAAC;IAC3E,OAAgB,MAAM,UAAO;IAC7B,OAAgB,IAAI,KAAK;IACzB,OAAgB,WAAW,SAA0D;IACrF,OAAgB,QAAQ,WAA+D;IACvF,OAAgB,KAAK;;MAEpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAE/C;IAGY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAYlC"}
@@ -0,0 +1,54 @@
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]="9b414a25-ffd6-56d4-9196-e9ef1b31464d")}catch(e){}}();
3
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ };
9
+ var __metadata = (this && this.__metadata) || function (k, v) {
10
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11
+ };
12
+ import { Flags } from "@oclif/core";
13
+ import { SentryTraced } from "@sentry/nestjs";
14
+ import { z } from "zod";
15
+ import { SentryCommand } from "../../types/index.js";
16
+ import { watchAnalyzeStatus } from "../../utils/analyze-status.js";
17
+ import { createApiClient } from "../../utils/http-client.js";
18
+ const AnalyzeStatusConfig = z.object({
19
+ designSystemId: z.string().optional(),
20
+ });
21
+ export default class AnalyzeStatus extends SentryCommand {
22
+ static hidden = true;
23
+ static args = {};
24
+ static description = "Show code snapshot processing status for current user";
25
+ static examples = ["<%= config.bin %> <%= command.id %> --designSystemId 123"];
26
+ static flags = {
27
+ designSystemId: Flags.string({ char: "d", description: "Design system ID" }),
28
+ };
29
+ get commandId() {
30
+ return AnalyzeStatus.id;
31
+ }
32
+ get configSchema() {
33
+ return AnalyzeStatusConfig;
34
+ }
35
+ async run() {
36
+ const { flags } = await this.parse(AnalyzeStatus);
37
+ const config = this.configService.get();
38
+ const designSystemId = flags.designSystemId ?? config?.designSystemId ?? (await this.promptDesignSystemId());
39
+ const apiClient = await createApiClient(this.env);
40
+ await watchAnalyzeStatus({
41
+ apiClient,
42
+ designSystemId,
43
+ error: message => this.error(message),
44
+ });
45
+ }
46
+ }
47
+ __decorate([
48
+ SentryTraced(),
49
+ __metadata("design:type", Function),
50
+ __metadata("design:paramtypes", []),
51
+ __metadata("design:returntype", Promise)
52
+ ], AnalyzeStatus.prototype, "run", null);
53
+ //# sourceMappingURL=status.js.map
54
+ //# debugId=9b414a25-ffd6-56d4-9196-e9ef1b31464d
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sources":["../../../src/commands/analyze/status.ts"],"sourceRoot":"","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport { z, ZodType } from \"zod\"\n\nimport { SentryCommand } from \"../../types/index.js\"\nimport { watchAnalyzeStatus } from \"../../utils/analyze-status.js\"\nimport { createApiClient } from \"../../utils/http-client.js\"\n\nconst AnalyzeStatusConfig = z.object({\n designSystemId: z.string().optional(),\n})\n\ntype AnalyzeStatusConfig = z.infer<typeof AnalyzeStatusConfig>\n\nexport default class AnalyzeStatus extends SentryCommand<AnalyzeStatusConfig> {\n static override hidden = true\n static override args = {}\n static override description = \"Show code snapshot processing status for current user\"\n static override examples = [\"<%= config.bin %> <%= command.id %> --designSystemId 123\"]\n static override flags = {\n designSystemId: Flags.string({ char: \"d\", description: \"Design system ID\" }),\n }\n\n get commandId(): string {\n return AnalyzeStatus.id\n }\n\n get configSchema(): ZodType<AnalyzeStatusConfig> {\n return AnalyzeStatusConfig\n }\n\n @SentryTraced()\n public async run(): Promise<void> {\n const { flags } = await this.parse(AnalyzeStatus)\n const config = this.configService.get()\n const designSystemId = flags.designSystemId ?? config?.designSystemId ?? (await this.promptDesignSystemId())\n const apiClient = await createApiClient(this.env)\n\n await watchAnalyzeStatus({\n apiClient,\n designSyst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,EAAE,cAAc,IAAI,CAAC,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAA;QAC5G,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAEjD,MAAM,kBAAkB,CAAC;YACvB,SAAS;YACT,cAAc;YACd,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;SACtC,CAAC,CAAA;IACJ,CAAC;;AAXY;IADZ,YAAY,EAAE;;;;wCAYd","debug_id":"9b414a25-ffd6-56d4-9196-e9ef1b31464d"}
@@ -0,0 +1,15 @@
1
+ import { AnalyzeCommandBase } from "../utils/analyze-command.js";
2
+ export default class Analyze extends AnalyzeCommandBase {
3
+ static hidden: boolean;
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ designSystemId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ package: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ exclude: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ dryRun: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ noWait: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=analyze.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/commands/analyze.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAgB,MAAM,6BAA6B,CAAA;AAE9E,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,kBAAkB;IACrD,OAAgB,MAAM,UAAO;IAC7B,OAAgB,WAAW,SAA0E;IACrG,OAAgB,QAAQ,WAGvB;IACD,OAAgB,KAAK;;;;;;MAAe;IAGvB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAIlC"}
@@ -0,0 +1,34 @@
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]="72f138af-8f7b-5b85-8570-234d6a37d37d")}catch(e){}}();
3
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ };
9
+ var __metadata = (this && this.__metadata) || function (k, v) {
10
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11
+ };
12
+ import { SentryTraced } from "@sentry/nestjs";
13
+ import { AnalyzeCommandBase, analyzeFlags } from "../utils/analyze-command.js";
14
+ export default class Analyze extends AnalyzeCommandBase {
15
+ static hidden = true;
16
+ static description = "Analyze components and adoption, then push all snapshots to Supernova";
17
+ static examples = [
18
+ "<%= config.bin %> <%= command.id %> --designSystemId 123 --package @acme/ds",
19
+ "<%= config.bin %> <%= command.id %> --package @acme/ds --package @acme/icons",
20
+ ];
21
+ static flags = analyzeFlags;
22
+ async run() {
23
+ const { flags } = await this.parse(Analyze);
24
+ await this.executeAnalyze(flags, "all");
25
+ }
26
+ }
27
+ __decorate([
28
+ SentryTraced(),
29
+ __metadata("design:type", Function),
30
+ __metadata("design:paramtypes", []),
31
+ __metadata("design:returntype", Promise)
32
+ ], Analyze.prototype, "run", null);
33
+ //# sourceMappingURL=analyze.js.map
34
+ //# debugId=72f138af-8f7b-5b85-8570-234d6a37d37d
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze.js","sources":["../../src/commands/analyze.ts"],"sourceRoot":"","sourcesContent":["import { SentryTraced } from \"@sentry/nestjs\"\n\nimport { AnalyzeCommandBase, analyzeFlags } from \"../utils/analyze-command.js\"\n\nexport default class Analyze extends AnalyzeCommandBase {\n static override hidden = true\n static override description = \"Analyze components and adoption, then push all snapshots to Supernova\"\n static override examples = [\n \"<%= config.bin %> <%= command.id %> --designSystemId 123 --package @acme/ds\",\n \"<%= config.bin %> <%= command.id %> --package @acme/ds --package @acme/icons\",\n ]\n static override flags = analyzeFlags\n\n @SentryTraced()\n public async run(): Promise<void> {\n const { flags } = await this.parse(Analyze)\n await this.executeAnalyze(flags, \"all\")\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE9E,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,kBAAkB;IACrD,MAAM,CAAU,MAAM,GAAG,IAAI,CAAA;IAC7B,MAAM,CAAU,WAAW,GAAG,uEAAuE,CAAA;IACrG,MAAM,CAAU,QAAQ,GAAG;QACzB,6EAA6E;QAC7E,8EAA8E;KAC/E,CAAA;IACD,MAAM,CAAU,KAAK,GAAG,YAAY,CAAA;IAGvB,AAAN,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC3C,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IACzC,CAAC;;AAHY;IADZ,YAAY,EAAE;;;;kCAId","debug_id":"72f138af-8f7b-5b85-8570-234d6a37d37d"}
@@ -7,13 +7,13 @@ declare const ImportComponentsConfigSchema: z.ZodEffects<z.ZodObject<{
7
7
  versionId: z.ZodString;
8
8
  }, "strip", z.ZodTypeAny, {
9
9
  designSystemId: string;
10
- importFrom: string;
11
10
  rootDir: string;
11
+ importFrom: string;
12
12
  versionId: string;
13
13
  }, {
14
14
  designSystemId: string;
15
- importFrom: string;
16
15
  rootDir: string;
16
+ importFrom: string;
17
17
  versionId: string;
18
18
  }>, {
19
19
  rootDir: string;
@@ -22,8 +22,8 @@ declare const ImportComponentsConfigSchema: z.ZodEffects<z.ZodObject<{
22
22
  versionId: string;
23
23
  }, {
24
24
  designSystemId: string;
25
- importFrom: string;
26
25
  rootDir: string;
26
+ importFrom: string;
27
27
  versionId: string;
28
28
  }>;
29
29
  type ImportComponentsConfig = z.infer<typeof ImportComponentsConfigSchema>;
@@ -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,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
+ {"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;AAM1E,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;CAkDlC"}
@@ -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]="c8903c25-f445-5364-bfe9-74efbeac1ceb")}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]="e7b627d2-dc90-561a-907c-4a3200d9df7e")}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);
@@ -25,6 +25,9 @@ const ImportComponentsConfigSchema = z
25
25
  ...data,
26
26
  rootDir: data.rootDir ?? process.cwd(),
27
27
  }));
28
+ function isComponentsImportDisabled() {
29
+ return true;
30
+ }
28
31
  export default class ImportComponents extends SentryCommand {
29
32
  static args = {};
30
33
  static description = "Analyze react components from given package and import them into Supernova";
@@ -54,6 +57,9 @@ export default class ImportComponents extends SentryCommand {
54
57
  return ImportComponentsConfigSchema;
55
58
  }
56
59
  async run() {
60
+ if (isComponentsImportDisabled()) {
61
+ this.error("Command 'components-import' is temporarily disabled. use 'analyze' instead.");
62
+ }
57
63
  const { flags } = await this.parse(ImportComponents);
58
64
  const { designSystemId, importFrom, rootDir, versionId } = flags;
59
65
  this.log("📦 Component Import Summary");
@@ -99,4 +105,4 @@ __decorate([
99
105
  __metadata("design:returntype", Promise)
100
106
  ], ImportComponents.prototype, "run", null);
101
107
  //# sourceMappingURL=components-import.js.map
102
- //# debugId=c8903c25-f445-5364-bfe9-74efbeac1ceb
108
+ //# debugId=e7b627d2-dc90-561a-907c-4a3200d9df7e
@@ -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 = 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\")\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`)\n } else {\n this.log(\"\\n⚠️ No components were imported\")\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,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,KAAK,CAAC,MAAM,CAAC;YACvB,IAAI,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;YACpE,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;YACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;YACrC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,SAAS,EAAE;gBAClG,cAAc,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBACnC,GAAG,CAAC;oBACJ,YAAY,EAAE,GAAG,cAAc,IAAI,SAAS,GAAG,CAAC,CAAC,UAAU,GAAG;iBAC/D,CAAC,CAAC;aACJ,CAAC,CAAA;YACF,IAAI,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAA;QAC1D,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;;AA7CY;IADZ,YAAY,EAAE;;;;2CA8Cd","debug_id":"c8903c25-f445-5364-bfe9-74efbeac1ceb"}
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\nfunction isComponentsImportDisabled(): boolean {\n return true\n}\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 if (isComponentsImportDisabled()) {\n this.error(\"Command 'components-import' is temporarily disabled. use 'analyze' instead.\")\n }\n\n const { flags } = await this.parse(ImportComponents)\n\n const { designSystemId, importFrom, rootDir, versionId } = flags\n\n this.log(\"📦 Component Import Summary\")\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`)\n } else {\n this.log(\"\\n⚠️ No components were imported\")\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,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,SAAS,0BAA0B;IACjC,OAAO,IAAI,CAAA;AACb,CAAC;AAED,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,CA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,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;YACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;YACrC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,SAAS,EAAE;gBAClG,cAAc,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBACnC,GAAG,CAAC;oBACJ,YAAY,EAAE,GAAG,cAAc,IAAI,SAAS,GAAG,CAAC,CAAC,UAAU,GAAG;iBAC/D,CAAC,CAAC;aACJ,CAAC,CAAA;YACF,IAAI,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAA;QAC1D,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;;AAjDY;IADZ,YAAY,EAAE;;;;2CAkDd","debug_id":"e7b627d2-dc90-561a-907c-4a3200d9df7e"}
@@ -8,10 +8,12 @@ export default class TemplateUpload extends SentryCommand<TemplateUploadConfig>
8
8
  static examples: string[];
9
9
  static hidden: boolean;
10
10
  static flags: {
11
- workspaceId: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
- designSystemId: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ workspaceId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ designSystemId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
13
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
14
  npmToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ discover: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
17
  };
16
18
  get commandId(): string;
17
19
  get configSchema(): ZodType<TemplateUploadConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"template-upload.d.ts","sourceRoot":"","sources":["../../src/commands/template-upload.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAIhC,OAAO,EAAe,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAY9D,QAAA,MAAM,oBAAoB,gDAAe,CAAA;AAEzC,KAAK,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAuBhE,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IAC7E,OAAgB,IAAI,KAAK;IACzB,OAAgB,WAAW,SAAqD;IAChF,OAAgB,QAAQ,WAA0D;IAClF,OAAgB,MAAM,EAAE,OAAO,CAAQ;IACvC,OAAgB,KAAK;;;;;MAmBpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAEhD;IAGY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YA2DnB,oBAAoB;IAMlC,OAAO,CAAC,cAAc;YAIR,cAAc;YAId,kBAAkB;YAclB,gBAAgB;YAyBhB,eAAe;YAkBf,mBAAmB;YA0BnB,iCAAiC;CA8FhD"}
1
+ {"version":3,"file":"template-upload.d.ts","sourceRoot":"","sources":["../../src/commands/template-upload.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAIhC,OAAO,EAAe,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAc9D,QAAA,MAAM,oBAAoB,gDAAe,CAAA;AAEzC,KAAK,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAahE,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IAC7E,OAAgB,IAAI,KAAK;IACzB,OAAgB,WAAW,SAAqD;IAChF,OAAgB,QAAQ,WAA0D;IAClF,OAAgB,MAAM,EAAE,OAAO,CAAQ;IACvC,OAAgB,KAAK;;;;;;;MA4BpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAEhD;IAGY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YA8FnB,oBAAoB;IAMlC,OAAO,CAAC,cAAc;YAIR,cAAc;YAId,kBAAkB;YAclB,gBAAgB;YAyBhB,eAAe;YAkBf,mBAAmB;YA0BnB,iCAAiC;CA8FhD"}
@@ -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]="3a01607f-c974-5086-8482-944a26462fb3")}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]="b80a82ae-3a40-5488-a3cf-4d8210ab28a6")}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);
@@ -23,17 +23,10 @@ import crypto from "node:crypto";
23
23
  import { commonFlags, SentryCommand } from "../types/index.js";
24
24
  import { sleep } from "../utils/common.js";
25
25
  import { tmpdir } from "node:os";
26
+ import { discoverAndUpdatePackageJson, discoverFilesForTemplates } from "../utils/discover.js";
27
+ import { validateTemplates, fileExists } from "../utils/validate-templates.js";
26
28
  const exec = promisify(execCallback);
27
29
  const TemplateUploadConfig = z.object({});
28
- async function fileExists(p) {
29
- try {
30
- await fs.access(p);
31
- return true;
32
- }
33
- catch {
34
- return false;
35
- }
36
- }
37
30
  const dockerfileTemplate = `
38
31
  FROM node:22-slim
39
32
 
@@ -52,11 +45,11 @@ export default class TemplateUpload extends SentryCommand {
52
45
  static hidden = false;
53
46
  static flags = {
54
47
  ...commonFlags,
55
- workspaceId: Flags.string({ char: "w", description: "Workspace ID to upload the template to", required: true }),
48
+ workspaceId: Flags.string({ char: "w", description: "Workspace ID to upload the template to", required: false }),
56
49
  designSystemId: Flags.string({
57
50
  char: "d",
58
51
  description: "Design system ID to upload the template to",
59
- required: true,
52
+ required: false,
60
53
  }),
61
54
  force: Flags.boolean({
62
55
  char: "f",
@@ -67,6 +60,15 @@ export default class TemplateUpload extends SentryCommand {
67
60
  description: "Allows passing NPM token as a Docker secret. The token will be available as a NPM_TOKEN env variable",
68
61
  required: false,
69
62
  }),
63
+ discover: Flags.boolean({
64
+ description: "Run template and pattern discovery before upload to update package.json",
65
+ required: false,
66
+ }),
67
+ debug: Flags.boolean({
68
+ description: "Preserve shell directory and App.tsx on template build failures for debugging",
69
+ required: false,
70
+ hidden: true,
71
+ }),
70
72
  };
71
73
  get commandId() {
72
74
  return TemplateUpload.id;
@@ -77,6 +79,31 @@ export default class TemplateUpload extends SentryCommand {
77
79
  async run() {
78
80
  const apiClient = await this.apiClient();
79
81
  const { flags } = await this.parse();
82
+ if (flags.discover) {
83
+ action.start("🔍 Running template and pattern discovery");
84
+ try {
85
+ const { templates, patterns } = await discoverAndUpdatePackageJson(process.cwd());
86
+ action.stop(`found ${Object.keys(templates).length} templates, ${Object.keys(patterns).length} patterns`);
87
+ }
88
+ catch (error) {
89
+ action.stop("failed");
90
+ if (error instanceof Error)
91
+ this.error(`Discovery failed: ${error.message}`);
92
+ else
93
+ throw error;
94
+ }
95
+ }
96
+ const isDiscoverOnly = flags.discover && !flags.workspaceId && !flags.designSystemId;
97
+ if (isDiscoverOnly) {
98
+ this.log("✅ Discovery completed. Use --workspaceId and --designSystemId to upload templates.");
99
+ return;
100
+ }
101
+ if (!flags.workspaceId) {
102
+ this.error("Missing required flag workspaceId");
103
+ }
104
+ if (!flags.designSystemId) {
105
+ this.error("Missing required flag designSystemId");
106
+ }
80
107
  let pkg;
81
108
  try {
82
109
  pkg = await readPackageJson();
@@ -98,9 +125,12 @@ export default class TemplateUpload extends SentryCommand {
98
125
  this.warn(`package.json doesn't contain 'supernova.privateDependencies' declaration.`);
99
126
  this.warn(`Dependencies coming from private registries will fail`);
100
127
  }
101
- const templatesWithThumbnailUrls = pkg.supernova?.templates
102
- ? await this.uploadThumbnailsAndBuildTemplates(apiClient, flags.workspaceId, pkg.supernova.templates)
103
- : undefined;
128
+ let templatesWithThumbnailUrls;
129
+ if (pkg.supernova?.templates) {
130
+ const templates = await discoverFilesForTemplates(pkg.supernova.templates, process.cwd());
131
+ await validateTemplates(templates, this, flags.debug);
132
+ templatesWithThumbnailUrls = await this.uploadThumbnailsAndBuildTemplates(apiClient, flags.workspaceId, templates);
133
+ }
104
134
  const buildData = await apiClient.sandboxes.builds.start({
105
135
  workspaceId: flags.workspaceId,
106
136
  designSystemId: flags.designSystemId,
@@ -334,7 +364,7 @@ async function uploadFilesToUrls(uploadUrls, fileResponses, thumbnailFiles) {
334
364
  function buildTemplateUrlMap(thumbnailFiles, fileResponses) {
335
365
  const thumbnailUrlMap = {};
336
366
  for (const thumbnailFile of thumbnailFiles) {
337
- const fileResponse = fileResponses.find(f => f.name === thumbnailFile.name && f.size === thumbnailFile.size);
367
+ const fileResponse = fileResponses.find(f => f.deduplicationKey === thumbnailFile.checksum);
338
368
  if (fileResponse) {
339
369
  thumbnailUrlMap[thumbnailFile.templateId] = fileResponse.url;
340
370
  }
@@ -351,4 +381,4 @@ async function getFileSize(filePath) {
351
381
  return stats.size;
352
382
  }
353
383
  //# sourceMappingURL=template-upload.js.map
354
- //# debugId=3a01607f-c974-5086-8482-944a26462fb3
384
+ //# debugId=b80a82ae-3a40-5488-a3cf-4d8210ab28a6