Skip to content

Commit

Permalink
fix: correct sideEffects path
Browse files Browse the repository at this point in the history
  • Loading branch information
kyubisation committed Nov 11, 2023
1 parent 601e2e2 commit aeaf3bf
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions scripts/build-lib.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { execSync } from 'child_process';
import { lstatSync, readdirSync, readFileSync, writeFileSync } from 'fs';
import { copyFile, mkdir, readFile, writeFile } from 'fs/promises';
import * as glob from 'glob';
import { dirname, join, relative } from 'path';

await finalizePackage();
Expand Down Expand Up @@ -30,7 +31,7 @@ async function finalizePackage() {
}

const ngsscSchema: Schema = JSON.parse(
await readFile(join(sourceDir, 'builders/ngsscbuild/schema.json'), 'utf8')
await readFile(join(sourceDir, 'builders/ngsscbuild/schema.json'), 'utf8'),
);
delete ngsscSchema.properties['buildTarget'];
delete ngsscSchema.properties['browserTarget'];
Expand All @@ -39,7 +40,7 @@ async function finalizePackage() {
rootDir,
'node_modules/@angular-devkit/build-angular/src/builders',
schemaVariant,
'schema.json'
'schema.json',
);
const schema: Schema = JSON.parse(await readFile(sourceFile, 'utf8'));
schema.properties = { ...schema.properties, ...ngsscSchema.properties };
Expand All @@ -52,7 +53,7 @@ async function finalizePackage() {
await writeFile(
join(sourceDir, 'builders', schemaVariant, 'schema.json'),
JSON.stringify(schema, null, 2),
'utf8'
'utf8',
);
}

Expand All @@ -66,20 +67,18 @@ async function finalizePackage() {
}

const distPackageJson = JSON.parse(
readFileSync(join(rootDir, 'dist/angular-server-side-configuration/package.json'), 'utf8')
readFileSync(join(rootDir, 'dist/angular-server-side-configuration/package.json'), 'utf8'),
);
distPackageJson.sideEffects = [
'./esm2020/ng-env/public_api.mjs',
'./esm2020/process/public_api.mjs',
'./fesm2015/angular-server-side-configuration-ng-env.mjs',
'./fesm2015/angular-server-side-configuration-process.mjs',
'./fesm2020/angular-server-side-configuration-ng-env.mjs',
'./fesm2020/angular-server-side-configuration-process.mjs',
];
distPackageJson.sideEffects = glob
.sync(['esm*/**/public_api.{mjs,js}', 'fesm*/*{ng-env,process}.{mjs,js}'], {
cwd: 'dist/angular-server-side-configuration',
dotRelative: true,
})
.sort();
writeFileSync(
join(rootDir, 'dist/angular-server-side-configuration/package.json'),
JSON.stringify(distPackageJson, null, 2),
'utf8'
'utf8',
);
}

Expand Down

0 comments on commit aeaf3bf

Please sign in to comment.