Skip to content

Commit d284224

Browse files
authored
chore: pin, not lock (#956)
* chore: no lock Signed-off-by: Jan Kowalleck <[email protected]> * build: test before publish Signed-off-by: Jan Kowalleck <[email protected]> * chore: lock tools Signed-off-by: Jan Kowalleck <[email protected]> * ci: carefully skip unneeded dev-deps on tests Signed-off-by: Jan Kowalleck <[email protected]> * wording Signed-off-by: Jan Kowalleck <[email protected]> * unlock schema-downloader Signed-off-by: Jan Kowalleck <[email protected]> * ci: drop npm cache Signed-off-by: Jan Kowalleck <[email protected]> * release assets Signed-off-by: Jan Kowalleck <[email protected]> * simplify ci Signed-off-by: Jan Kowalleck <[email protected]> * wording Signed-off-by: Jan Kowalleck <[email protected]> --------- Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 0ebfd14 commit d284224

File tree

10 files changed

+83
-10449
lines changed

10 files changed

+83
-10449
lines changed

.github/workflows/nodejs.yml

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
tags: [ "v*" ] # have tools scan this stable version
99
pull_request:
1010
workflow_dispatch:
11+
schedule:
12+
# schedule weekly tests, since dependencies are not intended to be locked
13+
# this means: at 23:42 on Fridays
14+
- cron: '42 23 * * 5'
1115

1216
concurrency:
1317
group: ${{ github.workflow }}-${{ github.ref }}
@@ -40,10 +44,10 @@ jobs:
4044
uses: actions/setup-node@v3
4145
with:
4246
node-version: ${{ env.NODE_ACTIVE_LTS }}
43-
cache: "npm"
44-
cache-dependency-path: "**/package-lock.json"
47+
# cache: "npm"
48+
# cache-dependency-path: "**/package-lock.json"
4549
- name: setup project
46-
run: npm ci --ignore-scripts --include=optional --loglevel=silly
50+
run: npm i --ignore-scripts --include=optional --loglevel=silly
4751
- name: build ${{ matrix.target }}
4852
run: npm run build:${{ matrix.target }}
4953
- name: artifact build result
@@ -67,10 +71,10 @@ jobs:
6771
uses: actions/setup-node@v3
6872
with:
6973
node-version: ${{ env.NODE_ACTIVE_LTS }}
70-
cache: "npm"
71-
cache-dependency-path: "**/package-lock.json"
74+
# cache: "npm"
75+
# cache-dependency-path: "**/package-lock.json"
7276
- name: setup project
73-
run: npm ci --ignore-scripts --include=optional --loglevel=silly
77+
run: npm i --ignore-scripts --include=optional --loglevel=silly
7478
- name: make reports dir
7579
run: mkdir -p "$REPORTS_DIR"
7680
- name: test
@@ -123,15 +127,18 @@ jobs:
123127
uses: actions/setup-node@v3
124128
with:
125129
node-version: ${{ matrix.node-version }}
126-
cache: "npm"
127-
cache-dependency-path: "**/package-lock.json"
130+
# cache: "npm"
131+
# cache-dependency-path: "**/package-lock.json"
128132
- name: setup project
129133
shell: bash
130134
run: |
131135
set -ex
132-
npm ci --ignore-scripts --include=optional --loglevel=silly
136+
## dont install all the dev-packages, especially since some are not runnable on node 14.0.0
137+
npm i --ignore-scripts --include=optional --omit=dev --only=prod --loglevel=silly
133138
## rebuild deps for which scripts were ignored, or partially installed - since "ignore-scripts" was used
134139
npm rebuild --loglevel=silly libxmljs2 || npm uninstall --no-save libxmljs2
140+
## install the needed dev-deps
141+
npm i --no-save mocha c8 npm-run-all
135142
- name: fetch build artifact
136143
# see https://github.com/actions/download-artifact
137144
uses: actions/download-artifact@v3
@@ -171,7 +178,12 @@ jobs:
171178
with:
172179
node-version: ${{ env.NODE_ACTIVE_LTS }}
173180
- name: setup library
174-
run: npm ci --ignore-scripts --omit=optional --loglevel=silly
181+
run: |
182+
set -ex
183+
## dont install all the dev-packages, especially since some are not runnable on node 14.0.0
184+
npm i --ignore-scripts --omit=optional --omit=dev --loglevel=silly
185+
## install the needed dev-deps
186+
npm i --no-save mocha c8 npm-run-all
175187
- name: fetch build artifact
176188
# see https://github.com/actions/download-artifact
177189
uses: actions/download-artifact@v3
@@ -253,7 +265,7 @@ jobs:
253265
- name: setup library
254266
run: |
255267
set -ex
256-
npm ci --ignore-scripts --omit=dev --include=optional --loglevel=silly
268+
npm i --ignore-scripts --omit=dev --include=optional --loglevel=silly
257269
## rebuild deps for which scripts were ignored, or partially installed - since "ignore-scripts" was used
258270
npm rebuild --loglevel=silly libxmljs2 || npm uninstall --no-save libxmljs2
259271
- name: setup example project
@@ -306,7 +318,7 @@ jobs:
306318
- name: setup library
307319
run: |
308320
set -ex
309-
npm ci --ignore-scripts --omit=dev --include=optional --loglevel=silly
321+
npm i --ignore-scripts --omit=dev --include=optional --loglevel=silly
310322
## rebuild deps for which scripts were ignored, or partially installed - since "ignore-scripts" was used
311323
npm rebuild --loglevel=silly libxmljs2 || npm uninstall --no-save libxmljs2
312324
- name: setup example project
@@ -354,7 +366,7 @@ jobs:
354366
name: dist.web
355367
path: dist.web
356368
- name: setup library
357-
run: npm ci --ignore-scripts --omit=dev --include=optional --loglevel=silly
369+
run: npm i --ignore-scripts --omit=dev --include=optional --loglevel=silly
358370
- name: setup example project
359371
run: npm i --no-save --loglevel=silly
360372
working-directory: ${{ env.EXAMPLE_DIR }}
@@ -381,9 +393,9 @@ jobs:
381393
uses: actions/setup-node@v3
382394
with:
383395
node-version: ${{ env.NODE_ACTIVE_LTS }}
384-
cache: "npm"
385-
cache-dependency-path: "**/package-lock.json"
396+
# cache: "npm"
397+
# cache-dependency-path: "**/package-lock.json"
386398
- name: setup project
387-
run: npm ci --ignore-scripts --loglevel=silly
399+
run: npm i --ignore-scripts --loglevel=silly
388400
- name: api-doc ${{ matrix.target }}
389401
run: npm run api-doc:${{ matrix.target }}

.github/workflows/release.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
default: rc
2424
required: false
2525
prerelease:
26-
description: "This a pre-release"
26+
description: "This is a pre-release"
2727
type: boolean
2828
default: false
2929
required: false
@@ -32,6 +32,8 @@ permissions: write-all
3232

3333
env:
3434
REPORTS_DIR: CI_reports
35+
PACKED_DIR: CI_packed
36+
PACKED_ARTIFACT: packed
3537
NODE_ACTIVE_LTS: "20"
3638

3739
jobs:
@@ -82,6 +84,8 @@ jobs:
8284
name: publish NPMJS
8385
runs-on: ubuntu-latest
8486
timeout-minutes: 30
87+
env:
88+
NPMJS_RELEASE_TAG: ${{ github.event.inputs.prerelease == 'true' && 'unstable-prerelease' || 'latest' }}
8589
steps:
8690
- name: Checkout code
8791
# see https://github.com/actions/checkout
@@ -94,18 +98,25 @@ jobs:
9498
with:
9599
node-version: ${{ env.NODE_ACTIVE_LTS }}
96100
- name: install build tools
97-
run: npm ci --ignore-scripts --include=optional --loglevel=silly
101+
run: npm i --ignore-scripts --include=optional --loglevel=silly
98102
# no explicit npm build. if a build is required, it should be configured as prepublish/prepublishOnly script of npm.
99103
- name: login to NPMJS
100104
run: npm config set "//registry.npmjs.org/:_authToken=$NPMJS_AUTH_TOKEN"
101105
env:
102106
NPMJS_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
103-
- name: publish to NPMJS as "latest"
104-
if: ${{ github.event.inputs.prerelease != 'true' }}
105-
run: npm publish --access public --tag 'latest'
106-
- name: publish to NPMJS as "unstable-prerelease"
107-
if: ${{ github.event.inputs.prerelease == 'true' }}
108-
run: npm publish --access public --tag 'unstable-prerelease'
107+
- name: publish to NPMJS as "${{ env.NPMJS_RELEASE_TAG }}"
108+
run: npm publish --access public --tag "$NPMJS_RELEASE_TAG"
109+
- name: pack release result
110+
run: |
111+
mkdir -p "$PACKED_DIR"
112+
npm pack --pack-destination "$PACKED_DIR"
113+
- name: artifact release result
114+
# see https://github.com/actions/upload-artifact
115+
uses: actions/upload-artifact@v3
116+
with:
117+
name: ${{ env.PACKED_ARTIFACT }}
118+
path: ${{ env.PACKED_DIR }}/
119+
if-no-files-found: error
109120

110121
release-GH:
111122
needs:
@@ -117,6 +128,12 @@ jobs:
117128
env:
118129
ASSETS_DIR: release_assets
119130
steps:
131+
- name: fetch release result
132+
# see https://github.com/actions/download-artifact
133+
uses: actions/download-artifact@v3
134+
with:
135+
name: ${{ env.PACKED_ARTIFACT }}
136+
path: ${{ env.ASSETS_DIR }}
120137
- name: Create Release
121138
id: release
122139
# see https://github.com/softprops/action-gh-release
@@ -127,3 +144,4 @@ jobs:
127144
tag_name: ${{ needs.bump.outputs.version }}
128145
name: ${{ needs.bump.outputs.version_plain }}
129146
prerelease: ${{ github.event.inputs.prerelease }}
147+
files: ${{ env.ASSETS_DIR }}/*

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22

33
/reports/
44
/CI_reports/
5+
/packed/
6+
/CI_packed/
57

68
/dist/
79
/dist.*/
810

11+
## no lock. pinning of direct dependencies should be enough for a library
12+
/package-lock.json
13+
914
### https://github.com/github/gitignore/blob/main/Node.gitignore
1015

1116
# Logs

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,6 @@ dist
180180

181181
/reports/
182182
/CI_reports/
183+
/packed/
184+
/CI_packed/
185+

.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
; see the docs: https://docs.npmjs.com/cli/v9/using-npm/config
2+
3+
engine-strict=true
4+
package-lock=false

0 commit comments

Comments
 (0)