Add version file & auto-insertion into client app code

This commit is contained in:
Starbeamrainbowlabs 2019-01-26 22:00:37 +00:00
parent dc7427c18b
commit 844d23e0a6
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
6 changed files with 60 additions and 1 deletions

View file

@ -1,6 +1,8 @@
"use strict"; "use strict";
export default { export default {
version: "__VERSION__",
buid_date: new Date("__BUILD_DATE__"),
// The url of api.php. Can be relative. // The url of api.php. Can be relative.
api_root: "../api.php", api_root: "../api.php",
// The default location to show on the map when loading the page. // The default location to show on the map when loading the page.

View file

@ -11,7 +11,7 @@ import UI from './UI.mjs';
class MapManager { class MapManager {
constructor() { constructor() {
console.log(Config);
} }
setup() { setup() {

44
package-lock.json generated
View file

@ -296,6 +296,24 @@
"integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==",
"dev": true "dev": true
}, },
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
},
"dependencies": {
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
}
}
},
"braces": { "braces": {
"version": "1.8.5", "version": "1.8.5",
"resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz",
@ -557,6 +575,12 @@
"integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=",
"dev": true "dev": true
}, },
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
"concat-with-sourcemaps": { "concat-with-sourcemaps": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz", "resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz",
@ -1701,6 +1725,15 @@
"regex-cache": "^0.4.2" "regex-cache": "^0.4.2"
} }
}, },
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
@ -4449,6 +4482,17 @@
"style-inject": "^0.3.0" "style-inject": "^0.3.0"
} }
}, },
"rollup-plugin-replace": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-replace/-/rollup-plugin-replace-2.1.0.tgz",
"integrity": "sha512-SxrAIgpH/B5/W4SeULgreOemxcpEgKs2gcD42zXw50bhqGWmcnlXneVInQpAqzA/cIly4bJrOpeelmB9p4YXSQ==",
"dev": true,
"requires": {
"magic-string": "^0.25.1",
"minimatch": "^3.0.2",
"rollup-pluginutils": "^2.0.1"
}
},
"rollup-plugin-terser": { "rollup-plugin-terser": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-4.0.2.tgz", "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-4.0.2.tgz",

View file

@ -37,6 +37,7 @@
"rollup-plugin-commonjs": "^9.2.0", "rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^4.0.0", "rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-postcss": "^1.6.3", "rollup-plugin-postcss": "^1.6.3",
"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-terser": "^4.0.2" "rollup-plugin-terser": "^4.0.2"
} }
} }

View file

@ -1,10 +1,12 @@
import os from 'os'; import os from 'os';
import path from 'path'; import path from 'path';
import fs from 'fs';
import resolve from 'rollup-plugin-node-resolve'; import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs'; import commonjs from 'rollup-plugin-commonjs';
import postcss from 'rollup-plugin-postcss'; import postcss from 'rollup-plugin-postcss';
import { terser } from "rollup-plugin-terser"; import { terser } from "rollup-plugin-terser";
import replace from 'rollup-plugin-replace';
import postcss_import from 'postcss-import'; import postcss_import from 'postcss-import';
import postcss_copy from 'postcss-copy'; import postcss_copy from 'postcss-copy';
@ -33,6 +35,15 @@ let plugins = [
extensions: ['.mjs', '.js', '.jsx', '.json'], // Default: [ '.mjs', '.js', '.json', '.node' ] extensions: ['.mjs', '.js', '.jsx', '.json'], // Default: [ '.mjs', '.js', '.json', '.node' ]
}), }),
replace({
exclude: 'node_modules/**',
values: {
"__BUILD_DATE__": () => new Date().toISOString(),
"__VERSION__": fs.readFileSync("version", "utf8").trim()
}
}),
commonjs({ commonjs({
}), }),

1
version Normal file
View file

@ -0,0 +1 @@
v0.2.0