From 84e52c2c9bc85c3b45e61b37b89c3166fae6615e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 19 May 2021 23:53:13 +0200 Subject: [PATCH] Add some version handling automation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- package-lock.json | 60 ++++++++++++++++++++++++------- package.json | 10 +++--- rollup.config.js | 2 ++ src/charging-station/Bootstrap.ts | 4 ++- tsconfig.json | 3 +- 5 files changed, 60 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 075b4fb4..15c0bdd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -655,6 +655,34 @@ "fastq": "^1.6.0" } }, + "@rollup/plugin-json": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", + "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.8" + }, + "dependencies": { + "@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + } + }, + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + } + } + }, "@rollup/pluginutils": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.1.0.tgz", @@ -694,6 +722,12 @@ "seedrandom": "2.4.3" } }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, "@types/fs-extra": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.1.tgz", @@ -732,9 +766,9 @@ "dev": true }, "@types/node": { - "version": "14.14.45", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.45.tgz", - "integrity": "sha512-DssMqTV9UnnoxDWu959sDLZzfvqCF0qDNRjaWeYSui9xkFe61kKo4l1TWNTQONpuXEm+gLMRvdlzvNHBamzmEw==", + "version": "14.17.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.0.tgz", + "integrity": "sha512-w8VZUN/f7SSbvVReb9SWp6cJFevxb4/nkG65yLAya//98WgocKm5PLDAtSs5CtJJJM+kHmJjO/6mmYW4MHShZA==", "dev": true }, "@types/offscreencanvas": { @@ -4420,9 +4454,9 @@ } }, "eslint-plugin-jsdoc": { - "version": "34.7.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-34.7.0.tgz", - "integrity": "sha512-H2zrJorJfocd//PNNYsrPxWNAQjHONzIHGZ9CFYISyfZCOTXYUzH8CyA95LHYpZqGf5UEueHiwl+0bzWreqAjQ==", + "version": "34.8.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-34.8.2.tgz", + "integrity": "sha512-UOU9A40Cl806JMtla2vF+RM6sNqfLPbhLv9FZqhcC7+LmChD3DVaWqM7ADxpF0kMyZNWe1QKUnqGnXaA3NTn+w==", "dev": true, "requires": { "@es-joy/jsdoccomment": "^0.6.0", @@ -6925,14 +6959,14 @@ "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" }, "mongodb": { - "version": "3.6.6", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz", - "integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==", + "version": "3.6.7", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.7.tgz", + "integrity": "sha512-VXW2bWz47LhAEw0qs8Mk2zRgQwgbXH16KAwQFtylBu0zXO8rkQmA8ncsYbmICaVutZeINRlXYXG3MDIz90NM3g==", "requires": { "bl": "^2.2.1", "bson": "^1.1.4", "denque": "^1.4.1", - "optional-require": "^1.0.2", + "optional-require": "^1.0.3", "safe-buffer": "^5.1.2", "saslprep": "^1.0.0" } @@ -7658,9 +7692,9 @@ } }, "optional-require": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.2.tgz", - "integrity": "sha512-HZubVd6IfHsbnpdNF/ICaSAzBUEW1TievpkjY3tB4Jnk8L7+pJ3conPzUt3Mn/6OZx9uzTDOHYPGA8/AxYHBOg==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz", + "integrity": "sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA==" }, "optionator": { "version": "0.8.3", diff --git a/package.json b/package.json index 27af082d..77d888b5 100644 --- a/package.json +++ b/package.json @@ -44,10 +44,11 @@ "git:sinit": "git submodule update --init --recursive --force", "git:sdiff": "git diff && git submodule foreach 'git diff'", "git:supdate": "git submodule update --remote --recursive --merge", - "git:spush": "git push --recurse-submodules=on-demand" + "git:spush": "git push --recurse-submodules=on-demand", + "postversion": "git push && git push upstream && git push --tags && git push upstream --tags" }, "dependencies": { - "mongodb": "^3.6.6", + "mongodb": "^3.6.7", "poolifier": "^2.0.2", "source-map-support": "^0.5.19", "tslib": "^2.2.0", @@ -61,7 +62,8 @@ "utf-8-validate": "^5.0.5" }, "devDependencies": { - "@types/node": "^14.14.45", + "@rollup/plugin-json": "^4.1.0", + "@types/node": "^14.17.0", "@types/uuid": "^8.3.0", "@types/ws": "^7.4.4", "@typescript-eslint/eslint-plugin": "^4.24.0", @@ -70,7 +72,7 @@ "cross-env": "^7.0.3", "eslint": "^7.26.0", "eslint-plugin-import": "^2.23.2", - "eslint-plugin-jsdoc": "^34.7.0", + "eslint-plugin-jsdoc": "^34.8.2", "mbt": "^1.1.1", "npm-check": "^5.9.2", "rollup": "^2.48.0", diff --git a/rollup.config.js b/rollup.config.js index 2184bb6e..79cc619a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,6 +1,7 @@ import analyze from 'rollup-plugin-analyzer'; import copy from 'rollup-plugin-copy'; import del from 'rollup-plugin-delete'; +import json from '@rollup/plugin-json'; import { terser } from 'rollup-plugin-terser'; import typescript from 'rollup-plugin-typescript2'; @@ -20,6 +21,7 @@ export default { }, external: ['crypto', 'perf_hooks', 'fs', 'path', 'poolifier', 'uuid', 'ws', 'winston-daily-rotate-file', 'winston/lib/winston/transports', 'winston', 'worker_threads'], plugins: [ + json(), typescript({ tsconfig: 'tsconfig.json' }), diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index a6eb4939..6c2892a1 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -5,9 +5,11 @@ import WorkerAbstract from '../worker/WorkerAbstract'; import WorkerFactory from '../worker/WorkerFactory'; import { isMainThread } from 'worker_threads'; import path from 'path'; +import { version } from '../../package.json'; export default class Bootstrap { private static instance: Bootstrap; + private version: string = version as string; private started: boolean; private workerScript: string; private workerImplementationInstance: WorkerAbstract | null = null; @@ -53,7 +55,7 @@ export default class Bootstrap { if (numStationsTotal === 0) { console.log('No charging station template enabled in configuration, exiting'); } else { - console.log(`Charging station simulator started with ${numStationsTotal.toString()} charging station(s) and ${Utils.workerDynamicPoolInUse() ? `${Configuration.getWorkerPoolMinSize().toString()}/` : ''}${this.getWorkerImplementationInstance().size}${Utils.workerPoolInUse() ? `/${Configuration.getWorkerPoolMaxSize().toString()}` : ''} worker(s) concurrently running in '${Configuration.getWorkerProcess()}' mode${this.getWorkerImplementationInstance().maxElementsPerWorker ? ` (${this.getWorkerImplementationInstance().maxElementsPerWorker} charging station(s) per worker)` : ''}`); + console.log(`Charging station simulator ${this.version} started with ${numStationsTotal.toString()} charging station(s) and ${Utils.workerDynamicPoolInUse() ? `${Configuration.getWorkerPoolMinSize().toString()}/` : ''}${this.getWorkerImplementationInstance().size}${Utils.workerPoolInUse() ? `/${Configuration.getWorkerPoolMaxSize().toString()}` : ''} worker(s) concurrently running in '${Configuration.getWorkerProcess()}' mode${this.getWorkerImplementationInstance().maxElementsPerWorker ? ` (${this.getWorkerImplementationInstance().maxElementsPerWorker} charging station(s) per worker)` : ''}`); } this.started = true; } catch (error) { diff --git a/tsconfig.json b/tsconfig.json index 1fd8e1cd..02ad086d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,7 @@ "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ "outDir": "./dist", /* Redirect output structure to the directory. */ - "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ "removeComments": true, /* Do not emit comments to output. */ @@ -44,6 +44,7 @@ /* Module Resolution Options */ "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + "resolveJsonModule": true, // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ -- 2.34.1