@pixpilot/scaffoldfy 0.24.0 → 0.25.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 (2) hide show
  1. package/README.md +134 -76
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # @pixpilot/scaffoldfy
2
2
 
3
+ [![Documentation](https://img.shields.io/badge/docs-pixpilot.github.io/scaffoldfy-blue)](https://pixpilot.github.io/scaffoldfy/)
4
+
3
5
  A flexible and powerful task automation utility for project setup, cleanup, and configuration.
4
6
 
5
7
  ## Features
6
8
 
7
- - 🔄 **9 Task Types** - update-json, write, regex-replace, replace-in-file, delete, conditional-delete, rename, git-init, exec
9
+ - 🔄 **13 Task Types** - update-json, template, create, regex-replace, replace-in-file, delete, rename, move, copy, append, mkdir, git-init, exec
8
10
  - 🧩 **Template Inheritance** - Extend base templates for code reuse
9
11
  - 🔍 **Dry-Run Mode with Diff** - Preview exact changes before applying
10
12
  - 🔌 **Plugin System** - Create custom task types and lifecycle hooks
@@ -34,14 +36,8 @@ scaffoldfy
34
36
  # With custom tasks file
35
37
  scaffoldfy --tasks-file ./my-tasks.json
36
38
 
37
- # TypeScript tasks file
38
- scaffoldfy --tasks-ts ./my-tasks.ts
39
-
40
39
  # Preview changes (dry run)
41
40
  scaffoldfy --dry-run
42
-
43
- # Force re-initialization
44
- scaffoldfy --force
45
41
  ```
46
42
 
47
43
  Or run without installing using npx:
@@ -53,14 +49,8 @@ npx @pixpilot/scaffoldfy
53
49
  # With custom tasks file
54
50
  npx @pixpilot/scaffoldfy --tasks-file ./my-tasks.json
55
51
 
56
- # TypeScript tasks file
57
- npx @pixpilot/scaffoldfy --tasks-ts ./my-tasks.ts
58
-
59
52
  # Preview changes (dry run)
60
53
  npx @pixpilot/scaffoldfy --dry-run
61
-
62
- # Force re-initialization
63
- npx @pixpilot/scaffoldfy --force
64
54
  ```
65
55
 
66
56
  ### CLI Options
@@ -70,7 +60,6 @@ npx @pixpilot/scaffoldfy --force
70
60
  | `--tasks-file <path>` | Path to JSON task file (default: `./template-tasks.json`) |
71
61
  | `--tasks-ts <path>` | Path to TypeScript task file (default: `./template-tasks.ts`) |
72
62
  | `--dry-run` | Preview changes without applying them |
73
- | `--force` | Force re-initialization |
74
63
  | `--no-validate` | Skip schema validation of task configuration (validation is enabled by default) |
75
64
  | `-h, --help` | Show help message |
76
65
  | `-v, --version` | Show version |
@@ -89,36 +78,38 @@ await runWithTasks(tasks, {
89
78
 
90
79
  ### Task Types
91
80
 
92
- 9 built-in task types for common operations:
93
-
94
- | Type | Purpose |
95
- | -------------------- | -------------------------------------------------- |
96
- | `update-json` | Update JSON files (supports nested properties) |
97
- | `template` | Create files from templates (simple or Handlebars) |
98
- | `regex-replace` | Find and replace with regex |
99
- | `replace-in-file` | Simple find and replace |
100
- | `delete` | Remove files/directories |
101
- | `conditional-delete` | Remove based on conditions |
102
- | `rename` | Rename or move files |
103
- | `git-init` | Initialize git repository |
104
- | `exec` | Execute shell commands |
81
+ 13 built-in task types for common operations:
82
+
83
+ | Type | Purpose |
84
+ | ----------------- | -------------------------------------------------- |
85
+ | `update-json` | Update JSON files (supports nested properties) |
86
+ | `template` | Create files from templates (simple or Handlebars) |
87
+ | `create` | Create new files with optional content |
88
+ | `regex-replace` | Find and replace with regex |
89
+ | `replace-in-file` | Simple find and replace |
90
+ | `delete` | Remove files/directories |
91
+ | `rename` | Rename or move files |
92
+ | `move` | Move files or directories |
93
+ | `copy` | Copy files or directories |
94
+ | `append` | Append content to existing files |
95
+ | `mkdir` | Create directories |
96
+ | `git-init` | Initialize git repository |
97
+ | `exec` | Execute shell commands |
105
98
 
106
99
  📖 **[Complete Task Types Reference →](https://pixpilot.github.io/scaffoldfy/TASK_TYPES.html)**
107
100
 
108
101
  ### Interactive Prompts
109
102
 
110
- Collect custom user input directly in your task definitions:
103
+ Collect user input at the root level - prompts are collected once before tasks run and available to all tasks:
111
104
 
112
105
  ```json
113
106
  {
114
- "id": "setup",
115
107
  "prompts": [
116
108
  {
117
109
  "id": "projectName",
118
110
  "type": "input",
119
111
  "message": "What is your project name?",
120
- "required": true,
121
- "global": true
112
+ "required": true
122
113
  },
123
114
  {
124
115
  "id": "useTypeScript",
@@ -127,38 +118,72 @@ Collect custom user input directly in your task definitions:
127
118
  "default": true
128
119
  }
129
120
  ],
130
- "config": {
131
- "file": "package.json",
132
- "updates": {
133
- "name": "{{projectName}}"
121
+ "tasks": [
122
+ {
123
+ "id": "setup",
124
+ "name": "Setup Project",
125
+ "type": "update-json",
126
+ "config": {
127
+ "file": "package.json",
128
+ "updates": {
129
+ "name": "{{projectName}}"
130
+ }
131
+ }
134
132
  }
135
- }
133
+ ]
136
134
  }
137
135
  ```
138
136
 
139
137
  **Supported prompt types:** `input`, `password`, `number`, `select`, `confirm`
140
138
 
141
- **Global prompts:** Mark prompts with `"global": true` to share values across all tasks
139
+ **Root-level only:** Prompts are defined at the root level, collected once upfront, and available to all tasks
142
140
 
143
141
  💬 **[Full Prompts Guide →](https://pixpilot.github.io/scaffoldfy/PROMPTS.html)** | 📋 **[Quick Reference →](https://pixpilot.github.io/scaffoldfy/PROMPTS_QUICK_REFERENCE.html)**
144
142
 
145
- ### Template Variables
143
+ ### Variables
146
144
 
147
- Use `{{variable}}` syntax anywhere in your task configs:
145
+ Define reusable values without user interaction - automatically resolved from static values or executable commands:
148
146
 
149
147
  ```json
150
148
  {
151
- "updates": {
152
- "name": "{{projectName}}",
153
- "author": "{{author}}",
154
- "repository": "{{repoUrl}}"
155
- }
149
+ "variables": [
150
+ {
151
+ "id": "currentYear",
152
+ "value": {
153
+ "type": "exec",
154
+ "value": "node -e \"console.log(new Date().getFullYear())\""
155
+ }
156
+ },
157
+ {
158
+ "id": "gitUserName",
159
+ "value": {
160
+ "type": "exec",
161
+ "value": "git config user.name"
162
+ }
163
+ },
164
+ {
165
+ "id": "defaultLicense",
166
+ "value": "MIT"
167
+ }
168
+ ],
169
+ "tasks": [
170
+ {
171
+ "id": "update-license",
172
+ "type": "template",
173
+ "config": {
174
+ "file": "LICENSE",
175
+ "template": "Copyright {{currentYear}} {{gitUserName}}\n\nLicense: {{defaultLicense}}"
176
+ }
177
+ }
178
+ ]
156
179
  }
157
180
  ```
158
181
 
159
- **All variables come from prompts:** Define prompts with `"global": true` to create variables available across all tasks.
182
+ **Use in tasks:** Reference variables using `{{variable}}` syntax: `{{currentYear}}`, `{{gitUserName}}`, `{{defaultLicense}}`
160
183
 
161
- **Example:** `{{projectName}}`, `{{author}}`, `{{repoUrl}}`, `{{port}}`, etc.
184
+ **Variable types:** Static values, executable commands (with auto-parsing), or conditional expressions
185
+
186
+ 📌 **[Complete Variables Guide →](https://pixpilot.github.io/scaffoldfy/VARIABLES.html)**
162
187
 
163
188
  ### Handlebars Templates
164
189
 
@@ -292,63 +317,96 @@ Control execution order:
292
317
 
293
318
  ## Example Configuration
294
319
 
295
- ### Simple Example
320
+ ### Complete Example with Prompts and Variables
296
321
 
297
322
  ```json
298
323
  {
324
+ "prompts": [
325
+ {
326
+ "id": "projectName",
327
+ "type": "input",
328
+ "message": "What is your project name?",
329
+ "required": true
330
+ },
331
+ {
332
+ "id": "author",
333
+ "type": "input",
334
+ "message": "Who is the author?",
335
+ "default": {
336
+ "type": "exec",
337
+ "value": "git config user.name"
338
+ }
339
+ },
340
+ {
341
+ "id": "useTypeScript",
342
+ "type": "confirm",
343
+ "message": "Use TypeScript?",
344
+ "default": true
345
+ }
346
+ ],
347
+ "variables": [
348
+ {
349
+ "id": "currentYear",
350
+ "value": {
351
+ "type": "exec",
352
+ "value": "node -e \"console.log(new Date().getFullYear())\""
353
+ }
354
+ },
355
+ {
356
+ "id": "license",
357
+ "value": "MIT"
358
+ }
359
+ ],
299
360
  "tasks": [
300
361
  {
301
362
  "id": "update-package",
302
363
  "name": "Update package.json",
303
- "description": "Update repository information",
304
- "required": true,
305
- "enabled": true,
364
+ "description": "Set project metadata",
306
365
  "type": "update-json",
307
366
  "config": {
308
367
  "file": "package.json",
309
368
  "updates": {
310
369
  "name": "{{projectName}}",
311
- "author": "{{author}}"
370
+ "author": "{{author}}",
371
+ "license": "{{license}}"
312
372
  }
313
373
  }
374
+ },
375
+ {
376
+ "id": "create-readme",
377
+ "name": "Create README",
378
+ "description": "Generate README file",
379
+ "type": "template",
380
+ "config": {
381
+ "file": "README.md",
382
+ "template": "# {{projectName}}\n\nAuthor: {{author}}\nCopyright {{currentYear}}"
383
+ }
314
384
  }
315
385
  ]
316
386
  }
317
387
  ```
318
388
 
319
- ### With Prompts
389
+ ### Simple Example
320
390
 
321
391
  ```json
322
392
  {
393
+ "prompts": [
394
+ {
395
+ "id": "projectName",
396
+ "type": "input",
397
+ "message": "Project name?",
398
+ "required": true
399
+ }
400
+ ],
323
401
  "tasks": [
324
402
  {
325
- "id": "setup-project",
326
- "name": "Setup Project",
327
- "description": "Configure project settings",
328
- "required": true,
329
- "enabled": true,
403
+ "id": "update-package",
404
+ "name": "Update package.json",
330
405
  "type": "update-json",
331
- "prompts": [
332
- {
333
- "id": "projectName",
334
- "type": "input",
335
- "message": "Project name?",
336
- "required": true
337
- },
338
- {
339
- "id": "includeTests",
340
- "type": "confirm",
341
- "message": "Include tests?",
342
- "default": true
343
- }
344
- ],
345
406
  "config": {
346
407
  "file": "package.json",
347
408
  "updates": {
348
- "name": "{{projectName}}",
349
- "scripts": {
350
- "test": "{{includeTests ? 'vitest' : 'echo \"No tests\"'}}"
351
- }
409
+ "name": "{{projectName}}"
352
410
  }
353
411
  }
354
412
  }
@@ -365,7 +423,7 @@ Control execution order:
365
423
  ### Quick Links
366
424
 
367
425
  - **[Getting Started](https://pixpilot.github.io/scaffoldfy/GETTING_STARTED.html)** - Installation, CLI usage, and examples
368
- - **[Task Types Reference](https://pixpilot.github.io/scaffoldfy/TASK_TYPES.html)** - All 9 built-in task types
426
+ - **[Task Types Reference](https://pixpilot.github.io/scaffoldfy/TASK_TYPES.html)** - All 13 built-in task types
369
427
  - **[Interactive Prompts](https://pixpilot.github.io/scaffoldfy/PROMPTS.html)** - Collect user input
370
428
  - **[Variables](https://pixpilot.github.io/scaffoldfy/VARIABLES.html)** - Reusable values without user interaction
371
429
  - **[Advanced Features](https://pixpilot.github.io/scaffoldfy/FEATURES.html)** - Conditional execution, global prompts, Handlebars
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixpilot/scaffoldfy",
3
3
  "type": "module",
4
- "version": "0.24.0",
4
+ "version": "0.25.0",
5
5
  "author": "PixPilot <m.doaie@hotmail.com>",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -47,11 +47,11 @@
47
47
  "eslint": "^9.38.0",
48
48
  "tsdown": "^0.15.8",
49
49
  "typescript": "^5.9.3",
50
- "@internal/eslint-config": "0.3.0",
51
- "@internal/tsconfig": "0.1.0",
50
+ "@internal/prettier-config": "0.0.1",
52
51
  "@internal/tsdown-config": "0.1.0",
52
+ "@internal/tsconfig": "0.1.0",
53
53
  "@internal/vitest-config": "0.1.0",
54
- "@internal/prettier-config": "0.0.1"
54
+ "@internal/eslint-config": "0.3.0"
55
55
  },
56
56
  "prettier": "@internal/prettier-config",
57
57
  "scripts": {