diff --git a/packages/scripts/src/cli.ts b/packages/scripts/src/cli.ts index 48490293..c342ba88 100644 --- a/packages/scripts/src/cli.ts +++ b/packages/scripts/src/cli.ts @@ -64,12 +64,11 @@ class CompassCli { } public async run() { - const { user, force, packages } = this.options; + const { user, force } = this.options; const cmd = this.program.args[0]; switch (true) { case cmd === "build": { - validatePackages(packages); await runBuild(this.options); break; } diff --git a/packages/scripts/src/commands/build.ts b/packages/scripts/src/commands/build.ts index fb2fdf00..d3a3aaca 100644 --- a/packages/scripts/src/commands/build.ts +++ b/packages/scripts/src/commands/build.ts @@ -16,13 +16,12 @@ import { getClientId, getApiBaseUrl, getEnvironmentAnswer, + validatePackages, } from "@scripts/common/cli.utils"; export const runBuild = async (options: Options_Cli) => { - const pckgs = - options?.packages?.length === 0 - ? await getPckgsTo("build") - : (options.packages as string[]); + const pckgs = options.packages ? options.packages : await getPckgsTo("build"); + validatePackages(pckgs); if (pckgs.includes(PCKG.NODE)) { await buildNodePckgs(options); diff --git a/packages/scripts/src/common/cli.utils.ts b/packages/scripts/src/common/cli.utils.ts index bf9e8aca..297690db 100644 --- a/packages/scripts/src/common/cli.utils.ts +++ b/packages/scripts/src/common/cli.utils.ts @@ -176,7 +176,7 @@ export const validateOptions = (options: Options_Cli): Options_Cli => { export const validatePackages = (packages: string[] | undefined) => { if (!packages) { - log.error("Packages must be defined"); + log.error("Package must be defined"); process.exit(1); } const unsupportedPackages = packages.filter(