Skip to content

Standardize NPM Scripts #40952

Closed
Closed
@ObliviousHarmony

Description

@ObliviousHarmony

In order to introduce more consistency into our monorepo we are going to move our package scripts towards a consistent naming scheme. As part of this effort we are going to remove superfluous scripts in favor of using some tools directly. This will make it easier for developers to know what commands to use in each package.

Scripts

Building

  • build:project: Builds the project itself without any of the dependencies.
  • build: Builds the project and all of its dependencies according to the dependency graph.
  • watch:build: Builds the project and then watches it for changes to automatically rebuild.

Linting

  • lint:js: Lints any of the JavaScript/TypeScript files in the project (if there are any). This uses lint-staged to only run against files that have changed.
  • lint:php: Lints any of the PHP files in the project (if there are any). This uses lint-staged to only run against files that have changed.
  • lint: Lints all of the languages present in the package. Use the regex /^lint:(?!fix)[a-z0-9\-]+$/ to run against language linting but not :fix scripts.
  • lint:js:fix: Fixes any JS linting errors.
  • lint:php:fix: Fixes any PHP linting errors.
  • lint:fix: Fixes any linting errors. Use the regex ^lint:[a-z0-9\-]+:fix$ to run only against fix linting scripts.

Development Environment

  • env: Calls wp-env directly. There's not much value in commands like env:start since the command is just env start like this.

Testing

  • test:js: Runs any JavaScript tests.
  • test:php: Runs any PHP tests.
  • test:e2e: Runs any E2E tests.
  • test:api: Runs any API tests.
  • test:performance: Runs any performance tests.

Acceptance Criteria

  • Scripts for all projects replaced with the above.
  • Documentation updated.

Metadata

Metadata

Labels

KirigamiWC Store Editing (FSE)Task (new)The issue is an internally driven task (e.g. from another A8c team).focus: monorepo infrastructureIssues and PRs related to monorepo tooling.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions