Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 03d65ce0f5 | |||
| 77a921920b | |||
| 3c68eae55d | |||
| d0f485ee85 | |||
| 1c008bfcc1 | |||
| 80b53ef2fe | |||
| 9fb0933dbc | |||
| 9e88f62e7e | |||
| 78bbbb2060 | |||
| b262106bd7 | |||
| abc7cbc5ea |
@@ -6,8 +6,8 @@ on:
|
|||||||
- '**'
|
- '**'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
||||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
|
||||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- name: Install pnpm and npmci
|
- name: Install pnpm and npmci
|
||||||
run: |
|
run: |
|
||||||
pnpm install -g pnpm
|
pnpm install -g pnpm
|
||||||
pnpm install -g @shipzone/npmci
|
pnpm install -g @ship.zone/npmci
|
||||||
|
|
||||||
- name: Run npm prepare
|
- name: Run npm prepare
|
||||||
run: npmci npm prepare
|
run: npmci npm prepare
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ on:
|
|||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
||||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
|
||||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
pnpm install -g pnpm
|
pnpm install -g pnpm
|
||||||
pnpm install -g @shipzone/npmci
|
pnpm install -g @ship.zone/npmci
|
||||||
npmci npm prepare
|
npmci npm prepare
|
||||||
|
|
||||||
- name: Audit production dependencies
|
- name: Audit production dependencies
|
||||||
@@ -54,7 +54,7 @@ jobs:
|
|||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
pnpm install -g pnpm
|
pnpm install -g pnpm
|
||||||
pnpm install -g @shipzone/npmci
|
pnpm install -g @ship.zone/npmci
|
||||||
npmci npm prepare
|
npmci npm prepare
|
||||||
|
|
||||||
- name: Test stable
|
- name: Test stable
|
||||||
@@ -82,7 +82,7 @@ jobs:
|
|||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
pnpm install -g pnpm
|
pnpm install -g pnpm
|
||||||
pnpm install -g @shipzone/npmci
|
pnpm install -g @ship.zone/npmci
|
||||||
npmci npm prepare
|
npmci npm prepare
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
@@ -104,7 +104,7 @@ jobs:
|
|||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
pnpm install -g pnpm
|
pnpm install -g pnpm
|
||||||
pnpm install -g @shipzone/npmci
|
pnpm install -g @ship.zone/npmci
|
||||||
npmci npm prepare
|
npmci npm prepare
|
||||||
|
|
||||||
- name: Code quality
|
- name: Code quality
|
||||||
|
|||||||
+5
-2
@@ -3,7 +3,6 @@
|
|||||||
# artifacts
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
|
||||||
|
|
||||||
# installs
|
# installs
|
||||||
node_modules/
|
node_modules/
|
||||||
@@ -17,4 +16,8 @@ node_modules/
|
|||||||
dist/
|
dist/
|
||||||
dist_*/
|
dist_*/
|
||||||
|
|
||||||
# custom
|
# AI
|
||||||
|
.claude/
|
||||||
|
.serena/
|
||||||
|
|
||||||
|
#------# custom
|
||||||
@@ -1,12 +1,5 @@
|
|||||||
{
|
{
|
||||||
"npmts": {
|
"@git.zone/cli": {
|
||||||
"coverageTreshold": 30
|
|
||||||
},
|
|
||||||
"npmci": {
|
|
||||||
"npmGlobalTools": [],
|
|
||||||
"npmAccessLevel": "public"
|
|
||||||
},
|
|
||||||
"gitzone": {
|
|
||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "code.foss.global",
|
"githost": "code.foss.global",
|
||||||
@@ -25,9 +18,17 @@
|
|||||||
"yaml",
|
"yaml",
|
||||||
"cli tool"
|
"cli tool"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"release": {
|
||||||
|
"registries": [
|
||||||
|
"https://verdaccio.lossless.digital",
|
||||||
|
"https://registry.npmjs.org"
|
||||||
|
],
|
||||||
|
"accessLevel": "public"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tsdoc": {
|
"@git.zone/tsdoc": {
|
||||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
}
|
},
|
||||||
|
"@ship.zone/szci": {}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,42 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-04-30 - 4.0.22 - fix(smartscaf)
|
||||||
|
migrate file handling to SmartFileFactory and tighten TypeScript compatibility
|
||||||
|
|
||||||
|
- replace deprecated smartfile fs and memory helpers with SmartFileFactory virtual directory APIs
|
||||||
|
- initialize class properties and add explicit typings to satisfy stricter TypeScript settings
|
||||||
|
- update test imports and tooling dependencies for newer tstest and smartfile ecosystem versions
|
||||||
|
|
||||||
|
## 2026-03-24 - 4.0.21 - fix(smartconfig)
|
||||||
|
correct smartconfig package key and add npmjs registry for public releases
|
||||||
|
|
||||||
|
- Rename the CLI configuration key from git.zone/cli to @git.zone/cli.
|
||||||
|
- Add https://registry.npmjs.org to the release registries alongside the existing Verdaccio registry.
|
||||||
|
- Register @ship.zone/szci in the project smart configuration.
|
||||||
|
|
||||||
|
## 2025-08-17 - 4.0.19 - fix(readme)
|
||||||
|
Update README with comprehensive quick start, usage examples, API reference and advanced guides
|
||||||
|
|
||||||
|
- Expanded README with a detailed Quick Start guide and installation instructions
|
||||||
|
- Added examples for creating templates, supplying variables, and scaffolding projects programmatically
|
||||||
|
- Documented core features: smart variable system, template composition, dynamic file naming, interactive CLI, and post-scaffold scripts
|
||||||
|
- Included advanced usage, CI/CD integration, template validation, and real-world example templates
|
||||||
|
- Improved formatting and added code snippets for API reference and ScafTemplate usage
|
||||||
|
|
||||||
|
## 2025-08-17 - 4.0.18 - fix(ScafTemplate)
|
||||||
|
Use interactive shell for post-scaffold scripts; update CI workflows and package metadata
|
||||||
|
|
||||||
|
- Switched ScafTemplate.runScripts to use smartshell.execInteractive so post-scaffold 'runafter' commands can run interactively
|
||||||
|
- Updated Gitea workflow environment: replaced CI image with code.foss.global/host.today/ht-docker-node:npmci and adjusted NPMCI_COMPUTED_REPOURL
|
||||||
|
- Changed CI install target from @shipzone/npmci to @ship.zone/npmci
|
||||||
|
- Updated package.json metadata (bugs URL and homepage now point to code.foss.global) and added a pnpm.overrides entry
|
||||||
|
- Minor TypeScript code cleanups and formatting (consistent trailing commas, safer string handling when parsing templates/frontmatter, improved concatenation when merging template files)
|
||||||
|
- tsconfig adjustments: enabled emitDecoratorMetadata and added baseUrl/paths entries
|
||||||
|
- Normalized README and template/test output files; updated .gitignore to ignore AI agent directories
|
||||||
|
- Updated changelog and commitinfo metadata
|
||||||
|
|
||||||
## 2025-08-17 - 4.0.17 - fix(ScafTemplate)
|
## 2025-08-17 - 4.0.17 - fix(ScafTemplate)
|
||||||
|
|
||||||
Use interactive shell for post-scaffold scripts; update test/build config and dependency versions
|
Use interactive shell for post-scaffold scripts; update test/build config and dependency versions
|
||||||
|
|
||||||
- Switched from smartshell.exec to smartshell.execInteractive when running smartscaf 'runafter' commands to allow interactive commands during post-scaffold execution (ScafTemplate.runScripts).
|
- Switched from smartshell.exec to smartshell.execInteractive when running smartscaf 'runafter' commands to allow interactive commands during post-scaffold execution (ScafTemplate.runScripts).
|
||||||
@@ -10,6 +46,7 @@ Use interactive shell for post-scaffold scripts; update test/build config and de
|
|||||||
- Added pnpm-workspace.yaml with onlyBuiltDependencies configuration (esbuild, mongodb-memory-server, puppeteer).
|
- Added pnpm-workspace.yaml with onlyBuiltDependencies configuration (esbuild, mongodb-memory-server, puppeteer).
|
||||||
|
|
||||||
## 2025-04-15 - 4.0.16 - fix(dependencies)
|
## 2025-04-15 - 4.0.16 - fix(dependencies)
|
||||||
|
|
||||||
Update dependency references and bump version numbers; adjust workflow and template commands
|
Update dependency references and bump version numbers; adjust workflow and template commands
|
||||||
|
|
||||||
- Bump versions for devDependencies (@git.zone/tsbuild, @git.zone/tsrun, @git.zone/tstest, @push.rocks/tapbundle, and @types/node) and dependencies (@push.rocks/lik, @push.rocks/smartfile, @push.rocks/smartfm, @push.rocks/smarthbs, @push.rocks/smartinteract, @push.rocks/smartobject, @push.rocks/smartpromise, @push.rocks/smartshell, and @push.rocks/smartyaml)
|
- Bump versions for devDependencies (@git.zone/tsbuild, @git.zone/tsrun, @git.zone/tstest, @push.rocks/tapbundle, and @types/node) and dependencies (@push.rocks/lik, @push.rocks/smartfile, @push.rocks/smartfm, @push.rocks/smarthbs, @push.rocks/smartinteract, @push.rocks/smartobject, @push.rocks/smartpromise, @push.rocks/smartshell, and @push.rocks/smartyaml)
|
||||||
@@ -18,6 +55,7 @@ Update dependency references and bump version numbers; adjust workflow and templ
|
|||||||
- Update template runafter command from 'npm install' to 'echo "runafter"'
|
- Update template runafter command from 'npm install' to 'echo "runafter"'
|
||||||
|
|
||||||
## 2024-05-29 - 4.0.15 - configuration updates
|
## 2024-05-29 - 4.0.15 - configuration updates
|
||||||
|
|
||||||
Updates to the project’s configuration files, description and build settings.
|
Updates to the project’s configuration files, description and build settings.
|
||||||
|
|
||||||
- Updated description.
|
- Updated description.
|
||||||
@@ -25,219 +63,262 @@ Updates to the project’s configuration files, description and build settings.
|
|||||||
- Updated npmextra.json (githost).
|
- Updated npmextra.json (githost).
|
||||||
|
|
||||||
## 2023-08-18 - 4.0.14 - core
|
## 2023-08-18 - 4.0.14 - core
|
||||||
|
|
||||||
Improved core functionality.
|
Improved core functionality.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2023-07-25 - 4.0.13 - core & organization
|
## 2023-07-25 - 4.0.13 - core & organization
|
||||||
|
|
||||||
Enhancements in core behavior and organizational structure.
|
Enhancements in core behavior and organizational structure.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
- Switched to new organization scheme.
|
- Switched to new organization scheme.
|
||||||
|
|
||||||
## 2023-06-25 - 4.0.12 - core
|
## 2023-06-25 - 4.0.12 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2023-06-25 - 4.0.11 - core
|
## 2023-06-25 - 4.0.11 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2023-06-25 - 4.0.10 - core
|
## 2023-06-25 - 4.0.10 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2023-06-25 - 4.0.9 - core
|
## 2023-06-25 - 4.0.9 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2023-06-25 - 4.0.8 - core
|
## 2023-06-25 - 4.0.8 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2023-06-25 - 4.0.7 - core
|
## 2023-06-25 - 4.0.7 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2023-06-25 - 4.0.6 - core
|
## 2023-06-25 - 4.0.6 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2023-06-25 - 4.0.5 - core
|
## 2023-06-25 - 4.0.5 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2023-06-24 - 4.0.4 - core
|
## 2023-06-24 - 4.0.4 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2023-06-24 - 4.0.3 - core
|
## 2023-06-24 - 4.0.3 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2022-06-25 - 4.0.2 - core
|
## 2022-06-25 - 4.0.2 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2022-06-25 - 4.0.1 - core
|
## 2022-06-25 - 4.0.1 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2022-06-25 - 4.0.0 - core
|
## 2022-06-25 - 4.0.0 - core
|
||||||
|
|
||||||
Core improvements.
|
Core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2022-06-25 - 3.0.10 - core (breaking)
|
## 2022-06-25 - 3.0.10 - core (breaking)
|
||||||
|
|
||||||
A breaking change was introduced affecting the module format.
|
A breaking change was introduced affecting the module format.
|
||||||
|
|
||||||
- BREAKING CHANGE (core): switched to ESM.
|
- BREAKING CHANGE (core): switched to ESM.
|
||||||
|
|
||||||
## 2020-01-31 - 3.0.9 - core
|
## 2020-01-31 - 3.0.9 - core
|
||||||
|
|
||||||
Routine core update.
|
Routine core update.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2019-10-11 - 3.0.8 - core
|
## 2019-10-11 - 3.0.8 - core
|
||||||
|
|
||||||
Routine core update.
|
Routine core update.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2019-10-02 - 3.0.7 - core
|
## 2019-10-02 - 3.0.7 - core
|
||||||
|
|
||||||
Routine core update.
|
Routine core update.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2019-09-10 - 3.0.6 - core
|
## 2019-09-10 - 3.0.6 - core
|
||||||
|
|
||||||
Routine core update.
|
Routine core update.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2019-09-10 - 3.0.5 - core
|
## 2019-09-10 - 3.0.5 - core
|
||||||
|
|
||||||
Routine core update.
|
Routine core update.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2019-09-10 - 3.0.4 - core
|
## 2019-09-10 - 3.0.4 - core
|
||||||
|
|
||||||
Routine core update.
|
Routine core update.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2019-09-10 - 3.0.3 - general updates
|
## 2019-09-10 - 3.0.3 - general updates
|
||||||
|
|
||||||
Updates to project dependencies and general code improvements.
|
Updates to project dependencies and general code improvements.
|
||||||
|
|
||||||
- Performed update.
|
- Performed update.
|
||||||
- Updated dependencies.
|
- Updated dependencies.
|
||||||
|
|
||||||
## 2019-02-17 - 3.0.2 - core
|
## 2019-02-17 - 3.0.2 - core
|
||||||
|
|
||||||
Routine core update.
|
Routine core update.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2019-01-27 - 3.0.1 - core
|
## 2019-01-27 - 3.0.1 - core
|
||||||
|
|
||||||
Routine core update.
|
Routine core update.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
|
|
||||||
## 2018-10-04 - 3.0.0 - core
|
## 2018-10-04 - 3.0.0 - core
|
||||||
|
|
||||||
Changes from merging and core improvements.
|
Changes from merging and core improvements.
|
||||||
|
|
||||||
- Fixed core update.
|
- Fixed core update.
|
||||||
- Merged master branch changes and performed additional updates.
|
- Merged master branch changes and performed additional updates.
|
||||||
|
|
||||||
## 2018-08-30 - 2.0.2 - structure (breaking)
|
## 2018-08-30 - 2.0.2 - structure (breaking)
|
||||||
|
|
||||||
A breaking change in the project’s structure.
|
A breaking change in the project’s structure.
|
||||||
|
|
||||||
- BREAKING CHANGE (structure): templates now take their path within the constructor.
|
- BREAKING CHANGE (structure): templates now take their path within the constructor.
|
||||||
|
|
||||||
## 2018-08-27 - 2.0.1 - minor
|
## 2018-08-27 - 2.0.1 - minor
|
||||||
|
|
||||||
Versions in this range involved only version bump commits with no significant changes.
|
Versions in this range involved only version bump commits with no significant changes.
|
||||||
|
|
||||||
- No significant changes.
|
- No significant changes.
|
||||||
|
|
||||||
## 2017-08-09 - 1.0.14 - scope (breaking)
|
## 2017-08-09 - 1.0.14 - scope (breaking)
|
||||||
|
|
||||||
A breaking change in the package scope was applied.
|
A breaking change in the package scope was applied.
|
||||||
|
|
||||||
- BREAKING CHANGE (scope): switched to new @pushrocks scope.
|
- BREAKING CHANGE (scope): switched to new @pushrocks scope.
|
||||||
|
|
||||||
## 2017-08-09 - 1.0.13 - core
|
## 2017-08-09 - 1.0.13 - core
|
||||||
|
|
||||||
Improvements to variable handling.
|
Improvements to variable handling.
|
||||||
|
|
||||||
- Fixed variable distribution.
|
- Fixed variable distribution.
|
||||||
|
|
||||||
## 2017-07-28 - 1.0.12 - dependencies
|
## 2017-07-28 - 1.0.12 - dependencies
|
||||||
|
|
||||||
Dependency updates.
|
Dependency updates.
|
||||||
|
|
||||||
- Updated dependencies.
|
- Updated dependencies.
|
||||||
|
|
||||||
## 2017-06-01 - 1.0.11 - dependencies
|
## 2017-06-01 - 1.0.11 - dependencies
|
||||||
|
|
||||||
Dependency updates.
|
Dependency updates.
|
||||||
|
|
||||||
- Updated dependencies.
|
- Updated dependencies.
|
||||||
|
|
||||||
## 2017-06-01 - 1.0.10 - CLI improvements
|
## 2017-06-01 - 1.0.10 - CLI improvements
|
||||||
|
|
||||||
Enhanced CLI error prevention.
|
Enhanced CLI error prevention.
|
||||||
|
|
||||||
- Prevented error due to empty defaults.yml.
|
- Prevented error due to empty defaults.yml.
|
||||||
|
|
||||||
## 2017-05-27 - 1.0.9 - dependencies
|
## 2017-05-27 - 1.0.9 - dependencies
|
||||||
|
|
||||||
Dependency updates.
|
Dependency updates.
|
||||||
|
|
||||||
- Updated dependencies.
|
- Updated dependencies.
|
||||||
|
|
||||||
## 2017-05-27 - 1.0.8 - templating
|
## 2017-05-27 - 1.0.8 - templating
|
||||||
|
|
||||||
Improved file templating support.
|
Improved file templating support.
|
||||||
|
|
||||||
- Added support for frontmatter for advanced file templating.
|
- Added support for frontmatter for advanced file templating.
|
||||||
|
|
||||||
## 2017-05-27 - 1.0.7 - documentation
|
## 2017-05-27 - 1.0.7 - documentation
|
||||||
|
|
||||||
Documentation improvements.
|
Documentation improvements.
|
||||||
|
|
||||||
- Added docs.
|
- Added docs.
|
||||||
|
|
||||||
## 2017-05-27 - 1.0.6 - fixes
|
## 2017-05-27 - 1.0.6 - fixes
|
||||||
|
|
||||||
Minor fixes.
|
Minor fixes.
|
||||||
|
|
||||||
- Fixed deep add.
|
- Fixed deep add.
|
||||||
|
|
||||||
## 2017-05-26 - 1.0.5 - smartfile updates
|
## 2017-05-26 - 1.0.5 - smartfile updates
|
||||||
|
|
||||||
Smartfile updates.
|
Smartfile updates.
|
||||||
|
|
||||||
- Updated smartfile.
|
- Updated smartfile.
|
||||||
|
|
||||||
## 2017-05-26 - 1.0.4 - tests
|
## 2017-05-26 - 1.0.4 - tests
|
||||||
|
|
||||||
Test fixes.
|
Test fixes.
|
||||||
|
|
||||||
- Fixed tests.
|
- Fixed tests.
|
||||||
|
|
||||||
## 2017-05-26 - 1.0.3 - smartfile updates
|
## 2017-05-26 - 1.0.3 - smartfile updates
|
||||||
|
|
||||||
Smartfile updates.
|
Smartfile updates.
|
||||||
|
|
||||||
- Updated smartfile.
|
- Updated smartfile.
|
||||||
|
|
||||||
## 2017-05-25 - 1.0.2 - functionality
|
## 2017-05-25 - 1.0.2 - functionality
|
||||||
|
|
||||||
Minor functionality improvements.
|
Minor functionality improvements.
|
||||||
|
|
||||||
- Ensured proper functionality.
|
- Ensured proper functionality.
|
||||||
|
|
||||||
## 2017-05-25 - 1.0.1 - core
|
## 2017-05-25 - 1.0.1 - core
|
||||||
|
|
||||||
Core fixes.
|
Core fixes.
|
||||||
|
|
||||||
- Fixed working issues.
|
- Fixed working issues.
|
||||||
|
|
||||||
## 2017-05-06 - 1.0.0 - initial release and CLI integration
|
## 2017-05-06 - 1.0.0 - initial release and CLI integration
|
||||||
|
|
||||||
The initial release introducing CLI support and project setup.
|
The initial release introducing CLI support and project setup.
|
||||||
|
|
||||||
- Added CLI to prompt for missing variables.
|
- Added CLI to prompt for missing variables.
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 Task Venture Capital GmbH
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
+16
-14
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartscaf",
|
"name": "@push.rocks/smartscaf",
|
||||||
"version": "4.0.17",
|
"version": "4.0.22",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A project aimed at quickly scaffolding projects with support for TypeScript, smart file handling, and template rendering.",
|
"description": "A project aimed at quickly scaffolding projects with support for TypeScript, smart file handling, and template rendering.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --verbose --logfile --timeout 60)",
|
"test": "(tstest test/ --verbose --logfile --timeout 60)",
|
||||||
"build": "(tsbuild --web --allowimplicitany)",
|
"build": "(tsbuild --web)",
|
||||||
"buildDocs": "tsdoc"
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -17,9 +17,9 @@
|
|||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitlab.com/pushrocks/smartscaf/issues"
|
"url": "https://code.foss.global/push.rocks/smartscaf/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://code.foss.global/push.rocks/smartscaf",
|
"homepage": "https://code.foss.global/push.rocks/smartscaf#readme",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"typescript",
|
"typescript",
|
||||||
"scaffolding",
|
"scaffolding",
|
||||||
@@ -31,21 +31,21 @@
|
|||||||
"cli tool"
|
"cli tool"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@git.zone/tsbuild": "^2.6.4",
|
"@git.zone/tsbuild": "^4.4.0",
|
||||||
"@git.zone/tsrun": "^1.3.3",
|
"@git.zone/tsrun": "^2.0.2",
|
||||||
"@git.zone/tstest": "^2.3.4",
|
"@git.zone/tstest": "^3.6.3",
|
||||||
"@push.rocks/tapbundle": "^6.0.3",
|
"@types/node": "^25.6.0"
|
||||||
"@types/node": "^22.14.1"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@push.rocks/lik": "^6.2.2",
|
"@push.rocks/lik": "^6.4.1",
|
||||||
"@push.rocks/smartfile": "^11.2.5",
|
"@push.rocks/smartfile": "^13.1.3",
|
||||||
"@push.rocks/smartfm": "^2.2.2",
|
"@push.rocks/smartfm": "^2.2.2",
|
||||||
"@push.rocks/smarthbs": "^3.0.3",
|
"@push.rocks/smartfs": "^1.5.1",
|
||||||
|
"@push.rocks/smarthbs": "^3.0.5",
|
||||||
"@push.rocks/smartinteract": "^2.0.16",
|
"@push.rocks/smartinteract": "^2.0.16",
|
||||||
"@push.rocks/smartobject": "^1.0.12",
|
"@push.rocks/smartobject": "^1.0.12",
|
||||||
"@push.rocks/smartpromise": "^4.2.3",
|
"@push.rocks/smartpromise": "^4.2.3",
|
||||||
"@push.rocks/smartshell": "^3.3.0",
|
"@push.rocks/smartshell": "^3.3.8",
|
||||||
"@push.rocks/smartyaml": "^3.0.4"
|
"@push.rocks/smartyaml": "^3.0.4"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
@@ -57,6 +57,8 @@
|
|||||||
"dist_ts_web/**/*",
|
"dist_ts_web/**/*",
|
||||||
"assets/**/*",
|
"assets/**/*",
|
||||||
"cli.js",
|
"cli.js",
|
||||||
|
".smartconfig.json",
|
||||||
|
"license",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
],
|
],
|
||||||
@@ -64,5 +66,5 @@
|
|||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
],
|
],
|
||||||
"packageManager": "pnpm@10.7.0+sha512.6b865ad4b62a1d9842b61d674a393903b871d9244954f652b8842c2b553c72176b278f64c463e52d40fff8aba385c235c8c9ecf5cc7de4fd78b8bb6d49633ab6"
|
"packageManager": "pnpm@10.28.2"
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+2107
-4478
File diff suppressed because it is too large
Load Diff
@@ -1,81 +1,405 @@
|
|||||||
# @push.rocks/smartscaf
|
# @push.rocks/smartscaf 🚀
|
||||||
scaffold projects quickly
|
|
||||||
|
|
||||||
## Install
|
**Lightning-fast project scaffolding with smart templates and variable interpolation**
|
||||||
To install `@push.rocks/smartscaf`, run the following command in your project directory:
|
|
||||||
|
## What It Does
|
||||||
|
|
||||||
|
SmartScaf is a powerful TypeScript scaffolding engine that transforms template directories into fully configured projects in seconds. Think of it as your project's DNA replicator - define once, deploy anywhere with custom variables, dependency merging, and automated post-setup scripts.
|
||||||
|
|
||||||
|
Perfect for:
|
||||||
|
- 🏗️ **Bootstrapping microservices** with consistent structure
|
||||||
|
- 📦 **Creating npm packages** with standard configurations
|
||||||
|
- 🎨 **Spinning up frontend projects** with your tech stack
|
||||||
|
- 🔧 **Standardizing team workflows** with company templates
|
||||||
|
- ⚡ **Automating repetitive project setups**
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install @push.rocks/smartscaf --save
|
# Install globally for CLI usage
|
||||||
|
npm install -g @push.rocks/smartscaf
|
||||||
|
|
||||||
|
# Or add to your project
|
||||||
|
npm install @push.rocks/smartscaf --save-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Quick Start
|
||||||
|
|
||||||
Smartscaf provides a streamlined approach to quickly scaffold projects with predefined templates. It leverages modern TypeScript and ESM syntax to offer a flexible and powerful toolchain for project initialization. This guide will walk you through utilizing Smartscaf to its full potential, including setting up templates, customizing scaffolding processes, and programmatically controlling scaffolding operations.
|
### Create Your First Template
|
||||||
|
|
||||||
### Setting Up Your First Template
|
1. **Set up a template directory** with your project structure:
|
||||||
|
|
||||||
A Smartscaf template is essentially a directory with a set of files that you want to reuse across projects. It can include source code files, configuration files, and a special `.smartscaf.yml` file for defining template variables and dependencies.
|
```
|
||||||
|
my-template/
|
||||||
|
├── .smartscaf.yml # Template configuration
|
||||||
|
├── package.json # With {{projectName}} variables
|
||||||
|
├── src/
|
||||||
|
│ └── index.ts # Your source files
|
||||||
|
├── readme.md # With {{description}} placeholder
|
||||||
|
└── .gitignore # Standard ignores
|
||||||
|
```
|
||||||
|
|
||||||
1. **Create a Template Directory**: This directory should contain all the files and folders representing your template.
|
2. **Configure your template** in `.smartscaf.yml`:
|
||||||
|
|
||||||
2. **Define Template Variables in `.smartscaf.yml`**: This YAML file contains metadata about your template, such as default values for variables, dependency templates to merge, and scripts to run after scaffolding. Here's a basic example:
|
```yaml
|
||||||
|
# Template defaults and configuration
|
||||||
|
defaults:
|
||||||
|
projectName: 'my-awesome-project'
|
||||||
|
description: 'A fantastic new project'
|
||||||
|
author: '{{gitName}}'
|
||||||
|
license: 'MIT'
|
||||||
|
nodeVersion: '20'
|
||||||
|
|
||||||
```yml
|
# Merge other templates (optional)
|
||||||
defaults:
|
dependencies:
|
||||||
projectName: "My Awesome Project"
|
merge:
|
||||||
dependencies:
|
- ../shared-config-template
|
||||||
merge: []
|
- ../company-standards-template
|
||||||
runafter:
|
|
||||||
- "npm install"
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Utilize Handlebars Syntax for Dynamic Content**: Files in your template can use the Handlebars syntax (`{{variableName}}`) for dynamic content that will be replaced during the scaffolding process.
|
# Post-scaffold automation
|
||||||
|
runafter:
|
||||||
|
- 'npm install'
|
||||||
|
- 'git init'
|
||||||
|
- 'git add .'
|
||||||
|
- 'git commit -m "Initial commit from SmartScaf"'
|
||||||
|
```
|
||||||
|
|
||||||
### Scaffolding a New Project
|
3. **Use Handlebars syntax** in your template files:
|
||||||
|
|
||||||
Once you have a template ready, you can scaffold a new project by programmatically creating and manipulating a `ScafTemplate` instance from Smartscaf.
|
```typescript
|
||||||
|
// src/index.ts
|
||||||
|
/**
|
||||||
|
* {{description}}
|
||||||
|
* @author {{author}}
|
||||||
|
* @license {{license}}
|
||||||
|
*/
|
||||||
|
|
||||||
1. **Import Smartscaf and Create a New Instance**:
|
export class {{className}} {
|
||||||
|
constructor() {
|
||||||
|
console.log('Welcome to {{projectName}}!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
```typescript
|
### Scaffold a New Project
|
||||||
import { ScafTemplate } from '@push.rocks/smartscaf';
|
|
||||||
|
|
||||||
async function scaffoldProject() {
|
```typescript
|
||||||
const myTemplate = await ScafTemplate.createTemplateFromDir('<path-to-your-template>');
|
import { ScafTemplate } from '@push.rocks/smartscaf';
|
||||||
await myTemplate.readTemplateFromDir(); // Load the template
|
|
||||||
// Supply any additional variables or override defaults
|
async function createProject() {
|
||||||
await myTemplate.supplyVariables({
|
// Load your template
|
||||||
projectName: 'My New Project'
|
const template = await ScafTemplate.createTemplateFromDir('./my-template');
|
||||||
|
await template.readTemplateFromDir();
|
||||||
|
|
||||||
|
// Supply variables (overrides defaults)
|
||||||
|
await template.supplyVariables({
|
||||||
|
projectName: 'super-api',
|
||||||
|
description: 'Revolutionary API service',
|
||||||
|
className: 'SuperAPI',
|
||||||
|
author: 'John Doe'
|
||||||
});
|
});
|
||||||
// Optionally, interactively ask for missing variables
|
|
||||||
// await myTemplate.askCliForMissingVariables();
|
// Interactive mode - asks for any missing variables
|
||||||
await myTemplate.writeToDisk('<destination-path>'); // Scaffold!
|
await template.askCliForMissingVariables();
|
||||||
|
|
||||||
|
// Generate the project
|
||||||
|
await template.writeToDisk('./projects/super-api');
|
||||||
|
|
||||||
|
console.log('✨ Project scaffolded successfully!');
|
||||||
|
}
|
||||||
|
|
||||||
|
createProject();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Core Features
|
||||||
|
|
||||||
|
### 🎯 Smart Variable System
|
||||||
|
|
||||||
|
SmartScaf intelligently manages template variables through multiple layers:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const template = await ScafTemplate.createTemplateFromDir('./template');
|
||||||
|
await template.readTemplateFromDir();
|
||||||
|
|
||||||
|
// Access variable collections
|
||||||
|
console.log(template.defaultVariables); // From .smartscaf.yml defaults
|
||||||
|
console.log(template.requiredVariables); // Found in template files
|
||||||
|
console.log(template.suppliedVariables); // What you've provided
|
||||||
|
console.log(template.missingVariables); // What still needs values
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🔀 Template Composition
|
||||||
|
|
||||||
|
Merge multiple templates to create complex project structures:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# .smartscaf.yml
|
||||||
|
dependencies:
|
||||||
|
merge:
|
||||||
|
- ../base-template # Common structure
|
||||||
|
- ../auth-template # Authentication setup
|
||||||
|
- ../docker-template # Container configuration
|
||||||
|
```
|
||||||
|
|
||||||
|
Templates are merged in order, allowing you to build sophisticated scaffolds from modular components.
|
||||||
|
|
||||||
|
### 📝 Dynamic File Naming
|
||||||
|
|
||||||
|
Use frontmatter to dynamically rename files during scaffolding:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
fileName: {{projectName}}.config.js
|
||||||
|
---
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: '{{projectName}}',
|
||||||
|
version: '{{version}}'
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🤖 Interactive CLI Mode
|
||||||
|
|
||||||
|
Let SmartScaf prompt for missing variables:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Automatically prompts for any variables not yet supplied
|
||||||
|
await template.askCliForMissingVariables();
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🚀 Post-Scaffold Scripts
|
||||||
|
|
||||||
|
Automate setup tasks after scaffolding:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
runafter:
|
||||||
|
- 'npm install' # Install dependencies
|
||||||
|
- 'npm run build' # Initial build
|
||||||
|
- 'npm test' # Verify setup
|
||||||
|
- 'code .' # Open in VS Code
|
||||||
|
```
|
||||||
|
|
||||||
|
Scripts run in order using an interactive shell, ensuring proper environment handling.
|
||||||
|
|
||||||
|
## Advanced Usage
|
||||||
|
|
||||||
|
### Programmatic Control
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { ScafTemplate } from '@push.rocks/smartscaf';
|
||||||
|
|
||||||
|
class ProjectGenerator {
|
||||||
|
private template: ScafTemplate;
|
||||||
|
|
||||||
|
async initialize(templatePath: string) {
|
||||||
|
this.template = await ScafTemplate.createTemplateFromDir(templatePath);
|
||||||
|
await this.template.readTemplateFromDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
scaffoldProject().then(() => console.log('Project scaffolded successfully!'));
|
async generate(config: any, outputPath: string) {
|
||||||
```
|
// Supply configuration
|
||||||
|
await this.template.supplyVariables(config);
|
||||||
|
|
||||||
2. **Customizing the Scaffolding Process**: You can customize the scaffolding process by defining additional logic to manipulate files, directories, or template variables before writing to disk.
|
// Check what's missing
|
||||||
|
if (this.template.missingVariables.length > 0) {
|
||||||
|
console.log('Missing:', this.template.missingVariables);
|
||||||
|
// Handle missing variables programmatically
|
||||||
|
// or use: await this.template.askCliForMissingVariables();
|
||||||
|
}
|
||||||
|
|
||||||
### Advanced Features
|
// Generate project
|
||||||
|
await this.template.writeToDisk(outputPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
- **Merging Templates**: Smartscaf allows you to compose complex templates by specifying dependencies in the `.smartscaf.yml` file. This enables you to merge multiple templates into one scaffolded project.
|
### Template Validation
|
||||||
|
|
||||||
- **Running Scripts After Scaffolding**: Specify an array of shell commands in the `runafter` section of your `.smartscaf.yml` to be executed after the project is scaffolded. This is useful for running installations or initial builds.
|
```typescript
|
||||||
|
// Validate template before using
|
||||||
|
const template = await ScafTemplate.createTemplateFromDir('./template');
|
||||||
|
await template.readTemplateFromDir();
|
||||||
|
|
||||||
- **Programmatic API**: Smartscaf's flexible API allows for programmatically controlling every aspect of the scaffolding process, making it suitable for integrating into build tools, command line utilities, or CI/CD pipelines.
|
// Check template structure
|
||||||
|
if (template.templateSmartfileArray.length === 0) {
|
||||||
|
throw new Error('Template is empty!');
|
||||||
|
}
|
||||||
|
|
||||||
### Complete Feature Set and Use Cases
|
// Verify required variables
|
||||||
|
const required = template.requiredVariables;
|
||||||
|
const defaults = Object.keys(template.defaultVariables);
|
||||||
|
const missing = required.filter(v => !defaults.includes(v));
|
||||||
|
|
||||||
The usage scenarios outlined above merely scratch the surface of what Smartscaf can do. With its comprehensive API, you can manage complex scaffolding tasks, including but not limited to:
|
if (missing.length > 0) {
|
||||||
|
console.warn(`Template needs: ${missing.join(', ')}`);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
- Creating project templates with varying levels of complexity and customization.
|
### Complex Variable Structures
|
||||||
- Dynamically adjusting project structures based on user input or external parameters.
|
|
||||||
- Integrating scaffolding steps into larger automation workflows, significantly reducing manual setup time for new projects.
|
|
||||||
|
|
||||||
In conclusion, Smartscaf empowers developers to streamline their project initialization process, ensuring consistency, reducing boilerplate, and allowing more time to be spent on development rather than setup. Its flexibility and broad feature set make it a valuable tool in a modern developer's toolkit.
|
SmartScaf supports nested object variables:
|
||||||
|
|
||||||
For further information and a deeper dive into Smartscaf's capabilities, please refer to the [official documentation](https://gitlab.com/push.rocks/smartscaf#README) and explore the [source code](https://gitlab.com/push.rocks/smartscaf) for advanced use cases and customization options.
|
```yaml
|
||||||
|
# .smartscaf.yml
|
||||||
|
defaults:
|
||||||
|
app.name: 'MyApp'
|
||||||
|
app.version: '1.0.0'
|
||||||
|
database.host: 'localhost'
|
||||||
|
database.port: 5432
|
||||||
|
api.endpoints.users: '/api/users'
|
||||||
|
api.endpoints.auth: '/api/auth'
|
||||||
|
```
|
||||||
|
|
||||||
|
Use in templates:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// config.js
|
||||||
|
export default {
|
||||||
|
app: {
|
||||||
|
name: '{{app.name}}',
|
||||||
|
version: '{{app.version}}'
|
||||||
|
},
|
||||||
|
database: {
|
||||||
|
host: '{{database.host}}',
|
||||||
|
port: {{database.port}}
|
||||||
|
},
|
||||||
|
api: {
|
||||||
|
users: '{{api.endpoints.users}}',
|
||||||
|
auth: '{{api.endpoints.auth}}'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### CI/CD Integration
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// ci-scaffold.ts
|
||||||
|
import { ScafTemplate } from '@push.rocks/smartscaf';
|
||||||
|
|
||||||
|
async function scaffoldForCI() {
|
||||||
|
const template = await ScafTemplate.createTemplateFromDir(
|
||||||
|
process.env.TEMPLATE_PATH
|
||||||
|
);
|
||||||
|
await template.readTemplateFromDir();
|
||||||
|
|
||||||
|
// Get variables from environment
|
||||||
|
const vars = {
|
||||||
|
projectName: process.env.PROJECT_NAME,
|
||||||
|
environment: process.env.DEPLOY_ENV,
|
||||||
|
apiKey: process.env.API_KEY,
|
||||||
|
region: process.env.AWS_REGION
|
||||||
|
};
|
||||||
|
|
||||||
|
await template.supplyVariables(vars);
|
||||||
|
await template.writeToDisk(process.env.OUTPUT_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run in CI pipeline
|
||||||
|
scaffoldForCI().catch(console.error);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Real-World Examples
|
||||||
|
|
||||||
|
### Microservice Template
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# .smartscaf.yml for microservice template
|
||||||
|
defaults:
|
||||||
|
serviceName: 'my-service'
|
||||||
|
port: 3000
|
||||||
|
dockerImage: 'node:20-alpine'
|
||||||
|
healthPath: '/health'
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
merge:
|
||||||
|
- ../shared/base-service
|
||||||
|
- ../shared/monitoring
|
||||||
|
- ../shared/logging
|
||||||
|
|
||||||
|
runafter:
|
||||||
|
- 'npm install'
|
||||||
|
- 'docker build -t {{serviceName}}:latest .'
|
||||||
|
- 'npm run test:integration'
|
||||||
|
```
|
||||||
|
|
||||||
|
### React Component Library
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# .smartscaf.yml for React library
|
||||||
|
defaults:
|
||||||
|
libraryName: 'ui-components'
|
||||||
|
componentPrefix: 'UI'
|
||||||
|
useTypeScript: true
|
||||||
|
useStorybook: true
|
||||||
|
testRunner: 'jest'
|
||||||
|
|
||||||
|
runafter:
|
||||||
|
- 'pnpm install'
|
||||||
|
- 'pnpm build'
|
||||||
|
- 'pnpm storybook:build'
|
||||||
|
- 'pnpm test'
|
||||||
|
```
|
||||||
|
|
||||||
|
## API Reference
|
||||||
|
|
||||||
|
### ScafTemplate Class
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
class ScafTemplate {
|
||||||
|
// Factory method
|
||||||
|
static createTemplateFromDir(dirPath: string): Promise<ScafTemplate>
|
||||||
|
|
||||||
|
// Core methods
|
||||||
|
readTemplateFromDir(): Promise<void>
|
||||||
|
supplyVariables(variables: object): Promise<void>
|
||||||
|
askCliForMissingVariables(): Promise<void>
|
||||||
|
writeToDisk(destinationPath: string): Promise<void>
|
||||||
|
|
||||||
|
// Properties
|
||||||
|
name: string // Template name
|
||||||
|
description: string // Template description
|
||||||
|
templateSmartfileArray: SmartFile[] // Loaded template files
|
||||||
|
defaultVariables: object // Default values from .smartscaf.yml
|
||||||
|
requiredVariables: string[] // Variables found in templates
|
||||||
|
suppliedVariables: object // Variables you've provided
|
||||||
|
missingVariables: string[] // Variables still needed
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Best Practices
|
||||||
|
|
||||||
|
### 📁 Template Organization
|
||||||
|
|
||||||
|
```
|
||||||
|
company-templates/
|
||||||
|
├── base/ # Shared foundations
|
||||||
|
│ ├── typescript/ # TS configuration
|
||||||
|
│ ├── eslint/ # Linting setup
|
||||||
|
│ └── ci-cd/ # CI/CD pipelines
|
||||||
|
├── services/ # Service templates
|
||||||
|
│ ├── rest-api/
|
||||||
|
│ ├── graphql-api/
|
||||||
|
│ └── worker-service/
|
||||||
|
└── frontends/ # Frontend templates
|
||||||
|
├── react-app/
|
||||||
|
├── vue-app/
|
||||||
|
└── static-site/
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🔒 Security Considerations
|
||||||
|
|
||||||
|
- Never commit sensitive data in templates
|
||||||
|
- Use environment variables for secrets
|
||||||
|
- Add `.smartscaf.yml` to `.gitignore` if it contains private defaults
|
||||||
|
- Validate user input when using in automation
|
||||||
|
|
||||||
|
### 🎨 Template Design Tips
|
||||||
|
|
||||||
|
1. **Start small** - Begin with minimal templates and grow them
|
||||||
|
2. **Use composition** - Build complex templates from simple ones
|
||||||
|
3. **Document variables** - Add comments in `.smartscaf.yml`
|
||||||
|
4. **Test templates** - Create test scaffolds before deploying
|
||||||
|
5. **Version templates** - Use git tags for template versions
|
||||||
|
|
||||||
## License and Legal Information
|
## License and Legal Information
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
import { expect, tap } from '@push.rocks/tapbundle';
|
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import * as smartscaf from '../ts/index.js';
|
import * as smartscaf from '../ts/index.js';
|
||||||
@@ -34,4 +34,4 @@ tap.test('should output ready rendered template', async () => {
|
|||||||
await testScafTemplate.writeToDisk(path.resolve('./test/test_output'));
|
await testScafTemplate.writeToDisk(path.resolve('./test/test_output'));
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.start();
|
export default tap.start();
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
|
||||||
# this is a wow
|
# this is a wow
|
||||||
|
|
||||||
# this is a here
|
# this is a here
|
||||||
|
|
||||||
# this is a undefined variable
|
# this is a undefined variable
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
|
|
||||||
# some undefined variable
|
# some undefined variable
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
# this is a from default yaml
|
# this is a from default yaml
|
||||||
|
|
||||||
# this is a this is another value from yml
|
# this is a this is another value from yml
|
||||||
|
|
||||||
# this is a undefined variable
|
# this is a undefined variable
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
fileName: anothername.yml
|
fileName: anothername.yml
|
||||||
---
|
---
|
||||||
|
|
||||||
# this is a {{templateObject.value1}}
|
# this is a {{templateObject.value1}}
|
||||||
|
|
||||||
# this is a {{templateObject.value2}}
|
# this is a {{templateObject.value2}}
|
||||||
|
|
||||||
# this is a {{templateVar3}}
|
# this is a {{templateVar3}}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
# this is a {{templateVar1}}
|
# this is a {{templateVar1}}
|
||||||
|
|
||||||
# this is a {{templateVar2}}
|
# this is a {{templateVar2}}
|
||||||
|
|
||||||
# this is a {{templateVar3}}
|
# this is a {{templateVar3}}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
fileName: changedname.md
|
fileName: changedname.md
|
||||||
---
|
---
|
||||||
|
|
||||||
# some {{wow}}
|
# some {{wow}}
|
||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartscaf',
|
name: '@push.rocks/smartscaf',
|
||||||
version: '4.0.17',
|
version: '4.0.22',
|
||||||
description: 'A project aimed at quickly scaffolding projects with support for TypeScript, smart file handling, and template rendering.'
|
description: 'A project aimed at quickly scaffolding projects with support for TypeScript, smart file handling, and template rendering.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,31 +15,37 @@ export class ScafTemplate {
|
|||||||
/**
|
/**
|
||||||
* the name of the template
|
* the name of the template
|
||||||
*/
|
*/
|
||||||
public name: string;
|
public name = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the descriptions of the template
|
* the descriptions of the template
|
||||||
*/
|
*/
|
||||||
public description: string;
|
public description = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the location on disk of the template
|
* the location on disk of the template
|
||||||
*/
|
*/
|
||||||
public dirPath: string;
|
public dirPath: string;
|
||||||
public destinationPath: string;
|
public destinationPath?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* smartscafFile
|
* smartscafFile
|
||||||
*/
|
*/
|
||||||
public smartscafFile: interfaces.ISmartscafFile;
|
public smartscafFile: interfaces.ISmartscafFile = {
|
||||||
|
defaults: {},
|
||||||
|
dependencies: {
|
||||||
|
merge: [],
|
||||||
|
},
|
||||||
|
runafter: [],
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the files of the template as array of Smartfiles
|
* the files of the template as array of Smartfiles
|
||||||
*/
|
*/
|
||||||
public templateSmartfileArray: plugins.smartfile.SmartFile[];
|
public templateSmartfileArray: plugins.smartfile.SmartFile[] = [];
|
||||||
public requiredVariables: string[];
|
public requiredVariables: string[] = [];
|
||||||
public defaultVariables: any;
|
public defaultVariables: Record<string, unknown> = {};
|
||||||
public suppliedVariables: any = {};
|
public suppliedVariables: Record<string, unknown> = {};
|
||||||
public missingVariables: string[] = [];
|
public missingVariables: string[] = [];
|
||||||
|
|
||||||
constructor(dirPathArg: string) {
|
constructor(dirPathArg: string) {
|
||||||
@@ -50,7 +56,10 @@ export class ScafTemplate {
|
|||||||
* read a template from a directory
|
* read a template from a directory
|
||||||
*/
|
*/
|
||||||
public async readTemplateFromDir() {
|
public async readTemplateFromDir() {
|
||||||
this.templateSmartfileArray = await plugins.smartfile.fs.fileTreeToObject(this.dirPath, '**/*');
|
const templateVirtualDirectory = await plugins.smartFileFactory.virtualDirectoryFromPath(
|
||||||
|
this.dirPath,
|
||||||
|
);
|
||||||
|
this.templateSmartfileArray = templateVirtualDirectory.listFiles();
|
||||||
|
|
||||||
// read .smartscaf.yml file
|
// read .smartscaf.yml file
|
||||||
let smartscafFile: interfaces.ISmartscafFile = {
|
let smartscafFile: interfaces.ISmartscafFile = {
|
||||||
@@ -61,15 +70,17 @@ export class ScafTemplate {
|
|||||||
runafter: [],
|
runafter: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const smartscafSmartfile = this.templateSmartfileArray.find((smartfileArg) => {
|
const smartscafSmartfile = this.templateSmartfileArray.find(
|
||||||
|
(smartfileArg) => {
|
||||||
return smartfileArg.parsedPath.base === '.smartscaf.yml';
|
return smartfileArg.parsedPath.base === '.smartscaf.yml';
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
if (smartscafSmartfile) {
|
if (smartscafSmartfile) {
|
||||||
smartscafFile = {
|
smartscafFile = {
|
||||||
...smartscafFile,
|
...smartscafFile,
|
||||||
...(await plugins.smartyaml.yamlStringToObject(
|
...(await plugins.smartyaml.yamlStringToObject(
|
||||||
smartscafSmartfile.contentBuffer.toString()
|
smartscafSmartfile.contentBuffer.toString(),
|
||||||
)),
|
)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -85,7 +96,7 @@ export class ScafTemplate {
|
|||||||
* supply the variables to render the teplate with
|
* supply the variables to render the teplate with
|
||||||
* @param variablesArg gets merged with this.suppliedVariables
|
* @param variablesArg gets merged with this.suppliedVariables
|
||||||
*/
|
*/
|
||||||
public async supplyVariables(variablesArg) {
|
public async supplyVariables(variablesArg: Record<string, unknown>) {
|
||||||
this.suppliedVariables = {
|
this.suppliedVariables = {
|
||||||
...this.suppliedVariables,
|
...this.suppliedVariables,
|
||||||
...variablesArg,
|
...variablesArg,
|
||||||
@@ -105,7 +116,10 @@ export class ScafTemplate {
|
|||||||
name: missingVariable,
|
name: missingVariable,
|
||||||
type: 'input',
|
type: 'input',
|
||||||
default: (() => {
|
default: (() => {
|
||||||
if (this.defaultVariables && this.defaultVariables[missingVariable]) {
|
if (
|
||||||
|
this.defaultVariables &&
|
||||||
|
this.defaultVariables[missingVariable]
|
||||||
|
) {
|
||||||
return this.defaultVariables[missingVariable];
|
return this.defaultVariables[missingVariable];
|
||||||
} else {
|
} else {
|
||||||
return 'undefined variable';
|
return 'undefined variable';
|
||||||
@@ -118,15 +132,63 @@ export class ScafTemplate {
|
|||||||
const answerBucket = await localSmartInteract.runQueue();
|
const answerBucket = await localSmartInteract.runQueue();
|
||||||
const answers = answerBucket.getAllAnswers();
|
const answers = answerBucket.getAllAnswers();
|
||||||
for (const answer of answers) {
|
for (const answer of answers) {
|
||||||
await plugins.smartobject.smartAdd(this.suppliedVariables, answer.name, answer.value);
|
await plugins.smartobject.smartAdd(
|
||||||
|
this.suppliedVariables,
|
||||||
|
answer.name,
|
||||||
|
answer.value,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders all template files in memory without writing to disk or running scripts.
|
||||||
|
* Returns new SmartFile instances — does not mutate the original templateSmartfileArray.
|
||||||
|
*/
|
||||||
|
public async renderToMemory(): Promise<plugins.smartfile.SmartFile[]> {
|
||||||
|
const renderedFiles: plugins.smartfile.SmartFile[] = [];
|
||||||
|
|
||||||
|
for (const smartfile of this.templateSmartfileArray) {
|
||||||
|
if (smartfile.path === '.smartscaf.yml') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render handlebars template
|
||||||
|
const template = await plugins.smarthbs.getTemplateForString(
|
||||||
|
smartfile.contents.toString(),
|
||||||
|
);
|
||||||
|
const renderedTemplateString = template(this.suppliedVariables);
|
||||||
|
|
||||||
|
// Handle frontmatter
|
||||||
|
const smartfmInstance = new plugins.smartfm.Smartfm({
|
||||||
|
fmType: 'yaml',
|
||||||
|
});
|
||||||
|
const parsedTemplate = smartfmInstance.parse(renderedTemplateString) as any;
|
||||||
|
|
||||||
|
// Determine final path (frontmatter fileName rename)
|
||||||
|
let finalPath = smartfile.path;
|
||||||
|
if (parsedTemplate.data.fileName) {
|
||||||
|
const oldFileName = plugins.path.parse(finalPath).base;
|
||||||
|
finalPath = finalPath.replace(new RegExp(oldFileName + '$'), parsedTemplate.data.fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Postprocess: convert {-{ back to {{
|
||||||
|
const finalContent = await plugins.smarthbs.postprocess(parsedTemplate.content);
|
||||||
|
|
||||||
|
renderedFiles.push(plugins.smartFileFactory.fromBuffer(
|
||||||
|
finalPath,
|
||||||
|
Buffer.from(finalContent),
|
||||||
|
smartfile.base,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return renderedFiles;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* writes a file to disk
|
* writes a file to disk
|
||||||
* @param destinationDirArg
|
* @param destinationDirArg
|
||||||
*/
|
*/
|
||||||
public async writeToDisk(destinationDirArg) {
|
public async writeToDisk(destinationDirArg: string) {
|
||||||
this.destinationPath = destinationDirArg;
|
this.destinationPath = destinationDirArg;
|
||||||
const smartfileArrayToWrite: plugins.smartfile.SmartFile[] = [];
|
const smartfileArrayToWrite: plugins.smartfile.SmartFile[] = [];
|
||||||
for (const smartfile of this.templateSmartfileArray) {
|
for (const smartfile of this.templateSmartfileArray) {
|
||||||
@@ -136,23 +198,32 @@ export class ScafTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// render the template
|
// render the template
|
||||||
const template = await plugins.smarthbs.getTemplateForString(smartfile.contents.toString());
|
const template = await plugins.smarthbs.getTemplateForString(
|
||||||
|
smartfile.contents.toString(),
|
||||||
|
);
|
||||||
const renderedTemplateString = template(this.suppliedVariables);
|
const renderedTemplateString = template(this.suppliedVariables);
|
||||||
|
|
||||||
// handle frontmatter
|
// handle frontmatter
|
||||||
const smartfmInstance = new plugins.smartfm.Smartfm({
|
const smartfmInstance = new plugins.smartfm.Smartfm({
|
||||||
fmType: 'yaml',
|
fmType: 'yaml',
|
||||||
});
|
});
|
||||||
const parsedTemplate = smartfmInstance.parse(renderedTemplateString) as any;
|
const parsedTemplate = smartfmInstance.parse(
|
||||||
|
renderedTemplateString,
|
||||||
|
) as any;
|
||||||
if (parsedTemplate.data.fileName) {
|
if (parsedTemplate.data.fileName) {
|
||||||
smartfile.updateFileName(parsedTemplate.data.fileName);
|
smartfile.updateFileName(parsedTemplate.data.fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
smartfile.contents = Buffer.from(await plugins.smarthbs.postprocess(parsedTemplate.content));
|
smartfile.contents = Buffer.from(
|
||||||
|
await plugins.smarthbs.postprocess(parsedTemplate.content),
|
||||||
|
);
|
||||||
smartfileArrayToWrite.push(smartfile);
|
smartfileArrayToWrite.push(smartfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
await plugins.smartfile.memory.smartfileArrayToFs(smartfileArrayToWrite, destinationDirArg);
|
const virtualDirectoryToWrite = plugins.smartFileFactory.virtualDirectoryFromFileArray(
|
||||||
|
smartfileArrayToWrite,
|
||||||
|
);
|
||||||
|
await virtualDirectoryToWrite.saveToDisk(destinationDirArg);
|
||||||
await this.runScripts();
|
await this.runScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +235,7 @@ export class ScafTemplate {
|
|||||||
let templateVariables: string[] = [];
|
let templateVariables: string[] = [];
|
||||||
for (const templateSmartfile of this.templateSmartfileArray) {
|
for (const templateSmartfile of this.templateSmartfileArray) {
|
||||||
const localTemplateVariables = await plugins.smarthbs.findVarsInHbsString(
|
const localTemplateVariables = await plugins.smarthbs.findVarsInHbsString(
|
||||||
templateSmartfile.contents.toString()
|
templateSmartfile.contents.toString(),
|
||||||
);
|
);
|
||||||
templateVariables = [...templateVariables, ...localTemplateVariables];
|
templateVariables = [...templateVariables, ...localTemplateVariables];
|
||||||
}
|
}
|
||||||
@@ -181,7 +252,7 @@ export class ScafTemplate {
|
|||||||
for (const templateSmartfile of this.templateSmartfileArray) {
|
for (const templateSmartfile of this.templateSmartfileArray) {
|
||||||
const localMissingVars = await plugins.smarthbs.checkVarsSatisfaction(
|
const localMissingVars = await plugins.smarthbs.checkVarsSatisfaction(
|
||||||
templateSmartfile.contents.toString(),
|
templateSmartfile.contents.toString(),
|
||||||
this.suppliedVariables
|
this.suppliedVariables,
|
||||||
);
|
);
|
||||||
|
|
||||||
// combine with other missingVars
|
// combine with other missingVars
|
||||||
@@ -208,13 +279,15 @@ export class ScafTemplate {
|
|||||||
* >> - yourDeeperKey: yourValue
|
* >> - yourDeeperKey: yourValue
|
||||||
*/
|
*/
|
||||||
private async _checkDefaultVariables() {
|
private async _checkDefaultVariables() {
|
||||||
const smartscafSmartfile = this.templateSmartfileArray.find((smartfileArg) => {
|
const smartscafSmartfile = this.templateSmartfileArray.find(
|
||||||
|
(smartfileArg) => {
|
||||||
return smartfileArg.parsedPath.base === '.smartscaf.yml';
|
return smartfileArg.parsedPath.base === '.smartscaf.yml';
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
if (smartscafSmartfile) {
|
if (smartscafSmartfile) {
|
||||||
const smartscafObject = await plugins.smartyaml.yamlStringToObject(
|
const smartscafObject = await plugins.smartyaml.yamlStringToObject(
|
||||||
smartscafSmartfile.contents.toString()
|
smartscafSmartfile.contents.toString(),
|
||||||
);
|
);
|
||||||
const defaultObject = smartscafObject.defaults;
|
const defaultObject = smartscafObject.defaults;
|
||||||
this.defaultVariables = defaultObject;
|
this.defaultVariables = defaultObject;
|
||||||
@@ -235,17 +308,19 @@ export class ScafTemplate {
|
|||||||
for (const dependency of this.smartscafFile.dependencies.merge) {
|
for (const dependency of this.smartscafFile.dependencies.merge) {
|
||||||
console.log(`Now resolving ${dependency}`);
|
console.log(`Now resolving ${dependency}`);
|
||||||
const templatePathToMerge = plugins.path.join(this.dirPath, dependency);
|
const templatePathToMerge = plugins.path.join(this.dirPath, dependency);
|
||||||
if (!plugins.smartfile.fs.isDirectory(templatePathToMerge)) {
|
if (!(await plugins.smartFs.directory(templatePathToMerge).exists())) {
|
||||||
console.log(
|
console.log(
|
||||||
`dependency ${dependency} resolves to ${templatePathToMerge} which ist NOT a directory`
|
`dependency ${dependency} resolves to ${templatePathToMerge} which ist NOT a directory`,
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const templateSmartfileArray = await plugins.smartfile.fs.fileTreeToObject(
|
const templateVirtualDirectoryToMerge = await plugins.smartFileFactory.virtualDirectoryFromPath(
|
||||||
templatePathToMerge,
|
templatePathToMerge,
|
||||||
'**/*'
|
|
||||||
);
|
);
|
||||||
this.templateSmartfileArray = this.templateSmartfileArray.concat(templateSmartfileArray);
|
const templateSmartfileArray = templateVirtualDirectoryToMerge.listFiles();
|
||||||
|
this.templateSmartfileArray = this.templateSmartfileArray.concat(
|
||||||
|
templateSmartfileArray,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +332,9 @@ export class ScafTemplate {
|
|||||||
executor: 'bash',
|
executor: 'bash',
|
||||||
});
|
});
|
||||||
for (const command of this.smartscafFile.runafter) {
|
for (const command of this.smartscafFile.runafter) {
|
||||||
await smartshellInstance.execInteractive(`cd ${this.destinationPath} && ${command}`);
|
await smartshellInstance.execInteractive(
|
||||||
|
`cd ${this.destinationPath} && ${command}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import * as path from 'path';
|
|||||||
import * as lik from '@push.rocks/lik';
|
import * as lik from '@push.rocks/lik';
|
||||||
import * as smartfile from '@push.rocks/smartfile';
|
import * as smartfile from '@push.rocks/smartfile';
|
||||||
import * as smartfm from '@push.rocks/smartfm';
|
import * as smartfm from '@push.rocks/smartfm';
|
||||||
|
import * as smartfs from '@push.rocks/smartfs';
|
||||||
import * as smarthbs from '@push.rocks/smarthbs';
|
import * as smarthbs from '@push.rocks/smarthbs';
|
||||||
import * as smartinteract from '@push.rocks/smartinteract';
|
import * as smartinteract from '@push.rocks/smartinteract';
|
||||||
import * as smartobject from '@push.rocks/smartobject';
|
import * as smartobject from '@push.rocks/smartobject';
|
||||||
@@ -9,11 +10,15 @@ import * as smartpromise from '@push.rocks/smartpromise';
|
|||||||
import * as smartyaml from '@push.rocks/smartyaml';
|
import * as smartyaml from '@push.rocks/smartyaml';
|
||||||
import * as smartshell from '@push.rocks/smartshell';
|
import * as smartshell from '@push.rocks/smartshell';
|
||||||
|
|
||||||
|
export const smartFileFactory = smartfile.SmartFileFactory.nodeFs();
|
||||||
|
export const smartFs = smartFileFactory.getSmartFs() as smartfs.SmartFs;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
path,
|
path,
|
||||||
lik,
|
lik,
|
||||||
smartfile,
|
smartfile,
|
||||||
smartfm,
|
smartfm,
|
||||||
|
smartfs,
|
||||||
smarthbs,
|
smarthbs,
|
||||||
smartinteract,
|
smartinteract,
|
||||||
smartobject,
|
smartobject,
|
||||||
|
|||||||
+5
-4
@@ -1,14 +1,15 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
"useDefineForClassFields": false,
|
"useDefineForClassFields": false,
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
|
"noImplicitAny": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"verbatimModuleSyntax": true
|
"verbatimModuleSyntax": true,
|
||||||
|
"types": ["node"]
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": ["dist_*/**/*.d.ts"]
|
||||||
"dist_*/**/*.d.ts"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user