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
12 changes: 0 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,3 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
[stackoverflow]: https://stackoverflow.com/questions/tagged/angular-devkit

## <a name="public-api"></a> Updating the Public API
Our Public API surface is tracked using golden files.

You check all golden files by running:
```bash
pnpm public-api:check
```

If you modified the public API, the test will fail. To update the golden files you need to run:
```bash
pnpm public-api:update
```
54 changes: 0 additions & 54 deletions goldens/public-api/manage.js

This file was deleted.

4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
"postinstall": "pnpm -s webdriver-update && husky",
"//webdriver-update-README": "ChromeDriver version must match Puppeteer Chromium version, see https://github.com/GoogleChrome/puppeteer/releases http://chromedriver.chromium.org/downloads",
"webdriver-update": "webdriver-manager update --standalone false --gecko false --versions.chrome 106.0.5249.21",
"public-api:check": "node goldens/public-api/manage.js test",
"ng-dev": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only node_modules/@angular/ng-dev/bundles/cli.mjs",
"public-api:update": "node goldens/public-api/manage.js accept",
"ts-circular-deps": "pnpm -s ng-dev ts-circular-deps --config ./scripts/circular-deps-test.conf.mjs",
"check-tooling-setup": "tsc --project .ng-dev/tsconfig.json",
"diff-release-package": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only scripts/diff-release-package.mts"
Expand Down Expand Up @@ -89,7 +87,6 @@
"@types/progress": "^2.0.3",
"@types/resolve": "^1.17.1",
"@types/semver": "^7.3.12",
"@types/shelljs": "^0.8.11",
"@types/watchpack": "^2.4.4",
"@types/yargs": "^17.0.20",
"@types/yargs-parser": "^21.0.0",
Expand Down Expand Up @@ -134,7 +131,6 @@
"rollup-plugin-dts": "6.2.3",
"rollup-plugin-sourcemaps2": "0.5.4",
"semver": "7.7.3",
"shelljs": "^0.10.0",
"source-map-support": "0.5.21",
"tar": "^7.0.0",
"ts-node": "^10.9.1",
Expand Down
23 changes: 0 additions & 23 deletions pnpm-lock.yaml

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

49 changes: 40 additions & 9 deletions scripts/build-packages-dist.mts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@

import { BuiltPackage } from '@angular/ng-dev';
import { execSync } from 'node:child_process';
import { chmodSync, copyFileSync, mkdirSync, rmSync } from 'node:fs';
import {
chmodSync,
copyFileSync,
cpSync,
existsSync,
lstatSync,
mkdirSync,
readdirSync,
rmSync,
} from 'node:fs';
import { dirname, join } from 'node:path';
import sh from 'shelljs';

/** Name of the Bazel tag that will be used to find release package targets. */
const releaseTargetTag = 'release-package';
Expand Down Expand Up @@ -89,14 +97,15 @@ function buildReleasePackages(
// Archive output is created by the npm_package_archive target
const archiveOutputPath = directoryOutputPath + '_archive.tgz';

if (sh.test('-d', directoryOutputPath)) {
sh.chmod('-R', 'u+w', directoryOutputPath);
sh.rm('-rf', directoryOutputPath);
if (existsSync(directoryOutputPath)) {
chmodRecursiveSync(directoryOutputPath, '0755');
rmSync(directoryOutputPath, { recursive: true, force: true });
}
try {

if (existsSync(archiveOutputPath)) {
chmodSync(archiveOutputPath, '0755');
rmSync(archiveOutputPath, { force: true });
} catch {}
}
});

// Build both the npm_package and npm_package_archive targets for each package
Expand All @@ -123,8 +132,8 @@ function buildReleasePackages(
mkdirSync(dirname(targetFolder), { recursive: true });

// Copy package contents to target directory
sh.cp('-R', directoryOutputPath, targetFolder);
sh.chmod('-R', 'u+w', targetFolder);
cpSync(directoryOutputPath, targetFolder, { recursive: true });
chmodRecursiveSync(targetFolder, '0755');

// Copy archive of package to target directory
const archiveTargetPath = join(distPath, `${pkgName.replace('/', '_')}.tgz`);
Expand Down Expand Up @@ -176,3 +185,25 @@ function exec(command: string, captureStdout?: true) {
return stdout.toString().trim();
}
}

/**
* Recursively changes the permissions (mode) of a directory and all its contents (files and subdirectories).
* @param startPath The starting directory path.
* @param mode The new permissions mode (e.g., 0755).
*/
function chmodRecursiveSync(startPath: string, mode: string): void {
chmodSync(startPath, mode);

const files = readdirSync(startPath);

for (const file of files) {
const filePath = join(startPath, file);
const stat = lstatSync(filePath);

if (stat.isDirectory()) {
chmodRecursiveSync(filePath, mode);
} else {
chmodSync(filePath, mode);
}
}
}
29 changes: 25 additions & 4 deletions scripts/diff-release-package.mts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

import { GitClient } from '@angular/ng-dev';
import childProcess from 'node:child_process';
import fs from 'node:fs';
import fs, { chmodSync, lstatSync, readdirSync } from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import sh from 'shelljs';
import path, { join } from 'node:path';

// Do not remove `.git` as we use Git for comparisons later.
// Also preserve `uniqueId` as it's irrelevant for the diff and not included via Bazel.
Expand Down Expand Up @@ -130,6 +129,28 @@ async function deleteDir(dirPath: string) {
}

// Needed as Bazel artifacts are readonly and cannot be deleted otherwise.
sh.chmod('-R', 'u+w', dirPath);
chmodRecursiveSync(dirPath, '0755');
await fs.promises.rm(dirPath, { recursive: true, force: true, maxRetries: 3 });
}

/**
* Recursively changes the permissions (mode) of a directory and all its contents (files and subdirectories).
* @param startPath The starting directory path.
* @param mode The new permissions mode (e.g., 0755).
*/
function chmodRecursiveSync(startPath: string, mode: string): void {
chmodSync(startPath, mode);

const files = readdirSync(startPath);

for (const file of files) {
const filePath = join(startPath, file);
const stat = lstatSync(filePath);

if (stat.isDirectory()) {
chmodRecursiveSync(filePath, mode);
} else {
chmodSync(filePath, mode);
}
}
}
12 changes: 0 additions & 12 deletions scripts/templates/contributing.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,3 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
[stackoverflow]: https://stackoverflow.com/questions/tagged/angular-devkit

## <a name="public-api"></a> Updating the Public API
Our Public API surface is tracked using golden files.

You check all golden files by running:
```bash
pnpm public-api:check
```

If you modified the public API, the test will fail. To update the golden files you need to run:
```bash
pnpm public-api:update
```