Skip to content

Commit 021a434

Browse files
committed
build: address issue with snapshot publishing due to non existing property
This should fix the snpashot publishing which are currently being skipped. ``` Skipping @angular/cli. Skipping @angular/create. Skipping @angular/pwa. Skipping @angular/ssr. Skipping @angular-devkit/architect. Skipping @angular-devkit/architect-cli. Skipping @angular-devkit/build-angular. Skipping @angular-devkit/build-webpack. Skipping @angular-devkit/core. Skipping @angular-devkit/schematics. Skipping @angular-devkit/schematics-cli. Skipping @ngtools/webpack. Skipping @schematics/angular. ```
1 parent 7975845 commit 021a434

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scripts/snapshots.mts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ function _copy(from: string, to: string) {
5151
});
5252
}
5353

54+
const monorepoData = JSON.parse(fs.readFileSync('./.monorepo.json', 'utf-8'));
55+
5456
function _exec(command: string, args: string[], opts: { cwd?: string }) {
5557
const { status, error, stdout } = spawnSync(command, args, {
5658
stdio: ['ignore', 'pipe', 'inherit'],
@@ -65,29 +67,27 @@ function _exec(command: string, args: string[], opts: { cwd?: string }) {
6567
return stdout.toString('utf-8');
6668
}
6769

68-
const monorepoData = JSON.parse(fs.readFileSync('./.monorepo.json', 'utf-8'));
6970
let gitShaCache: string | undefined;
70-
7171
async function _publishSnapshot(
7272
pkg: PackageInfo,
7373
branch: string,
7474
message: string,
7575
githubToken: string,
7676
) {
77-
const monoRepoPackageData = monorepoData[pkg.name];
78-
if (!monoRepoPackageData || !monorepoData.snapshot) {
77+
const snapshotRepo = monorepoData[pkg.name]?.snapshotRepo;
78+
if (!snapshotRepo) {
7979
console.warn(`Skipping ${pkg.name}.`);
8080

8181
return;
8282
}
8383

84-
console.info(`Publishing ${pkg.name} to repo ${JSON.stringify(monorepoData.snapshotRepo)}.`);
84+
console.info(`Publishing ${pkg.name} to repo ${snapshotRepo}.`);
8585

8686
const root = process.cwd();
8787
console.debug('Temporary directory: ' + root);
8888

89-
const url = `https://${githubToken ? githubToken + '@' : ''}github.com/${monorepoData.snapshotRepo}.git`;
90-
const destPath = path.join(root, path.basename(monorepoData.snapshotRepo));
89+
const url = `https://${githubToken ? githubToken + '@' : ''}github.com/${snapshotRepo}.git`;
90+
const destPath = path.join(root, path.basename(snapshotRepo));
9191

9292
_exec('git', ['clone', url], { cwd: root });
9393
if (branch) {
@@ -113,7 +113,7 @@ async function _publishSnapshot(
113113

114114
// Add the header to the existing README.md (or create a README if it doesn't exist).
115115
const readmePath = path.join(destPath, 'README.md');
116-
let readme = readmeHeaderFn(pkg.name, monoRepoPackageData.snapshotRepo);
116+
let readme = readmeHeaderFn(pkg.name, snapshotRepo);
117117
try {
118118
readme += fs.readFileSync(readmePath, 'utf-8');
119119
} catch {}

0 commit comments

Comments
 (0)