simple-scaffold 2.3.3 → 3.1.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 +55 -13
- package/before-write.d.ts +7 -0
- package/cmd.js +331 -259
- package/cmd.js.map +1 -1
- package/colors.d.ts +32 -0
- package/config.d.ts +12 -10
- package/file.d.ts +32 -12
- package/fs-utils.d.ts +9 -0
- package/ignore.d.ts +21 -0
- package/index.d.ts +1 -0
- package/index.js +15 -23
- package/index.js.map +1 -1
- package/init.d.ts +20 -0
- package/logger.d.ts +14 -0
- package/package.json +42 -20
- package/parser.d.ts +1 -1
- package/path-utils.d.ts +6 -0
- package/prompts.d.ts +36 -0
- package/scaffold-DOzCgpZT.js +1263 -0
- package/scaffold-DOzCgpZT.js.map +1 -0
- package/types.d.ts +110 -0
- package/utils.d.ts +4 -24
- package/validate.d.ts +96 -0
- package/config.js +0 -254
- package/config.js.map +0 -1
- package/file.js +0 -166
- package/file.js.map +0 -1
- package/git.js +0 -81
- package/git.js.map +0 -1
- package/logger.js +0 -58
- package/logger.js.map +0 -1
- package/parser.js +0 -100
- package/parser.js.map +0 -1
- package/scaffold.js +0 -139
- package/scaffold.js.map +0 -1
- package/types.js +0 -31
- package/types.js.map +0 -1
- package/utils.js +0 -61
- package/utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -13,17 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
</h2>
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
copying your commonly-created files.
|
|
16
|
+
Simple Scaffold is a file scaffolding tool. You define templates once, then generate files from them
|
|
17
|
+
whenever you need — whether it's a single component or an entire app boilerplate.
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
you can also use it to loop through data, use conditions, and write custom functions using helpers.
|
|
24
|
-
|
|
25
|
-
Don't waste any more time manually copying and pasting files - let Simple Scaffold do the heavy
|
|
26
|
-
lifting for you and start building your projects faster and more efficiently today!
|
|
19
|
+
Templates use **Handlebars.js** syntax, so you can inject data, loop over lists, use conditionals,
|
|
20
|
+
and write custom helpers. It works as a CLI or as a Node.js library, and it doesn't care what kind
|
|
21
|
+
of files you're generating.
|
|
27
22
|
|
|
28
23
|
<div align="center">
|
|
29
24
|
|
|
@@ -45,6 +40,21 @@ See full documentation [here](https://chenasraf.github.io/simple-scaffold).
|
|
|
45
40
|
|
|
46
41
|
## Getting Started
|
|
47
42
|
|
|
43
|
+
### Quick Start
|
|
44
|
+
|
|
45
|
+
The fastest way to get started is to run `init` in your project directory:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
npx simple-scaffold init
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This creates a `scaffold.config.js` and an example template in `templates/default/`. Then generate
|
|
52
|
+
files with:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npx simple-scaffold MyProject
|
|
56
|
+
```
|
|
57
|
+
|
|
48
58
|
### Cheat Sheet
|
|
49
59
|
|
|
50
60
|
A quick rundown of common usage scenarios:
|
|
@@ -100,9 +110,40 @@ See information about each option and flag using the `--help` flag, or read the
|
|
|
100
110
|
[CLI documentation](https://chenasraf.github.io/simple-scaffold/docs/usage/cli). For information
|
|
101
111
|
about how configuration files work, [see below](#configuration-files).
|
|
102
112
|
|
|
113
|
+
### Interactive Mode
|
|
114
|
+
|
|
115
|
+
When running in a terminal, Simple Scaffold will interactively prompt for any missing required
|
|
116
|
+
values — name, output directory, template paths, and template key (if multiple are available).
|
|
117
|
+
|
|
118
|
+
Config files can also define **inputs** — custom fields that are prompted interactively and become
|
|
119
|
+
template data:
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
module.exports = {
|
|
123
|
+
component: {
|
|
124
|
+
templates: ["templates/component"],
|
|
125
|
+
output: "src/components",
|
|
126
|
+
inputs: {
|
|
127
|
+
author: { message: "Author name", required: true },
|
|
128
|
+
license: { message: "License", default: "MIT" },
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Inputs can be pre-provided via `--data` or `-D` to skip the prompt:
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
npx simple-scaffold -c scaffold.config.js -k component -D author=John MyComponent
|
|
138
|
+
```
|
|
139
|
+
|
|
103
140
|
### Configuration Files
|
|
104
141
|
|
|
105
|
-
You can use a config file to more easily maintain all your scaffold definitions.
|
|
142
|
+
You can use a config file to more easily maintain all your scaffold definitions. Simple Scaffold
|
|
143
|
+
**auto-detects** config files in the current directory — no `--config` flag needed.
|
|
144
|
+
|
|
145
|
+
It searches for these files in order: `scaffold.config.{mjs,cjs,js,json}`,
|
|
146
|
+
`scaffold.{mjs,cjs,js,json}`, `.scaffold.{mjs,cjs,js,json}`.
|
|
106
147
|
|
|
107
148
|
`scaffold.config.js`
|
|
108
149
|
|
|
@@ -120,10 +161,11 @@ module.exports = {
|
|
|
120
161
|
}
|
|
121
162
|
```
|
|
122
163
|
|
|
123
|
-
Then
|
|
164
|
+
Then just run from the same directory:
|
|
124
165
|
|
|
125
166
|
```sh
|
|
126
|
-
$ npx simple-scaffold
|
|
167
|
+
$ npx simple-scaffold PageWrapper
|
|
168
|
+
# or explicitly: npx simple-scaffold -c scaffold.config.js PageWrapper
|
|
127
169
|
```
|
|
128
170
|
|
|
129
171
|
This will allow you to avoid needing to remember which configs are needed or to store them in a
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LogConfig, ScaffoldConfig } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Wraps a CLI beforeWrite command string into a beforeWrite callback function.
|
|
4
|
+
* The command receives the processed content via a temp file and can return modified content via stdout.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function wrapBeforeWrite(config: LogConfig & Pick<ScaffoldConfig, "dryRun">, beforeWrite: string): ScaffoldConfig["beforeWrite"];
|