var gulp = require('gulp'); const webpack = require('webpack-stream'); var sftp = require('gulp-sftp'); //const named = require('vinyl-named'); //const through = require('through2'); const sourcemaps = require('gulp-sourcemaps'); var exec = require('child_process').exec; require('gulp-submodule')(gulp); var HubRegistry = require('gulp-hub'); /* load some gulpfiles into the registry */ var hub = new HubRegistry(['./src/customApi/gulpfile.js', // './src/modules/gtw/gulpfile.js', // './src/modules/matrixLogin/gulpfile.js', // './src/modules/parentActivities/gulpfile.js', // './src/modules/scopeControllerTicketConsole/gulpfile.js', // './src/modules/removeCustomer/gulpfile.js', // './src/modules/removeAssetNav/gulpfile.js', // './src/modules/relatedItemList/gulpfile.js', // './src/modules/customEntityAssetLink/gulpfile.js', // './src/modules/changeIncidentLabelSRQ/gulpfile.js', // './src/modules/autoAssign/gulpfile.js', // './src/modules/productCatWidget/gulpfile.js', // './src/modules/adressService/gulpfile.js', // './src/modules/ticketsNearBy/gulpfile.js', // './src/modules/ticketDistanceService/gulpfile.js', // './src/modules/mailLink/gulpfile.js', // './src/modules/parentShareTicket/gulpfile.js', // './src/modules/taskStatus/gulpfile.js', // './src/modules/taskEmail/gulpfile.js', // './src/modules/customChangeProblemLink/gulpfile.js', './src/modules/homeButton/gulpfile.js', //'./src/modules/test/gulpfile.js', './src/modules/ccsServiceNtt/gulpfile.js', './src/modules/routeModifier/gulpfile.js', './src/modules/navigationModifier/gulpfile.js', './src/modules/pwaTicketControllerAsfinag/gulpfile.js', './src/modules/removeChat/gulpfile.js']); /* tell gulp to use the tasks just loaded */ gulp.registry(hub); gulp.task('set-dev-node-env', function(done) { process.env.WEBPACK_MODE = 'development'; done(); }); gulp.task('set-prod-node-env', function(done) { process.env.WEBPACK_MODE = 'production'; done(); }); gulp.task('set-prod-node-env', function(done) { process.env.WEBPACK_MODE = 'production'; //process.env.mode = "production"; done(); }); gulp.task('upload', function () { return gulp.src('dist/**/*') .pipe(sftp({ host: "vie-vm-259", user: 'remedy2', pass: 'remedy2', remotePath: "/opt/smartit/Smart_IT/Smart_IT/smartit/current/smart-it-full/" })); }); gulp.task('upload-helix', function (cb) { exec('kubectl cp dist/NTTDATA smartit-master-859974cd7c-hhlsw:/opt/bmc/Smart_IT/Smart_IT/smartit/current/smart-it-full -n nttokd1-dev -c smartit', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }); }) gulp.task('upload-helix-index', function (cb) { exec('kubectl cp helix/dev/index.html smartit-master-859974cd7c-hhlsw:/opt/bmc/Smart_IT/Smart_IT/smartit/current/smart-it-full/index.html -n nttokd1-dev -c smartit', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }); }) gulp.task('upload-helix-templates', function (cb) { exec('kubectl cp helix/dev/templates.min.js smartit-master-859974cd7c-hhlsw:/opt/bmc/Smart_IT/Smart_IT/smartit/current/smart-it-full/scripts/app/templates.min.js -n nttokd1-dev -c smartit', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }); }) gulp.task('upload-helix-prod', function (cb) { exec('kubectl cp dist/NTTDATA smartit-master-859974cd7c-hhlsw:/opt/bmc/Smart_IT/Smart_IT/smartit/current/smart-it -n nttokd1-dev -c smartit', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }); }) gulp.task('upload-helix-prod-index', function (cb) { exec('kubectl cp helix/prod/index.html smartit-master-859974cd7c-hhlsw:/opt/bmc/Smart_IT/Smart_IT/smartit/current/smart-it/index.html -n nttokd1-dev -c smartit', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }); }) gulp.task('build-dev', gulp.series('set-dev-node-env','build','copyResources','upload')); gulp.task('build-dev-helix', gulp.series('set-dev-node-env','build','copyResources','upload-helix', 'upload-helix-index', 'upload-helix-templates')); gulp.task('build-prod', gulp.series('set-prod-node-env','build','copyResources','upload')); gulp.task('build-prod-helix', gulp.series('set-prod-node-env','build','copyResources','upload-helix-prod', 'upload-helix-prod-index'));