Skip to content

Commit 7367773

Browse files
authored
feat: Switch from npm to pnpm (#4429)
1 parent db163b7 commit 7367773

File tree

33 files changed

+22666
-72016
lines changed

33 files changed

+22666
-72016
lines changed

.dockerignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
**/*.md
12
**/.env
3+
.cache
4+
assets
25
node_modules
36
packages/node-dev
4-
packages/*/node_modules
5-
packages/*/dist
6-
packages/*/.turbo
7+
packages/**/node_modules
8+
packages/**/dist
9+
packages/**/.turbo
710
.git
11+
.github
812
*.tsbuildinfo

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ A clear and concise description of what you expected to happen.
2222

2323
**Environment (please complete the following information):**
2424

25-
- OS: [e.g. Ubuntu Linux 18.04]
26-
- n8n Version [e.g. 0.119.0]
27-
- Node.js Version [e.g. 14.16.0]
25+
- OS: [e.g. Ubuntu Linux 22.04]
26+
- n8n Version [e.g. 0.200.1]
27+
- Node.js Version [e.g. 16.17.0]
2828
- Database system [e.g. SQLite; n8n uses SQLite as default otherwise changed]
2929
- Operation mode [e.g. own; operation modes are `own`, `main` and `queue`. Default is `own`]
3030

.github/workflows/ci-master.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,27 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v3
2020

21+
- uses: pnpm/action-setup@v2.2.4
22+
2123
- name: Use Node.js ${{ matrix.node-version }}
2224
uses: actions/setup-node@v3
2325
with:
2426
node-version: ${{ matrix.node-version }}
25-
cache: 'npm'
27+
cache: 'pnpm'
2628

27-
- name: Install npm and dependencies
28-
run: npm install -g npm@latest && npm install
29+
- name: Install dependencies
30+
run: pnpm install --frozen-lockfile
2931

3032
- name: Build
31-
run: npm run build --if-present
33+
run: pnpm build
3234

3335
- name: Test
34-
run:
35-
npm run test
36+
run: pnpm test
3637

3738
- name: Test E2E
38-
run:
39-
npm run test:e2e:ci:smoke
39+
run: |
40+
pnpm cypress:install
41+
pnpm test:e2e:ci:smoke
4042
4143
- name: Lint
42-
run: npm run lint
44+
run: pnpm lint

.github/workflows/ci-postgres-mysql.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,32 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v3
2020

21+
- uses: pnpm/action-setup@v2.2.4
22+
2123
- uses: actions/setup-node@v3
2224
with:
2325
node-version: 16.x
24-
cache: 'npm'
26+
cache: 'pnpm'
2527

26-
- name: Install npm and dependencies
27-
run: npm install -g npm@latest && npm install
28+
- name: Install dependencies
29+
run: pnpm install --frozen-lockfile
2830

2931
- name: Start MySQL & Postgres
3032
uses: isbang/compose-action@v1.3.2
3133
with:
3234
compose-file: ./.github/docker-compose.yml
3335

3436
- name: Build Core & Workflow
35-
run: npm run -w packages/workflow -w packages/core build
37+
run: pnpm --filter n8n-workflow --filter=n8n-core build
3638

3739
- name: Test MySQL
3840
working-directory: packages/cli
39-
run: npm run test:mysql
41+
run: pnpm test:mysql
4042

4143
- name: Test Postgres
4244
working-directory: packages/cli
43-
run: npm run test:postgres
45+
run: pnpm test:postgres
4446

4547
- name: Test Postgres (alternate schema)
4648
working-directory: packages/cli
47-
run: npm run test:postgres:alt-schema
49+
run: pnpm test:postgres:alt-schema

.github/workflows/ci-pull-requests.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,32 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v3
1717

18+
- uses: pnpm/action-setup@v2.2.4
19+
1820
- name: Use Node.js ${{ matrix.node-version }}
1921
uses: actions/setup-node@v3
2022
with:
2123
node-version: ${{ matrix.node-version }}
22-
cache: 'npm'
24+
cache: 'pnpm'
2325

24-
- name: Install npm and dependencies
25-
run: npm install -g npm@latest && npm install
26+
- name: Install dependencies
27+
run: pnpm install --frozen-lockfile
2628

2729
- name: Build
28-
run: npm run build --if-present
30+
run: pnpm build
2931

3032
- name: Test
31-
run: npm run test
33+
run: pnpm test
3234

3335
- name: Test E2E
34-
run:
35-
npm run test:e2e:ci:smoke
36+
run: |
37+
pnpm cypress:install
38+
pnpm test:e2e:ci:smoke
3639
3740
- name: Fetch base branch for `git diff`
3841
run: git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}
3942

4043
- name: Run ESLint on changes only
4144
env:
4245
ESLINT_PLUGIN_DIFF_COMMIT: ${{ github.event.pull_request.base.ref }}
43-
run: npm run lint
46+
run: pnpm lint

.github/workflows/test-workflows.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ jobs:
2626
repository: n8n-io/test-workflows
2727
path: test-workflows
2828

29+
- uses: pnpm/action-setup@v2.2.4
30+
2931
- name: Use Node.js ${{ matrix.node-version }}
3032
uses: actions/setup-node@v3
3133
with:
3234
node-version: ${{ matrix.node-version }}
33-
cache: 'npm'
34-
cache-dependency-path: 'n8n/package-lock.json'
35+
cache: 'pnpm'
36+
cache-dependency-path: 'n8n/pnpm-lock.yaml'
3537

3638
- name: Install dependencies
3739
run: |
@@ -41,12 +43,11 @@ jobs:
4143
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y graphicsmagick
4244
shell: bash
4345

44-
- name: npm install and build
46+
- name: pnpm install and build
4547
working-directory: n8n
4648
run: |
47-
npm install -g npm@latest
48-
npm install
49-
npm run build --if-present
49+
pnpm install
50+
pnpm build
5051
shell: bash
5152

5253
- name: Import credentials

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ _START_PACKAGE
1313
!.vscode/settings.default.json
1414
.idea
1515
nodelinter.config.json
16-
packages/*/package-lock.json
17-
packages/*/.turbo
16+
**/package-lock.json
17+
packages/**/.turbo
1818
*.tsbuildinfo
1919
cypress/videos/*
2020
cypress/screenshots/*

.npmrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
legacy-peer-deps=true
1+
auto-install-peers = true
2+
strict-peer-dependencies = false
3+
prefer-workspace-packages = true
4+
link-workspace-packages = deep
5+
hoist = true
6+
shamefully-hoist = true
7+
loglevel = warn

.vscode/settings.default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"search.exclude": {
55
"node_modules": true,
66
"dist": true,
7-
"package-lock.json": true
7+
"pnpm-lock.yaml": true
88
},
99
"typescript.tsdk": "node_modules/typescript/lib",
1010
"workspace-default-settings.runOnActivation": true

CONTRIBUTING.md

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@ Great that you are here and you want to contribute to n8n
44

55
## Contents
66

7-
- [Code of Conduct](#code-of-conduct)
8-
- [Directory Structure](#directory-structure)
9-
- [Development Setup](#development-setup)
10-
- [Development Cycle](#development-cycle)
11-
- [Create Custom Nodes](#create-custom-nodes)
12-
- [Create a new node to contribute to n8n](#create-a-new-node-to-contribute-to-n8n)
13-
- [Checklist before submitting a new node](#checklist-before-submitting-a-new-node)
14-
- [Extend Documentation](#extend-documentation)
15-
- [Contributor License Agreement](#contributor-license-agreement)
7+
- [Contributing to n8n](#contributing-to-n8n)
8+
- [Contents](#contents)
9+
- [Code of conduct](#code-of-conduct)
10+
- [Directory structure](#directory-structure)
11+
- [Development setup](#development-setup)
12+
- [Requirements](#requirements)
13+
- [Node.js](#nodejs)
14+
- [Build tools](#build-tools)
15+
- [pnpm workspaces](#pnpm-workspaces)
16+
- [Actual n8n setup](#actual-n8n-setup)
17+
- [Start](#start)
18+
- [Development cycle](#development-cycle)
19+
- [Test suite](#test-suite)
20+
- [Create custom nodes](#create-custom-nodes)
21+
- [Create a new node to contribute to n8n](#create-a-new-node-to-contribute-to-n8n)
22+
- [Checklist before submitting a new node](#checklist-before-submitting-a-new-node)
23+
- [Extend documentation](#extend-documentation)
24+
- [Contributor License Agreement](#contributor-license-agreement)
1625

1726
## Code of conduct
1827

@@ -51,7 +60,13 @@ dependencies are installed and the packages get linked correctly. Here a short g
5160

5261
#### Node.js
5362

54-
We suggest using [Node.js](https://nodejs.org/en/) version 16 for development purposes.
63+
We suggest using [Node.js](https://nodejs.org/en/) version 16.9 or newer for development purposes.
64+
65+
After that we recommend enabling [Node.js corepack](https://nodejs.org/docs/latest-v16.x/api/corepack.html) with `corepack enable`, and [pnpm](https://pnpm.io/) with `corepack prepare pnpm --activate`.
66+
67+
**IMPORTANT**: If you have installed Node.js via homebrew, you'll need to run `brew install corepack`, since homebrew explicitly removes `npm` and `corepack` from [the `node` formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/node.rb#L66).
68+
69+
**IMPORTANT**: If you are on windows, you'd need to run `corepack enable` and `corepack prepare pnpm --activate` in a terminal as an administrator.
5570

5671
#### Build tools
5772

@@ -72,15 +87,14 @@ yum install gcc gcc-c++ make
7287
Windows:
7388

7489
```
75-
npm install -g windows-build-tools
90+
npm add -g windows-build-tools
7691
```
7792

78-
#### npm workspaces
93+
#### pnpm workspaces
7994

8095
n8n is split up in different modules which are all in a single mono repository.
81-
To facilitate the module management, [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces) are
82-
used. This automatically sets up file-links between modules which depend on each
83-
other.
96+
To facilitate the module management, [pnpm workspaces](https://pnpm.io/workspaces) are used.
97+
This automatically sets up file-links between modules which depend on each other.
8498

8599
### Actual n8n setup
86100

@@ -112,20 +126,20 @@ checked out and set up:
112126
5. Install all dependencies of all modules and link them together:
113127

114128
```
115-
npm install
129+
pnpm install
116130
```
117131

118132
6. Build all the code:
119133
```
120-
npm run build
134+
pnpm build
121135
```
122136

123137
### Start
124138

125139
To start n8n execute:
126140

127141
```
128-
npm run start
142+
pnpm start
129143
```
130144

131145
To start n8n with tunnel:
@@ -136,24 +150,24 @@ To start n8n with tunnel:
136150

137151
## Development cycle
138152

139-
While iterating on n8n modules code, you can run `npm run dev`. It will then
153+
While iterating on n8n modules code, you can run `pnpm dev`. It will then
140154
automatically build your code, restart the backend and refresh the frontend
141155
(editor-ui) on every change you make.
142156

143157
1. Start n8n in development mode:
144158
```
145-
npm run dev
159+
pnpm dev
146160
```
147161
1. Hack, hack, hack
148162
1. Check if everything still runs in production mode
149163
```
150-
npm run build
151-
npm run start
164+
pnpm build
165+
pnpm start
152166
```
153167
1. Create tests
154168
1. Run all [tests](#test-suite)
155169
```
156-
npm run test
170+
pnpm test
157171
```
158172
1. Commit code and [create a pull request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)
159173

@@ -162,7 +176,7 @@ automatically build your code, restart the backend and refresh the frontend
162176
The tests can be started via:
163177

164178
```
165-
npm run test
179+
pnpm test
166180
```
167181

168182
If that gets executed in one of the package folders it will only run the tests

0 commit comments

Comments
 (0)