simple-scaffold 1.1.4 → 1.2.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/.editorconfig +8 -0
- package/.github/FUNDING.yml +13 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +47 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
- package/.github/workflows/docs.yml +20 -0
- package/.github/workflows/pull_requests.yml +17 -0
- package/.github/workflows/release.yml +24 -0
- package/.markdownlint.json +9 -0
- package/.prettierrc +15 -0
- package/.vscode/launch.json +27 -0
- package/.vscode/settings.json +22 -0
- package/.vscode/tasks.json +59 -0
- package/CHANGELOG.md +92 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +25 -0
- package/README.md +7 -1
- package/examples/test-input/Component/.hidden-file +0 -0
- package/examples/test-input/Component/button-example.png +0 -0
- package/examples/test-input/Component/inner/inner-{{name}}.txt +1 -0
- package/examples/test-input/Component/{{Name}}.tsx +17 -0
- package/jest.config.ts +205 -0
- package/media/intro.gif +0 -0
- package/package.json +22 -13
- package/release.config.js +84 -0
- package/src/cmd.ts +124 -0
- package/src/docs.css +46 -0
- package/src/index.ts +4 -0
- package/src/scaffold.ts +140 -0
- package/src/types.ts +339 -0
- package/src/utils.ts +397 -0
- package/tests/scaffold.test.ts +502 -0
- package/tests/utils.test.ts +124 -0
- package/tsconfig.json +16 -0
- package/typedoc.json +27 -0
- package/cmd.d.ts +0 -2
- package/cmd.js +0 -111
- package/cmd.js.map +0 -1
- package/index.d.ts +0 -4
- package/index.js +0 -24
- package/index.js.map +0 -1
- package/scaffold.d.ts +0 -34
- package/scaffold.js +0 -113
- package/scaffold.js.map +0 -1
- package/types.d.ts +0 -307
- package/types.js +0 -32
- package/types.js.map +0 -1
- package/utils.d.ts +0 -62
- package/utils.js +0 -266
- package/utils.js.map +0 -1
package/.editorconfig
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# These are supported funding model platforms
|
|
2
|
+
|
|
3
|
+
github: chenasraf
|
|
4
|
+
patreon: # Replace with a single Patreon username
|
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
|
6
|
+
ko_fi: casraf
|
|
7
|
+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
+
otechie: # Replace with a single Otechie username
|
|
12
|
+
custom:
|
|
13
|
+
- "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TSH3C3ABGQM22¤cy_code=ILS&source=url"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: "[BUG] "
|
|
5
|
+
labels: bug, needs-triage
|
|
6
|
+
assignees: chenasraf
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
#### Describe the bug
|
|
10
|
+
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
#### How To Reproduce
|
|
14
|
+
|
|
15
|
+
Steps to reproduce the behavior:
|
|
16
|
+
|
|
17
|
+
1. Prepare templates:
|
|
18
|
+
|
|
19
|
+
```txt
|
|
20
|
+
This is my {{ template }}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
2. Run with args/config:
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
npx simple-scaffold@latest -t input -o output TplName
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### Expected behavior\*\*
|
|
30
|
+
|
|
31
|
+
A clear and concise description of what you expected to happen.
|
|
32
|
+
|
|
33
|
+
#### Logs
|
|
34
|
+
|
|
35
|
+
If applicable, paste your logs to help explain your problem. To see more logs, run the scaffold with
|
|
36
|
+
`-v 1` to enable debug logging.
|
|
37
|
+
|
|
38
|
+
#### Desktop (please complete the following information):
|
|
39
|
+
|
|
40
|
+
- OS: [e.g. macOS, Windows, Linux]
|
|
41
|
+
- OS Version: [e.g. Big Sur, 11, Ubuntu 20.04]
|
|
42
|
+
- Node.js: [e.g. 16.8]
|
|
43
|
+
- Simple Scaffold Version [e.g. 1.1.2]
|
|
44
|
+
|
|
45
|
+
#### Additional context
|
|
46
|
+
|
|
47
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: "[FEATURE] "
|
|
5
|
+
labels: enhancement, needs-triage
|
|
6
|
+
assignees: chenasraf
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
#### Is your feature request related to a problem? Please describe.
|
|
10
|
+
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
#### Describe the solution you'd like
|
|
14
|
+
|
|
15
|
+
A clear and concise description of what you want to happen.
|
|
16
|
+
|
|
17
|
+
#### Describe alternatives you've considered
|
|
18
|
+
|
|
19
|
+
A clear and concise description of any alternative solutions or features you've considered, if
|
|
20
|
+
applicable.
|
|
21
|
+
|
|
22
|
+
#### Additional context
|
|
23
|
+
|
|
24
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Build Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master, develop]
|
|
6
|
+
jobs:
|
|
7
|
+
docs:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip docs]')"
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v3
|
|
12
|
+
- uses: actions/setup-node@v3
|
|
13
|
+
with:
|
|
14
|
+
node-version: "18.x"
|
|
15
|
+
- run: yarn install --frozen-lockfile
|
|
16
|
+
- run: yarn typedoc
|
|
17
|
+
- uses: peaceiris/actions-gh-pages@v3
|
|
18
|
+
with:
|
|
19
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
+
publish_dir: ./docs
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: Pull Requests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [master, develop]
|
|
6
|
+
jobs:
|
|
7
|
+
build:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v3
|
|
12
|
+
- uses: actions/setup-node@v3
|
|
13
|
+
with:
|
|
14
|
+
node-version: "18.x"
|
|
15
|
+
- run: yarn install --frozen-lockfile
|
|
16
|
+
- run: yarn build
|
|
17
|
+
- run: yarn test
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Semantic Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master, develop, feat/*, fix/*]
|
|
6
|
+
jobs:
|
|
7
|
+
build:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v3
|
|
12
|
+
- uses: actions/setup-node@v3
|
|
13
|
+
with:
|
|
14
|
+
node-version: "18.x"
|
|
15
|
+
- run: yarn install --frozen-lockfile
|
|
16
|
+
- run: yarn test
|
|
17
|
+
- run: yarn build
|
|
18
|
+
- run: cd ./dist && yarn pack --filename=../package.tgz
|
|
19
|
+
if: "!contains(github.event.head_commit.message, '[skip publish]')"
|
|
20
|
+
- run: yarn semantic-release
|
|
21
|
+
if: "!contains(github.event.head_commit.message, '[skip publish]')"
|
|
22
|
+
env:
|
|
23
|
+
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
|
24
|
+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
package/.prettierrc
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Debug Scaffold",
|
|
9
|
+
"type": "node",
|
|
10
|
+
"request": "launch",
|
|
11
|
+
"protocol": "inspector",
|
|
12
|
+
"cwd": "${workspaceFolder}",
|
|
13
|
+
"program": "${workspaceFolder}/test.ts",
|
|
14
|
+
"outFiles": ["${workspaceRoot}/dist/test.js"],
|
|
15
|
+
"env": {
|
|
16
|
+
"NODE_ENV": "develop"
|
|
17
|
+
},
|
|
18
|
+
"sourceMaps": true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "node",
|
|
22
|
+
"request": "attach",
|
|
23
|
+
"name": "Attach by Process ID",
|
|
24
|
+
"processId": "${command:PickProcess}"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"typescript.tsdk": "./node_modules/typescript/lib",
|
|
3
|
+
"npm.packageManager": "yarn",
|
|
4
|
+
"cSpell.words": [
|
|
5
|
+
"massarg",
|
|
6
|
+
"MYCOMPONENT",
|
|
7
|
+
"myname",
|
|
8
|
+
"nobrace",
|
|
9
|
+
"nocomment",
|
|
10
|
+
"nodir",
|
|
11
|
+
"noext",
|
|
12
|
+
"nonegate",
|
|
13
|
+
"subdir",
|
|
14
|
+
"variabletoken"
|
|
15
|
+
],
|
|
16
|
+
"[markdown]": {
|
|
17
|
+
"editor.rulers": [
|
|
18
|
+
87,
|
|
19
|
+
100
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
## [1.2.0](https://github.com/chenasraf/simple-scaffold/compare/v1.1.4...v1.2.0) (2023-04-24)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* append-data cli flag ([3c5c2de](https://github.com/chenasraf/simple-scaffold/commit/3c5c2ded02f61ff086e81ea4a7f40529bdff1c9d))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* ci node version ([767d34c](https://github.com/chenasraf/simple-scaffold/commit/767d34c684516d4cea865b25e87c27c779bb79ce))
|
|
14
|
+
* semantic-release build dir ([f7956dd](https://github.com/chenasraf/simple-scaffold/commit/f7956ddc786018905c48ccf1f21a3bb4657c3d75))
|
|
15
|
+
* support quote wrapping in append-data ([4fecca8](https://github.com/chenasraf/simple-scaffold/commit/4fecca848347312d45d704f82f2bcb3822da9b06))
|
|
16
|
+
|
|
17
|
+
### [1.1.4](https://github.com/chenasraf/simple-scaffold/compare/v1.1.3...v1.1.4) (2023-04-24)
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
- append-data cli flag
|
|
22
|
+
([2f4f7fc](https://github.com/chenasraf/simple-scaffold/commit/2f4f7fce47669e37ff49154fbec2acdfd0f5860e))
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
- github action node version
|
|
27
|
+
([7c19c53](https://github.com/chenasraf/simple-scaffold/commit/7c19c533376dc6904231e5cc51c7a4b2658c66e0))
|
|
28
|
+
- github action node version
|
|
29
|
+
([94fec76](https://github.com/chenasraf/simple-scaffold/commit/94fec766165f7540c578dbf2d0aeeb6ea3969ad8))
|
|
30
|
+
|
|
31
|
+
### [1.1.3](https://github.com/chenasraf/simple-scaffold/compare/v1.1.2...v1.1.3) (2023-03-11)
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
- base path
|
|
36
|
+
([943717a](https://github.com/chenasraf/simple-scaffold/commit/943717a76998ec0609f2072c886df6b4775f2ea2))
|
|
37
|
+
- binary files + add tests
|
|
38
|
+
([e450ad2](https://github.com/chenasraf/simple-scaffold/commit/e450ad242ed70ae928b19964da38cdcb1b6cf659))
|
|
39
|
+
|
|
40
|
+
## [1.1.0](https://github.com/chenasraf/simple-scaffold/compare/v1.0.4...v1.1.0) (2022-04-21)
|
|
41
|
+
|
|
42
|
+
### [1.0.3](https://github.com/chenasraf/simple-scaffold/compare/v1.0.2...v1.0.3) (2022-03-03)
|
|
43
|
+
|
|
44
|
+
### [1.0.1-pre.1](https://github.com/chenasraf/simple-scaffold/compare/v1.0.0...v1.0.1-pre.1) (2022-02-17)
|
|
45
|
+
|
|
46
|
+
### [0.7.5](https://github.com/chenasraf/simple-scaffold/compare/v0.7.4...v0.7.5) (2021-09-26)
|
|
47
|
+
|
|
48
|
+
### [0.7.4](https://github.com/chenasraf/simple-scaffold/compare/v0.7.3...v0.7.4) (2021-09-26)
|
|
49
|
+
|
|
50
|
+
### [0.7.3](https://github.com/chenasraf/simple-scaffold/compare/v0.7.2...v0.7.3) (2021-09-26)
|
|
51
|
+
|
|
52
|
+
### [0.7.2](https://github.com/chenasraf/simple-scaffold/compare/v0.6.1...v0.7.2) (2021-04-19)
|
|
53
|
+
|
|
54
|
+
### [0.6.1](https://github.com/chenasraf/simple-scaffold/compare/v0.6.0...v0.6.1) (2021-02-01)
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
- binary files
|
|
59
|
+
([7c0c347](https://github.com/chenasraf/simple-scaffold/commit/7c0c3470020d7c166ea68a8effa6df65ec38f2c8))
|
|
60
|
+
|
|
61
|
+
## [0.6.0](https://github.com/chenasraf/simple-scaffold/compare/v0.5.0...v0.6.0) (2021-02-01)
|
|
62
|
+
|
|
63
|
+
### Bug Fixes
|
|
64
|
+
|
|
65
|
+
- support deeper file structure
|
|
66
|
+
([4afafa5](https://github.com/chenasraf/simple-scaffold/commit/4afafa5a4af2e3f4b0af54f20811ecb2c8d98560))
|
|
67
|
+
|
|
68
|
+
## [0.5.0](https://github.com/chenasraf/simple-scaffold/compare/v0.4.5...v0.5.0) (2019-02-27)
|
|
69
|
+
|
|
70
|
+
### [0.4.5](https://github.com/chenasraf/simple-scaffold/compare/v0.4.4...v0.4.5) (2019-02-27)
|
|
71
|
+
|
|
72
|
+
### [0.4.4](https://github.com/chenasraf/simple-scaffold/compare/v0.4.3...v0.4.4) (2019-02-27)
|
|
73
|
+
|
|
74
|
+
### [0.4.3](https://github.com/chenasraf/simple-scaffold/compare/v0.4.2...v0.4.3) (2019-02-27)
|
|
75
|
+
|
|
76
|
+
### [0.4.2](https://github.com/chenasraf/simple-scaffold/compare/v0.4.1...v0.4.2) (2019-02-25)
|
|
77
|
+
|
|
78
|
+
### [0.4.1](https://github.com/chenasraf/simple-scaffold/compare/v0.3.1...v0.4.1) (2019-02-25)
|
|
79
|
+
|
|
80
|
+
### [0.3.1](https://github.com/chenasraf/simple-scaffold/compare/v0.3.0...v0.3.1) (2018-01-15)
|
|
81
|
+
|
|
82
|
+
## [0.3.0](https://github.com/chenasraf/simple-scaffold/compare/v0.2.0...v0.3.0) (2018-01-15)
|
|
83
|
+
|
|
84
|
+
## [0.2.0](https://github.com/chenasraf/simple-scaffold/compare/v0.1.5...v0.2.0) (2018-01-05)
|
|
85
|
+
|
|
86
|
+
### [0.1.5](https://github.com/chenasraf/simple-scaffold/compare/v0.1.4...v0.1.5) (2018-01-01)
|
|
87
|
+
|
|
88
|
+
### [0.1.4](https://github.com/chenasraf/simple-scaffold/compare/v0.1.3...v0.1.4) (2018-01-01)
|
|
89
|
+
|
|
90
|
+
### [0.1.3](https://github.com/chenasraf/simple-scaffold/compare/v0.1.2...v0.1.3) (2018-01-01)
|
|
91
|
+
|
|
92
|
+
### 0.1.2 (2018-01-01)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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.
|
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Migrating from 0.x to 1.x
|
|
2
|
+
|
|
3
|
+
In Simple Scaffold v1.0, the entire codebase was overhauled, yet usage remains mostly the same
|
|
4
|
+
between versions. With these notable exceptions:
|
|
5
|
+
|
|
6
|
+
- Some of the argument names have changed
|
|
7
|
+
- Template syntax has been improved
|
|
8
|
+
- The command to run Scaffold has been simplified from `new SimpleScaffold(opts).run()` to
|
|
9
|
+
`SimpleScaffold(opts)`, which now returns a promise that you can await to know when the process
|
|
10
|
+
has been completed.
|
|
11
|
+
|
|
12
|
+
## Argument changes
|
|
13
|
+
|
|
14
|
+
- `locals` has been renamed to `data`. The appropriate command line args have been updated as well
|
|
15
|
+
to `--data` | `-d`.
|
|
16
|
+
- Additional options have been added to both CLI and Node interfaces. See the [readme](/README.md)
|
|
17
|
+
for more 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.
|
package/README.md
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
[Documentation](https://casraf.dev/simple-scaffold) |
|
|
7
7
|
[NPM](https://npmjs.com/package/simple-scaffold) | [casraf.dev](https://casraf.dev)
|
|
8
8
|
|
|
9
|
-

|
|
9
|
+

|
|
10
|
+

|
|
10
11
|
|
|
11
12
|
</h2>
|
|
12
13
|
Generate any set of files in the easiest way possible with simple commands.
|
|
@@ -103,6 +104,10 @@ Options:
|
|
|
103
104
|
--data|-d Add custom data to the templates. By default, only
|
|
104
105
|
your app name is included.
|
|
105
106
|
|
|
107
|
+
--append-data|-D Append additional custom data to the templates, which
|
|
108
|
+
will overwrite --data, using an alternate syntax, which is
|
|
109
|
+
easier to use with CLI: -D key1=string -D key2:=raw
|
|
110
|
+
|
|
106
111
|
--create-sub-folder|-s Create subfolder with the input name (default: false)
|
|
107
112
|
|
|
108
113
|
--sub-folder-name-helper|-sh Default helper to apply to subfolder name when using
|
|
@@ -171,6 +176,7 @@ options available:
|
|
|
171
176
|
| `output` | | In addition to being passed the same as CLI, it may also be passed a function for each input file to output into a dynamic path: `{ output: (fullPath, baseDir, baseName) => path.resolve(baseDir, baseName) }` |
|
|
172
177
|
| `helpers` | `Record<string, (string) => string>` | Helpers are simple functions that transform your `data` variables into other values. See [Helpers](#helpers) for the list of default helpers, or add your own to be loaded into the template parser. |
|
|
173
178
|
| `beforeWrite` | `(content: Buffer, rawContent: Buffer, outputPath: string) => Promise<String \| Buffer \| undefined> \| String \| Buffer \| undefined` | Supply this function to override the final output contents of each of your files, allowing you to add more pre-processing to your generator pipeline. The return value of this function will replace the output content of the respective file, which you may discriminate (if needed) using the `outputPath` argument. |
|
|
179
|
+
| `append-data` | | Does not exist in Node.JS options, use `data` instead. |
|
|
174
180
|
|
|
175
181
|
## Preparing files
|
|
176
182
|
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{name}}
|
|
@@ -0,0 +1,17 @@
|
|
|
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}}
|