From 0d5d3a9104fc4afa1e6acc9cb467c91d37ff522d Mon Sep 17 00:00:00 2001 From: Will Roberts Date: Tue, 16 Aug 2022 17:33:53 -0400 Subject: [PATCH] Adds build:app and build:web scripts --- gulp/clean.js | 20 ++++++++++++++++++- gulpfile.babel.js | 49 ++++++++++++++++++++++++++++++++--------------- package.json | 4 +++- 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/gulp/clean.js b/gulp/clean.js index 0a799f6e1..ac56e24a5 100644 --- a/gulp/clean.js +++ b/gulp/clean.js @@ -9,7 +9,25 @@ export function all() { 'desktop/src', 'desktop/node_modules' ]) - return del('dist') +} + +// Cleans out app code only +export function app() { + return del('dist/src/duelyst.js') +} + +// Cleans out HTML/CSS only +export function web() { + return del([ + 'dist/src/duelyst.css', + 'dist/src/index.html', + 'dist/src/vendor.js' + ]) +} + +// Cleans out localization files only +export function locales() { + return del('dist/src/resources/locales') } // Cleans out desktop specific parts output folders diff --git a/gulpfile.babel.js b/gulpfile.babel.js index be43feed9..137e0280f 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -29,7 +29,7 @@ import * as git from './gulp/git' import * as docker from './gulp/docker' import * as shop from './gulp/shop' import * as localization from './gulp/localization' -import * as cdn from './gulp/cdn' +//import * as cdn from './gulp/cdn' import {opts,config,env,version,production,staging,development} from './gulp/shared' gutil.log(`${gutil.colors.red(`GULP :: env: ${env} :: version: ${version}`)}`) @@ -38,6 +38,9 @@ gutil.log(`${gutil.colors.yellow(`GULP :: minification = ${opts.minify}`)}`) // Define main tasks gulp.task('clean:all', clean.all) +gulp.task('clean:app', clean.app) +gulp.task('clean:web', clean.web) +gulp.task('clean:locales', clean.locales) gulp.task('clean:desktop', clean.desktop) gulp.task('clean:git', clean.git) gulp.task('css', css) @@ -49,7 +52,7 @@ gulp.task('vendor', vendor) gulp.task('rsx:imagemin', rsx.imageMin) gulp.task('rsx:imagemin:lossy', rsx.imageMinLossy) gulp.task('rsx:copy', rsx.copy) -gulp.task('rsx:copy:cdn', rsx.copyCdn) +//gulp.task('rsx:copy:cdn', rsx.copyCdn) gulp.task('rsx:copy:all', rsx.copyAll) gulp.task('rsx:packages', rsx.packages) gulp.task('rsx', gulp.series(rsx.packages,rsx.copy)) @@ -69,8 +72,8 @@ gulp.task('docker:push', docker.push) gulp.task('shop:paypal:buttons:SYNC:danger', shop.syncPaypalButtons) gulp.task('shop:paypal:buttons:add', shop.addPaypalButtons) gulp.task('localization:copy', localization.copy) -gulp.task('cdn:purgeAll', cdn.purgeAll) -gulp.task('cdn:purgeLocalization', cdn.purgeLocalization) +//gulp.task('cdn:purgeAll', cdn.purgeAll) +//gulp.task('cdn:purgeLocalization', cdn.purgeLocalization) // Define git helper tasks (master,staging,production) const branches = ['master', 'staging', 'production'] @@ -162,23 +165,36 @@ gulp.task('build', gulp.series( 'clean:all', 'source', 'rsx:copy', - 'rsx:copy:cdn', + //'rsx:copy:cdn', 'autowatch' )) +gulp.task('build:app', gulp.series( + 'clean:app', + 'js' +)) +gulp.task('build:web', gulp.series( + 'clean:web', + 'clean:locales', + 'html', + 'css', + 'vendor', + 'localization:copy' +)) + // register standalone page gulp.task('source:register', gulp.series(gulp.parallel('vendor','css','html:register'), 'localization:copy','rsx:packages', 'js:register')) gulp.task('build:register', gulp.series( 'clean:all', 'source:register', 'rsx:copy', - 'rsx:copy:cdn', + //'rsx:copy:cdn', 'autowatch' )) gulp.task('default', gulp.series('build')) // Release Builds (CI ready tasks) const ciTargets = ['staging','production'] -const cdnUrl = config.get('cdn') +//const cdnUrl = config.get('cdn') function validateConfig(cb) { // Ensure running build:release:${target} matches running config environemnt @@ -199,7 +215,9 @@ function validateConfigForDesktop(cb) { } cb() } -function overideCdnUrl(cb) { + +/* +function overrideCdnUrl(cb) { // We override the CDN url here // to prevent the CSS task from using for desktop app config.set('cdn', '') @@ -216,6 +234,7 @@ function versionedCdnUrl(cb) { config.set('cdn', cdnUrl) cb() } +*/ gulp.task('build:release', gulp.series( validateConfig, @@ -229,14 +248,14 @@ gulp.task('build:release', gulp.series( )) gulp.task('upload:release', gulp.series( 'rsx:copy', - 'rsx:copy:cdn', + //'rsx:copy:cdn', 'upload:main', 'upload:audio' )) gulp.task('build:release:versioned', gulp.series( validateConfig, 'clean:all', - versionedCdnUrl, + //versionedCdnUrl, 'source', 'source:register', 'rsx:build_urls', @@ -246,16 +265,16 @@ gulp.task('build:release:versioned', gulp.series( )) gulp.task('upload:release:versioned', gulp.series( 'rsx:copy', - 'rsx:copy:cdn', + //'rsx:copy:cdn', 'upload:main:versioned', 'upload:audio:versioned' )) gulp.task('desktop:build', gulp.series( validateConfigForDesktop, 'clean:all', - overideCdnUrl, + //overrideCdnUrl, 'source', - restoreCdnUrl, + //restoreCdnUrl, 'rsx:codex_urls', 'rsx:copy', 'desktop:setup', @@ -267,9 +286,9 @@ gulp.task('desktop:build', gulp.series( gulp.task('desktop:build:steam', gulp.series( validateConfigForDesktop, 'clean:all', - overideCdnUrl, + //overrideCdnUrl, 'source', - restoreCdnUrl, + //restoreCdnUrl, 'rsx:codex_urls', 'rsx:copy', 'desktop:setup', diff --git a/package.json b/package.json index ccdd96c47..728de3740 100644 --- a/package.json +++ b/package.json @@ -184,9 +184,11 @@ "worker": "node ./bin/worker", "worker-ui": "node ./bin/workerui", + "build:app": "node --max_old_space_size=2048 --stack-size=100000 node_modules/gulp/bin/gulp.js build:app --watch=false", "build:desktop": "node --max_old_space_size=2048 --stack-size=100000 node_modules/gulp/bin/gulp.js desktop:build", "build:release": "node --max_old_space_size=2048 --stack-size=100000 node_modules/gulp/bin/gulp.js build:release", "build:steam": "node --max_old_space_size=2048 --stack-size=100000 node_modules/gulp/bin/gulp.js desktop:build:steam", + "build:web": "node --max_old_space_size=2048 --stack-size=100000 node_modules/gulp/bin/gulp.js build:web --watch=false", "build": "node --max_old_space_size=2048 --stack-size=100000 node_modules/gulp/bin/gulp.js build --watch=false", "deploy:staging": "npm run push:master && npm run push:staging", "lint": "xo", @@ -202,7 +204,7 @@ "test:misc": "mocha test/unit/misc --recursive -t 5000", "test:sdk": "mocha test/unit/sdk --recursive -t 5000", "test": "mocha", - "watch": "node --max_old_space_size=2048 --stack-size=100000 node_modules/gulp/bin/gulp.js build", + "watch": "node --max_old_space_size=2048 --stack-size=100000 node_modules/gulp/bin/gulp.js build" }, "xo": { "esnext": true,