diff --git a/Jenkinsfile b/Jenkinsfile index 4bacaa6d2..2c04bcf16 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,9 +5,15 @@ def FROM_GIT def RUN_TESTS def RUN_BUILD +def BRANCH_ENV = [ + test: 'test', + master: 'production' +] + node { stage('Setup') { - env.NODE_ENV = 'dev' + env.BACK_REPLICAS = 1 + env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev' PROTECTED_BRANCH = [ 'dev', diff --git a/gulpfile.js b/gulpfile.js index 1c6fe2a2d..255b1ee05 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ require('require-yaml'); const gulp = require('gulp'); const PluginError = require('plugin-error'); @@ -67,19 +68,40 @@ back.description = `Starts backend and database service`; const defaultTask = gulp.parallel(front, back); defaultTask.description = `Starts all application services`; -function install() { - const install = require('gulp-install'); - const print = require('gulp-print'); +async function install() { + const spawn = require('child_process').spawn; - let npmArgs = []; - if (argv.ci) npmArgs = ['--no-audit', '--prefer-offline']; + console.log('-> Installing global packages...'); + await pnpmInstall(); - let packageFiles = ['front/package.json', 'print/package.json']; - return gulp.src(packageFiles) - .pipe(print(filepath => { - return `Installing packages in ${filepath}`; - })) - .pipe(install({npm: npmArgs})); + const modules = ['front', 'print']; + for (const module of modules) { + console.log(`-> Installing '${module}' packages...`); + await pnpmInstall(module); + } + + async function pnpmInstall(prefix) { + let args = ['install', '--prefer-offline']; + if (prefix) args = args.concat(['--prefix', prefix]); + + const options = { + stdio: [ + process.stdin, + process.stdout, + process.stderr + ] + }; + + await new Promise((resolve, reject) => { + const child = spawn('pnpm', args, options); + child.on('exit', code => { + if (code !== 0) + reject(new Error(`pnpm exit code ${code}`)); + else + resolve(code); + }); + }); + } } install.description = `Installs node dependencies in all directories`; diff --git a/package.json b/package.json index 73fa5fc7a..197c1094d 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "@babel/plugin-syntax-dynamic-import": "^7.7.4", "@babel/preset-env": "^7.11.0", "@babel/register": "^7.7.7", - "@verdnatura/myt": "^1.6.5", + "@verdnatura/myt": "^1.6.6", "angular-mocks": "^1.7.9", "babel-jest": "^26.0.1", "babel-loader": "^8.2.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 83904cf41..19f57caf9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -128,8 +128,8 @@ devDependencies: specifier: ^7.7.7 version: 7.23.7(@babel/core@7.23.9) '@verdnatura/myt': - specifier: ^1.6.5 - version: 1.6.5 + specifier: ^1.6.6 + version: 1.6.6 angular-mocks: specifier: ^1.7.9 version: 1.8.3 @@ -2633,8 +2633,8 @@ packages: dev: false optional: true - /@verdnatura/myt@1.6.5: - resolution: {integrity: sha512-0h7FvhSewd2W9EOymc59YymZJOBfCXmY5CWNFhol1yBfWSOOF9JAEE9DKRMbKaMqd/5Dy9LriS5PYOfeqm3HjA==} + /@verdnatura/myt@1.6.6: + resolution: {integrity: sha512-5KHi9w1baEQ6Oe/pAR8pl0oD5yyJJuPirE+ZhygreUGGURfig4VekjhlGE3WEbWquDiIAMi89J1VQ+1Ba0+jQw==} hasBin: true dependencies: '@sqltools/formatter': 1.2.5