@n8n/node-cli 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +243 -18
  2. package/dist/build.tsbuildinfo +1 -1
  3. package/dist/commands/build.js +7 -28
  4. package/dist/commands/build.js.map +1 -1
  5. package/dist/commands/dev/index.d.ts +1 -1
  6. package/dist/commands/dev/index.js +37 -23
  7. package/dist/commands/dev/index.js.map +1 -1
  8. package/dist/commands/dev/utils.d.ts +0 -5
  9. package/dist/commands/dev/utils.js +0 -30
  10. package/dist/commands/dev/utils.js.map +1 -1
  11. package/dist/commands/lint.d.ts +9 -0
  12. package/dist/commands/lint.js +34 -0
  13. package/dist/commands/lint.js.map +1 -0
  14. package/dist/commands/new/index.js +34 -5
  15. package/dist/commands/new/index.js.map +1 -1
  16. package/dist/commands/new/utils.js +1 -1
  17. package/dist/commands/new/utils.js.map +1 -1
  18. package/dist/commands/prerelease.d.ts +8 -0
  19. package/dist/commands/prerelease.js +20 -0
  20. package/dist/commands/prerelease.js.map +1 -0
  21. package/dist/commands/release.d.ts +7 -0
  22. package/dist/commands/release.js +49 -0
  23. package/dist/commands/release.js.map +1 -0
  24. package/dist/index.d.ts +6 -0
  25. package/dist/index.js +6 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/template/templates/declarative/custom/template/package.json +9 -12
  28. package/dist/template/templates/declarative/github-issues/template/package.json +9 -12
  29. package/dist/template/templates/programmatic/example/template/package.json +9 -12
  30. package/dist/template/templates/shared/default/CHANGELOG.md +0 -0
  31. package/dist/utils/child-process.d.ts +16 -0
  32. package/dist/utils/child-process.js +61 -0
  33. package/dist/utils/child-process.js.map +1 -0
  34. package/dist/utils/git.d.ts +1 -0
  35. package/dist/utils/git.js +5 -0
  36. package/dist/utils/git.js.map +1 -1
  37. package/dist/utils/package-manager.d.ts +2 -5
  38. package/dist/utils/package-manager.js +28 -26
  39. package/dist/utils/package-manager.js.map +1 -1
  40. package/package.json +3 -11
  41. package/LICENSE_EE.md +0 -27
package/README.md CHANGED
@@ -1,47 +1,272 @@
1
1
  # @n8n/node-cli
2
2
 
3
- Official CLI for developing community nodes for [n8n](https://n8n.io).
3
+ Official CLI for developing community nodes for n8n.
4
4
 
5
- ## Features
5
+ ## 🚀 Getting Started
6
6
 
7
- - 🔧 Scaffold new n8n nodes
8
- - 💻 Develop n8n nodes with live preview
7
+ **To create a new node**, run:
9
8
 
10
- ## Installation
9
+ ```bash
10
+ pnpm create @n8n/node
11
+ ```
12
+
13
+ This will generate a project with `pnpm` scripts that use this CLI under the hood.
14
+
15
+ ## 📦 Generated Project Commands
16
+
17
+ After creating your node with `pnpm create @n8n/node`, you'll use these commands in your project:
18
+
19
+ ### Development
20
+ ```bash
21
+ pnpm dev
22
+ # Runs: n8n-node dev
23
+ ```
24
+
25
+ ### Building
26
+ ```bash
27
+ pnpm build
28
+ # Runs: n8n-node build
29
+ ```
30
+
31
+ ### Linting
32
+ ```bash
33
+ pnpm lint
34
+ # Runs: n8n-node lint
35
+
36
+ pnpm lint:fix
37
+ # Runs: n8n-node lint --fix
38
+ ```
39
+
40
+ ### Publishing
41
+ ```bash
42
+ pnpm run release
43
+ # Runs: n8n-node release
44
+ ```
45
+
46
+ ## 🛠️ CLI Reference
47
+
48
+ > **Note:** These commands are typically wrapped by `pnpm` scripts in generated projects.
11
49
 
12
- Run directly via `npx`:
50
+ ```bash
51
+ n8n-node [COMMAND] [OPTIONS]
52
+ ```
53
+
54
+ ### Commands
55
+
56
+ #### `n8n-node new`
57
+
58
+ Create a new node project.
13
59
 
14
60
  ```bash
15
- npx n8n-node new
61
+ n8n-node new [NAME] [OPTIONS]
16
62
  ```
17
63
 
18
- Or install globally:
64
+ **Flags:**
65
+ | Flag | Description |
66
+ |------|-------------|
67
+ | `-f, --force` | Overwrite destination folder if it already exists |
68
+ | `--skip-install` | Skip installing dependencies |
69
+ | `--template <template>` | Choose template: `declarative/custom`, `declarative/github-issues`, `programmatic/example` |
19
70
 
71
+ **Examples:**
20
72
  ```bash
21
- npm install -g @n8n/node-cli
22
73
  n8n-node new
74
+ n8n-node new n8n-nodes-my-app --skip-install
75
+ n8n-node new n8n-nodes-my-app --force
76
+ n8n-node new n8n-nodes-my-app --template declarative/custom
77
+ ```
78
+
79
+ > **Note:** This command is used internally by `pnpm create @n8n/node` to provide the interactive scaffolding experience.
80
+
81
+ #### `n8n-node dev`
82
+
83
+ Run n8n with your node in development mode with hot reload.
84
+
85
+ ```bash
86
+ n8n-node dev [--external-n8n] [--custom-user-folder <value>]
23
87
  ```
24
88
 
25
- ## Commands
89
+ **Flags:**
90
+ | Flag | Description |
91
+ |------|-------------|
92
+ | `--external-n8n` | Run n8n externally instead of in a subprocess |
93
+ | `--custom-user-folder <path>` | Folder to use to store user-specific n8n data (default: `~/.n8n-node-cli`) |
26
94
 
27
- ## Create a node
95
+ This command:
96
+ - Starts n8n on `http://localhost:5678` (unless using `--external-n8n`)
97
+ - Links your node to n8n's custom nodes directory (`~/.n8n-node-cli/.n8n/custom`)
98
+ - Rebuilds on file changes for live preview
99
+ - Watches for changes in your `src/` directory
28
100
 
101
+ **Examples:**
29
102
  ```bash
30
- n8n-node new # Scaffold a new node
103
+ # Standard development with built-in n8n
104
+ n8n-node dev
105
+
106
+ # Use external n8n instance
107
+ n8n-node dev --external-n8n
108
+
109
+ # Custom n8n extensions directory
110
+ n8n-node dev --custom-user-folder /home/user
31
111
  ```
32
112
 
33
- ## Build a node
113
+ #### `n8n-node build`
114
+
115
+ Compile your node and prepare it for distribution.
34
116
 
35
117
  ```bash
36
- n8n-node build # Build your node; should be ran in the root of your custom node
118
+ n8n-node build
37
119
  ```
38
120
 
39
- ## Develop a node
121
+ **Flags:** None
122
+
123
+ Generates:
124
+ - Compiled TypeScript code
125
+ - Bundled node package
126
+ - Optimized assets and icons
127
+ - Ready-to-publish package in `dist/`
128
+
129
+ #### `n8n-node lint`
130
+
131
+ Lint the node in the current directory.
40
132
 
41
133
  ```bash
42
- n8n-node dev # Develop your node with hot reloading; should be ran in the root of your custom node
134
+ n8n-node lint [--fix]
43
135
  ```
44
136
 
45
- ## Related
137
+ **Flags:**
138
+ | Flag | Description |
139
+ |------|-------------|
140
+ | `--fix` | Automatically fix problems |
141
+
142
+ **Examples:**
143
+ ```bash
144
+ # Check for linting issues
145
+ n8n-node lint
146
+
147
+ # Automatically fix fixable issues
148
+ n8n-node lint --fix
149
+ ```
150
+
151
+ #### `n8n-node release`
152
+
153
+ Publish your community node package to npm.
154
+
155
+ ```bash
156
+ n8n-node release
157
+ ```
158
+
159
+ **Flags:** None
160
+
161
+ This command handles the complete release process using [release-it](https://github.com/release-it/release-it):
162
+ - Builds the node
163
+ - Runs linting checks
164
+ - Updates changelog
165
+ - Creates git tags
166
+ - Creates GitHub releases
167
+ - Publishes to npm
168
+
169
+ ## 🔄 Development Workflow
170
+
171
+ The recommended workflow using the scaffolding tool:
172
+
173
+ 1. **Create your node**:
174
+ ```bash
175
+ pnpm create @n8n/node my-awesome-node
176
+ cd my-awesome-node
177
+ ```
178
+
179
+ 2. **Start development**:
180
+ ```bash
181
+ pnpm dev
182
+ ```
183
+ - Starts n8n on `http://localhost:5678`
184
+ - Links your node automatically
185
+ - Rebuilds on file changes
186
+
187
+ 3. **Test your node** at `http://localhost:5678`
188
+
189
+ 4. **Lint your code**:
190
+ ```bash
191
+ pnpm lint
192
+ ```
193
+
194
+ 5. **Build for production**:
195
+ ```bash
196
+ pnpm build
197
+ ```
198
+
199
+ 6. **Publish**:
200
+ ```bash
201
+ pnpm run release
202
+ ```
203
+
204
+ ## 📁 Project Structure
205
+
206
+ The CLI expects your project to follow this structure:
207
+
208
+ ```
209
+ my-node/
210
+ ├── src/
211
+ │ ├── nodes/
212
+ │ │ └── MyNode/
213
+ │ │ ├── MyNode.node.ts
214
+ │ │ └── MyNode.node.json
215
+ │ └── credentials/
216
+ ├── package.json
217
+ └── tsconfig.json
218
+ ```
219
+
220
+ ## ⚙️ Configuration
221
+
222
+ The CLI reads configuration from your `package.json`:
223
+
224
+ ```json
225
+ {
226
+ "name": "n8n-nodes-my-awesome-node",
227
+ "n8n": {
228
+ "n8nNodesApiVersion": 1,
229
+ "nodes": [
230
+ "dist/nodes/MyNode/MyNode.node.js"
231
+ ],
232
+ "credentials": [
233
+ "dist/credentials/MyNodeAuth.credentials.js"
234
+ ]
235
+ }
236
+ }
237
+ ```
238
+
239
+ ## 🐛 Troubleshooting
240
+
241
+ ### Development server issues
242
+ ```bash
243
+ # Clear n8n custom nodes cache
244
+ rm -rf ~/.n8n-node-cli/.n8n/custom
245
+
246
+ # Restart development server
247
+ pnpm dev
248
+ ```
249
+
250
+ ### Build failures
251
+ ```bash
252
+ # Run linting first
253
+ pnpm lint
254
+
255
+ # Clean build
256
+ pnpm build
257
+ ```
258
+
259
+ ## 📚 Resources
260
+
261
+ - **[Creating Nodes Guide](https://docs.n8n.io/integrations/creating-nodes/)** - Complete documentation
262
+ - **[Node Development Reference](https://docs.n8n.io/integrations/creating-nodes/build/reference/)** - API specifications
263
+ - **[Community Forum](https://community.n8n.io)** - Get help and showcase your nodes
264
+ - **[@n8n/create-node](https://www.npmjs.com/package/@n8n/create-node)** - Recommended scaffolding tool
265
+
266
+ ## 🤝 Contributing
267
+
268
+ Found an issue? Contribute to the [n8n repository](https://github.com/n8n-io/n8n) on GitHub.
269
+
270
+ ---
46
271
 
47
- `@n8n/create-node`: Lightweight wrapper to support `npm create @n8n/node`
272
+ **Happy node development! 🎉**