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 CHANGED
@@ -13,17 +13,12 @@
13
13
 
14
14
  </h2>
15
15
 
16
- Looking to streamline your workflow and get your projects up and running quickly? Look no further
17
- than Simple Scaffold - the easy-to-use NPM package that simplifies the process of organizing and
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
- With its agnostic and un-opinionated approach, Simple Scaffold can handle anything from a few simple
21
- files to an entire app boilerplate setup. Plus, with the power of **Handlebars.js** syntax, you can
22
- easily replace custom data and personalize your files to fit your exact needs. But that's not all -
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 call your scaffold like this:
164
+ Then just run from the same directory:
124
165
 
125
166
  ```sh
126
- $ npx simple-scaffold -c scaffold.config.js PageWrapper
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"];