Skip to content

Commit 2baae62

Browse files
authored
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. PR: #287 Refs: https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#node-version-file
1 parent c99879e commit 2baae62

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

Diff for: .github/workflows/checkpr.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ on:
1010
branches:
1111
- main
1212

13-
env:
14-
lockfile: pnpm-lock.yaml
15-
node_version: "18"
16-
1713
# This is to avoid running multiple actions when a PR is updated repeatedly. See
1814
# https://docs.github.com/en/actions/using-jobs/using-concurrency
1915
concurrency:
@@ -34,9 +30,8 @@ jobs:
3430
- name: Set up Node.js
3531
uses: actions/setup-node@v4
3632
with:
37-
node-version: ${{ env.node_version }}
3833
cache: pnpm
39-
cache-dependency-path: ${{ env.lockfile }}
34+
node-version-file: package.json
4035

4136
- name: Install dependencies
4237
run: pnpm install
@@ -60,9 +55,8 @@ jobs:
6055
- name: Set up Node.js
6156
uses: actions/setup-node@v4
6257
with:
63-
node-version: ${{ env.node_version }}
6458
cache: pnpm
65-
cache-dependency-path: ${{ env.lockfile }}
59+
node-version-file: package.json
6660

6761
- name: Install dependencies
6862
run: pnpm install

Diff for: .github/workflows/publish-to-npm.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ on:
44
release:
55
types: [published]
66

7-
env:
8-
lockfile: pnpm-lock.yaml
9-
node_version: "18"
10-
117
jobs:
128
npm-publish:
139
name: Publish to NPM
@@ -24,9 +20,8 @@ jobs:
2420
- name: Set up Node.js
2521
uses: actions/setup-node@v4
2622
with:
27-
node-version: ${{ env.node_version }}
2823
cache: pnpm
29-
cache-dependency-path: ${{ env.lockfile }}
24+
node-version-file: package.json
3025

3126
- name: Install dependencies
3227
run: pnpm install

Diff for: package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
"description": "JS library to automatically report events to Topsort's Analytics",
55
"main": "dist/ts.js",
66
"type": "module",
7-
"packageManager": "pnpm@9.1.1",
7+
"packageManager": "pnpm@9.9.0",
88
"keywords": ["ads", "sponsored listings", "auctions", "analytics", "topsort"],
9+
"engines": {
10+
"node": ">=20.0.0"
11+
},
912
"exports": {
1013
".": {
1114
"import": "./dist/ts.mjs",

0 commit comments

Comments
 (0)