Browse Source

Add version file & auto-insertion into client app code

pull/26/head
Starbeamrainbowlabs 3 years ago
parent
commit
844d23e0a6
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
  1. 2
      client_src/js/Config.mjs
  2. 2
      client_src/js/MapManager.mjs
  3. 44
      package-lock.json
  4. 1
      package.json
  5. 11
      rollup.config.js
  6. 1
      version

2
client_src/js/Config.mjs

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

2
client_src/js/MapManager.mjs

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

44
package-lock.json generated

@ -296,6 +296,24 @@ @@ -296,6 +296,24 @@
"integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==",
"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": {
"version": "1.8.5",
"resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz",
@ -557,6 +575,12 @@ @@ -557,6 +575,12 @@
"integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=",
"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": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/concat-with-sourcemaps/-/concat-with-sourcemaps-1.1.0.tgz",
@ -1701,6 +1725,15 @@ @@ -1701,6 +1725,15 @@
"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": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
@ -4449,6 +4482,17 @@ @@ -4449,6 +4482,17 @@
"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": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-4.0.2.tgz",

1
package.json

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

11
rollup.config.js

@ -1,10 +1,12 @@ @@ -1,10 +1,12 @@
import os from 'os';
import path from 'path';
import fs from 'fs';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import postcss from 'rollup-plugin-postcss';
import { terser } from "rollup-plugin-terser";
import replace from 'rollup-plugin-replace';
import postcss_import from 'postcss-import';
import postcss_copy from 'postcss-copy';
@ -33,6 +35,15 @@ let plugins = [ @@ -33,6 +35,15 @@ let plugins = [
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({
}),

1
version

@ -0,0 +1 @@ @@ -0,0 +1 @@
v0.2.0
Loading…
Cancel
Save