Skip to content

Commit 5ba4d8b

Browse files
Build: Add GUTENBERG_CHECK_INSTALLED_DEPS env var to opt out of installed-deps check (#79068)
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
1 parent e1a7e9a commit 5ba4d8b

2 files changed

Lines changed: 46 additions & 22 deletions

File tree

tools/build-scripts/build.mjs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,29 @@ async function build() {
8585
const startTime = Date.now();
8686

8787
try {
88-
// Step 0: Verify node_modules is in sync with package-lock.json
89-
console.log( '🔍 Checking dependencies...' );
90-
await exec( 'npm', [
91-
'run',
92-
'check-installed-deps',
93-
'--workspace',
94-
'@wordpress/validation-tools',
95-
'--silent',
96-
] ).catch( () => {
97-
throw new Error( 'Run `npm install` to update.' );
98-
} );
88+
/*
89+
* Step 0: Verify node_modules is in sync with package-lock.json.
90+
*
91+
* GUTENBERG_CHECK_INSTALLED_DEPS controls when this runs:
92+
* - `BEFORE_BUILD` (default): pre-build gate.
93+
* - `NEVER`: skip entirely (sticky opt-out for power users).
94+
*/
95+
if ( process.env.GUTENBERG_CHECK_INSTALLED_DEPS === 'NEVER' ) {
96+
console.log(
97+
'🔍 Skipping dependency check (GUTENBERG_CHECK_INSTALLED_DEPS=NEVER).'
98+
);
99+
} else {
100+
console.log( '🔍 Checking dependencies...' );
101+
await exec( 'npm', [
102+
'run',
103+
'check-installed-deps',
104+
'--workspace',
105+
'@wordpress/validation-tools',
106+
'--silent',
107+
] ).catch( () => {
108+
throw new Error( 'Run `npm install` to update.' );
109+
} );
110+
}
99111

100112
console.log( '\n🧹 Cleaning packages...' );
101113
await exec( 'npm', [ 'run', 'clean:packages' ], { silent: true } );

tools/build-scripts/dev.mjs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,29 @@ async function dev() {
121121
readyMarkerFile.cleanup();
122122

123123
try {
124-
// Step 0: Verify node_modules is in sync with package-lock.json
125-
console.log( '🔍 Checking dependencies...' );
126-
await exec( 'npm', [
127-
'run',
128-
'check-installed-deps',
129-
'--workspace',
130-
'@wordpress/validation-tools',
131-
'--silent',
132-
] ).catch( () => {
133-
throw new Error( 'Run `npm install` to update.' );
134-
} );
124+
/*
125+
* Step 0: Verify node_modules is in sync with package-lock.json.
126+
*
127+
* GUTENBERG_CHECK_INSTALLED_DEPS controls when this runs:
128+
* - `BEFORE_BUILD` (default): pre-build gate.
129+
* - `NEVER`: skip entirely (sticky opt-out for power users).
130+
*/
131+
if ( process.env.GUTENBERG_CHECK_INSTALLED_DEPS === 'NEVER' ) {
132+
console.log(
133+
'🔍 Skipping dependency check (GUTENBERG_CHECK_INSTALLED_DEPS=NEVER).'
134+
);
135+
} else {
136+
console.log( '🔍 Checking dependencies...' );
137+
await exec( 'npm', [
138+
'run',
139+
'check-installed-deps',
140+
'--workspace',
141+
'@wordpress/validation-tools',
142+
'--silent',
143+
] ).catch( () => {
144+
throw new Error( 'Run `npm install` to update.' );
145+
} );
146+
}
135147

136148
console.log( '\n🧹 Cleaning packages...' );
137149
await exec( 'npm', [ 'run', 'clean:packages' ], { silent: true } );

0 commit comments

Comments
 (0)