[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 '' }}" variables.npm_scripts = "{{ 'package.json' | read | get('scripts') | tojson }}" # install [presets.nodejs.tasks.setup.npm] conditions = ["{{ 'package-lock.json' | file }}"] commands = ["{{ nvm }}npm install-clean"] # install legacy [presets.nodejs.tasks.setup.npm-legacy] conditions = ["{{ not ('package-lock.json' | file) }}"] commands = ["{{ nvm }}npm install"] # scripts [presets.nodejs.tasks."{{ npm_scripts | tojson }}".npm] commands = ["{{ nvm }}npm run {{ task }}"] # clean [presets.nodejs.tasks.clean.node_modules] conditions = ["{{ 'node_modules' | file }}"] 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", ]