Compare commits
35 Commits
Author | SHA1 | Date | |
---|---|---|---|
297e44a5e3 | |||
757bf763df | |||
4c158ba0ea | |||
831ab25a6f | |||
8fb95634df | |||
c8eeb4b8e6 | |||
56df0d3246 | |||
883ecff182 | |||
9589ad6146 | |||
c2d4f9684c | |||
d2b325889d | |||
f6cd3c245b | |||
1529ac12e4 | |||
b4b5e52799 | |||
7de1cfbb6f | |||
f426e110f0 | |||
02e9cdff98 | |||
576ee88283 | |||
d1886a0966 | |||
9f8b14c6fe | |||
e64e610092 | |||
86f19de7d8 | |||
1b6b45f15f | |||
a8d2954689 | |||
6071ae5de3 | |||
a664f3da76 | |||
5d3b4585b0 | |||
11abf9aafd | |||
1b86228bc4 | |||
8a5097ba50 | |||
2dae7b1200 | |||
909cceb1a5 | |||
5f1bc8dc29 | |||
d33f943fc6 | |||
e4c2d86dbc |
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
name: Default (not tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags-ignore:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install pnpm and npmci
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
|
||||||
|
- name: Run npm prepare
|
||||||
|
run: npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
name: Default (tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm publish
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Code quality
|
||||||
|
run: |
|
||||||
|
npmci command npm install -g typescript
|
||||||
|
npmci npm install
|
||||||
|
|
||||||
|
- name: Trigger
|
||||||
|
run: npmci trigger
|
||||||
|
|
||||||
|
- name: Build docs and upload artifacts
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
pnpm install -g @gitzone/tsdoc
|
||||||
|
npmci command tsdoc
|
||||||
|
continue-on-error: true
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -15,8 +15,6 @@ node_modules/
|
|||||||
|
|
||||||
# builds
|
# builds
|
||||||
dist/
|
dist/
|
||||||
dist_web/
|
dist_*/
|
||||||
dist_serve/
|
|
||||||
dist_ts_web/
|
|
||||||
|
|
||||||
# custom
|
# custom
|
120
.gitlab-ci.yml
120
.gitlab-ci.yml
@ -1,120 +0,0 @@
|
|||||||
# gitzone ci_default
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .npmci_cache/
|
|
||||||
key: "$CI_BUILD_STAGE"
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- metadata
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
snyk:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install -g snyk
|
|
||||||
- npmci command npm install --ignore-scripts
|
|
||||||
- npmci command snyk test
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# test stage
|
|
||||||
# ====================
|
|
||||||
|
|
||||||
testStable:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
testBuild:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run build
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# metadata stage
|
|
||||||
# ====================
|
|
||||||
codequality:
|
|
||||||
stage: metadata
|
|
||||||
allow_failure: true
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g tslint typescript
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
|
||||||
image: hosttoday/ht-docker-dbase:npmci
|
|
||||||
services:
|
|
||||||
- docker:stable-dind
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command tsdoc
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
allow_failure: true
|
|
23
.snyk
23
.snyk
@ -1,23 +0,0 @@
|
|||||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
|
||||||
version: v1.13.5
|
|
||||||
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
|
|
||||||
ignore:
|
|
||||||
SNYK-JS-JSYAML-173999:
|
|
||||||
- '@pushrocks/smartfm > gray-matter > js-yaml':
|
|
||||||
reason: None given
|
|
||||||
expires: '2019-10-10T16:23:38.993Z'
|
|
||||||
- '@pushrocks/smartyaml > js-yaml':
|
|
||||||
reason: None given
|
|
||||||
expires: '2019-10-10T16:23:38.993Z'
|
|
||||||
SNYK-JS-JSYAML-174129:
|
|
||||||
- '@pushrocks/smartfm > gray-matter > js-yaml':
|
|
||||||
reason: None given
|
|
||||||
expires: '2019-10-10T16:23:38.993Z'
|
|
||||||
- '@pushrocks/smartyaml > js-yaml':
|
|
||||||
reason: None given
|
|
||||||
expires: '2019-10-10T16:23:38.993Z'
|
|
||||||
SNYK-JS-LODASH-450202:
|
|
||||||
- '@pushrocks/smartinteract > inquirer > lodash':
|
|
||||||
reason: None given
|
|
||||||
expires: '2019-10-10T16:23:38.993Z'
|
|
||||||
patch: {}
|
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${relativeFile}"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "test.ts",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"args": [
|
|
||||||
"test/test.ts"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@ -11,7 +11,13 @@
|
|||||||
},
|
},
|
||||||
"gitzone": {
|
"gitzone": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"description": "settings for gitzone"
|
"description": "settings for gitzone",
|
||||||
|
"properties": {
|
||||||
|
"projectType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,13 @@
|
|||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
},
|
},
|
||||||
"gitzone": {
|
"gitzone": {
|
||||||
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartscaf",
|
"gitrepo": "smartscaf",
|
||||||
"shortDescription": "scaffold projects quickly",
|
"description": "scaffold projects quickly",
|
||||||
"npmPackagename": "@pushrocks/smartscaf",
|
"npmPackagename": "@push.rocks/smartscaf",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1921
package-lock.json
generated
1921
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
57
package.json
57
package.json
@ -1,13 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartscaf",
|
"name": "@push.rocks/smartscaf",
|
||||||
"version": "3.0.9",
|
"version": "4.0.15",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "scaffold projects quickly",
|
"description": "scaffold projects quickly",
|
||||||
"main": "dist/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild)"
|
"build": "(tsbuild --web --allowimplicitany)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -25,33 +26,37 @@
|
|||||||
"npm"
|
"npm"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.17",
|
"@gitzone/tsbuild": "^2.1.66",
|
||||||
"@gitzone/tsrun": "^1.2.8",
|
"@gitzone/tsrun": "^1.2.44",
|
||||||
"@gitzone/tstest": "^1.0.28",
|
"@gitzone/tstest": "^1.0.77",
|
||||||
"@pushrocks/tapbundle": "^3.0.13",
|
"@push.rocks/tapbundle": "^5.0.12",
|
||||||
"@types/node": "^12.7.9",
|
"@types/node": "^20.4.4"
|
||||||
"tslint": "^5.20.0",
|
|
||||||
"tslint-config-prettier": "^1.18.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^3.0.11",
|
"@push.rocks/lik": "^6.0.3",
|
||||||
"@pushrocks/smartfile": "^7.0.6",
|
"@push.rocks/smartfile": "^10.0.28",
|
||||||
"@pushrocks/smartfm": "^2.0.4",
|
"@push.rocks/smartfm": "^2.0.4",
|
||||||
"@pushrocks/smarthbs": "^2.0.8",
|
"@push.rocks/smarthbs": "^3.0.3",
|
||||||
"@pushrocks/smartinteract": "^2.0.4",
|
"@push.rocks/smartinteract": "^2.0.14",
|
||||||
"@pushrocks/smartpromise": "^3.0.6",
|
"@push.rocks/smartparam": "^1.1.10",
|
||||||
"@pushrocks/smartshell": "^2.0.25",
|
"@push.rocks/smartpromise": "^4.0.2",
|
||||||
"@pushrocks/smartyaml": "^2.0.3"
|
"@push.rocks/smartshell": "^3.0.3",
|
||||||
|
"@push.rocks/smartyaml": "^2.0.5"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/*",
|
"ts/**/*",
|
||||||
"ts_web/*",
|
"ts_web/**/*",
|
||||||
"dist/*",
|
"dist/**/*",
|
||||||
"dist_web/*",
|
"dist_*/**/*",
|
||||||
"dist_ts_web/*",
|
"dist_ts/**/*",
|
||||||
"assets/*",
|
"dist_ts_web/**/*",
|
||||||
|
"assets/**/*",
|
||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
|
],
|
||||||
|
"type": "module",
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
4980
pnpm-lock.yaml
generated
Normal file
4980
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
39
readme.md
39
readme.md
@ -1,20 +1,26 @@
|
|||||||
# @pushrocks/smartscaf
|
# @push.rocks/smartscaf
|
||||||
scaffold projects quickly
|
scaffold projects quickly
|
||||||
|
|
||||||
## Availabililty and Links
|
## Availabililty and Links
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartscaf)
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartscaf)
|
||||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartscaf)
|
* [gitlab.com (source)](https://gitlab.com/push.rocks/smartscaf)
|
||||||
* [github.com (source mirror)](https://github.com/pushrocks/smartscaf)
|
* [github.com (source mirror)](https://github.com/push.rocks/smartscaf)
|
||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartscaf/)
|
* [docs (typedoc)](https://push.rocks.gitlab.io/smartscaf/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[](https://gitlab.com/pushrocks/smartscaf/commits/master)
|
|
||||||
[](https://gitlab.com/pushrocks/smartscaf/commits/master)
|
Status Category | Status Badge
|
||||||
[](https://www.npmjs.com/package/@pushrocks/smartscaf)
|
-- | --
|
||||||
[](https://snyk.io/test/npm/@pushrocks/smartscaf)
|
GitLab Pipelines | [](https://lossless.cloud)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
npm | [](https://lossless.cloud)
|
||||||
[](https://prettier.io/)
|
Snyk | [](https://lossless.cloud)
|
||||||
|
TypeScript Support | [](https://lossless.cloud)
|
||||||
|
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
Code Style | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||||
|
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@ -27,9 +33,12 @@ For further information read the linked docs at the top of this README.
|
|||||||
|
|
||||||
[](https://)
|
[](https://)
|
||||||
|
|
||||||
|
## Contribution
|
||||||
|
|
||||||
|
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
## Legal
|
||||||
|
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||||
|
|
||||||
[](https://maintainedby.lossless.com)
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import * as smartscaf from '../ts/index';
|
import * as smartscaf from '../ts/index.js';
|
||||||
|
|
||||||
process.env.CI = 'true';
|
process.env.CI = 'true';
|
||||||
|
|
||||||
@ -9,12 +9,12 @@ let testScafTemplate: smartscaf.ScafTemplate;
|
|||||||
|
|
||||||
tap.test('should create new Smartscaf instance', async () => {
|
tap.test('should create new Smartscaf instance', async () => {
|
||||||
testScafTemplate = new smartscaf.ScafTemplate('./test/test_template');
|
testScafTemplate = new smartscaf.ScafTemplate('./test/test_template');
|
||||||
expect(testScafTemplate).to.be.instanceof(smartscaf.ScafTemplate);
|
expect(testScafTemplate).toBeInstanceOf(smartscaf.ScafTemplate);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('Smartscaf instance -> should read a template directory', async () => {
|
tap.test('Smartscaf instance -> should read a template directory', async () => {
|
||||||
await testScafTemplate.readTemplateFromDir();
|
await testScafTemplate.readTemplateFromDir();
|
||||||
expect(testScafTemplate.templateSmartfileArray.length).to.equal(6);
|
expect(testScafTemplate.templateSmartfileArray.length).toEqual(6);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('smartfile -> should accept variables', async () => {
|
tap.test('smartfile -> should accept variables', async () => {
|
||||||
|
3
test/test_output/anothername.yml
Normal file
3
test/test_output/anothername.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# this is a wow
|
||||||
|
# this is a here
|
||||||
|
# this is a undefined variable
|
@ -1,3 +1,6 @@
|
|||||||
|
---
|
||||||
|
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}}
|
||||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@push.rocks/smartscaf',
|
||||||
|
version: '4.0.15',
|
||||||
|
description: 'scaffold projects quickly'
|
||||||
|
}
|
@ -1 +1 @@
|
|||||||
export * from './smartscaf.classes.smartscaf';
|
export * from './smartscaf.classes.smartscaf.js';
|
||||||
|
@ -1 +1 @@
|
|||||||
export * from './smartscaf';
|
export * from './smartscaf.js';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export interface ISmartscafFile {
|
export interface ISmartscafFile {
|
||||||
defaults: {[key:string]: string};
|
defaults: { [key: string]: string };
|
||||||
dependencies: {
|
dependencies: {
|
||||||
merge: string[];
|
merge: string[];
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
import * as plugins from './smartscaf.plugins';
|
import * as plugins from './smartscaf.plugins.js';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces/index.js';
|
||||||
import * as helpers from './smartscaf.helpers';
|
|
||||||
|
|
||||||
// interfaces
|
|
||||||
import { Smartfile } from '@pushrocks/smartfile';
|
|
||||||
|
|
||||||
export interface ScafTemplateContructorOptions {
|
export interface ScafTemplateContructorOptions {
|
||||||
name?: string;
|
name?: string;
|
||||||
@ -12,7 +8,9 @@ export interface ScafTemplateContructorOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ScafTemplate {
|
export class ScafTemplate {
|
||||||
public static async createTemplateFromDir() {}
|
public static async createTemplateFromDir(dirPathArg: string) {
|
||||||
|
return new ScafTemplate(dirPathArg);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the name of the template
|
* the name of the template
|
||||||
@ -38,7 +36,7 @@ export class ScafTemplate {
|
|||||||
/**
|
/**
|
||||||
* the files of the template as array of Smartfiles
|
* the files of the template as array of Smartfiles
|
||||||
*/
|
*/
|
||||||
public templateSmartfileArray: Smartfile[];
|
public templateSmartfileArray: plugins.smartfile.Smartfile[];
|
||||||
public requiredVariables: string[];
|
public requiredVariables: string[];
|
||||||
public defaultVariables: any;
|
public defaultVariables: any;
|
||||||
public suppliedVariables: any = {};
|
public suppliedVariables: any = {};
|
||||||
@ -58,19 +56,21 @@ export class ScafTemplate {
|
|||||||
let smartscafFile: interfaces.ISmartscafFile = {
|
let smartscafFile: interfaces.ISmartscafFile = {
|
||||||
defaults: {},
|
defaults: {},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
merge: []
|
merge: [],
|
||||||
},
|
},
|
||||||
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(smartscafSmartfile.contentBuffer.toString())
|
...(await plugins.smartyaml.yamlStringToObject(
|
||||||
|
smartscafSmartfile.contentBuffer.toString()
|
||||||
|
)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.smartscafFile = smartscafFile;
|
this.smartscafFile = smartscafFile;
|
||||||
@ -88,7 +88,7 @@ export class ScafTemplate {
|
|||||||
public async supplyVariables(variablesArg) {
|
public async supplyVariables(variablesArg) {
|
||||||
this.suppliedVariables = {
|
this.suppliedVariables = {
|
||||||
...this.suppliedVariables,
|
...this.suppliedVariables,
|
||||||
...variablesArg
|
...variablesArg,
|
||||||
};
|
};
|
||||||
this.missingVariables = await this._checkSuppliedVariables();
|
this.missingVariables = await this._checkSuppliedVariables();
|
||||||
}
|
}
|
||||||
@ -111,14 +111,15 @@ export class ScafTemplate {
|
|||||||
return 'undefined variable';
|
return 'undefined variable';
|
||||||
}
|
}
|
||||||
})(),
|
})(),
|
||||||
message: `What is the value of ${missingVariable}?`
|
message: `What is the value of ${missingVariable}?`,
|
||||||
}
|
},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
const answerBucket = await localSmartInteract.runQueue();
|
const answerBucket = await localSmartInteract.runQueue();
|
||||||
await answerBucket.answerMap.forEach(async answer => {
|
const answers = answerBucket.getAllAnswers();
|
||||||
await helpers.deepAddToObject(this.suppliedVariables, answer.name, answer.value);
|
for (const answer of answers) {
|
||||||
});
|
await plugins.smartparam.smartAdd(this.suppliedVariables, answer.name, answer.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,7 +128,7 @@ export class ScafTemplate {
|
|||||||
*/
|
*/
|
||||||
public async writeToDisk(destinationDirArg) {
|
public async writeToDisk(destinationDirArg) {
|
||||||
this.destinationPath = destinationDirArg;
|
this.destinationPath = destinationDirArg;
|
||||||
const smartfileArrayToWrite: Smartfile[] = [];
|
const smartfileArrayToWrite: plugins.smartfile.Smartfile[] = [];
|
||||||
for (const smartfile of this.templateSmartfileArray) {
|
for (const smartfile of this.templateSmartfileArray) {
|
||||||
// lets filter out template files
|
// lets filter out template files
|
||||||
if (smartfile.path === '.smartscaf.yml') {
|
if (smartfile.path === '.smartscaf.yml') {
|
||||||
@ -140,14 +141,14 @@ export class ScafTemplate {
|
|||||||
|
|
||||||
// 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(parsedTemplate.content);
|
smartfile.contents = Buffer.from(await plugins.smarthbs.postprocess(parsedTemplate.content));
|
||||||
smartfileArrayToWrite.push(smartfile);
|
smartfileArrayToWrite.push(smartfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +208,7 @@ 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';
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -248,12 +249,12 @@ export class ScafTemplate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async runScripts () {
|
private async runScripts() {
|
||||||
if (!this.destinationPath) {
|
if (!this.destinationPath) {
|
||||||
throw new Error('cannot run scripts without an destinationdir');
|
throw new Error('cannot run scripts without an destinationdir');
|
||||||
}
|
}
|
||||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||||
executor: 'bash'
|
executor: 'bash',
|
||||||
});
|
});
|
||||||
for (const command of this.smartscafFile.runafter) {
|
for (const command of this.smartscafFile.runafter) {
|
||||||
await smartshellInstance.exec(`cd ${this.destinationPath} && ${command}`);
|
await smartshellInstance.exec(`cd ${this.destinationPath} && ${command}`);
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
import * as plugins from './smartscaf.plugins';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* adds a variable in string dot notation to an already more or less expanded object
|
|
||||||
*/
|
|
||||||
export let deepAddToObject = async (objectArg, varStringArg: string, valueArg: string) => {
|
|
||||||
let varNamesArray = varStringArg.split('.');
|
|
||||||
let referencePointer = objectArg;
|
|
||||||
for (let i = 0; i !== varNamesArray.length; i++) {
|
|
||||||
let varName = varNamesArray[i];
|
|
||||||
|
|
||||||
// is there a next variable ?
|
|
||||||
let varNameNext: string = (() => {
|
|
||||||
if (varNamesArray[i + 1]) {
|
|
||||||
return varNamesArray[i + 1];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
})();
|
|
||||||
|
|
||||||
// build the tree in suppliedVariables
|
|
||||||
if (!referencePointer[varName] && !varNameNext) {
|
|
||||||
referencePointer[varName] = valueArg;
|
|
||||||
referencePointer = null;
|
|
||||||
} else if (!referencePointer[varName] && varNameNext) {
|
|
||||||
referencePointer[varName] = {};
|
|
||||||
referencePointer = referencePointer[varName];
|
|
||||||
} else if (referencePointer[varName] && varNameNext) {
|
|
||||||
referencePointer = referencePointer[varName];
|
|
||||||
} else {
|
|
||||||
throw new Error('Something is strange!');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,11 +1,23 @@
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as lik from '@pushrocks/lik';
|
import * as lik from '@push.rocks/lik';
|
||||||
import * as smartfile from '@pushrocks/smartfile';
|
import * as smartfile from '@push.rocks/smartfile';
|
||||||
import * as smartfm from '@pushrocks/smartfm';
|
import * as smartfm from '@push.rocks/smartfm';
|
||||||
import * as smarthbs from '@pushrocks/smarthbs';
|
import * as smarthbs from '@push.rocks/smarthbs';
|
||||||
import * as smartinteract from '@pushrocks/smartinteract';
|
import * as smartinteract from '@push.rocks/smartinteract';
|
||||||
import * as smartq from '@pushrocks/smartpromise';
|
import * as smartparam from '@push.rocks/smartparam';
|
||||||
import * as smartyaml from '@pushrocks/smartyaml';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as smartshell from '@pushrocks/smartshell';
|
import * as smartyaml from '@push.rocks/smartyaml';
|
||||||
|
import * as smartshell from '@push.rocks/smartshell';
|
||||||
|
|
||||||
export { path, lik, smartfile, smartfm, smarthbs, smartinteract, smartq, smartyaml, smartshell };
|
export {
|
||||||
|
path,
|
||||||
|
lik,
|
||||||
|
smartfile,
|
||||||
|
smartfm,
|
||||||
|
smarthbs,
|
||||||
|
smartinteract,
|
||||||
|
smartparam,
|
||||||
|
smartpromise,
|
||||||
|
smartyaml,
|
||||||
|
smartshell,
|
||||||
|
};
|
||||||
|
9
tsconfig.json
Normal file
9
tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022",
|
||||||
|
"moduleResolution": "nodenext"
|
||||||
|
}
|
||||||
|
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [true, "always"],
|
|
||||||
"no-console": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"member-ordering": {
|
|
||||||
"options":{
|
|
||||||
"order": [
|
|
||||||
"static-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultSeverity": "warning"
|
|
||||||
}
|
|
Reference in New Issue
Block a user