From 8e9dcddd3a96241bb403a2e82031049dd6cee5de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstr=C3=B6m?= Date: Thu, 5 Sep 2024 15:19:16 +0100 Subject: [PATCH 1/3] chore: replace environment variables with `package.json` entries According to `actions/node-setup`, it will read `manifest.engine` values to decide what node version to use. Second, the lockfile path is only relevant if it is non-default. --- .github/workflows/checkpr.yml | 8 -------- .github/workflows/publish-to-npm.yml | 6 ------ package.json | 5 ++++- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/checkpr.yml b/.github/workflows/checkpr.yml index c48ff8f..7ee8b8b 100644 --- a/.github/workflows/checkpr.yml +++ b/.github/workflows/checkpr.yml @@ -10,10 +10,6 @@ on: branches: - main -env: - lockfile: pnpm-lock.yaml - node_version: "18" - # This is to avoid running multiple actions when a PR is updated repeatedly. See # https://docs.github.com/en/actions/using-jobs/using-concurrency concurrency: @@ -34,9 +30,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: ${{ env.node_version }} cache: pnpm - cache-dependency-path: ${{ env.lockfile }} - name: Install dependencies run: pnpm install @@ -60,9 +54,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: ${{ env.node_version }} cache: pnpm - cache-dependency-path: ${{ env.lockfile }} - name: Install dependencies run: pnpm install diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml index 0e948f3..a10ce70 100644 --- a/.github/workflows/publish-to-npm.yml +++ b/.github/workflows/publish-to-npm.yml @@ -4,10 +4,6 @@ on: release: types: [published] -env: - lockfile: pnpm-lock.yaml - node_version: "18" - jobs: npm-publish: name: Publish to NPM @@ -24,9 +20,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: ${{ env.node_version }} cache: pnpm - cache-dependency-path: ${{ env.lockfile }} - name: Install dependencies run: pnpm install diff --git a/package.json b/package.json index d0535f2..5edb324 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,11 @@ "description": "JS library to automatically report events to Topsort's Analytics", "main": "dist/ts.js", "type": "module", - "packageManager": "pnpm@9.1.1", + "packageManager": "pnpm@9.9.0", "keywords": ["ads", "sponsored listings", "auctions", "analytics", "topsort"], + "engines": { + "node": ">=20" + }, "exports": { ".": { "import": "./dist/ts.mjs", From 9a925d3f1921aa7ee7fb7dc5fd3a06911a4b1b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstr=C3=B6m?= Date: Thu, 5 Sep 2024 15:25:27 +0100 Subject: [PATCH 2/3] chore: attempt to have actions pick up node version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5edb324..9e586c1 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "packageManager": "pnpm@9.9.0", "keywords": ["ads", "sponsored listings", "auctions", "analytics", "topsort"], "engines": { - "node": ">=20" + "node": ">=20.0.0" }, "exports": { ".": { From 78213f1ccbb3a39f35a434f3685ea5b2a3d9b9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstr=C3=B6m?= Date: Thu, 17 Oct 2024 11:27:08 +0100 Subject: [PATCH 3/3] fix: add pointer to file --- .github/workflows/checkpr.yml | 2 ++ .github/workflows/publish-to-npm.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/checkpr.yml b/.github/workflows/checkpr.yml index 7ee8b8b..18e1e41 100644 --- a/.github/workflows/checkpr.yml +++ b/.github/workflows/checkpr.yml @@ -31,6 +31,7 @@ jobs: uses: actions/setup-node@v4 with: cache: pnpm + node-version-file: package.json - name: Install dependencies run: pnpm install @@ -55,6 +56,7 @@ jobs: uses: actions/setup-node@v4 with: cache: pnpm + node-version-file: package.json - name: Install dependencies run: pnpm install diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml index a10ce70..61c5da9 100644 --- a/.github/workflows/publish-to-npm.yml +++ b/.github/workflows/publish-to-npm.yml @@ -21,6 +21,7 @@ jobs: uses: actions/setup-node@v4 with: cache: pnpm + node-version-file: package.json - name: Install dependencies run: pnpm install