simple-scaffold 2.0.1 → 2.0.2-pre.1
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 +94 -88
- package/cmd.js +25 -5
- package/cmd.js.map +1 -1
- package/index.js.map +1 -1
- package/package.json +10 -5
- package/scaffold.js +1 -0
- package/scaffold.js.map +1 -1
- package/types.d.ts +26 -11
- package/types.js +11 -0
- package/types.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://chenasraf.github.io//simple-scaffold/img/logo-lg.png" alt="Logo" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
5
|
<h2 align="center">
|
|
4
6
|
|
|
@@ -31,54 +33,76 @@ lifting for you and start building your projects faster and more efficiently tod
|
|
|
31
33
|
|
|
32
34
|
---
|
|
33
35
|
|
|
34
|
-
##
|
|
36
|
+
## Documentation
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
See full documentation [here](https://chenasraf.github.io/simple-scaffold).
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
- [Command Line Interface (CLI) usage](https://chenasraf.github.io/simple-scaffold/docs/usage/cli)
|
|
41
|
+
- [Node.js usage](https://chenasraf.github.io/simple-scaffold/docs/usage/node)
|
|
42
|
+
- [Templates](https://chenasraf.github.io/simple-scaffold/docs/usage/templates)
|
|
43
|
+
- [Configuration Files](https://chenasraf.github.io/simple-scaffold/docs/usage/configuration_files)
|
|
44
|
+
- [Migration](https://chenasraf.github.io/simple-scaffold/docs/usage/migration)
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
that in the CLI args. Here is a simple example file:
|
|
46
|
+
## Getting Started
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
### Cheat Sheet
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
A quick rundown of common usage scenarios:
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
// Created: {{ now 'yyyy-MM-dd' }}
|
|
49
|
-
import React from 'react'
|
|
52
|
+
- Remote template config file on GitHub:
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
```
|
|
54
|
+
```sh
|
|
55
|
+
npx simple-scaffold -g username/repository -c scaffold.js -k component NewComponentName
|
|
56
|
+
```
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
- Local template config file:
|
|
59
59
|
|
|
60
|
-
```sh
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
-t templates/component -o src/components PageWrapper
|
|
64
|
-
```
|
|
60
|
+
```sh
|
|
61
|
+
npx simple-scaffold -c scaffold.js -k component NewComponentName
|
|
62
|
+
```
|
|
65
63
|
|
|
66
|
-
|
|
64
|
+
- Local one-time usage:
|
|
67
65
|
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
```sh
|
|
67
|
+
npx simple-scaffold -t templates/component -o src/components NewComponentName
|
|
68
|
+
```
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
### Remote Configurations
|
|
71
|
+
|
|
72
|
+
The fastest way to get started is to is to re-use someone else's (or your own) work using a template
|
|
73
|
+
repository.
|
|
74
|
+
|
|
75
|
+
A remote config can be loaded in one of these ways:
|
|
76
|
+
|
|
77
|
+
- For templates hosted on GitHub, the syntax is `-g user/repository_name`
|
|
78
|
+
- For other Git platforms like GitLab, use `-g https://example.com/user/repository_name.git`
|
|
79
|
+
|
|
80
|
+
These remote configurations support multiple scaffold groups, which can be specified using the
|
|
81
|
+
`--key` or `-k` argument:
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
$ npx simple-scaffold \
|
|
85
|
+
-g chenasraf/simple-scaffold \
|
|
86
|
+
-k component \
|
|
87
|
+
PageWrapper
|
|
88
|
+
|
|
89
|
+
# equivalent to:
|
|
90
|
+
$ npx simple-scaffold \
|
|
91
|
+
-g https://github.com/chenasraf/simple-scaffold.git \
|
|
92
|
+
-c scaffold.config.js \
|
|
93
|
+
-k component \
|
|
94
|
+
PageWrapper
|
|
77
95
|
```
|
|
78
96
|
|
|
97
|
+
By default, the template name is set to `default` when the `--key` option is not provided.
|
|
98
|
+
|
|
99
|
+
See information about each option and flag using the `--help` flag, or read the
|
|
100
|
+
[CLI documentation](https://chenasraf.github.io/simple-scaffold/docs/usage/cli). For information
|
|
101
|
+
about how configuration files work, [see below](#configuration-files).
|
|
102
|
+
|
|
79
103
|
### Configuration Files
|
|
80
104
|
|
|
81
|
-
You can
|
|
105
|
+
You can use a config file to more easily maintain all your scaffold definitions.
|
|
82
106
|
|
|
83
107
|
`scaffold.config.js`
|
|
84
108
|
|
|
@@ -99,66 +123,61 @@ module.exports = {
|
|
|
99
123
|
Then call your scaffold like this:
|
|
100
124
|
|
|
101
125
|
```sh
|
|
102
|
-
$ npx simple-scaffold
|
|
126
|
+
$ npx simple-scaffold -c scaffold.config.js PageWrapper
|
|
103
127
|
```
|
|
104
128
|
|
|
105
129
|
This will allow you to avoid needing to remember which configs are needed or to store them in a
|
|
106
|
-
|
|
130
|
+
one-liner in `package.json` which can get pretty long and messy, and harder to maintain.
|
|
107
131
|
|
|
108
132
|
Also, this allows you to define more complex scaffolds with logic without having to use the Node.js
|
|
109
133
|
API directly. (Of course you always have the option to still do so if you wish)
|
|
110
134
|
|
|
111
|
-
|
|
112
|
-
[Configuration Files](https://chenasraf.github.io/simple-scaffold/docs/usage/configuration_files).
|
|
135
|
+
More information can be found at the
|
|
136
|
+
[Configuration Files documentation](https://chenasraf.github.io/simple-scaffold/docs/usage/configuration_files).
|
|
113
137
|
|
|
114
|
-
###
|
|
138
|
+
### Templates Structure
|
|
115
139
|
|
|
116
|
-
|
|
117
|
-
repository.
|
|
140
|
+
Templates are **any file** in the a directory given to `--templates`.
|
|
118
141
|
|
|
119
|
-
|
|
142
|
+
Simple Scaffold will maintain any file and directory structure you try to generate, while replacing
|
|
143
|
+
any tokens such as `{{ name }}` or other custom-data using
|
|
144
|
+
[Handlebars.js](https://handlebarsjs.com/).
|
|
120
145
|
|
|
121
|
-
|
|
122
|
-
- If it's on another git server (such as GitLab), you can use
|
|
123
|
-
`-g https://example.com/user/repository_name.git`
|
|
146
|
+
`templates/component/{{ pascalName name }}.tsx`
|
|
124
147
|
|
|
125
|
-
|
|
126
|
-
|
|
148
|
+
```tsx
|
|
149
|
+
// Created: {{ now 'yyyy-MM-dd' }}
|
|
150
|
+
import React from 'react'
|
|
127
151
|
|
|
128
|
-
|
|
129
|
-
|
|
152
|
+
export default {{pascalCase name}}: React.FC = (props) => {
|
|
153
|
+
return (
|
|
154
|
+
<div className="{{camelCase name}}">{{pascalCase name}} Component</div>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
130
157
|
```
|
|
131
158
|
|
|
132
|
-
|
|
159
|
+
To generate the template output once without saving a configuration file, run:
|
|
133
160
|
|
|
134
161
|
```sh
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
# equivalent to:
|
|
141
|
-
$ npx simple-scaffold@latest \
|
|
142
|
-
-g https://github.com/chenasraf/simple-scaffold.git \
|
|
143
|
-
-c scaffold.config.js \
|
|
144
|
-
-k component \
|
|
162
|
+
# generate single component
|
|
163
|
+
$ npx simple-scaffold \
|
|
164
|
+
-t templates/component \
|
|
165
|
+
-o src/components \
|
|
145
166
|
PageWrapper
|
|
146
167
|
```
|
|
147
168
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
See more at the [CLI documentation](https://chenasraf.github.io/simple-scaffold/docs/usage/cli) and
|
|
151
|
-
[Configuration Files](https://chenasraf.github.io/simple-scaffold/docs/usage/configuration_files).
|
|
152
|
-
|
|
153
|
-
## Documentation
|
|
169
|
+
This will immediately create the following file: `src/components/PageWrapper.tsx`
|
|
154
170
|
|
|
155
|
-
|
|
171
|
+
```tsx
|
|
172
|
+
// Created: 2077-01-01
|
|
173
|
+
import React from 'react'
|
|
156
174
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
175
|
+
export default PageWrapper: React.FC = (props) => {
|
|
176
|
+
return (
|
|
177
|
+
<div className="pageWrapper">PageWrapper Component</div>
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
```
|
|
162
181
|
|
|
163
182
|
## Contributing
|
|
164
183
|
|
|
@@ -189,22 +208,9 @@ If you are a developer and want to contribute code, here are some starting tips:
|
|
|
189
208
|
|
|
190
209
|
Some tips on getting around the code:
|
|
191
210
|
|
|
192
|
-
- Use `pnpm dev` for development - it runs TypeScript compile in watch mode, allowing you to make
|
|
193
|
-
changes and immediately be able to try them using `pnpm cmd`.
|
|
194
|
-
- Use `pnpm build` to build the output once
|
|
195
|
-
- Use `pnpm test` to run tests
|
|
196
211
|
- Use `pnpm cmd` to use the CLI feature of Simple Scaffold from within the root directory, enabling
|
|
197
212
|
you to test different behaviors. See `pnpm cmd -h` for more information.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
> - Run `pnpm dev` to watch for file changes and build automatically
|
|
203
|
-
> - Run `pnpm build` before running this to trigger a one-time build
|
|
204
|
-
> - Run `pnpm build-cmd` which triggers a build right before running `pnpm cmd` automatically with
|
|
205
|
-
> the rest of the given arguments.
|
|
206
|
-
|
|
207
|
-
- Use `pnpm build-docs` to build the documentation once
|
|
208
|
-
- Use `pnpm watch-docs` to start docs in watch mode
|
|
209
|
-
- To see the documentation, currently you have to serve the directory yourself with a static web
|
|
210
|
-
server (like node's built in serve, VS code's "Go Live" mode, etc)
|
|
213
|
+
- Use `pnpm test` to run tests
|
|
214
|
+
- Use `pnpm docs:build` to build the documentation once
|
|
215
|
+
- Use `pnpm docs:watch` to start docs in watch mode
|
|
216
|
+
- Use `pnpm build` to build the output
|
package/cmd.js
CHANGED
|
@@ -13,22 +13,31 @@ const scaffold_1 = require("./scaffold");
|
|
|
13
13
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
14
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
15
15
|
const config_1 = require("./config");
|
|
16
|
+
const logger_1 = require("./logger");
|
|
16
17
|
async function parseCliArgs(args = process.argv.slice(2)) {
|
|
17
18
|
const isProjectRoot = Boolean(await promises_1.default.stat(node_path_1.default.join(__dirname, "package.json")).catch(() => false));
|
|
18
19
|
const pkgFile = await promises_1.default.readFile(node_path_1.default.resolve(__dirname, isProjectRoot ? "." : "..", "package.json"));
|
|
19
20
|
const pkg = JSON.parse(pkgFile.toString());
|
|
20
|
-
const
|
|
21
|
+
const isVersionFlag = args.includes("--version") || args.includes("-v");
|
|
22
|
+
const isConfigProvided = args.includes("--config") || args.includes("-c") || args.includes("--git") || args.includes("-g") || isVersionFlag;
|
|
21
23
|
return (0, massarg_1.massarg)({
|
|
22
24
|
name: pkg.name,
|
|
23
25
|
description: pkg.description,
|
|
24
26
|
})
|
|
25
27
|
.main(async (config) => {
|
|
28
|
+
if (config.version) {
|
|
29
|
+
console.log(pkg.version);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
(0, logger_1.log)(config, types_1.LogLevel.info, `Simple Scaffold v${pkg.version}`);
|
|
26
33
|
const tmpPath = node_path_1.default.resolve(node_os_1.default.tmpdir(), `scaffold-config-${Date.now()}`);
|
|
27
|
-
const parsed = await (0, config_1.parseConfigFile)(config, tmpPath);
|
|
28
34
|
try {
|
|
29
|
-
|
|
35
|
+
(0, logger_1.log)(config, types_1.LogLevel.debug, "Parsing config file...", config);
|
|
36
|
+
const parsed = await (0, config_1.parseConfigFile)(config, tmpPath);
|
|
37
|
+
await (0, scaffold_1.Scaffold)(parsed);
|
|
30
38
|
}
|
|
31
39
|
finally {
|
|
40
|
+
(0, logger_1.log)(config, types_1.LogLevel.debug, "Cleaning up temporary files...", tmpPath);
|
|
32
41
|
await promises_1.default.rm(tmpPath, { recursive: true, force: true });
|
|
33
42
|
}
|
|
34
43
|
})
|
|
@@ -38,7 +47,7 @@ async function parseCliArgs(args = process.argv.slice(2)) {
|
|
|
38
47
|
description: "Name to be passed to the generated files. `{{name}}` and other data parameters inside " +
|
|
39
48
|
"contents and file names will be replaced accordingly. You may omit the `--name` or `-n` for this specific option.",
|
|
40
49
|
isDefault: true,
|
|
41
|
-
required:
|
|
50
|
+
required: !isVersionFlag,
|
|
42
51
|
})
|
|
43
52
|
.option({
|
|
44
53
|
name: "config",
|
|
@@ -121,7 +130,13 @@ async function parseCliArgs(args = process.argv.slice(2)) {
|
|
|
121
130
|
description: "Determine amount of logs to display. The values are: " +
|
|
122
131
|
`${chalk_1.default.bold `\`none | debug | info | warn | error\``}. ` +
|
|
123
132
|
"The provided level will display messages of the same level or higher.",
|
|
124
|
-
parse: (v) =>
|
|
133
|
+
parse: (v) => {
|
|
134
|
+
const val = v.toLowerCase();
|
|
135
|
+
if (!(val in types_1.LogLevel)) {
|
|
136
|
+
throw new Error(`Invalid log level: ${val}, must be one of: ${Object.keys(types_1.LogLevel).join(", ")}`);
|
|
137
|
+
}
|
|
138
|
+
return val;
|
|
139
|
+
},
|
|
125
140
|
})
|
|
126
141
|
.flag({
|
|
127
142
|
name: "dry-run",
|
|
@@ -129,6 +144,11 @@ async function parseCliArgs(args = process.argv.slice(2)) {
|
|
|
129
144
|
defaultValue: false,
|
|
130
145
|
description: "Don't emit files. This is good for testing your scaffolds and making sure they " +
|
|
131
146
|
"don't fail, without having to write actual file contents or create directories.",
|
|
147
|
+
})
|
|
148
|
+
.flag({
|
|
149
|
+
name: "version",
|
|
150
|
+
aliases: ["v"],
|
|
151
|
+
description: "Display version.",
|
|
132
152
|
})
|
|
133
153
|
.example({
|
|
134
154
|
description: "Usage with config file",
|
package/cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd.js","sourceRoot":"","sources":["../src/cmd.ts"],"names":[],"mappings":";;;;;;;AAEA,sDAAwB;AAC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;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,0CAAuB;AACvB,0DAAiC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,0CAAuB;AACvB,0DAAiC;AAEjC,kBAAe,kBAAQ,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simple-scaffold",
|
|
3
|
-
"version": "2.0.1",
|
|
3
|
+
"version": "2.0.2-pre.1",
|
|
4
4
|
"description": "Generate any file structure - from single components to entire app boilerplates, with a single command.",
|
|
5
5
|
"homepage": "https: //chenasraf.github.io/simple-scaffold",
|
|
6
|
-
"repository":
|
|
7
|
-
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/chenasraf/simple-scaffold.git"
|
|
9
|
+
},
|
|
10
|
+
"author": "Chen Asraf <contact@casraf.dev> (https://casraf.dev)",
|
|
8
11
|
"license": "MIT",
|
|
9
12
|
"main": "index.js",
|
|
10
|
-
"bin":
|
|
11
|
-
|
|
13
|
+
"bin": {
|
|
14
|
+
"simple-scaffold": "cmd.js"
|
|
15
|
+
},
|
|
16
|
+
"packageManager": "pnpm@8.15.1",
|
|
12
17
|
"keywords": [
|
|
13
18
|
"javascript",
|
|
14
19
|
"cli",
|
package/scaffold.js
CHANGED
package/scaffold.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;GAKG;AACH,0DAA4B;AAC5B,sDAAwB;AAExB,mCAA4C;AAC5C,iCAQe;AACf,mCAA8F;AAC9F,qCAA0C;AAC1C,qCAAyD;AACzD,qCAA0C;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACI,KAAK,UAAU,QAAQ,C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AO,GAAG,mBAAI,CAAC,OAAO,CAAC,iBAAE,CAAC,MAAM,EAAE,EAAE,mBAAmB,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IAC1E,MAAM,UAAU,GAAG,IAAA,eAAO,EAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IACjD,MAAM,OAAO,GAAG,MAAM,IAAA,wBAAe,EAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC1D,OAAO,QAAQ,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,UAAU,EAAE,CAAC,CAAA;AAChD,CAAC,CAAA;AAED,kBAAe,QAAQ,CAAA"}
|
package/types.d.ts
CHANGED
|
@@ -231,6 +231,17 @@ export type DefaultHelpers = CaseHelpers | DateHelpers;
|
|
|
231
231
|
* @category Helpers
|
|
232
232
|
*/
|
|
233
233
|
export type Helper = HelperDelegate;
|
|
234
|
+
/**
|
|
235
|
+
* The amount of information to log when generating scaffold.
|
|
236
|
+
* When not `none`, the selected level will be the lowest level included.
|
|
237
|
+
*
|
|
238
|
+
* For example, level `info` will include `info`, `warning` and `error`, but not `debug`; and `warning` will only
|
|
239
|
+
* show `warning` and `error`, but not `info` or `debug`.
|
|
240
|
+
*
|
|
241
|
+
* @default `info`
|
|
242
|
+
*
|
|
243
|
+
* @category Logging (const)
|
|
244
|
+
*/
|
|
234
245
|
export declare const LogLevel: {
|
|
235
246
|
/** Silent output */
|
|
236
247
|
readonly none: "none";
|
|
@@ -249,17 +260,14 @@ export declare const LogLevel: {
|
|
|
249
260
|
};
|
|
250
261
|
/**
|
|
251
262
|
* The amount of information to log when generating scaffold.
|
|
252
|
-
* When not `
|
|
253
|
-
*
|
|
254
|
-
* For example, level `Info` (2) will include `Info`, `Warning` and `Error`, but not `Debug`; and `Warning` will only
|
|
255
|
-
* show `Warning` and `Error`.
|
|
263
|
+
* When not `none`, the selected level will be the lowest level included.
|
|
256
264
|
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
265
|
+
* For example, level `info` will include `info`, `warning` and `error`, but not `debug`; and `warning` will only
|
|
266
|
+
* show `warning` and `error`, but not `info` or `debug`.
|
|
259
267
|
*
|
|
260
|
-
* @default `
|
|
268
|
+
* @default `info`
|
|
261
269
|
*
|
|
262
|
-
* @category Logging
|
|
270
|
+
* @category Logging (type)
|
|
263
271
|
*/
|
|
264
272
|
export type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
|
|
265
273
|
/**
|
|
@@ -294,7 +302,7 @@ export type FileResponse<T> = T | FileResponseHandler<T>;
|
|
|
294
302
|
* The Scaffold config for CLI
|
|
295
303
|
* Contains less and more specific options than {@link ScaffoldConfig}
|
|
296
304
|
*/
|
|
297
|
-
export
|
|
305
|
+
export type ScaffoldCmdConfig = {
|
|
298
306
|
/** The name of the scaffold template to use. */
|
|
299
307
|
name: string;
|
|
300
308
|
/** The templates to use for generation */
|
|
@@ -327,7 +335,9 @@ export interface ScaffoldCmdConfig {
|
|
|
327
335
|
key?: string;
|
|
328
336
|
/** The git repository to use to fetch the config file */
|
|
329
337
|
git?: string;
|
|
330
|
-
|
|
338
|
+
/** Display version */
|
|
339
|
+
version: boolean;
|
|
340
|
+
};
|
|
331
341
|
/**
|
|
332
342
|
* A mapping of scaffold template keys to their configurations.
|
|
333
343
|
*
|
|
@@ -338,13 +348,18 @@ export interface ScaffoldCmdConfig {
|
|
|
338
348
|
* When no template key is provided to the scaffold command, the "default" template is used.
|
|
339
349
|
*
|
|
340
350
|
* @see {@link ScaffoldConfig}
|
|
351
|
+
*
|
|
352
|
+
* @category Config
|
|
341
353
|
*/
|
|
342
354
|
export type ScaffoldConfigMap = Record<string, ScaffoldConfig>;
|
|
343
|
-
/**
|
|
355
|
+
/**
|
|
356
|
+
* The scaffold config file is either:
|
|
344
357
|
* - A {@link ScaffoldConfigMap} object
|
|
345
358
|
* - A function that returns a {@link ScaffoldConfigMap} object
|
|
346
359
|
* - A promise that resolves to a {@link ScaffoldConfigMap} object
|
|
347
360
|
* - A function that returns a promise that resolves to a {@link ScaffoldConfigMap} object
|
|
361
|
+
*
|
|
362
|
+
* @category Config
|
|
348
363
|
*/
|
|
349
364
|
export type ScaffoldConfigFile = AsyncResolver<ScaffoldCmdConfig, ScaffoldConfigMap>;
|
|
350
365
|
/** @internal */
|
package/types.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LogLevel = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The amount of information to log when generating scaffold.
|
|
6
|
+
* When not `none`, the selected level will be the lowest level included.
|
|
7
|
+
*
|
|
8
|
+
* For example, level `info` will include `info`, `warning` and `error`, but not `debug`; and `warning` will only
|
|
9
|
+
* show `warning` and `error`, but not `info` or `debug`.
|
|
10
|
+
*
|
|
11
|
+
* @default `info`
|
|
12
|
+
*
|
|
13
|
+
* @category Logging (const)
|
|
14
|
+
*/
|
|
4
15
|
exports.LogLevel = {
|
|
5
16
|
/** Silent output */
|
|
6
17
|
none: "none",
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAmQA;;;;;;;;;;GAUG;AAEU,QAAA,QAAQ,GAAG;IACtB,oBAAoB;IACpB,IAAI,EAAE,MAAM;IACZ,oFAAoF;IACpF,KAAK,EAAE,OAAO;IACd;;;;OAIG;IACH,IAAI,EAAE,MAAM;IACZ,qFAAqF;IACrF,OAAO,EAAE,SAAS;IAClB,+FAA+F;IAC/F,KAAK,EAAE,OAAO;CACN,CAAA"}
|