Skip to content

Commit

Permalink
chore: replace environment variables with package.json entries
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jbergstroem authored Oct 17, 2024
1 parent c99879e commit 2baae62
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/checkpr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -34,9 +30,8 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
cache: pnpm
cache-dependency-path: ${{ env.lockfile }}
node-version-file: package.json

- name: Install dependencies
run: pnpm install
Expand All @@ -60,9 +55,8 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
cache: pnpm
cache-dependency-path: ${{ env.lockfile }}
node-version-file: package.json

- name: Install dependencies
run: pnpm install
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
release:
types: [published]

env:
lockfile: pnpm-lock.yaml
node_version: "18"

jobs:
npm-publish:
name: Publish to NPM
Expand All @@ -24,9 +20,8 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
cache: pnpm
cache-dependency-path: ${{ env.lockfile }}
node-version-file: package.json

- name: Install dependencies
run: pnpm install
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.0.0"
},
"exports": {
".": {
"import": "./dist/ts.mjs",
Expand Down

0 comments on commit 2baae62

Please sign in to comment.