Skip to content

Commit 78cee8e

Browse files
josephperrottkirjs
authored andcommitted
ci: correctly check for outputPaths to exist before deleting them (angular#64137)
Properly check if the output paths for each npm package exists before ensuring they are deleted when building all packages PR Close angular#64137
1 parent 3b28ee1 commit 78cee8e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

scripts/build/package-builder.mts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import {execSync, spawnSync} from 'child_process';
9+
import {execSync} from 'child_process';
1010
import {join, dirname} from 'path';
1111
import {BuiltPackage} from '@angular/ng-dev';
1212
import {fileURLToPath} from 'url';
13+
import {existsSync, lstatSync} from 'fs';
1314

1415
/** Path to the project directory. */
1516
export const projectDir: string = join(dirname(fileURLToPath(import.meta.url)), '../..');
@@ -72,7 +73,7 @@ function buildReleasePackages(
7273
// do this to ensure that the version placeholders are properly populated.
7374
packageNames.forEach((pkgName) => {
7475
const outputPath = getBazelOutputPath(pkgName);
75-
if (spawnSync(`[ -d ${outputPath} ]`).status !== 0) {
76+
if (existsSync(outputPath) && lstatSync(outputPath).isDirectory()) {
7677
exec(`chmod -R u+w ${outputPath}`);
7778
exec(`rm -rf ${outputPath}`);
7879
}

0 commit comments

Comments
 (0)