for pwa test

This commit is contained in:
cutls 2020-02-08 00:31:06 +09:00
parent b6255244ef
commit 547a7b7c7c

View File

@ -6,8 +6,8 @@ if (process.argv.indexOf('--automatic') === -1) {
} }
} }
var pwa = false var pwa = false
if (process.argv.indexOf('--pwa') === -1) { if (process.argv.indexOf('--pwa') > 0) {
pwa = true var pwa = true
} }
const path = require('path') const path = require('path')
const basefile = path.join(__dirname, '../../') const basefile = path.join(__dirname, '../../')
@ -139,10 +139,10 @@ function main(ver, basefile, pwa) {
source = source.replace(/@@lang@@/g, lang) source = source.replace(/@@lang@@/g, lang)
source = source.replace(/@@langlist@@/g, langstr) source = source.replace(/@@langlist@@/g, langstr)
if(pwa) { if(pwa) {
source = source.replace(/@@pwa@@/g, '<script>var pwa = true</script>') source = source.replace(/@@pwa@@/g, '<script>var pwa = true;</script>')
source = source.replace(/@@node_base@@/g, 'dependencies') source = source.replace(/@@node_base@@/g, 'dependencies')
} else { } else {
source = source.replace(/@@pwa@@/g, '<script>var pwa = false</script>') source = source.replace(/@@pwa@@/g, '<script>var pwa = false;</script>')
source = source.replace(/@@node_base@@/g, 'node_modules') source = source.replace(/@@node_base@@/g, 'node_modules')
} }
fs.writeFileSync(basefile + 'view/' + lang + '/' + pages[i], source) fs.writeFileSync(basefile + 'view/' + lang + '/' + pages[i], source)