Skip to content

Commit

Permalink
Patch release-it plugin to rely on a single package version
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt committed Apr 13, 2024
1 parent 4ce91e0 commit c86dd16
Show file tree
Hide file tree
Showing 9 changed files with 357 additions and 349 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/setup-node@v4
with:
node-version: "18.13"
node-version: '18.13'
- uses: pnpm/action-setup@v3
with:
version: 8
Expand All @@ -41,7 +41,7 @@ jobs:
token: ${{ secrets.PUBLISH_BOT }}
- uses: actions/setup-node@v4
with:
node-version: "18.13"
node-version: '18.13'
- uses: pnpm/action-setup@v3
with:
version: 8
Expand All @@ -52,5 +52,5 @@ jobs:
git config --global user.email "$BOT_EMAIL"
git config --global user.name "esm-bundle-org-bot"
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
- name: "Publish to npm"
- name: 'Publish to npm'
run: pnpm run release
3 changes: 3 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
singleQuote: true,
};
4 changes: 2 additions & 2 deletions browser-test/systemjs-setup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
document.head.appendChild(
Object.assign(document.createElement("script"), {
type: "systemjs-importmap",
Object.assign(document.createElement('script'), {
type: 'systemjs-importmap',
textContent: `
{
"imports": {
Expand Down
68 changes: 34 additions & 34 deletions browser-test/test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
describe("@esm-bundle/angular", () => {
describe("@angular/animations", () => {
describe('@esm-bundle/angular', () => {
describe('@angular/animations', () => {
[
["angular-animations", "AnimationBuilder"],
["angular-animations-browser", "AnimationDriver"],
['angular-animations', 'AnimationBuilder'],
['angular-animations-browser', 'AnimationDriver'],
].forEach(([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand All @@ -16,11 +16,11 @@ describe("@esm-bundle/angular", () => {
});
});

describe("@angular/common", () => {
describe('@angular/common', () => {
[
["angular-common", "NgClass"],
["angular-common-http", "HttpClient"],
["angular-common-upgrade", "AngularJSUrlCodec"],
['angular-common', 'NgClass'],
['angular-common-http', 'HttpClient'],
['angular-common-upgrade', 'AngularJSUrlCodec'],
].forEach(([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand All @@ -34,8 +34,8 @@ describe("@esm-bundle/angular", () => {
});
});

describe("@angular/compiler", () => {
[["angular-compiler", "compileComponentClassMetadata"]].forEach(
describe('@angular/compiler', () => {
[['angular-compiler', 'compileComponentClassMetadata']].forEach(
([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand All @@ -52,11 +52,11 @@ describe("@esm-bundle/angular", () => {
);
});

describe("@angular/core", () => {
describe('@angular/core', () => {
[
["angular-core", "Injectable"],
["angular-core-primitives-signals", "consumerMarkDirty"],
["angular-core-rxjs-interop", "takeUntilDestroyed"],
['angular-core', 'Injectable'],
['angular-core-primitives-signals', 'consumerMarkDirty'],
['angular-core-rxjs-interop', 'takeUntilDestroyed'],
].forEach(([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand All @@ -70,8 +70,8 @@ describe("@esm-bundle/angular", () => {
});
});

describe("@angular/elements", () => {
[["angular-elements", "createCustomElement"]].forEach(
describe('@angular/elements', () => {
[['angular-elements', 'createCustomElement']].forEach(
([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand All @@ -88,8 +88,8 @@ describe("@esm-bundle/angular", () => {
);
});

describe("@angular/forms", () => {
[["angular-forms", "ReactiveFormsModule"]].forEach(
describe('@angular/forms', () => {
[['angular-forms', 'ReactiveFormsModule']].forEach(
([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand All @@ -106,8 +106,8 @@ describe("@esm-bundle/angular", () => {
);
});

describe("@angular/localize", () => {
[["angular-localize", "loadTranslations"]].forEach(
describe('@angular/localize', () => {
[['angular-localize', 'loadTranslations']].forEach(
([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand All @@ -124,11 +124,11 @@ describe("@esm-bundle/angular", () => {
);
});

describe("@angular/platform-browser", () => {
describe('@angular/platform-browser', () => {
[
["angular-platform-browser", "bootstrapApplication"],
["angular-platform-browser-animations", "provideAnimations"],
["angular-platform-browser-animations-async", "provideAnimationsAsync"],
['angular-platform-browser', 'bootstrapApplication'],
['angular-platform-browser-animations', 'provideAnimations'],
['angular-platform-browser-animations-async', 'provideAnimationsAsync'],
].forEach(([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand All @@ -142,8 +142,8 @@ describe("@esm-bundle/angular", () => {
});
});

describe("@angular/platform-browser-dynamic", () => {
[["angular-platform-browser-dynamic", "JitCompilerFactory"]].forEach(
describe('@angular/platform-browser-dynamic', () => {
[['angular-platform-browser-dynamic', 'JitCompilerFactory']].forEach(
([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand All @@ -160,10 +160,10 @@ describe("@esm-bundle/angular", () => {
);
});

describe("@angular/router", () => {
describe('@angular/router', () => {
[
["angular-router", "provideRouter"],
["angular-router-upgrade", "locationSyncBootstrapListener"],
['angular-router', 'provideRouter'],
['angular-router-upgrade', 'locationSyncBootstrapListener'],
].forEach(([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand All @@ -177,8 +177,8 @@ describe("@esm-bundle/angular", () => {
});
});

describe("@angular/service-worker", () => {
[["angular-service-worker", "provideServiceWorker"]].forEach(
describe('@angular/service-worker', () => {
[['angular-service-worker', 'provideServiceWorker']].forEach(
([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand All @@ -195,10 +195,10 @@ describe("@esm-bundle/angular", () => {
);
});

describe("@angular/upgrade", () => {
describe('@angular/upgrade', () => {
[
["angular-upgrade", "UpgradeAdapter"],
["angular-upgrade-static", "downgradeComponent"],
['angular-upgrade', 'UpgradeAdapter'],
['angular-upgrade-static', 'downgradeComponent'],
].forEach(([filename, exportName]) => {
it(`can load the System.register bundle`, async () => {
const m = await System.import(`/base/system/es2022/${filename}.js`);
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,10 @@
"rxjs": "7.8.1",
"tslib": "2.6.2",
"typescript": "5.4.5"
},
"pnpm": {
"patchedDependencies": {
"release-it-plugin-esm-bundle@3.0.0": "patches/release-it-plugin-esm-bundle@3.0.0.patch"
}
}
}
15 changes: 15 additions & 0 deletions patches/release-it-plugin-esm-bundle@3.0.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/index.js b/index.js
index 6b5f3aead4855517f078cb5544d27a7737bd0362..0afed99684ca5b49d09147ee74a648b1f0392131 100644
--- a/index.js
+++ b/index.js
@@ -41,7 +41,9 @@ function getDepName() {
}

function getDepVersion() {
- const depName = getDepName();
+ // Since we have all the packages within a single repository we
+ // may rely on the primary core package version.
+ const depName = '@angular/core';
const dependency = (packageJson.devDependencies || {})[depName];
if (!dependency) {
throw Error(`Missing package.json dependency '${depName}'`);
10 changes: 8 additions & 2 deletions pnpm-lock.yaml

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

Loading

0 comments on commit c86dd16

Please sign in to comment.