simple-scaffold 1.3.1 → 1.4.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 (54) hide show
  1. package/cmd.d.ts +2 -0
  2. package/cmd.js +132 -0
  3. package/cmd.js.map +1 -0
  4. package/index.d.ts +4 -0
  5. package/index.js +24 -0
  6. package/index.js.map +1 -0
  7. package/package.json +1 -1
  8. package/scaffold.d.ts +34 -0
  9. package/scaffold.js +113 -0
  10. package/scaffold.js.map +1 -0
  11. package/types.d.ts +311 -0
  12. package/types.js +32 -0
  13. package/types.js.map +1 -0
  14. package/utils.d.ts +66 -0
  15. package/utils.js +305 -0
  16. package/utils.js.map +1 -0
  17. package/.editorconfig +0 -8
  18. package/.github/FUNDING.yml +0 -13
  19. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -47
  20. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -24
  21. package/.github/workflows/docs.yml +0 -20
  22. package/.github/workflows/pull_requests.yml +0 -17
  23. package/.github/workflows/release.yml +0 -22
  24. package/.markdownlint.json +0 -9
  25. package/.prettierrc +0 -15
  26. package/.vscode/launch.json +0 -27
  27. package/.vscode/settings.json +0 -22
  28. package/.vscode/tasks.json +0 -59
  29. package/CHANGELOG.md +0 -120
  30. package/LICENSE +0 -21
  31. package/examples/test-input/Component/.hidden-file +0 -0
  32. package/examples/test-input/Component/button-example.png +0 -0
  33. package/examples/test-input/Component/inner/inner-{{name}}.txt +0 -1
  34. package/examples/test-input/Component/{{Name}}.tsx +0 -17
  35. package/examples/test-input/scaffold.config.js +0 -13
  36. package/jest.config.ts +0 -205
  37. package/media/intro.gif +0 -0
  38. package/pages/README.md +0 -7
  39. package/pages/cli.md +0 -74
  40. package/pages/configuration_files.md +0 -86
  41. package/pages/migration.md +0 -25
  42. package/pages/node.md +0 -53
  43. package/pages/templates.md +0 -224
  44. package/release.config.js +0 -76
  45. package/src/cmd.ts +0 -130
  46. package/src/docs.css +0 -55
  47. package/src/index.ts +0 -4
  48. package/src/scaffold.ts +0 -140
  49. package/src/types.ts +0 -342
  50. package/src/utils.ts +0 -423
  51. package/tests/scaffold.test.ts +0 -502
  52. package/tests/utils.test.ts +0 -124
  53. package/tsconfig.json +0 -16
  54. package/typedoc.config.js +0 -63
@@ -1,59 +0,0 @@
1
- {
2
- "version": "2.0.0",
3
- "tasks": [
4
- {
5
- "script": "build",
6
- "label": "build",
7
- "type": "npm",
8
- "problemMatcher": []
9
- },
10
- {
11
- "script": "dev",
12
- "label": "dev",
13
- "type": "npm",
14
- "problemMatcher": []
15
- },
16
- {
17
- "command": "yarn typedoc --watch",
18
- "label": "typedoc --watch",
19
- "type": "shell",
20
- "problemMatcher": []
21
- },
22
- {
23
- "script": "start",
24
- "label": "start",
25
- "type": "npm",
26
- "problemMatcher": []
27
- },
28
- {
29
- "script": "test",
30
- "label": "test",
31
- "type": "npm",
32
- "problemMatcher": []
33
- },
34
- {
35
- "command": "yarn test --watchAll",
36
- "label": "yarn test --watchAll",
37
- "type": "shell",
38
- "problemMatcher": []
39
- },
40
- {
41
- "script": "cmd",
42
- "label": "cmd",
43
- "type": "npm",
44
- "problemMatcher": []
45
- },
46
- {
47
- "script": "build-test",
48
- "label": "build-test",
49
- "type": "npm",
50
- "problemMatcher": []
51
- },
52
- {
53
- "script": "build-cmd",
54
- "label": "build-cmd",
55
- "type": "npm",
56
- "problemMatcher": []
57
- }
58
- ]
59
- }
package/CHANGELOG.md DELETED
@@ -1,120 +0,0 @@
1
- # Change Log
2
-
3
- ## [1.3.1](https://github.com/chenasraf/simple-scaffold/compare/v1.3.0...v1.3.1) (2023-04-28)
4
-
5
-
6
- ### Bug Fixes
7
-
8
- * docs ([6e19a86](https://github.com/chenasraf/simple-scaffold/commit/6e19a86190dd924058a48448aa6463569ef1125f))
9
- * remove old peer-dep ([c7e2ef8](https://github.com/chenasraf/simple-scaffold/commit/c7e2ef862cb658feb1071ac120b185d8b34d6dd3))
10
-
11
- ## [1.3.0](https://github.com/chenasraf/simple-scaffold/compare/v1.2.0...v1.3.0) (2023-04-25)
12
-
13
- ### Features
14
-
15
- - load scaffold config from files
16
- ([c398976](https://github.com/chenasraf/simple-scaffold/commit/c3989769fee445c9183ff5e5b3892c4e9fb66a9e))
17
-
18
- ### Bug Fixes
19
-
20
- - config option should not be mandatory
21
- ([3db6a91](https://github.com/chenasraf/simple-scaffold/commit/3db6a918f13d9300efa2fcb4a356d004475ab91c))
22
- - export config file type
23
- ([4302eb5](https://github.com/chenasraf/simple-scaffold/commit/4302eb5ce35ed6cf1dc80dfb92790c3fdd96f963))
24
-
25
- ## [1.2.0](https://github.com/chenasraf/simple-scaffold/compare/v1.1.4...v1.2.0) (2023-04-24)
26
-
27
- ### Features
28
-
29
- - append-data cli flag
30
- ([3c5c2de](https://github.com/chenasraf/simple-scaffold/commit/3c5c2ded02f61ff086e81ea4a7f40529bdff1c9d))
31
-
32
- ### Bug Fixes
33
-
34
- - ci node version
35
- ([767d34c](https://github.com/chenasraf/simple-scaffold/commit/767d34c684516d4cea865b25e87c27c779bb79ce))
36
- - semantic-release build dir
37
- ([f7956dd](https://github.com/chenasraf/simple-scaffold/commit/f7956ddc786018905c48ccf1f21a3bb4657c3d75))
38
- - support quote wrapping in append-data
39
- ([4fecca8](https://github.com/chenasraf/simple-scaffold/commit/4fecca848347312d45d704f82f2bcb3822da9b06))
40
-
41
- ## [1.1.4](https://github.com/chenasraf/simple-scaffold/compare/v1.1.3...v1.1.4) (2023-03-13)
42
-
43
- ### Bug Fixes
44
-
45
- - github action node version
46
- ([7c19c53](https://github.com/chenasraf/simple-scaffold/commit/7c19c533376dc6904231e5cc51c7a4b2658c66e0))
47
- - github action node version
48
- ([94fec76](https://github.com/chenasraf/simple-scaffold/commit/94fec766165f7540c578dbf2d0aeeb6ea3969ad8))
49
-
50
- ### Misc
51
-
52
- - update typedoc version
53
- ([c334396](https://github.com/chenasraf/simple-scaffold/commit/c334396d74414cbe0aba305c66dfad7fdeb88669))
54
- - update dependencies
55
- ([20400bd](https://github.com/chenasraf/simple-scaffold/commit/20400bd81dd43d457427675286c9964a8bc0d5f6))
56
- - bump version number
57
- ([8e432bf](https://github.com/chenasraf/simple-scaffold/commit/8e432bfb0b410dc0655c3924031bea2648a42ad0))
58
-
59
- ## [1.1.3](https://github.com/chenasraf/simple-scaffold/compare/v1.1.2...v1.1.3) (2023-03-11)
60
-
61
- ### Bug Fixes
62
-
63
- - base path
64
- ([943717a](https://github.com/chenasraf/simple-scaffold/commit/943717a76998ec0609f2072c886df6b4775f2ea2))
65
- - binary files + add tests
66
- ([e450ad2](https://github.com/chenasraf/simple-scaffold/commit/e450ad242ed70ae928b19964da38cdcb1b6cf659))
67
-
68
- ## [1.1.0](https://github.com/chenasraf/simple-scaffold/compare/v1.0.4...v1.1.0) (2022-04-21)
69
-
70
- ## [1.0.3](https://github.com/chenasraf/simple-scaffold/compare/v1.0.2...v1.0.3) (2022-03-03)
71
-
72
- ## [1.0.1-pre.1](https://github.com/chenasraf/simple-scaffold/compare/v1.0.0...v1.0.1-pre.1) (2022-02-17)
73
-
74
- ## [0.7.5](https://github.com/chenasraf/simple-scaffold/compare/v0.7.4...v0.7.5) (2021-09-26)
75
-
76
- ## [0.7.4](https://github.com/chenasraf/simple-scaffold/compare/v0.7.3...v0.7.4) (2021-09-26)
77
-
78
- ## [0.7.3](https://github.com/chenasraf/simple-scaffold/compare/v0.7.2...v0.7.3) (2021-09-26)
79
-
80
- ## [0.7.2](https://github.com/chenasraf/simple-scaffold/compare/v0.6.1...v0.7.2) (2021-04-19)
81
-
82
- ## [0.6.1](https://github.com/chenasraf/simple-scaffold/compare/v0.6.0...v0.6.1) (2021-02-01)
83
-
84
- ### Bug Fixes
85
-
86
- - binary files
87
- ([7c0c347](https://github.com/chenasraf/simple-scaffold/commit/7c0c3470020d7c166ea68a8effa6df65ec38f2c8))
88
-
89
- ## [0.6.0](https://github.com/chenasraf/simple-scaffold/compare/v0.5.0...v0.6.0) (2021-02-01)
90
-
91
- ### Bug Fixes
92
-
93
- - support deeper file structure
94
- ([4afafa5](https://github.com/chenasraf/simple-scaffold/commit/4afafa5a4af2e3f4b0af54f20811ecb2c8d98560))
95
-
96
- ## [0.5.0](https://github.com/chenasraf/simple-scaffold/compare/v0.4.5...v0.5.0) (2019-02-27)
97
-
98
- ## [0.4.5](https://github.com/chenasraf/simple-scaffold/compare/v0.4.4...v0.4.5) (2019-02-27)
99
-
100
- ## [0.4.4](https://github.com/chenasraf/simple-scaffold/compare/v0.4.3...v0.4.4) (2019-02-27)
101
-
102
- ## [0.4.3](https://github.com/chenasraf/simple-scaffold/compare/v0.4.2...v0.4.3) (2019-02-27)
103
-
104
- ## [0.4.2](https://github.com/chenasraf/simple-scaffold/compare/v0.4.1...v0.4.2) (2019-02-25)
105
-
106
- ## [0.4.1](https://github.com/chenasraf/simple-scaffold/compare/v0.3.1...v0.4.1) (2019-02-25)
107
-
108
- ## [0.3.1](https://github.com/chenasraf/simple-scaffold/compare/v0.3.0...v0.3.1) (2018-01-15)
109
-
110
- ## [0.3.0](https://github.com/chenasraf/simple-scaffold/compare/v0.2.0...v0.3.0) (2018-01-15)
111
-
112
- ## [0.2.0](https://github.com/chenasraf/simple-scaffold/compare/v0.1.5...v0.2.0) (2018-01-05)
113
-
114
- ## [0.1.5](https://github.com/chenasraf/simple-scaffold/compare/v0.1.4...v0.1.5) (2018-01-01)
115
-
116
- ## [0.1.4](https://github.com/chenasraf/simple-scaffold/compare/v0.1.3...v0.1.4) (2018-01-01)
117
-
118
- ## [0.1.3](https://github.com/chenasraf/simple-scaffold/compare/v0.1.2...v0.1.3) (2018-01-01)
119
-
120
- ## 0.1.2 (2018-01-01)
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2017 Chen Asraf
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
File without changes
@@ -1,17 +0,0 @@
1
- import * as React from "react"
2
- import * as css from "./{{Name}}.css"
3
-
4
- class {{Name}} extends React.Component<any> {
5
- private {{ property }}
6
-
7
- constructor(props: any) {
8
- super(props)
9
- this.{{ property }} = {{ value }}
10
- }
11
-
12
- public render() {
13
- return <div className={ css.{{Name}} } />
14
- }
15
- }
16
-
17
- export default {{Name}}
@@ -1,13 +0,0 @@
1
- /** @type {import('simple-scaffold').ScaffoldConfigFile} */
2
- module.exports = {
3
- default: {
4
- templates: ["examples/test-input/Component"],
5
- output: "examples/test-output",
6
- data: { property: "myProp", value: "10" },
7
- },
8
- component: {
9
- templates: ["examples/test-input/Component"],
10
- output: "examples/test-output",
11
- data: { property: "myProp", value: "10" },
12
- },
13
- }
package/jest.config.ts DELETED
@@ -1,205 +0,0 @@
1
- /*
2
- * For a detailed explanation regarding each configuration property and type check, visit:
3
- * https://jestjs.io/docs/configuration
4
- */
5
-
6
- export default {
7
- // All imported modules in your tests should be mocked automatically
8
- // automock: false,
9
-
10
- // Stop running tests after `n` failures
11
- // bail: 0,
12
-
13
- // The directory where Jest should store its cached dependency information
14
- // cacheDirectory: "/private/var/folders/q9/0mns8fgd00b4t5j5lq2wh2yh0000gn/T/jest_dx",
15
-
16
- // Automatically clear mock calls, instances, contexts and results before every test
17
- clearMocks: true,
18
-
19
- // Indicates whether the coverage information should be collected while executing the test
20
- collectCoverage: true,
21
-
22
- // An array of glob patterns indicating a set of files for which coverage information should be collected
23
- // collectCoverageFrom: undefined,
24
-
25
- // The directory where Jest should output its coverage files
26
- coverageDirectory: "coverage",
27
-
28
- // An array of regexp pattern strings used to skip coverage collection
29
- // coveragePathIgnorePatterns: [
30
- // "/node_modules/"
31
- // ],
32
-
33
- // Indicates which provider should be used to instrument code for coverage
34
- coverageProvider: "v8",
35
-
36
- // A list of reporter names that Jest uses when writing coverage reports
37
- // coverageReporters: [
38
- // "json",
39
- // "text",
40
- // "lcov",
41
- // "clover"
42
- // ],
43
-
44
- // An object that configures minimum threshold enforcement for coverage results
45
- // coverageThreshold: undefined,
46
-
47
- // A path to a custom dependency extractor
48
- // dependencyExtractor: undefined,
49
-
50
- // Make calling deprecated APIs throw helpful error messages
51
- // errorOnDeprecated: false,
52
-
53
- // The default configuration for fake timers
54
- // fakeTimers: {
55
- // "enableGlobally": false
56
- // },
57
-
58
- // Force coverage collection from ignored files using an array of glob patterns
59
- // forceCoverageMatch: [],
60
-
61
- // A path to a module which exports an async function that is triggered once before all test suites
62
- // globalSetup: undefined,
63
-
64
- // A path to a module which exports an async function that is triggered once after all test suites
65
- // globalTeardown: undefined,
66
-
67
- // A set of global variables that need to be available in all test environments
68
- // globals: {},
69
-
70
- // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
71
- // maxWorkers: "50%",
72
-
73
- // An array of directory names to be searched recursively up from the requiring module's location
74
- // moduleDirectories: [
75
- // "node_modules"
76
- // ],
77
-
78
- // An array of file extensions your modules use
79
- // moduleFileExtensions: [
80
- // "js",
81
- // "mjs",
82
- // "cjs",
83
- // "jsx",
84
- // "ts",
85
- // "tsx",
86
- // "json",
87
- // "node"
88
- // ],
89
-
90
- // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
91
- // moduleNameMapper: {},
92
- // moduleNameMapper: {
93
- // chalk: "<rootDir>/node_modules/chalk/source/index.js",
94
- // "#ansi-styles": "<rootDir>/node_modules/chalk/source/vendor/ansi-styles/index.js",
95
- // "#supports-color": "<rootDir>/node_modules/chalk/source/vendor/supports-color/index.js",
96
- // },
97
-
98
- // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
99
- modulePathIgnorePatterns: ["<rootDir>/dist"],
100
-
101
- // Activates notifications for test results
102
- // notify: false,
103
-
104
- // An enum that specifies notification mode. Requires { notify: true }
105
- // notifyMode: "failure-change",
106
-
107
- // A preset that is used as a base for Jest's configuration
108
- preset: "ts-jest",
109
-
110
- // Run tests from one or more projects
111
- // projects: undefined,
112
-
113
- // Use this configuration option to add custom reporters to Jest
114
- // reporters: undefined,
115
-
116
- // Automatically reset mock state before every test
117
- // resetMocks: false,
118
-
119
- // Reset the module registry before running each individual test
120
- // resetModules: false,
121
-
122
- // A path to a custom resolver
123
- // resolver: undefined,
124
-
125
- // Automatically restore mock state and implementation before every test
126
- // restoreMocks: false,
127
-
128
- // The root directory that Jest should scan for tests and modules within
129
- // rootDir: undefined,
130
-
131
- // A list of paths to directories that Jest should use to search for files in
132
- // roots: [
133
- // "<rootDir>"
134
- // ],
135
-
136
- // Allows you to use a custom runner instead of Jest's default test runner
137
- // runner: "jest-runner",
138
-
139
- // The paths to modules that run some code to configure or set up the testing environment before each test
140
- // setupFiles: [],
141
-
142
- // A list of paths to modules that run some code to configure or set up the testing framework before each test
143
- // setupFilesAfterEnv: [],
144
-
145
- // The number of seconds after which a test is considered as slow and reported as such in the results.
146
- // slowTestThreshold: 5,
147
-
148
- // A list of paths to snapshot serializer modules Jest should use for snapshot testing
149
- // snapshotSerializers: [],
150
-
151
- // The test environment that will be used for testing
152
- // testEnvironment: "jest-environment-node",
153
-
154
- // Options that will be passed to the testEnvironment
155
- // testEnvironmentOptions: {},
156
-
157
- // Adds a location field to test results
158
- // testLocationInResults: false,
159
-
160
- // The glob patterns Jest uses to detect test files
161
- // testMatch: [
162
- // "**/__tests__/**/*.[jt]s?(x)",
163
- // "**/?(*.)+(spec|test).[tj]s?(x)"
164
- // ],
165
-
166
- // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
167
- // testPathIgnorePatterns: [
168
- // "/node_modules/"
169
- // ],
170
-
171
- // The regexp pattern or array of patterns that Jest uses to detect test files
172
- // testRegex: [],
173
-
174
- // This option allows the use of a custom results processor
175
- // testResultsProcessor: undefined,
176
-
177
- // This option allows use of a custom test runner
178
- // testRunner: "jest-circus/runner",
179
-
180
- // A map from regular expressions to paths to transformers
181
- // transform: undefined,
182
-
183
- // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
184
- // transformIgnorePatterns: [
185
- // "/node_modules/",
186
- // "\\.pnp\\.[^\\/]+$"
187
- // ],
188
-
189
- // transform: {
190
- // "^.+\\.ts?$": "ts-jest",
191
- // },
192
- // transformIgnorePatterns: ["<rootDir>/node_modules/"],
193
-
194
- // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
195
- // unmockedModulePathPatterns: undefined,
196
-
197
- // Indicates whether each individual test should be reported during the run
198
- // verbose: undefined,
199
-
200
- // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
201
- // watchPathIgnorePatterns: [],
202
-
203
- // Whether to use watchman for file crawling
204
- // watchman: true,
205
- }
package/media/intro.gif DELETED
Binary file
package/pages/README.md DELETED
@@ -1,7 +0,0 @@
1
- See full documentation [here](https://chenasraf.github.io/simple-scaffold).
2
-
3
- - [Command Line Interface (CLI) usage](https://chenasraf.github.io/simple-scaffold/pages/cli.html)
4
- - [Node.js usage](https://chenasraf.github.io/simple-scaffold/pages/node.html)
5
- - [Templates](https://chenasraf.github.io/simple-scaffold/pages/templates.html)
6
- - [Configuration Files](https://chenasraf.github.io/simple-scaffold/pages/configuration_files.html)
7
- - [Migrating v0.x to v1.x](https://chenasraf.github.io/simple-scaffold/pages/migration.html)
package/pages/cli.md DELETED
@@ -1,74 +0,0 @@
1
- ## Available flags
2
-
3
- The following is the help text from the `simple-scaffold` binary. To see this and more information
4
- anytime, add the `-h` or `--help` flag to your call, e.g. `npx simple-scaffold@latest -h`.
5
-
6
- ```text
7
- Usage: simple-scaffold [options]
8
-
9
- Create structured files based on templates.
10
-
11
- Options:
12
-
13
- --help|-h Display help information
14
-
15
- --name|-n Name to be passed to the generated files. {{name}} and
16
- {{Name}} inside contents and file names will be replaced
17
- accordingly.
18
-
19
- --config|-c Filename to load config from instead of passing
20
- arguments to CLI or using a Node.js script. You may pass a
21
- JSON or JS file, with a relative or absolute path.
22
-
23
- --output|-o Path to output to. If --create-sub-folder is enabled,
24
- the subfolder will be created inside this path.
25
- (default: current dir)
26
-
27
- --templates|-t Template files to use as input. You may provide multiple
28
- files, each of which can be a relative or absolute path, or a
29
- glob pattern for multiple file matching easily.
30
-
31
- --overwrite|-w Enable to override output files, even if they already
32
- exist. (default: false)
33
-
34
- --data|-d Add custom data to the templates. By default, only your
35
- app name is included.
36
-
37
- --append-data|-D Append additional custom data to the templates, which
38
- will overwrite --data, using an alternate syntax, which is
39
- easier to use with CLI: -D key1=string -D key2:=raw
40
-
41
- --create-sub-folder|-s Create subfolder with the input name
42
- (default: false)
43
-
44
- --sub-folder-name-helper|-sh Default helper to apply to subfolder name when using
45
- `--create-sub-folder true`.
46
-
47
- --quiet|-q Suppress output logs (Same as --verbose 0)
48
- (default: false)
49
-
50
- --verbose|-v Determine amount of logs to display. The values are:
51
- 0 (none) | 1 (debug) | 2 (info) | 3 (warn) | 4
52
- (error). The provided level will display messages of
53
- the same level or higher. (default:
54
- 2)
55
-
56
- --dry-run|-dr Don't emit files. This is good for testing your
57
- scaffolds and making sure they don't fail, without having to
58
- write actual file contents or create directories.
59
- (default: false)
60
- ```
61
-
62
- > See
63
- > [Configuration Files](https://chenasraf.githun.io/simple-scaffold/pages/docs/configuration_files.md)
64
- > for organizing multiple scaffold types into easy-to-maintain files
65
-
66
- You can also add this as a script in your `package.json`:
67
-
68
- ```json
69
- {
70
- "scripts": {
71
- "scaffold": "npx simple-scaffold@latest -t scaffolds/component/**/* -o src/components -d '{\"myProp\": \"propName\", \"myVal\": 123}'"
72
- }
73
- }
74
- ```
@@ -1,86 +0,0 @@
1
- If you want to have reusable configurations which are complex and don't fit into command lines
2
- easily, or just want to manage your templates easier, you can use configuration files to load your
3
- scaffolding configurations.
4
-
5
- ## Creating config files
6
-
7
- Configuration files should be valid `.js`/`.json` files that contain valid Scaffold configurations.
8
-
9
- Each file hold multiple scaffolds. Each scaffold is a key, and its value is the configuration. For
10
- example:
11
-
12
- ```json
13
- {
14
- "component": {
15
- "templates": ["templates/component"],
16
- "output": "src/components"
17
- }
18
- }
19
- ```
20
-
21
- The configuration contents are identical to the
22
- [Node.js configuration structure](https://chenasraf.github.io/simple-scaffold/pages/node.md):
23
-
24
- ```ts
25
- interface ScaffoldConfig {
26
- name: string
27
- templates: string[]
28
- output: FileResponse<string>
29
- createSubFolder?: boolean
30
- data?: Record<string, any>
31
- overwrite?: FileResponse<boolean>
32
- quiet?: boolean
33
- verbose?: LogLevel
34
- dryRun?: boolean
35
- helpers?: Record<string, Helper>
36
- subFolderNameHelper?: DefaultHelpers | string
37
- beforeWrite?(
38
- content: Buffer,
39
- rawContent: Buffer,
40
- outputPath: string,
41
- ): string | Buffer | undefined | Promise<string | Buffer | undefined>
42
- }
43
- ```
44
-
45
- If you want to supply functions inside the configurations, you must use a `.js` file as JSON does
46
- not support non-primitives.
47
-
48
- A `.js` file is just like a `.json` file, make sure to export the final configuration:
49
-
50
- ```js
51
- /** @type {import('simple-scaffold').ScaffoldConfigFile} */
52
- module.exports = {
53
- component: {
54
- templates: ["templates/component"],
55
- output: "src/components",
56
- },
57
- }
58
- ```
59
-
60
- ## Using a config file
61
-
62
- Once your config is created, you can use it by providing the file name to the `--config` (or `-c`
63
- for brevity), followed by a colon, then your scaffold config name. For example:
64
-
65
- ```shell
66
- simple-scaffold -c scaffold.json:component MyComponentName
67
- ```
68
-
69
- If you don't want to supply a template/config name (e.g. `component`), you can omit the colon and
70
- the name, and it will use the configuration named `default`:
71
-
72
- ```js
73
- /** @type {import('simple-scaffold').ScaffoldConfigFile} */
74
- module.exports = {
75
- default: {
76
- // ...
77
- },
78
- }
79
- ```
80
-
81
- And then:
82
-
83
- ```shell
84
- # will use 'default' template
85
- simple-scaffold -c scaffold.json MyComponentName
86
- ```
@@ -1,25 +0,0 @@
1
- In Simple Scaffold v1.0, the entire codebase was overhauled, yet usage remains mostly the same
2
- between versions. With these notable exceptions:
3
-
4
- - Some of the argument names have changed
5
- - Template syntax has been improved
6
- - The command to run Scaffold has been simplified from `new SimpleScaffold(opts).run()` to
7
- `SimpleScaffold(opts)`, which now returns a promise that you can await to know when the process
8
- has been completed.
9
-
10
- ## Argument changes
11
-
12
- - `locals` has been renamed to `data`. The appropriate command line args have been updated as well
13
- to `--data` | `-d`.
14
- - Additional options have been added to both CLI and Node interfaces. See
15
- [Command Line Interface (CLI) usage](https://chenasraf.github.io/simple-scaffold/pages/cli.html)
16
- and [Node.js usage](https://chenasraf.github.io/simple-scaffold/pages/node.html) for more
17
- information.
18
-
19
- ## Template syntax changes
20
-
21
- Simple Scaffold still uses Handlebars.js to handle template content and file names. However, helpers
22
- have been added to remove the need for you to pre-process the template data on simple use-cases such
23
- as case type manipulation (converting to camel case, snake case, etc)
24
-
25
- See the readme for the full information on how to use these helpers and which are available.