Use these checks to make it easier to work with scripts, dependencies, and more.

Check that a package has specific scripts

Helpful when using a task runner or package manager that allows running scripts across many packages.

.commonality/has-build-scripts.ts
import { hasJsonFile } from 'commonality-checks-recommended';

export default hasJsonFile('package.json', {
  scripts: {
    build: 'tsc --build',
    dev: 'tsc --watch',
  },
});
.commonality/config.json
{
  "checks": [
    "buildable": [
      "has-build-scripts"
    ]
  ]
}

Check that a package has an .npmignore

Useful to prevent publishing dist directories or *.test.* files.

.commonality/has-npm-ignore.ts
import { hasText } from 'commonality-checks-recommended';

export default hasText('.npmignore', ['dist']);
.commonality/config.json
{
  "checks": [
    "publishable": [
      "has-npm-ignore"
    ]
  ]
}