Skip to content

checkPackageScripts

checkPackageScripts(scripts, role): PackageScriptProblem[]

Defined in: cli/astromech/src/generators/scripts/check-package-scripts/check-package-scripts.ts:34

The rule violations in one package.json’s scripts (spec ci-flat-task-vocabulary, “The recursion hazard” and “The check that keeps them aligned”):

  • a script named like an npm or pnpm lifecycle word (publish, install, …), except the root’s prepare (husky);
  • a script named like a suite (test, lint, scan) in a package: a suite is a turbo task with no script, and a package’s own would be run by turbo run test as well as the aggregator. The root holds the suite scripts;
  • a leaf script that calls turbo run or holocron run in a package: it must hold the real tool command, or turbo would run it, and it would run turbo again;
  • a script that looks like a suite member but is none (test:unt), other than a known variant;
  • a script named by a task id’s hyphen spelling (deploy-preview) where the script spelling takes a colon (deploy:preview): holocron run looks the script up by the script spelling, so the task would find none and be skipped as “enforced in CI” (#1929);
  • an old dotted task name, as a warn while those are accepted.

Readonly<Record<string, string>>

PackageRole

PackageScriptProblem[]