Skip to content

Commit d1f553d

Browse files
committed
chore(angular): another simpler patch for Angular-Slickgrid npm release
- we can take advantage of Lerna-Lite lifecycle to patch our Angular-Slickgird dist/package.json just after Lerna-Lite finished running its lerna version command
1 parent f76a615 commit d1f553d

6 files changed

Lines changed: 10 additions & 39 deletions

File tree

.github/workflows/publish-npm-latest.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,6 @@ jobs:
106106
pnpm whoami
107107
pnpm exec ${{ env.LERNA_VERSION_QUERY }}
108108
109-
# because ng-packagr copies the package.json to dist,
110-
# we need to re-run the build to get latest version in its dist/package.json
111-
- name: run another Angular-Slickgrid build
112-
run: pnpm run angular:build:framework
113-
114-
# then we need to replace all `workspace:` protocol with valid workspace package versions
115-
- name: replace Angular-Slickgrid "workspace:"
116-
run: pnpm run angular:replace-workspace
117-
118109
- name: OTP
119110
if: ${{ inputs.dryrun != true }}
120111
uses: step-security/wait-for-secrets@v1

.github/workflows/publish-npm-prerelease.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,6 @@ jobs:
154154
pnpm whoami
155155
pnpm exec lerna version ${{ inputs.bump }} --conventional-commits --conventional-prerelease --preid ${{ inputs.tag }} --force-publish --yes
156156
157-
# because ng-packagr copies the package.json to dist,
158-
# we need to re-run the build to get latest version in its dist/package.json
159-
- name: run another Angular-Slickgrid build
160-
run: pnpm run angular:build:framework
161-
162-
# then we need to replace all `workspace:` protocol with valid workspace package versions
163-
- name: replace Angular-Slickgrid "workspace:"
164-
run: pnpm run angular:replace-workspace
165-
166157
- name: OTP
167158
if: ${{ inputs.dryrun != true }}
168159
uses: step-security/wait-for-secrets@v1

.github/workflows/publish-npm-prompt.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,6 @@ jobs:
105105
pnpm whoami
106106
pnpm exec lerna version prerelease --conventional-commits --conventional-prerelease --preid beta --force-publish --yes
107107
108-
# because ng-packagr copies the package.json to dist,
109-
# we need to re-run the build to get latest version in its dist/package.json
110-
- name: run another Angular-Slickgrid build
111-
run: pnpm run angular:build:framework
112-
113-
# then we need to replace all `workspace:` protocol with valid workspace package versions
114-
- name: replace Angular-Slickgrid "workspace:"
115-
run: pnpm run angular:replace-workspace
116-
117108
- name: OTP
118109
if: ${{ inputs.dryrun != true }}
119110
uses: step-security/wait-for-secrets@v1

.github/workflows/publish-npm-publish-retry.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,6 @@ jobs:
6969
- name: Build Everything
7070
run: pnpm build
7171

72-
# because ng-packagr copies the package.json to dist,
73-
# we need to re-run the build to get latest version in its dist/package.json
74-
- name: run another Angular-Slickgrid build
75-
run: pnpm run angular:build:framework
76-
77-
# then we need to replace all `workspace:` protocol with valid workspace package versions
78-
- name: replace Angular-Slickgrid "workspace:"
79-
run: pnpm run angular:replace-workspace
80-
8172
- name: OTP
8273
if: ${{ inputs.dryrun != true }}
8374
uses: step-security/wait-for-secrets@v1

frameworks/angular-slickgrid/scripts/replace-workspace.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,23 @@ const projectRootPath = pJoin(__dirname, '../');
1212
* with current version from "package.json" root into "dist/package.json"
1313
*/
1414
(async function main() {
15+
const mainPkg = readJSONSync(pJoin(projectRootPath, 'package.json'));
1516
const distPkg = readJSONSync(pJoin(projectRootPath, 'dist', 'package.json'));
1617

1718
// replace all workspace protocol with current version from "package.json" root into "dist/package.json"
1819
console.log('-------------------------------------------------------------------------------------');
19-
console.log(`Angular-Slickgrid, replace all "workspace:*" protocol in "dist/package.json"`);
20+
console.log(`Angular-Slickgrid, replace dist version & all "workspace:*" protocol in "dist/package.json"`);
21+
22+
console.log(`update "dist/package.json" to { "version": "${mainPkg.version}" }`);
23+
distPkg.version = mainPkg.version;
24+
2025
for (let [depName, depVersion] of Object.entries(distPkg.dependencies)) {
2126
if (depVersion.startsWith('workspace:*')) {
2227
// we need to get each package version
2328
const depPkgName = depName.replace('@slickgrid-universal', '');
2429
const depPkg = readJSONSync(pJoin(projectRootPath, '../../packages/', depPkgName, 'package.json'));
25-
distPkg.dependencies[depName] = depPkg.version;
2630
console.log(`update dependency { "${depName}": "${depPkg.version}" }`);
31+
distPkg.dependencies[depName] = depPkg.version;
2732
}
2833
}
2934
writeJsonSync(pResolve(projectRootPath, 'dist', 'package.json'), distPkg, { spaces: 2 });

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@
8282
"vue:build:framework": "pnpm -r --stream --filter=slickgrid-vue run build",
8383
"vue:build:demo": "pnpm -r --stream --filter=slickgrid-vue-demo run build",
8484
"vue:cypress": "pnpm -r --stream --filter=slickgrid-vue-demo run vue:cypress",
85-
"vue:serve": "pnpm -r --stream --filter=slickgrid-vue-demo run vue:preview"
85+
"vue:serve": "pnpm -r --stream --filter=slickgrid-vue-demo run vue:preview",
86+
"docs:99": "// run Lerna-Lite lifecycle to patch Angular-Slickgrid dist/package.json (because of ng-packagr)",
87+
"postversion": "pnpm angular:replace-workspace"
8688
},
8789
"comments": {
8890
"new-version": "To create a new version with Lerna-Lite, simply run the following script (1) 'roll-new-release'.",

0 commit comments

Comments
 (0)