centralize version info for building. change 'SH' vars to 'PROMPT'

This commit is contained in:
sawka 2023-01-17 09:59:31 -08:00
parent daeef7a4d0
commit 9fd803bc11
6 changed files with 19 additions and 15 deletions

View File

@ -8,7 +8,9 @@ import {GlobalModel} from "./model";
import {v4 as uuidv4} from "uuid"; import {v4 as uuidv4} from "uuid";
// @ts-ignore // @ts-ignore
let VERSION = __SHVERSION__; let VERSION = __PROMPT_VERSION__;
// @ts-ignore
let BUILD = __PROMPT_BUILD__;
let jbmFontNormal = new FontFace("JetBrains Mono", "url('static/fonts/jetbrains-mono-v13-latin-regular.woff2')", {style: "normal", weight: "400"}); let jbmFontNormal = new FontFace("JetBrains Mono", "url('static/fonts/jetbrains-mono-v13-latin-regular.woff2')", {style: "normal", weight: "400"});
let jbmFont200 = new FontFace("JetBrains Mono", "url('static/fonts/jetbrains-mono-v13-latin-200.woff2')", {style: "normal", weight: "200"}); let jbmFont200 = new FontFace("JetBrains Mono", "url('static/fonts/jetbrains-mono-v13-latin-200.woff2')", {style: "normal", weight: "200"});
@ -42,4 +44,4 @@ document.addEventListener("DOMContentLoaded", () => {
(window as any).mobx = mobx; (window as any).mobx = mobx;
(window as any).sprintf = sprintf; (window as any).sprintf = sprintf;
console.log("PROMPT", VERSION) console.log("PROMPT", VERSION, BUILD)

2
version.js Normal file
View File

@ -0,0 +1,2 @@
const VERSION = "v0.1.1";
module.exports = VERSION;

View File

@ -64,4 +64,4 @@ module.exports = {
resolve: { resolve: {
extensions: ['.ts', '.tsx', '.js', '.mjs', '.cjs', '.wasm', '.json', '.less', '.css'] extensions: ['.ts', '.tsx', '.js', '.mjs', '.cjs', '.wasm', '.json', '.less', '.css']
}, },
} };

View File

@ -3,7 +3,7 @@ const merge = require('webpack-merge');
const common = require('./webpack.common.js'); const common = require('./webpack.common.js');
const path = require('path'); const path = require('path');
const CopyPlugin = require("copy-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin");
const VERSION = "v0.1.1"; const VERSION = require("./version.js");
var merged = merge.merge(common, { var merged = merge.merge(common, {
mode: "development", mode: "development",
@ -27,9 +27,9 @@ var merged = merge.merge(common, {
}); });
var definePlugin = new webpack.DefinePlugin({ var definePlugin = new webpack.DefinePlugin({
__SHDEV__: "true", __PROMPT_DEV__: "true",
__SHVERSION__: JSON.stringify(VERSION), __PROMPT_VERSION__: JSON.stringify(VERSION),
__SHBUILD__: JSON.stringify("devbuild"), __PROMPT_BUILD__: JSON.stringify("devbuild"),
}); });
merged.plugins.push(definePlugin); merged.plugins.push(definePlugin);

View File

@ -2,7 +2,7 @@ const webpack = require('webpack');
const merge = require('webpack-merge'); const merge = require('webpack-merge');
const common = require('./webpack.electron.js'); const common = require('./webpack.electron.js');
const moment = require("dayjs"); const moment = require("dayjs");
const VERSION = "v0.1.1"; const VERSION = require('./version.js');
const path = require("path"); const path = require("path");
function makeBuildStr() { function makeBuildStr() {
@ -26,9 +26,9 @@ let merged = merge.merge(common, {
}); });
merged.plugins.push(new webpack.DefinePlugin({ merged.plugins.push(new webpack.DefinePlugin({
__SHDEV__: "false", __PROMPT_DEV__: "false",
__SHVERSION__: JSON.stringify(VERSION), __PROMPT_VERSION__: JSON.stringify(VERSION),
__SHBUILD__: JSON.stringify(BUILD), __PROMPT_BUILD__: JSON.stringify(BUILD),
})); }));
module.exports = merged; module.exports = merged;

View File

@ -2,8 +2,8 @@ const webpack = require('webpack');
const merge = require('webpack-merge'); const merge = require('webpack-merge');
const common = require('./webpack.common.js'); const common = require('./webpack.common.js');
const moment = require("dayjs"); const moment = require("dayjs");
const VERSION = "v0.1.1";
const path = require("path"); const path = require("path");
const VERSION = require("./version.js");
function makeBuildStr() { function makeBuildStr() {
let buildStr = moment().format("YYYYMMDD-HHmmss"); let buildStr = moment().format("YYYYMMDD-HHmmss");
@ -34,9 +34,9 @@ if (BundleAnalyzerPlugin != null) {
merged.plugins.push(new BundleAnalyzerPlugin()); merged.plugins.push(new BundleAnalyzerPlugin());
} }
merged.plugins.push(new webpack.DefinePlugin({ merged.plugins.push(new webpack.DefinePlugin({
__SHDEV__: "false", __PROMPT_DEV__: "false",
__SHVERSION__: JSON.stringify(VERSION), __PROMPT_VERSION__: JSON.stringify(VERSION),
__SHBUILD__: JSON.stringify(BUILD), __PROMPT_BUILD__: JSON.stringify(BUILD),
})); }));
module.exports = merged; module.exports = merged;