@supernovaio/cli
Version:
Supernova.io Command Line Interface
74 lines (72 loc) • 3.97 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]="e1efc569-bfeb-5bef-a414-811fe63c4db5")}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 { SentryTraced } from "@sentry/nestjs";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { AnalyzeCommandBase, analyzeFlags } from "../../utils/analyze-command.js";
const fallbackAnalyzeHelpDescription = [
"Analyze components and package adoption for one or more packages.",
"Runs both scanners (`components` and `usage`) for each package target.",
"By default, generated snapshots are uploaded to Supernova and processing is tracked until completion.",
"Use `--dryRun` to keep results local only and skip upload, or `--noWait` to exit after processing starts.",
].join("\n");
const loadAnalyzeHelpDescription = () => {
const commandFilePath = fileURLToPath(import.meta.url);
const docsPath = path.resolve(path.dirname(commandFilePath), "../../../docs/code-analysis.md");
try {
return fs.readFileSync(docsPath, "utf8").trim();
}
catch {
return fallbackAnalyzeHelpDescription;
}
};
export default class Analyze extends AnalyzeCommandBase {
static description = loadAnalyzeHelpDescription();
static examples = [
"<%= config.bin %> <%= command.id %> --package @acme/ds --dryRun",
"<%= config.bin %> <%= command.id %> --designSystemId 1234 --package @acme/ds",
"<%= config.bin %> <%= command.id %> --package @acme/ds --package @acme/icons",
"<%= config.bin %> <%= command.id %> --package @acme/ds --exclude @acme/utils",
"<%= config.bin %> code analyze status --designSystemId 1234",
];
static flags = analyzeFlags;
async run() {
const { flags } = await this.parse(Analyze);
if (this.isWizardMode(flags)) {
await this.promptIntro();
const selectedDesignSystem = flags.designSystemId
? await this.fetchDesignSystemById(flags.designSystemId)
: await this.promptDesignSystemWizard();
flags.designSystemId = selectedDesignSystem.id;
const discovered = await this.promptSourceScanIntro();
while (true) {
flags.package = await this.promptPackageSelection(discovered);
const scope = await this.promptScanScope();
flags.exclude =
scope === "select" ? await this.promptExcludePackageSelection(discovered) : undefined;
const result = await this.executeAnalyze(flags, "all", true, selectedDesignSystem);
if (result === "completed")
break;
}
return;
}
await this.executeAnalyze(flags, "all");
}
}
__decorate([
SentryTraced(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], Analyze.prototype, "run", null);
//# sourceMappingURL=analyze.js.map
//# debugId=e1efc569-bfeb-5bef-a414-811fe63c4db5