Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize NPM Scripts #40952

Closed
ObliviousHarmony opened this issue Oct 23, 2023 · 2 comments
Closed

Standardize NPM Scripts #40952

ObliviousHarmony opened this issue Oct 23, 2023 · 2 comments
Assignees
Labels
focus: monorepo infrastructure Issues and PRs related to monorepo tooling. team: Kirigami & Origami type: task The issue is an internally driven task (e.g. from another A8c team).

Comments

@ObliviousHarmony
Copy link
Contributor

ObliviousHarmony commented Oct 23, 2023

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.
@ObliviousHarmony ObliviousHarmony added the focus: monorepo infrastructure Issues and PRs related to monorepo tooling. label Oct 23, 2023
@ObliviousHarmony
Copy link
Contributor Author

Some packages check for TypeScript types but don't include that in the build process. This looks like ts:check but we should make it lint:types

@ObliviousHarmony ObliviousHarmony added the type: task The issue is an internally driven task (e.g. from another A8c team). label Oct 24, 2023
@ObliviousHarmony ObliviousHarmony self-assigned this Nov 16, 2023
@ObliviousHarmony
Copy link
Contributor Author

In the interest of minimizing the breakage from the associated PR we will leave most of the scripts in the plugins and clients alone. We can alter them in a follow-up once everything has settled in a bit and we've taken care of a few prerequisites around E2E test initialization and sharding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: monorepo infrastructure Issues and PRs related to monorepo tooling. team: Kirigami & Origami type: task The issue is an internally driven task (e.g. from another A8c team).
Projects
None yet
Development

No branches or pull requests

2 participants