Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
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
|
||||||
|
7
.gitignore
vendored
7
.gitignore
vendored
@@ -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
|
69
changelog.md
69
changelog.md
@@ -1,6 +1,28 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 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 +32,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 +41,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,222 +49,265 @@ 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.
|
||||||
- Started CLI integration.
|
- Started CLI integration.
|
||||||
- Added readme and CI tslint configuration.
|
- Added readme and CI tslint configuration.
|
||||||
- Performed initial setup and various update tasks.
|
- Performed initial setup and various update tasks.
|
||||||
|
@@ -30,4 +30,4 @@
|
|||||||
"tsdoc": {
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
package.json
11
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartscaf",
|
"name": "@push.rocks/smartscaf",
|
||||||
"version": "4.0.17",
|
"version": "4.0.19",
|
||||||
"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",
|
||||||
@@ -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",
|
||||||
@@ -64,5 +64,8 @@
|
|||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
],
|
],
|
||||||
"packageManager": "pnpm@10.7.0+sha512.6b865ad4b62a1d9842b61d674a393903b871d9244954f652b8842c2b553c72176b278f64c463e52d40fff8aba385c235c8c9ecf5cc7de4fd78b8bb6d49633ab6"
|
"packageManager": "pnpm@10.7.0+sha512.6b865ad4b62a1d9842b61d674a393903b871d9244954f652b8842c2b553c72176b278f64c463e52d40fff8aba385c235c8c9ecf5cc7de4fd78b8bb6d49633ab6",
|
||||||
|
"pnpm": {
|
||||||
|
"overrides": {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
432
readme.md
432
readme.md
@@ -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
|
|
||||||
await myTemplate.supplyVariables({
|
|
||||||
projectName: 'My New Project'
|
|
||||||
});
|
|
||||||
// Optionally, interactively ask for missing variables
|
|
||||||
// await myTemplate.askCliForMissingVariables();
|
|
||||||
await myTemplate.writeToDisk('<destination-path>'); // Scaffold!
|
|
||||||
}
|
|
||||||
|
|
||||||
scaffoldProject().then(() => console.log('Project scaffolded successfully!'));
|
async function createProject() {
|
||||||
```
|
// Load your template
|
||||||
|
const template = await ScafTemplate.createTemplateFromDir('./my-template');
|
||||||
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.
|
await template.readTemplateFromDir();
|
||||||
|
|
||||||
### Advanced Features
|
|
||||||
|
|
||||||
- **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.
|
|
||||||
|
|
||||||
- **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.
|
// Supply variables (overrides defaults)
|
||||||
|
await template.supplyVariables({
|
||||||
|
projectName: 'super-api',
|
||||||
|
description: 'Revolutionary API service',
|
||||||
|
className: 'SuperAPI',
|
||||||
|
author: 'John Doe'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Interactive mode - asks for any missing variables
|
||||||
|
await template.askCliForMissingVariables();
|
||||||
|
|
||||||
|
// Generate the project
|
||||||
|
await template.writeToDisk('./projects/super-api');
|
||||||
|
|
||||||
|
console.log('✨ Project scaffolded successfully!');
|
||||||
|
}
|
||||||
|
|
||||||
- **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.
|
createProject();
|
||||||
|
```
|
||||||
|
|
||||||
### Complete Feature Set and Use Cases
|
## Core Features
|
||||||
|
|
||||||
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:
|
### 🎯 Smart Variable System
|
||||||
|
|
||||||
- Creating project templates with varying levels of complexity and customization.
|
SmartScaf intelligently manages template variables through multiple layers:
|
||||||
- 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.
|
```typescript
|
||||||
|
const template = await ScafTemplate.createTemplateFromDir('./template');
|
||||||
|
await template.readTemplateFromDir();
|
||||||
|
|
||||||
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.
|
// 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
async generate(config: any, outputPath: string) {
|
||||||
|
// Supply configuration
|
||||||
|
await this.template.supplyVariables(config);
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate project
|
||||||
|
await this.template.writeToDisk(outputPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Template Validation
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Validate template before using
|
||||||
|
const template = await ScafTemplate.createTemplateFromDir('./template');
|
||||||
|
await template.readTemplateFromDir();
|
||||||
|
|
||||||
|
// Check template structure
|
||||||
|
if (template.templateSmartfileArray.length === 0) {
|
||||||
|
throw new Error('Template is empty!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify required variables
|
||||||
|
const required = template.requiredVariables;
|
||||||
|
const defaults = Object.keys(template.defaultVariables);
|
||||||
|
const missing = required.filter(v => !defaults.includes(v));
|
||||||
|
|
||||||
|
if (missing.length > 0) {
|
||||||
|
console.warn(`Template needs: ${missing.join(', ')}`);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Complex Variable Structures
|
||||||
|
|
||||||
|
SmartScaf supports nested object variables:
|
||||||
|
|
||||||
|
```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
|
||||||
|
|
||||||
@@ -94,4 +418,4 @@ Registered at District court Bremen HRB 35230 HB, Germany
|
|||||||
|
|
||||||
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||||
|
|
||||||
By 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.
|
By 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.
|
@@ -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 +1 @@
|
|||||||
# param1 10
|
# param1 10
|
||||||
|
@@ -1 +1 @@
|
|||||||
awesome!
|
awesome!
|
||||||
|
@@ -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
|
||||||
|
@@ -10,4 +10,4 @@ dependencies:
|
|||||||
- ../test_template_2
|
- ../test_template_2
|
||||||
|
|
||||||
runafter:
|
runafter:
|
||||||
- echo 'runafter'
|
- echo 'runafter'
|
||||||
|
@@ -1 +1 @@
|
|||||||
awesome!
|
awesome!
|
||||||
|
@@ -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}}
|
||||||
|
@@ -1 +1 @@
|
|||||||
# param1 {{node_version}}
|
# param1 {{node_version}}
|
||||||
|
@@ -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.19',
|
||||||
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.'
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,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, '**/*');
|
this.templateSmartfileArray = await plugins.smartfile.fs.fileTreeToObject(
|
||||||
|
this.dirPath,
|
||||||
|
'**/*',
|
||||||
|
);
|
||||||
|
|
||||||
// read .smartscaf.yml file
|
// read .smartscaf.yml file
|
||||||
let smartscafFile: interfaces.ISmartscafFile = {
|
let smartscafFile: interfaces.ISmartscafFile = {
|
||||||
@@ -61,15 +64,17 @@ export class ScafTemplate {
|
|||||||
runafter: [],
|
runafter: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
const smartscafSmartfile = this.templateSmartfileArray.find((smartfileArg) => {
|
const smartscafSmartfile = this.templateSmartfileArray.find(
|
||||||
return smartfileArg.parsedPath.base === '.smartscaf.yml';
|
(smartfileArg) => {
|
||||||
});
|
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(),
|
||||||
)),
|
)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -105,7 +110,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,7 +126,11 @@ 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,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,23 +148,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);
|
await plugins.smartfile.memory.smartfileArrayToFs(
|
||||||
|
smartfileArrayToWrite,
|
||||||
|
destinationDirArg,
|
||||||
|
);
|
||||||
await this.runScripts();
|
await this.runScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +185,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 +202,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 +229,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(
|
||||||
return smartfileArg.parsedPath.base === '.smartscaf.yml';
|
(smartfileArg) => {
|
||||||
});
|
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;
|
||||||
@@ -237,15 +260,18 @@ export class ScafTemplate {
|
|||||||
const templatePathToMerge = plugins.path.join(this.dirPath, dependency);
|
const templatePathToMerge = plugins.path.join(this.dirPath, dependency);
|
||||||
if (!plugins.smartfile.fs.isDirectory(templatePathToMerge)) {
|
if (!plugins.smartfile.fs.isDirectory(templatePathToMerge)) {
|
||||||
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 templateSmartfileArray =
|
||||||
templatePathToMerge,
|
await plugins.smartfile.fs.fileTreeToObject(
|
||||||
'**/*'
|
templatePathToMerge,
|
||||||
|
'**/*',
|
||||||
|
);
|
||||||
|
this.templateSmartfileArray = this.templateSmartfileArray.concat(
|
||||||
|
templateSmartfileArray,
|
||||||
);
|
);
|
||||||
this.templateSmartfileArray = this.templateSmartfileArray.concat(templateSmartfileArray);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +283,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}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"verbatimModuleSyntax": true
|
"verbatimModuleSyntax": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {}
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": ["dist_*/**/*.d.ts"]
|
||||||
"dist_*/**/*.d.ts"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user