config: universally define the app name in the package.json as "productName"
The goal is to have this as the only truth, as well as the version string.
This commit is contained in:
parent
e02e0d97e0
commit
8a5472e9ee
|
@ -1,3 +1,5 @@
|
|||
const packageJson = require('./package');
|
||||
|
||||
const ignoreList = [
|
||||
/^\/\.idea($|\/)/,
|
||||
/^\/\.vscode($|\/)/,
|
||||
|
@ -32,10 +34,13 @@ const ignoreList = [
|
|||
/^\/src\/.*tslint\.json/,
|
||||
];
|
||||
|
||||
const name = packageJson.productName;
|
||||
|
||||
module.exports = {
|
||||
packagerConfig: {
|
||||
icon: 'resources/icon',
|
||||
ignore: ignoreList,
|
||||
name: name,
|
||||
},
|
||||
electronRebuildConfig: {
|
||||
force: true,
|
||||
|
@ -43,6 +48,9 @@ module.exports = {
|
|||
makers: [
|
||||
{
|
||||
name: '@electron-forge/maker-squirrel',
|
||||
config: {
|
||||
name: name,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "renai",
|
||||
"productName": "Renai",
|
||||
"version": "1.0.0",
|
||||
"description": "Hentai Library Thingy",
|
||||
"private": true,
|
||||
|
|
|
@ -3,15 +3,13 @@
|
|||
"csp": {
|
||||
"default-src": ["self"],
|
||||
"style-src": ["unsafe-inline"]
|
||||
},
|
||||
"appBundle": "./bundle.js"
|
||||
}
|
||||
},
|
||||
"dev": {
|
||||
"csp": {
|
||||
"default-src": ["self"],
|
||||
"style-src": ["unsafe-inline"],
|
||||
"script-src": ["self", "unsafe-eval"]
|
||||
},
|
||||
"appBundle": "./bundle.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
content="{{#each csp}}{{@key}}{{#each this}} '{{this}}'{{/each}};{{/each}}"
|
||||
/>
|
||||
{{/if}}
|
||||
<title>Renai</title>
|
||||
<title>{{appTitle}}</title>
|
||||
</head>
|
||||
<body id="app"></body>
|
||||
<script src="{{appBundle}}"></script>
|
||||
|
|
|
@ -2,19 +2,22 @@ const handlebars = require('handlebars');
|
|||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const data = require('./data');
|
||||
const packageJson = require('../package');
|
||||
|
||||
function compile(isDevMode = false) {
|
||||
const templatePath = path.resolve(__dirname, 'index.html.handlebars');
|
||||
const template = fs.readFileSync(templatePath).toString();
|
||||
const compiled = handlebars.compile(template);
|
||||
let result;
|
||||
const delegate = handlebars.compile(template);
|
||||
let extendedData;
|
||||
if (isDevMode) {
|
||||
result = compiled(data.dev);
|
||||
extendedData = data.dev;
|
||||
} else {
|
||||
result = compiled(data.prod);
|
||||
extendedData = data.prod;
|
||||
}
|
||||
extendedData.appBundle = './bundle.js';
|
||||
extendedData.appTitle = packageJson.productName;
|
||||
|
||||
return result;
|
||||
return delegate(extendedData);
|
||||
}
|
||||
|
||||
exports.compile = compile;
|
||||
|
|
Loading…
Reference in New Issue