Skip to content

Commit 4df25b0

Browse files
authored
refactor: migrate from npm to pnpm (#96)
* refactor: migrated from npm to pnpm To improve package management and reduce load times, dependency management is now handled by pnpm BREAKING CHANGE: npm commands will fail compared to previous commits
1 parent eb77bd8 commit 4df25b0

File tree

11 files changed

+17635
-32017
lines changed

11 files changed

+17635
-32017
lines changed

.github/workflows/build-on-every-push.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,36 @@ jobs:
1414

1515
steps:
1616
- uses: actions/checkout@v4
17+
18+
- name: Setup pnpm
19+
uses: pnpm/action-setup@v4
20+
with:
21+
run_install: false
1722

1823
- name: Setup Node.js
1924
uses: actions/setup-node@v4
2025
with:
2126
node-version: 20
22-
27+
cache: 'pnpm'
28+
29+
- name: Get pnpm store directory
30+
shell: bash
31+
run: |
32+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
33+
34+
- uses: actions/cache@v4
35+
name: Setup pnpm cache
36+
with:
37+
path: ${{ vars.STORE_PATH }}
38+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
39+
restore-keys: |
40+
${{ runner.os }}-pnpm-store-
41+
2342
- name: Install dependencies
24-
run: npm ci
25-
43+
run: pnpm install
44+
2645
- name: Build project
27-
run: npm run build
46+
run: pnpm run build
2847

2948
- name: Upload UI Artifact
3049
uses: actions/upload-artifact@v4
@@ -43,14 +62,28 @@ jobs:
4362

4463
steps:
4564
- uses: actions/checkout@v4
65+
66+
- name: Setup pnpm
67+
uses: pnpm/action-setup@v4
68+
with:
69+
run_install: false
4670

4771
- name: Setup Node.js
4872
uses: actions/setup-node@v4
4973
with:
5074
node-version: 20
75+
cache: 'pnpm'
5176

77+
- uses: actions/cache@v4
78+
name: Setup pnpm cache
79+
with:
80+
path: ${{ vars.STORE_PATH }}
81+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
82+
restore-keys: |
83+
${{ runner.os }}-pnpm-store-
84+
5285
- name: Install dependencies
53-
run: npm ci
86+
run: pnpm install
5487

5588
- name: Download UI Artifact
5689
uses: actions/download-artifact@v4

.github/workflows/deploy-pages.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,29 @@ jobs:
1818
build:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v4
23-
- name: Setup Node
21+
- uses: actions/checkout@v4
22+
23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
run_install: false
27+
28+
- name: Setup Node.js
2429
uses: actions/setup-node@v4
2530
with:
2631
node-version: 20
27-
cache: npm
28-
- name: Setup Pages
29-
uses: actions/configure-pages@v5
30-
- name: Install packages
31-
run: npm ci
32+
cache: 'pnpm'
33+
34+
- uses: actions/cache@v4
35+
name: Setup pnpm cache
36+
with:
37+
path: ${{ vars.STORE_PATH }}
38+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
39+
restore-keys: |
40+
${{ runner.os }}-pnpm-store-
41+
42+
- name: Install dependencies
43+
run: pnpm install
3244
- name: Build Pages
3345
run: |
3446
npm run docs:build

.github/workflows/eslint.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,25 @@ jobs:
2828
steps:
2929
- name: Checkout code
3030
uses: actions/checkout@v4
31+
- name: Setup pnpm
32+
uses: pnpm/action-setup@v4
33+
with:
34+
run_install: false
3135
- name: Setup Node.js
3236
uses: actions/setup-node@v4
3337
with:
3438
node-version: 20
35-
- name: Install Node Packages
36-
run: npm install --save-dev
39+
cache: 'pnpm'
40+
- uses: actions/cache@v4
41+
name: Setup pnpm cache
42+
with:
43+
path: ${{ vars.STORE_PATH }}
44+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
45+
restore-keys: |
46+
${{ runner.os }}-pnpm-store-
47+
48+
- name: Install dependencies
49+
run: pnpm install
3750
- name: Run ESLint
3851
run: npx eslint . --config .eslintrc.json --ext .js,.jsx,.ts,.tsx --format @microsoft/eslint-formatter-sarif --output-file eslint-results.sarif --debug
3952
continue-on-error: false

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
"cSpell.enableFiletypes": [
1111
"cedarschema"
1212
],
13+
"npm.packageManager": "pnpm",
1314
}

cli/config-manage.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import prompt from 'prompt-sync'
55
import { CONFIG_VERSION } from './config-version'
66
import path from 'path'
77
import figlet from 'figlet'
8+
import { fileURLToPath } from 'url'
9+
import { dirname } from 'path'
10+
const __filename = fileURLToPath(import.meta.url)
11+
const __dirname = dirname(__filename)
812
const deployConfig = path.join(__dirname, '../bin/config.json')
913

1014
const prompter = prompt({ sigint: true })

cli/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Command } from 'commander'
2-
import { CONFIG_VERSION } from './config-version'
2+
import * as CONFIG from './config-version'
33
import figlet from 'figlet'
44

55
const program = new Command()
@@ -15,7 +15,7 @@ program
1515
.description(
1616
'CLI utility for creating, viewing, and updating you GenAI Newsletter deployment configuration.'
1717
)
18-
.version(CONFIG_VERSION)
18+
.version(CONFIG.CONFIG_VERSION)
1919
.configureOutput({
2020
writeOut: (str) => {
2121
try {

cli/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as ansi from 'ansi-escape-sequences'
1+
import ansi from 'ansi-escape-sequences'
22

33
interface FormattingOptions {
44
bigHeader?: boolean

0 commit comments

Comments
 (0)