feat(preset): add preset tasks template support
test / test (push) Failing after 1m49s

This commit is contained in:
2026-10-16 15:38:58 +03:00
parent 6c15ab4d0f
commit dc566087fb
2 changed files with 52 additions and 41 deletions
+7 -15
View File
@@ -2,6 +2,7 @@
conditions = ["{{ 'package.json' | file }}"]
variables.use_nvm = "{{ (((('home' | env) + '/.nvm/nvm.sh') | file) and ('.nvmrc' | file)) | bool }}"
variables.nvm = "{{ '. ~/.nvm/nvm.sh && nvm use && ' if use_nvm | bool else '' }}"
variables.npm_scripts = "{{ 'package.json' | read | get('scripts') | tojson }}"
# install
[presets.nodejs.tasks.setup.npm]
@@ -13,20 +14,9 @@ commands = ["{{ nvm }}npm install-clean"]
conditions = ["{{ not ('package-lock.json' | file) }}"]
commands = ["{{ nvm }}npm install"]
# test
[presets.nodejs.tasks.test.jest]
conditions = ["{{ 'node_modules/jest' | file }}"]
commands = ["{{ nvm }}npx jest"]
# build
[presets.nodejs.tasks.build.npm]
conditions = ["{{ 'package.json' | read | get('scripts.build') }}"]
commands = ["{{ nvm }}npm run build"]
# publish
[presets.nodejs.tasks.publish.npm]
conditions = ["{{ 'package.json' | read | get('scripts.publish') }}"]
commands = ["{{ nvm }}npm run publish"]
# scripts
[presets.nodejs.tasks."{{ npm_scripts | tojson }}".npm]
commands = ["{{ nvm }}npm run {{ task }}"]
# clean
[presets.nodejs.tasks.clean.node_modules]
@@ -36,4 +26,6 @@ commands = ["rm -rf node_modules"]
# version
[presets.nodejs.tasks.version.npm]
conditions = ["{{ version }}"]
commands = ["{{ nvm }}npm version {{ version }} --allow-same-version --commit-hooks false --git-tag-version false"]
commands = [
"{{ nvm }}npm version {{ version }} --allow-same-version --commit-hooks false --git-tag-version false",
]