test for pwa
This commit is contained in:
parent
b24d937152
commit
04e7088b7d
|
@ -13,7 +13,8 @@
|
||||||
"build:js": "node build.js",
|
"build:js": "node build.js",
|
||||||
"build": "node view/make/make.js --automatic && npx electron-builder",
|
"build": "node view/make/make.js --automatic && npx electron-builder",
|
||||||
"build:all": "npx electron-builder --win --linux",
|
"build:all": "npx electron-builder --win --linux",
|
||||||
"build:win": "npx electron-builder --win"
|
"build:win": "npx electron-builder --win",
|
||||||
|
"build:pwa": "node view/make/make.js --automatic --pwa"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"mastodon",
|
"mastodon",
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@@pwa@@
|
||||||
<script>
|
<script>
|
||||||
var ver = "@@versionLetter@@";
|
var ver = "@@versionLetter@@";
|
||||||
var gitHash = "@@gitHash@@"
|
var gitHash = "@@gitHash@@"
|
||||||
|
|
|
@ -5,9 +5,13 @@ if (process.argv.indexOf('--automatic') === -1) {
|
||||||
ver = input
|
ver = input
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var pwa = false
|
||||||
|
if (process.argv.indexOf('--pwa') === -1) {
|
||||||
|
pwa = true
|
||||||
|
}
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const basefile = path.join(__dirname, '../../')
|
const basefile = path.join(__dirname, '../../')
|
||||||
function main(ver, basefile) {
|
function main(ver, basefile, pwa) {
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const execSync = require('child_process').execSync
|
const execSync = require('child_process').execSync
|
||||||
let gitHash = execSync('git rev-parse HEAD')
|
let gitHash = execSync('git rev-parse HEAD')
|
||||||
|
@ -134,11 +138,16 @@ function main(ver, basefile) {
|
||||||
source = source.replace(/@@gitHashShort@@/g, gitHash.slice(0, 7))
|
source = source.replace(/@@gitHashShort@@/g, gitHash.slice(0, 7))
|
||||||
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) {
|
||||||
|
source = source.replace(/@@pwa@@/g, '<script>var pwa = true</script>')
|
||||||
|
} else {
|
||||||
|
source = source.replace(/@@pwa@@/g, '<script>var pwa = false</script>')
|
||||||
|
}
|
||||||
fs.writeFileSync(basefile + 'view/' + lang + '/' + pages[i], source)
|
fs.writeFileSync(basefile + 'view/' + lang + '/' + pages[i], source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
main(ver, basefile)
|
main(ver, basefile, pwa)
|
||||||
|
|
||||||
//if --watch, to yarn dev
|
//if --watch, to yarn dev
|
||||||
if (process.argv.indexOf('--watch') !== -1) {
|
if (process.argv.indexOf('--watch') !== -1) {
|
||||||
|
|
6
index.html
Normal file
6
index.html
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv=”refresh” content=”0;URL=’./view/ja'” />
|
||||||
|
</head>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user