@atom8n/create-node 0.16.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.
- package/README.md +305 -0
- package/bin/create-node.cjs +11 -0
- package/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# @n8n/create-node
|
|
2
|
+
|
|
3
|
+
A powerful scaffolding tool to quickly create custom n8n community nodes with best practices built-in.
|
|
4
|
+
|
|
5
|
+
## 🚀 Quick Start
|
|
6
|
+
|
|
7
|
+
Create a new n8n node in seconds:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm create @n8n/node@latest # or pnpm/yarn/...
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Follow the interactive prompts to configure your node, or specify options directly:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm create @n8n/node my-awesome-node --template declarative/custom
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 📋 Command Line Options
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm create @n8n/node [NAME] [OPTIONS]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Options
|
|
26
|
+
|
|
27
|
+
| Flag | Description |
|
|
28
|
+
|------|-------------|
|
|
29
|
+
| `-f, --force` | Overwrite destination folder if it already exists |
|
|
30
|
+
| `--skip-install` | Skip automatic dependency installation |
|
|
31
|
+
| `--template <template>` | Specify which template to use |
|
|
32
|
+
|
|
33
|
+
### Available Templates
|
|
34
|
+
|
|
35
|
+
- **`declarative/custom`** - Start with a minimal declarative node structure
|
|
36
|
+
- **`declarative/github-issues`** - GitHub Issues integration example
|
|
37
|
+
- **`programmatic/example`** - Full programmatic node with advanced features
|
|
38
|
+
|
|
39
|
+
## 🎯 Interactive Setup
|
|
40
|
+
|
|
41
|
+
The CLI will guide you through setting up your node:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
$ npm create @n8n/node
|
|
45
|
+
┌ @n8n/create-node
|
|
46
|
+
│
|
|
47
|
+
◇ What is your node called?
|
|
48
|
+
│ my-awesome-api-node
|
|
49
|
+
│
|
|
50
|
+
◇ What kind of node are you building?
|
|
51
|
+
│ HTTP API
|
|
52
|
+
│
|
|
53
|
+
◇ What template do you want to use?
|
|
54
|
+
│ Start from scratch
|
|
55
|
+
│
|
|
56
|
+
◇ What's the base URL of the API?
|
|
57
|
+
│ https://api.example.com/v1
|
|
58
|
+
│
|
|
59
|
+
◇ What type of authentication does your API use?
|
|
60
|
+
│ API Key
|
|
61
|
+
│
|
|
62
|
+
◇ Files copied ✓
|
|
63
|
+
│
|
|
64
|
+
◇ Dependencies installed ✓
|
|
65
|
+
│
|
|
66
|
+
◇ Next Steps ─────────────────────────────────────────────────────────────────────╮
|
|
67
|
+
│ │
|
|
68
|
+
│ cd ./my-awesome-api-node && npm run dev │
|
|
69
|
+
│ │
|
|
70
|
+
│ 📚 Documentation: https://docs.n8n.io/integrations/creating-nodes/ │
|
|
71
|
+
│ 💬 Community: https://community.n8n.io │
|
|
72
|
+
│ │
|
|
73
|
+
├──────────────────────────────────────────────────────────────────────────────────╯
|
|
74
|
+
│
|
|
75
|
+
└ Created ./my-awesome-api-node ✨
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 🛠️ Development Workflow
|
|
79
|
+
|
|
80
|
+
### 1. Navigate to your project
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
cd ./my-awesome-api-node
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 2. Start development server
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm run dev
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
This command:
|
|
93
|
+
- Starts n8n in development mode on `http://localhost:5678`
|
|
94
|
+
- Enables hot reload for your node changes
|
|
95
|
+
- Automatically includes your node in the n8n instance
|
|
96
|
+
- Links your node to `~/.n8n-node-cli/.n8n/custom` for development
|
|
97
|
+
- Watches for file changes and rebuilds automatically
|
|
98
|
+
|
|
99
|
+
### 3. Test your node
|
|
100
|
+
|
|
101
|
+
- Open n8n at `http://localhost:5678`
|
|
102
|
+
- Create a new workflow
|
|
103
|
+
- Find your node in the node panel
|
|
104
|
+
- Test parameters and functionality in real-time
|
|
105
|
+
|
|
106
|
+
## 📦 Generated Project Commands
|
|
107
|
+
|
|
108
|
+
Your generated project comes with these convenient npm scripts:
|
|
109
|
+
|
|
110
|
+
### Development
|
|
111
|
+
```bash
|
|
112
|
+
npm run dev
|
|
113
|
+
# Runs: n8n-node dev
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Building
|
|
117
|
+
```bash
|
|
118
|
+
npm run build
|
|
119
|
+
# Runs: n8n-node build
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Linting
|
|
123
|
+
```bash
|
|
124
|
+
npm run lint
|
|
125
|
+
# Runs: n8n-node lint
|
|
126
|
+
|
|
127
|
+
npm run lint:fix
|
|
128
|
+
# Runs: n8n-node lint --fix
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Publishing
|
|
132
|
+
```bash
|
|
133
|
+
npm run release
|
|
134
|
+
# Runs: n8n-node release
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 📦 Build & Deploy
|
|
138
|
+
|
|
139
|
+
### Build for production
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npm run build
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Generates:
|
|
146
|
+
- Compiled TypeScript code
|
|
147
|
+
- Bundled node package
|
|
148
|
+
- Optimized assets and icons
|
|
149
|
+
- Ready-to-publish package
|
|
150
|
+
|
|
151
|
+
### Quality checks
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npm run lint
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Validates:
|
|
158
|
+
- Code style and formatting
|
|
159
|
+
- n8n node conventions
|
|
160
|
+
- Common integration issues
|
|
161
|
+
- Cloud publication readiness
|
|
162
|
+
|
|
163
|
+
### Cloud support
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npx n8n-node cloud-support
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Manage n8n Cloud publication eligibility. In strict mode, your node must use the default ESLint config and pass all community node rules to be eligible for n8n Cloud publication.
|
|
170
|
+
|
|
171
|
+
Fix issues automatically:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
npm run lint:fix
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Publish your node
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm run release
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Runs [release-it](https://github.com/release-it/release-it) to handle the complete release process:
|
|
184
|
+
- Ensures working directory is clean
|
|
185
|
+
- Verifies you're on the main git branch
|
|
186
|
+
- Increments your package version
|
|
187
|
+
- Runs build and lint checks
|
|
188
|
+
- Updates changelog
|
|
189
|
+
- Creates git tag with version bump
|
|
190
|
+
- Creates GitHub release with changelog
|
|
191
|
+
- Publishes to npm
|
|
192
|
+
|
|
193
|
+
## 📁 Project Structure
|
|
194
|
+
|
|
195
|
+
Your generated project includes:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
my-awesome-api-node/
|
|
199
|
+
├── src/
|
|
200
|
+
│ ├── nodes/
|
|
201
|
+
│ │ └── MyAwesomeApi/
|
|
202
|
+
│ │ ├── MyAwesomeApi.node.ts # Main node logic
|
|
203
|
+
│ │ └── MyAwesomeApi.node.json # Node metadata
|
|
204
|
+
│ └── credentials/
|
|
205
|
+
│ └── MyAwesomeApiAuth.credentials.ts
|
|
206
|
+
├── package.json
|
|
207
|
+
├── tsconfig.json
|
|
208
|
+
└── README.md
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The CLI expects your project to follow this structure for proper building and development.
|
|
212
|
+
|
|
213
|
+
## ⚙️ Configuration
|
|
214
|
+
|
|
215
|
+
The CLI reads configuration from your `package.json`:
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"name": "n8n-nodes-my-awesome-node",
|
|
220
|
+
"n8n": {
|
|
221
|
+
"n8nNodesApiVersion": 1,
|
|
222
|
+
"nodes": [
|
|
223
|
+
"dist/nodes/MyAwesomeApi/MyAwesomeApi.node.js"
|
|
224
|
+
],
|
|
225
|
+
"credentials": [
|
|
226
|
+
"dist/credentials/MyAwesomeApiAuth.credentials.js"
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## 🎨 Node Types
|
|
233
|
+
|
|
234
|
+
Choose the right template for your use case:
|
|
235
|
+
|
|
236
|
+
| Template | Best For | Features |
|
|
237
|
+
|----------|----------|----------|
|
|
238
|
+
| **Declarative** | REST APIs, simple integrations | JSON-based configuration, automatic UI generation |
|
|
239
|
+
| **Programmatic** | Complex logic, custom operations | Full TypeScript control, advanced error handling |
|
|
240
|
+
|
|
241
|
+
## 🐛 Troubleshooting
|
|
242
|
+
|
|
243
|
+
### Common Issues
|
|
244
|
+
|
|
245
|
+
**Node not appearing in n8n:**
|
|
246
|
+
```bash
|
|
247
|
+
# Clear n8n node cli cache and restart
|
|
248
|
+
rm -rf ~/.n8n-node-cli/.n8n/custom
|
|
249
|
+
npm run dev
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**TypeScript errors:**
|
|
253
|
+
```bash
|
|
254
|
+
# Reinstall dependencies
|
|
255
|
+
rm -rf node_modules npm-lock.yaml
|
|
256
|
+
npm install
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
**Build failures:**
|
|
260
|
+
```bash
|
|
261
|
+
# Check for linting issues first
|
|
262
|
+
npm run lint --fix
|
|
263
|
+
npm run build
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Development server issues:**
|
|
267
|
+
```bash
|
|
268
|
+
# Clear cache and restart development server
|
|
269
|
+
rm -rf ~/.n8n-node-cli/.n8n/custom
|
|
270
|
+
npm run dev
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## 🔧 Advanced Usage
|
|
274
|
+
|
|
275
|
+
### Using External n8n Instance
|
|
276
|
+
|
|
277
|
+
If you prefer to use your own n8n installation:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
npm run dev --external-n8n
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Custom User Folder
|
|
284
|
+
|
|
285
|
+
Specify a custom location for n8n user data:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
npm run dev --custom-user-folder /path/to/custom/folder
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## 📚 Resources
|
|
292
|
+
|
|
293
|
+
- **[Node Development Guide](https://docs.n8n.io/integrations/creating-nodes/)** - Complete documentation
|
|
294
|
+
- **[API Reference](https://docs.n8n.io/integrations/creating-nodes/build/reference/)** - Technical specifications
|
|
295
|
+
- **[Community Forum](https://community.n8n.io)** - Get help and share your nodes
|
|
296
|
+
- **[Node Examples](https://github.com/n8n-io/n8n/tree/master/packages/nodes-base/nodes)** - Official node implementations
|
|
297
|
+
- **[@n8n/node-cli](https://www.npmjs.com/package/@n8n/node-cli)** - The underlying CLI tool
|
|
298
|
+
|
|
299
|
+
## 🤝 Contributing
|
|
300
|
+
|
|
301
|
+
Found a bug or want to contribute? Check out the [n8n repository](https://github.com/n8n-io/n8n) and join our community!
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
**Happy node building! 🎉**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
const n8nNodeBin = require.resolve('.bin/n8n-node');
|
|
6
|
+
|
|
7
|
+
const result = spawnSync(n8nNodeBin, ['new', ...process.argv.slice(2)], {
|
|
8
|
+
stdio: 'inherit',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atom8n/create-node",
|
|
3
|
+
"version": "0.16.0",
|
|
4
|
+
"description": "Official CLI to create new community nodes for n8n",
|
|
5
|
+
"bin": {
|
|
6
|
+
"create-node": "bin/create-node.cjs"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin",
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"start": "node bin/create-node.cjs"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/n8n-io/n8n.git"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@atom8n/node-cli": "0.17.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@atom8n/typescript-config": "1.3.0"
|
|
24
|
+
}
|
|
25
|
+
}
|