Skip to content

Commit

Permalink
Adds build:app and build:web scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
willroberts committed Aug 16, 2022
1 parent a051216 commit 0d5d3a9
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 17 deletions.
20 changes: 19 additions & 1 deletion gulp/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
49 changes: 34 additions & 15 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)}`)
Expand All @@ -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)
Expand All @@ -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))
Expand All @@ -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']
Expand Down Expand Up @@ -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
Expand All @@ -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', '')
Expand All @@ -216,6 +234,7 @@ function versionedCdnUrl(cb) {
config.set('cdn', cdnUrl)
cb()
}
*/

gulp.task('build:release', gulp.series(
validateConfig,
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down

0 comments on commit 0d5d3a9

Please sign in to comment.