Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@
"lint-staged": "^16.4.0",
"npm-run-all": "^4.1.5",
"patch-package": "^8.0.0",
"rimraf": "^5.0.10",
"syncpack": "^15.3.1",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"wait-on": "^8.0.1"
},
"overrides": {
Expand All @@ -92,8 +90,8 @@
"scripts": {
"build": "npm run --workspace @wordpress/build-scripts build:all --",
"build:plugin-zip": "bash ./bin/build-plugin-zip.sh",
"clean:package-types": "tsc --build --clean && rimraf --glob \"./packages/*/build-types\"",
"clean:packages": "rimraf --glob \"./packages/*/{build,build-module,build-wp,build-style}\" \"./build\"",
"clean:package-types": "npm run --workspace @wordpress/build-scripts clean:package-types --",
"clean:packages": "npm run --workspace @wordpress/build-scripts clean:packages --",
"dev": "npm run --workspace @wordpress/build-scripts dev --",
"distclean": "git clean --force -d -X",
"docs:api-ref": "npm run --workspace @wordpress/docs-tools docs:api-ref --",
Expand All @@ -105,7 +103,7 @@
"docs:gen": "npm run --workspace @wordpress/docs-tools docs:gen --",
"docs:theme-ref": "npm run --workspace @wordpress/docs-tools docs:theme-ref --",
"env": "wp-env",
"fixtures:clean": "rimraf --glob \"test/integration/fixtures/blocks/*.{json,serialized.html}\"",
"fixtures:clean": "npm run --workspace @wordpress/integration-tests fixtures:clean --",
"fixtures:generate": "cross-env GENERATE_MISSING_FIXTURES=y npm run test:unit -- test/integration/full-content/ && npm run format test/integration/fixtures/blocks/*.json",
"fixtures:regenerate": "npm-run-all fixtures:clean fixtures:generate",
"format": "wp-scripts format",
Expand Down Expand Up @@ -182,11 +180,7 @@
"packages/*",
"routes/*",
"storybook",
"test/e2e",
"test/integration",
"test/performance",
"test/storybook-playwright",
"test/unit",
"test/*",
"tools/*",
"widgets/*"
]
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"@types/eslint": "^9",
"@types/estree": "^1.0.8",
"@typescript-eslint/parser": "^8.57.1",
"eslint": "^10.0.0"
"eslint": "^10.0.0",
"typescript": "npm:@typescript/typescript6@^6.0.2"
},
"peerDependencies": {
"@babel/core": ">=7",
Expand Down
1 change: 1 addition & 0 deletions storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"storybook": "^10.4.3",
"storybook-addon-tag-badges": "^3.0.4",
"terser": "^5.37.0",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^7.3.2"
},
"publishConfig": {
Expand Down
6 changes: 5 additions & 1 deletion test/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@
"@wordpress/rich-text": "file:../../packages/rich-text",
"ajv": "^8.17.1",
"fast-glob": "^3.2.7",
"react": "^18.3.1"
"react": "^18.3.1",
"rimraf": "^5.0.10"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"fixtures:clean": "rimraf --glob \"fixtures/blocks/*.{json,serialized.html}\""
}
}
6 changes: 5 additions & 1 deletion tools/build-scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ async function build() {
}

console.log( '\n🧹 Cleaning packages...' );
await exec( 'npm', [ 'run', 'clean:packages' ], { silent: true } );
await exec(
'node',
[ path.join( __dirname, 'clean.mjs' ), '--packages' ],
{ silent: true }
);

console.log( '\n📦 Building workspaces...' );
await exec(
Expand Down
60 changes: 60 additions & 0 deletions tools/build-scripts/clean.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env node

/**
* External dependencies
*/
import spawn from 'cross-spawn';
import path from 'path';
import { rimraf } from 'rimraf';
import { fileURLToPath } from 'url';
import { parseArgs } from 'util';

const __dirname = path.dirname( fileURLToPath( import.meta.url ) );
const ROOT_DIR = path.resolve( __dirname, '../..' );

const { values } = parseArgs( {
options: {
packages: { type: 'boolean', default: false },
types: { type: 'boolean', default: false },
},
strict: false,
} );

if ( ! values.packages && ! values.types ) {
console.error( 'Usage: node ./clean.mjs [--packages] [--types]' );
process.exit( 1 );
}

/**
* Remove paths matching the given globs, resolved from the repository root.
*
* @param {string[]} patterns Glob patterns.
* @return {Promise<void>} Promise that resolves once the paths are removed.
*/
function remove( patterns ) {
return rimraf( patterns, { glob: { cwd: ROOT_DIR, absolute: true } } );
}

if ( values.types ) {
/*
* TypeScript tracks its own output through `.tsbuildinfo` files, so it has to
* remove those itself before the emitted directories are deleted.
*/
const { status } = spawn.sync( 'tsc', [ '--build', '--clean' ], {
cwd: ROOT_DIR,
stdio: 'inherit',
} );

if ( status !== 0 ) {
process.exit( status ?? 1 );
}

await remove( [ 'packages/*/build-types' ] );
}

if ( values.packages ) {
await remove( [
'packages/*/{build,build-module,build-wp,build-style}',
'build',
] );
}
6 changes: 5 additions & 1 deletion tools/build-scripts/dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ async function dev() {
}

console.log( '\n🧹 Cleaning packages...' );
await exec( 'npm', [ 'run', 'clean:packages' ], { silent: true } );
await exec(
'node',
[ path.join( __dirname, 'clean.mjs' ), '--packages' ],
{ silent: true }
);

console.log( '\n📦 Building workspaces...' );
await exec(
Expand Down
3 changes: 3 additions & 0 deletions tools/build-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@
"magic-string": "^0.30.21",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rimraf": "^5.0.10",
"source-map": "^0.6.1"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build:all": "node ./build.mjs",
"clean:package-types": "node ./clean.mjs --types",
"clean:packages": "node ./clean.mjs --packages",
"dev": "node ./dev.mjs",
"build-vendors": "node ./packages/build-vendors.mjs",
"generate-worker-placeholders": "node ./packages/generate-worker-placeholders.mjs",
Expand Down
3 changes: 2 additions & 1 deletion tools/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"fast-glob": "^3.2.7",
"glob": "^7.1.2",
"json2md": "^2.0.1",
"react-docgen-typescript": "^2.4.0"
"react-docgen-typescript": "^2.4.0",
"typescript": "npm:@typescript/typescript6@^6.0.2"
},
"publishConfig": {
"access": "public"
Expand Down
1 change: 1 addition & 0 deletions tools/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"glob": "^7.1.2",
"globals": "^16.0.0",
"react": "^18.3.1",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"typescript-eslint": "^8.57.1"
},
"publishConfig": {
Expand Down
Loading