@supernovaio/cli
Version:
Supernova.io Command Line Interface
77 lines (75 loc) • 3.67 kB
JavaScript
!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]="6c917424-276a-5601-8d13-86c37b6ae6b4")}catch(e){}}();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Flags } from "@oclif/core";
import { SentryTraced } from "@sentry/nestjs";
import { z } from "zod";
import { commonFlags, SentryCommand } from "../types/index.js";
import { getWritableVersion } from "../utils/sdk.js";
const DescribeDesignSystemConfigSchema = z
.object({
apiKey: z.string(),
designSystemId: z.string(),
proxyUrl: z.string().url().optional(),
})
.transform(data => ({
...data,
}));
export class DescribeDesignSystem extends SentryCommand {
static aliases = ["describe-design-system"];
static description = "Describe structure of single design system by provided ID";
static examples = [
`$ @supernovaio/cli describe-design-system --apiKey="{xxx-xxx-xxx}" --designSystemId="{1234}"`,
];
static flags = {
...commonFlags,
apiKey: Flags.string({ description: "API key to use for accessing Supernova instance", required: true }),
designSystemId: Flags.string({ description: "Design System to describe structure of", required: true }),
proxyUrl: Flags.string({
description: "When set, CLI will use provided proxy URL for all requests",
hidden: true,
required: false,
}),
};
get commandId() {
return DescribeDesignSystem.id;
}
get configSchema() {
return DescribeDesignSystemConfigSchema;
}
async run() {
const { flags } = await this.parse(DescribeDesignSystem);
const { designSystem, id, instance } = await getWritableVersion(flags);
const brands = await instance.brands.getBrands(id);
const themes = await instance.tokens.getTokenThemes(id);
this.log(`\n↳ Design system "${designSystem.name}", id: ${designSystem.id}`.cyan);
for (const brand of brands) {
this.log(` ↳ Brand: "${brand.name}", id: ${brand.id}`);
const brandThemes = themes.filter(t => t.brandId === brand.id);
if (brandThemes.length > 0) {
for (const theme of brandThemes) {
this.log(` ↳ Theme: "${theme.name}", id: ${theme.id}`);
}
}
else {
this.log(` ↳ No themes defined in this brand`.gray);
}
}
this.log("\nDone".green);
}
}
__decorate([
SentryTraced(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], DescribeDesignSystem.prototype, "run", null);
//# sourceMappingURL=describe-design-system.js.map
//# debugId=6c917424-276a-5601-8d13-86c37b6ae6b4