simple-scaffold 0.7.5 → 1.0.0-alpha.12
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 +175 -79
- package/{dist/cmd.d.ts → cmd.d.ts} +0 -0
- package/cmd.js +5 -0
- package/cmd.js.map +1 -0
- package/cmd_util.d.ts +1 -0
- package/cmd_util.js +92 -0
- package/cmd_util.js.map +1 -0
- package/index.d.ts +4 -30
- package/index.js +20 -2
- package/index.js.map +1 -0
- package/package.json +24 -29
- package/scaffold.d.ts +3 -0
- package/scaffold.js +122 -0
- package/scaffold.js.map +1 -0
- package/types.d.ts +64 -0
- package/types.js +12 -0
- package/types.js.map +1 -0
- package/utils.d.ts +12 -0
- package/utils.js +119 -0
- package/utils.js.map +1 -0
- package/.prettierrc +0 -3
- package/.vscode/launch.json +0 -29
- package/.vscode/settings.json +0 -4
- package/.vscode/tasks.json +0 -47
- package/LICENSE +0 -21
- package/cmd.ts +0 -135
- package/dist/cmd.js +0 -3
- package/dist/cmd.js.map +0 -1
- package/dist/index.d.ts +0 -30
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/scaffold.d.ts +0 -21
- package/dist/test.d.ts +0 -1
- package/dist/test.js +0 -2
- package/dist/test.js.map +0 -1
- package/examples/test-input/Component/.hidden-file +0 -0
- package/examples/test-input/Component/Scaffold.tsx +0 -19
- package/examples/test-input/Component/{{Name}}.tsx +0 -19
- package/examples/test-output/.gitkeep +0 -0
- package/scaffold.ts +0 -198
- package/test.ts +0 -35
- package/tsconfig.json +0 -19
- package/webpack.config.js +0 -46
package/README.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Simple Scaffold allows you to create your structured files based on templates.
|
|
4
4
|
|
|
5
|
+
Simply organize your commonly-created files in their original structure, and replace any variable
|
|
6
|
+
values (such as component or app name) inside the paths or contents of the files with tokens to be
|
|
7
|
+
populated upon scaffolding.
|
|
8
|
+
|
|
9
|
+
Then, run Simple Scaffold and it will generate your files for you in the desired structure,
|
|
10
|
+
with file names and contents that contain your dynamic information.
|
|
11
|
+
|
|
12
|
+
It's a simple way to easily create reusable components, common class files to start writing from,
|
|
13
|
+
or even entire app structures.
|
|
14
|
+
|
|
5
15
|
## Install
|
|
6
16
|
|
|
7
17
|
You can either use it as a command line tool or import into your own code and run from there.
|
|
@@ -11,6 +21,8 @@ You can either use it as a command line tool or import into your own code and ru
|
|
|
11
21
|
npm install [-g] simple-scaffold
|
|
12
22
|
# yarn
|
|
13
23
|
yarn [global] add simple-scaffold
|
|
24
|
+
# run without installing
|
|
25
|
+
npx simple-scaffold <...args>
|
|
14
26
|
```
|
|
15
27
|
|
|
16
28
|
## Use as a command line tool
|
|
@@ -18,62 +30,71 @@ yarn [global] add simple-scaffold
|
|
|
18
30
|
### Command Line Options
|
|
19
31
|
|
|
20
32
|
```plaintext
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
Usage: simple-scaffold [options]
|
|
34
|
+
|
|
35
|
+
Create structured files based on templates.
|
|
36
|
+
|
|
37
|
+
Options:
|
|
38
|
+
|
|
39
|
+
--help|-h Display help information
|
|
40
|
+
|
|
41
|
+
--name|-n Name to be passed to the generated files. {{name}} and
|
|
42
|
+
{{Name}} inside contents and file names will be replaced
|
|
43
|
+
accordingly.
|
|
44
|
+
|
|
45
|
+
--output|-o Path to output to. If --create-sub-folder is enabled, the
|
|
46
|
+
subfolder will be created inside this path.
|
|
47
|
+
|
|
48
|
+
--templates|-t Template files to use as input. You may provide multiple
|
|
49
|
+
files, each of which can be a relative or absolute path, or a glob
|
|
50
|
+
pattern for multiple file matching easily. (default:
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
--overwrite|-w Enable to override output files, even if they already exist.
|
|
54
|
+
(default: false)
|
|
55
|
+
|
|
56
|
+
--data|-d Add custom data to the templates. By default, only your app
|
|
57
|
+
name is included.
|
|
58
|
+
|
|
59
|
+
--create-sub-folder|-s Create subfolder with the input name (default:
|
|
60
|
+
false)
|
|
61
|
+
|
|
62
|
+
--quiet|-q Suppress output logs (Same as --verbose 0)
|
|
63
|
+
(default: false)
|
|
64
|
+
|
|
65
|
+
--verbose|-v Determine amount of logs to display. The values are: 0
|
|
66
|
+
(none) | 1 (debug) | 2 (info) | 3 (warn) | 4 (error). The
|
|
67
|
+
provided level will display messages of the same level or higher.
|
|
68
|
+
(default: 2)
|
|
69
|
+
|
|
70
|
+
--dry-run|-dr Don't emit files. This is good for testing your scaffolds and
|
|
71
|
+
making sure they don't fail, without having to write actual file
|
|
72
|
+
contents or create directories. (default:
|
|
73
|
+
false)
|
|
42
74
|
```
|
|
43
75
|
|
|
44
|
-
You can add this as a script in your `package.json`:
|
|
76
|
+
You can also add this as a script in your `package.json`:
|
|
45
77
|
|
|
46
78
|
```json
|
|
47
79
|
{
|
|
80
|
+
...
|
|
48
81
|
"scripts": {
|
|
49
|
-
|
|
82
|
+
...
|
|
83
|
+
"scaffold": "yarn simple-scaffold --templates scaffolds/component/**/* --output src/components --data '{\"myProp\": \"propName\", \"myVal\": \"123\"}'"
|
|
50
84
|
}
|
|
51
85
|
}
|
|
52
86
|
```
|
|
53
87
|
|
|
54
|
-
##
|
|
55
|
-
|
|
56
|
-
Scaffolding will replace {{vars}} in both the file name and its contents and put the transformed files
|
|
57
|
-
in `<output>/<{{Name}}>`, as per the Handlebars formatting rules.
|
|
58
|
-
|
|
59
|
-
Your context will be pre-populated with the following:
|
|
60
|
-
|
|
61
|
-
- `{{Name}}`: CapitalizedName of the component
|
|
62
|
-
- `{{name}}`: camelCasedName of the component
|
|
63
|
-
|
|
64
|
-
Any `locals` you add in the config will populate with their names wrapped in `{{` and `}}`.
|
|
65
|
-
They are all stringified, so be sure to parse them accordingly by creating a script, if necessary.
|
|
66
|
-
|
|
67
|
-
### Use in Node.js
|
|
88
|
+
## Use in Node.js
|
|
68
89
|
|
|
69
90
|
You can also build the scaffold yourself, if you want to create more complex arguments or scaffold groups.
|
|
70
91
|
Simply pass a config object to the constructor, and invoke `run()` when you are ready to start.
|
|
71
92
|
The config takes similar arguments to the command line:
|
|
72
93
|
|
|
73
|
-
```
|
|
74
|
-
|
|
94
|
+
```typescript
|
|
95
|
+
import Scaffold from "simple-scaffold"
|
|
75
96
|
|
|
76
|
-
const scaffold =
|
|
97
|
+
const scaffold = SimpleScaffold({
|
|
77
98
|
name: "component",
|
|
78
99
|
templates: [path.join(__dirname, "scaffolds", "component")],
|
|
79
100
|
output: path.join(__dirname, "src", "components"),
|
|
@@ -81,84 +102,159 @@ const scaffold = new SimpleScaffold({
|
|
|
81
102
|
locals: {
|
|
82
103
|
property: "value",
|
|
83
104
|
},
|
|
84
|
-
})
|
|
105
|
+
})
|
|
85
106
|
```
|
|
86
107
|
|
|
87
108
|
The exception in the config is that `output`, when used in Node directly, may also be passed a
|
|
88
109
|
function for each input file to output into a dynamic path:
|
|
89
110
|
|
|
90
|
-
```
|
|
111
|
+
```typescript
|
|
91
112
|
config.output = (fullPath, baseDir, baseName) => {
|
|
92
113
|
console.log({ fullPath, baseDir, baseName })
|
|
93
|
-
return
|
|
114
|
+
return path.resolve(baseDir, baseName)
|
|
94
115
|
}
|
|
95
116
|
```
|
|
96
117
|
|
|
97
|
-
##
|
|
118
|
+
## Preparing files
|
|
119
|
+
|
|
120
|
+
### Template files
|
|
121
|
+
|
|
122
|
+
Put your template files anywhere, and fill them with tokens for replacement.
|
|
123
|
+
|
|
124
|
+
### Variable/token replacement
|
|
125
|
+
|
|
126
|
+
Scaffolding will replace `{{ varName }}` in both the file name and its contents and put the
|
|
127
|
+
transformed files in the output directory.
|
|
128
|
+
|
|
129
|
+
The data available for the template parser is the data you pass to the `data` config option (or
|
|
130
|
+
`--data` argument in CLI).
|
|
131
|
+
|
|
132
|
+
Your `data` will be pre-populated with the following:
|
|
133
|
+
|
|
134
|
+
- `{{Name}}`: PascalCase of the component name
|
|
135
|
+
- `{{name}}`: raw name of the component
|
|
136
|
+
|
|
137
|
+
> Simple-Scaffold uses [Handlebars.js](https://handlebarsjs.com/) for outputting the file contents,
|
|
138
|
+
> see their documentation for more information on syntax.
|
|
139
|
+
> Any `data` you add in the config will be available for use with their names wrapped in
|
|
140
|
+
> `{{` and `}}`.
|
|
141
|
+
|
|
142
|
+
#### Helpers
|
|
143
|
+
|
|
144
|
+
Simple-Scaffold provides some built-in text transformation filters usable by handleBars.
|
|
98
145
|
|
|
99
|
-
|
|
146
|
+
For example, you may use `{{ snakeCase name }}` inside a template file or filename, and it will
|
|
147
|
+
replace `My Name` with `my_name` when producing the final value.
|
|
148
|
+
|
|
149
|
+
Here are the built-in helpers available for use:
|
|
150
|
+
|
|
151
|
+
| Helper name | Example code | Example output |
|
|
152
|
+
| ----------- | ----------------------- | -------------- |
|
|
153
|
+
| camelCase | `{{ camelCase name }}` | myName |
|
|
154
|
+
| snakeCase | `{{ snakeCase name }}` | my_name |
|
|
155
|
+
| startCase | `{{ startCase name }}` | My Name |
|
|
156
|
+
| kebabCase | `{{ kebabCase name }}` | my-name |
|
|
157
|
+
| hyphenCase | `{{ hyphenCase name }}` | my-name |
|
|
158
|
+
| pascalCase | `{{ pascalCase name }}` | MyName |
|
|
159
|
+
|
|
160
|
+
> These helpers are available for any data property, not exclusive to `name`.
|
|
161
|
+
|
|
162
|
+
## Examples
|
|
163
|
+
|
|
164
|
+
### Command Example
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
simple-scaffold MyComponent \
|
|
168
|
+
-t project/scaffold/**/* \
|
|
169
|
+
-o src/components \
|
|
170
|
+
-d '{"className": "myClassName"}'
|
|
171
|
+
MyComponent
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Example Scaffold Input
|
|
175
|
+
|
|
176
|
+
#### Input Directory structure
|
|
100
177
|
|
|
101
178
|
```plaintext
|
|
102
179
|
- project
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
180
|
+
- scaffold
|
|
181
|
+
- {{Name}}.js
|
|
182
|
+
- src
|
|
183
|
+
- components
|
|
184
|
+
- ...
|
|
108
185
|
```
|
|
109
186
|
|
|
110
|
-
#### project/scaffold/{{Name}}.
|
|
187
|
+
#### Contents of `project/scaffold/{{Name}}.jsx`
|
|
111
188
|
|
|
112
189
|
```js
|
|
113
190
|
const React = require('react')
|
|
114
191
|
|
|
115
|
-
module.exports =
|
|
116
|
-
|
|
192
|
+
module.exports = function {{Name}}(props) {
|
|
193
|
+
return (
|
|
117
194
|
<div className="{{className}}">{{Name}} Component</div>
|
|
118
|
-
|
|
195
|
+
)
|
|
119
196
|
}
|
|
120
197
|
```
|
|
121
198
|
|
|
122
|
-
###
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
simple-scaffold MyComponent \
|
|
126
|
-
-t project/scaffold/**/* \
|
|
127
|
-
-o src/components \
|
|
128
|
-
-l className=my-component
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Example Scaffold Output
|
|
199
|
+
### Example Scaffold Output
|
|
132
200
|
|
|
133
201
|
### Output directory structure
|
|
134
202
|
|
|
135
203
|
```plaintext
|
|
136
204
|
- project
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
205
|
+
- src
|
|
206
|
+
- components
|
|
207
|
+
- MyComponent
|
|
208
|
+
- MyComponent.js
|
|
209
|
+
- ...
|
|
142
210
|
```
|
|
143
211
|
|
|
144
|
-
With `
|
|
212
|
+
With `createSubFolder = false`:
|
|
145
213
|
|
|
146
214
|
```plaintext
|
|
147
215
|
- project
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
216
|
+
- src
|
|
217
|
+
- components
|
|
218
|
+
- MyComponent.js
|
|
219
|
+
- ...
|
|
152
220
|
```
|
|
153
221
|
|
|
154
|
-
#### project/scaffold/MyComponent/MyComponent.
|
|
222
|
+
#### Contents of `project/scaffold/MyComponent/MyComponent.jsx`
|
|
155
223
|
|
|
156
224
|
```js
|
|
157
225
|
const React = require("react")
|
|
158
226
|
|
|
159
|
-
module.exports =
|
|
160
|
-
|
|
161
|
-
<div className="
|
|
162
|
-
|
|
227
|
+
module.exports = function MyComponent(props) {
|
|
228
|
+
return (
|
|
229
|
+
<div className="myClassName">MyComponent Component</div>
|
|
230
|
+
)
|
|
163
231
|
}
|
|
164
232
|
```
|
|
233
|
+
|
|
234
|
+
## Contributing
|
|
235
|
+
|
|
236
|
+
I welcome any issues or pull requests on GitHub. If you find a bug, or would like a new feature,
|
|
237
|
+
don't hesitate to open an appropriate issue and I will do my best to reply promptly.
|
|
238
|
+
|
|
239
|
+
If you are a developer and want to contribute code, here are some starting tips:
|
|
240
|
+
|
|
241
|
+
1. Fork this repository
|
|
242
|
+
2. Run `yarn install`
|
|
243
|
+
3. Run `yarn dev` to start file watch mode
|
|
244
|
+
4. Make any changes you would like
|
|
245
|
+
5. Create tests for your changes
|
|
246
|
+
6. Update the relevant documentation (readme, code comments, type comments)
|
|
247
|
+
7. Create a PR on upstream
|
|
248
|
+
|
|
249
|
+
Some tips on getting around the code:
|
|
250
|
+
|
|
251
|
+
- Use `yarn dev` for development - it runs TypeScript compile in watch mode, allowing you to make
|
|
252
|
+
changes and immediately be able to try them using `yarn cmd`.
|
|
253
|
+
- Use `yarn build` to build the output
|
|
254
|
+
- Use `yarn test` to run tests
|
|
255
|
+
- Use `yarn cmd` to use the CLI feature of Simple Scaffold from within the root directory,
|
|
256
|
+
enabling you to test different behaviors. See `yarn cmd -h` for more information.
|
|
257
|
+
|
|
258
|
+
> This requires an updated build, and does not trigger one itself. Either use `yarn dev` or
|
|
259
|
+
> `yarn build` before running this, or use `yarn build-cmd` instead, which triggers a build right
|
|
260
|
+
> before running the command with the rest of the given arguments.
|
|
File without changes
|
package/cmd.js
ADDED
package/cmd.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmd.js","sourceRoot":"","sources":["../src/cmd.ts"],"names":[],"mappings":";;AAAA,yCAAyC;AACzC,uBAAY,EAAE,CAAA"}
|
package/cmd_util.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function parseCliArgs(args?: string[]): void;
|
package/cmd_util.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseCliArgs = void 0;
|
|
7
|
+
const massarg_1 = __importDefault(require("massarg"));
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const types_1 = require("./types");
|
|
10
|
+
const scaffold_1 = require("./scaffold");
|
|
11
|
+
function parseCliArgs(args = process.argv.slice(2)) {
|
|
12
|
+
return (massarg_1.default()
|
|
13
|
+
.main(scaffold_1.Scaffold)
|
|
14
|
+
.option({
|
|
15
|
+
name: "name",
|
|
16
|
+
aliases: ["n"],
|
|
17
|
+
description: "Name to be passed to the generated files. {{name}} and {{Name}} inside contents and file names will be replaced accordingly.",
|
|
18
|
+
isDefault: true,
|
|
19
|
+
required: true,
|
|
20
|
+
})
|
|
21
|
+
.option({
|
|
22
|
+
name: "output",
|
|
23
|
+
aliases: ["o"],
|
|
24
|
+
description: "Path to output to. If --create-sub-folder is enabled, the subfolder will be created inside this path.",
|
|
25
|
+
required: true,
|
|
26
|
+
})
|
|
27
|
+
.option({
|
|
28
|
+
name: "templates",
|
|
29
|
+
aliases: ["t"],
|
|
30
|
+
array: true,
|
|
31
|
+
description: "Template files to use as input. You may provide multiple files, each of which can be a relative or absolute path, " +
|
|
32
|
+
"or a glob pattern for multiple file matching easily.",
|
|
33
|
+
required: true,
|
|
34
|
+
})
|
|
35
|
+
.option({
|
|
36
|
+
name: "overwrite",
|
|
37
|
+
aliases: ["w"],
|
|
38
|
+
boolean: true,
|
|
39
|
+
defaultValue: false,
|
|
40
|
+
description: "Enable to override output files, even if they already exist.",
|
|
41
|
+
})
|
|
42
|
+
.option({
|
|
43
|
+
name: "data",
|
|
44
|
+
aliases: ["d"],
|
|
45
|
+
description: "Add custom data to the templates. By default, only your app name is included.",
|
|
46
|
+
parse: (v) => JSON.parse(v),
|
|
47
|
+
})
|
|
48
|
+
.option({
|
|
49
|
+
name: "create-sub-folder",
|
|
50
|
+
aliases: ["s"],
|
|
51
|
+
boolean: true,
|
|
52
|
+
defaultValue: false,
|
|
53
|
+
description: "Create subfolder with the input name",
|
|
54
|
+
})
|
|
55
|
+
.option({
|
|
56
|
+
name: "quiet",
|
|
57
|
+
aliases: ["q"],
|
|
58
|
+
boolean: true,
|
|
59
|
+
defaultValue: false,
|
|
60
|
+
description: "Suppress output logs (Same as --verbose 0)",
|
|
61
|
+
})
|
|
62
|
+
.option({
|
|
63
|
+
name: "verbose",
|
|
64
|
+
aliases: ["v"],
|
|
65
|
+
defaultValue: types_1.LogLevel.Info,
|
|
66
|
+
description: `Determine amount of logs to display. The values are: ${chalk_1.default.bold `0 (none) | 1 (debug) | 2 (info) | 3 (warn) | 4 (error)`}. The provided level will display messages of the same level or higher.`,
|
|
67
|
+
parse: Number,
|
|
68
|
+
})
|
|
69
|
+
.option({
|
|
70
|
+
name: "dry-run",
|
|
71
|
+
aliases: ["dr"],
|
|
72
|
+
boolean: true,
|
|
73
|
+
defaultValue: false,
|
|
74
|
+
description: "Don't emit files. This is good for testing your scaffolds and making sure they " +
|
|
75
|
+
"don't fail, without having to write actual file contents or create directories.",
|
|
76
|
+
})
|
|
77
|
+
// .example({
|
|
78
|
+
// input: `yarn cmd -t examples/test-input/Component -o examples/test-output -d '{"property":"myProp","value":"10"}'`,
|
|
79
|
+
// description: "Usage",
|
|
80
|
+
// output: "",
|
|
81
|
+
// })
|
|
82
|
+
.help({
|
|
83
|
+
binName: "simple-scaffold",
|
|
84
|
+
useGlobalColumns: true,
|
|
85
|
+
usageExample: "[options]",
|
|
86
|
+
header: "Create structured files based on templates.",
|
|
87
|
+
footer: `Copyright © Chen Asraf 2021\nNPM: ${chalk_1.default.underline `https://npmjs.com/package/massarg`}\nGitHub: ${chalk_1.default.underline `https://github.com/chenasraf/massarg`}`,
|
|
88
|
+
})
|
|
89
|
+
.parse(args));
|
|
90
|
+
}
|
|
91
|
+
exports.parseCliArgs = parseCliArgs;
|
|
92
|
+
//# sourceMappingURL=cmd_util.js.map
|
package/cmd_util.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmd_util.js","sourceRoot":"","sources":["../src/cmd_util.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;AAC7B,kDAAyB;AACzB,mCAAqD;AACrD,yCAAqC;AAErC,SAAgB,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,OAAO,CACL,iBAAO,EAA2D;SAC/D,IAAI,CAAC,mBAAQ,CAAC;SACd,MAAM,CAAC;QACN,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,WAAW,EACT,8HAA8H;QAChI,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;KACf,CAAC;SACD,MAAM,CAAC;QACN,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,WAAW,EACT,uGAAuG;QACzG,QAAQ,EAAE,IAAI;KACf,CAAC;SACD,MAAM,CAAC;QACN,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,KAAK,EAAE,IAAI;QACX,WAAW,EACT,oHAAoH;YACpH,sDAAsD;QACxD,QAAQ,EAAE,IAAI;KACf,CAAC;SACD,MAAM,CAAC;QACN,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,8DAA8D;KAC5E,CAAC;SACD,MAAM,CAAC;QACN,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,WAAW,EAAE,+EAA+E;QAC5F,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;KAC5B,CAAC;SACD,MAAM,CAAC;QACN,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,sCAAsC;KACpD,CAAC;SACD,MAAM,CAAC;QACN,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,4CAA4C;KAC1D,CAAC;SACD,MAAM,CAAC;QACN,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,CAAC,GAAG,CAAC;QACd,YAAY,EAAE,gBAAQ,CAAC,IAAI;QAC3B,WAAW,EAAE,wDAAwD,eAAK,CAAC,IAAI,CAAA,wDAAwD,yEAAyE;QAChN,KAAK,EAAE,MAAM;KACd,CAAC;SACD,MAAM,CAAC;QACN,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,CAAC,IAAI,CAAC;QACf,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,KAAK;QACnB,WAAW,EACT,iFAAiF;YACjF,iFAAiF;KACpF,CAAC;QACF,aAAa;QACb,wHAAwH;QACxH,0BAA0B;QAC1B,gBAAgB;QAChB,KAAK;SACJ,IAAI,CAAC;QACJ,OAAO,EAAE,iBAAiB;QAC1B,gBAAgB,EAAE,IAAI;QACtB,YAAY,EAAE,WAAW;QACzB,MAAM,EAAE,6CAA6C;QACrD,MAAM,EAAE,qCAAqC,eAAK,CAAC,SAAS,CAAA,mCAAmC,aAAa,eAAK,CAAC,SAAS,CAAA,sCAAsC,EAAE;KACpK,CAAC;SACD,KAAK,CAAC,IAAI,CAAC,CACf,CAAA;AACH,CAAC;AArFD,oCAqFC"}
|
package/index.d.ts
CHANGED
|
@@ -1,30 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface Config {
|
|
8
|
-
name?: string
|
|
9
|
-
templates: string[]
|
|
10
|
-
output:
|
|
11
|
-
| string
|
|
12
|
-
| ((fullPath: string, basedir: string, basename: string) => string)
|
|
13
|
-
locals?: Locals
|
|
14
|
-
createSubfolder?: boolean
|
|
15
|
-
overwrite?: boolean | ((path: string) => boolean)
|
|
16
|
-
quiet?: boolean
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface Locals {
|
|
20
|
-
[k: string]: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface FileRepr {
|
|
24
|
-
base: string
|
|
25
|
-
file: string
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default IScaffold.SimpleScaffold
|
|
30
|
-
export { IScaffold }
|
|
1
|
+
export * from "./scaffold";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
import Scaffold from "./scaffold";
|
|
4
|
+
export default Scaffold;
|
package/index.js
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
__exportStar(require("./scaffold"), exports);
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
const scaffold_1 = __importDefault(require("./scaffold"));
|
|
19
|
+
exports.default = scaffold_1.default;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,0CAAuB;AACvB,0DAAiC;AACjC,kBAAe,kBAAQ,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,47 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simple-scaffold",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.12",
|
|
4
4
|
"description": "Create files based on templates",
|
|
5
5
|
"repository": "https://github.com/chenasraf/simple-scaffold.git",
|
|
6
6
|
"author": "Chen Asraf <inbox@casraf.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"main": "
|
|
9
|
-
"bin": "
|
|
10
|
-
"types": "index.d.ts",
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"bin": "cmd.js",
|
|
11
10
|
"scripts": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"dev": "
|
|
11
|
+
"clean": "rm -rf dist/",
|
|
12
|
+
"build": "yarn clean && tsc && chmod -R +x ./dist && cp ./package.json ./dist/ && cp ./README.md ./dist/",
|
|
13
|
+
"dev": "tsc --watch",
|
|
15
14
|
"start": "node dist/scaffold.js",
|
|
16
|
-
"test": "
|
|
17
|
-
"cmd": "dist/cmd.js",
|
|
15
|
+
"test": "jest --verbose",
|
|
16
|
+
"cmd": "node --trace-warnings dist/cmd.js",
|
|
18
17
|
"build-test": "yarn build && yarn test",
|
|
19
18
|
"build-cmd": "yarn build && yarn cmd"
|
|
20
19
|
},
|
|
21
20
|
"dependencies": {
|
|
22
|
-
"
|
|
23
|
-
"
|
|
21
|
+
"args": "^5.0.1",
|
|
22
|
+
"chalk": "^4.1.2",
|
|
24
23
|
"glob": "^7.1.3",
|
|
25
|
-
"handlebars": "^4.
|
|
24
|
+
"handlebars": "^4.7.7",
|
|
25
|
+
"lodash": "^4.17.21",
|
|
26
|
+
"massarg": "^1.0.4",
|
|
27
|
+
"util.promisify": "^1.1.1"
|
|
26
28
|
},
|
|
27
29
|
"devDependencies": {
|
|
28
|
-
"@types/
|
|
29
|
-
"@types/command-line-usage": "^5.0.1",
|
|
30
|
+
"@types/args": "^3.0.1",
|
|
30
31
|
"@types/glob": "^7.1.1",
|
|
32
|
+
"@types/jest": "^26.0.24",
|
|
33
|
+
"@types/lodash": "^4.14.171",
|
|
34
|
+
"@types/mock-fs": "^4.13.1",
|
|
31
35
|
"@types/node": "^14.14.22",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"ts-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"webpack-cli": "^4.4.0",
|
|
38
|
-
"webpack-dev-server": "^3.2.1",
|
|
39
|
-
"webpack-node-externals": "^2.5.2"
|
|
40
|
-
},
|
|
41
|
-
"jest": {
|
|
42
|
-
"testPathIgnorePatterns": [
|
|
43
|
-
"node_modules",
|
|
44
|
-
"dist"
|
|
45
|
-
]
|
|
36
|
+
"jest": "^27.0.6",
|
|
37
|
+
"mock-fs": "^5.0.0",
|
|
38
|
+
"ts-jest": "^27.0.3",
|
|
39
|
+
"ts-node": "^10.1.0",
|
|
40
|
+
"typescript": "^4.3.5"
|
|
46
41
|
}
|
|
47
|
-
}
|
|
42
|
+
}
|
package/scaffold.d.ts
ADDED