add version.js
This commit is contained in:
parent
cb73daf863
commit
327aef0f21
|
|
@ -62,7 +62,6 @@ pids
|
|||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
*.js
|
||||
*.map
|
||||
package-lock.json
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
tsconfigRootDir: __dirname,
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['@typescript-eslint/eslint-plugin'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
],
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
jest: true,
|
||||
},
|
||||
ignorePatterns: ['.eslintrc.js'],
|
||||
rules: {
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#! /usr/bin/env node
|
||||
const fs = require('fs');
|
||||
const dayjs = require('dayjs');
|
||||
const timezone = require('dayjs/plugin/timezone');
|
||||
const utc = require('dayjs/plugin/utc');
|
||||
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(timezone);
|
||||
|
||||
const write = (content, path) => {
|
||||
const writePath = path || `${process.cwd()}/src/build.ts`;
|
||||
try {
|
||||
fs.writeFileSync(
|
||||
writePath,
|
||||
'// Build information, automatically generated by `the_build_script` :zwinkern:\n' + 'const build = ' + JSON.stringify(content, null, 4).replace(/\"([^(\")"]+)\":/g, '$1:') + ';\n\nexport default build;',
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
const package = require(`${process.cwd()}/package.json`);
|
||||
(() => {
|
||||
console.log('start build.js script ...');
|
||||
// Generate `build` object
|
||||
const build = {};
|
||||
build.timestamp = dayjs(new Date()).utc().format('DD.MM.YYYY HH:mm') + ' UTC';
|
||||
// Write Build information to file
|
||||
write(build);
|
||||
console.log('build.js script finished ...');
|
||||
})();
|
||||
Loading…
Reference in New Issue