feat: update default presets

This commit is contained in:
2026-09-15 17:21:23 +03:00
parent 06c3bc4e18
commit 5cf71fcae1
10 changed files with 58 additions and 18 deletions
+8 -6
View File
@@ -1,30 +1,32 @@
[presets.nodejs]
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 '' }}"
# install
[presets.nodejs.tasks.setup.npm]
conditions = ["{{ 'package-lock.json' | file }}"]
commands = ["npm install-clean"]
commands = ["{{ nvm }}npm install-clean"]
# install legacy
[presets.nodejs.tasks.setup.npm-legacy]
conditions = ["{{ not ('package-lock.json' | file) }}"]
commands = ["npm install"]
commands = ["{{ nvm }}npm install"]
# test
[presets.nodejs.tasks.test.jest]
conditions = ["{{ 'node_modules/jest' | file }}"]
commands = ["npx jest"]
commands = ["{{ nvm }}npx jest"]
# build
[presets.nodejs.tasks.build.npm]
conditions = ["{{ 'package.json' | read | get('scripts.build') }}"]
commands = ["npm run build"]
commands = ["{{ nvm }}npm run build"]
# publish
[presets.nodejs.tasks.publish.npm]
conditions = ["{{ 'package.json' | read | get('scripts.publish') }}"]
commands = ["npm run publish"]
commands = ["{{ nvm }}npm run publish"]
# clean
[presets.nodejs.tasks.clean.node_modules]
@@ -34,4 +36,4 @@ commands = ["rm -rf node_modules"]
# version
[presets.nodejs.tasks.version.npm]
conditions = ["{{ version }}"]
commands = ["npm version {{ version }} --allow-same-version"]
commands = ["{{ nvm }}npm version {{ version }} --allow-same-version"]