mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-19 09:48:18 -05:00
feat: use 4 character version hash (#322)
This will shorten the `productionPrefix` that is used in mui for generating class names
This commit is contained in:
committed by
GitHub
parent
8b5705802f
commit
10c0d19bde
@@ -6,12 +6,19 @@ const nodeResolve = require('@rollup/plugin-node-resolve');
|
||||
const replace = require('@rollup/plugin-replace');
|
||||
const { terser } = require('rollup-plugin-terser');
|
||||
|
||||
const crypto = require('crypto');
|
||||
const localeStringValidator = require('./tools/locale-string-validator');
|
||||
|
||||
const cwd = process.cwd();
|
||||
const pkg = require(path.join(cwd, 'package.json')); // eslint-disable-line
|
||||
const { name, version, license } = pkg;
|
||||
|
||||
const versionHash = crypto
|
||||
.createHash('md5')
|
||||
.update(version)
|
||||
.digest('hex')
|
||||
.slice(0, 4);
|
||||
|
||||
const targetName = name.split('/')[1];
|
||||
const targetDirName = 'dist';
|
||||
const targetDir = path.join(cwd, targetDirName);
|
||||
@@ -127,6 +134,7 @@ const config = (isEsm, dev = false) => {
|
||||
__NEBULA_DEV__: dev,
|
||||
'process.env.NODE_ENV': JSON.stringify(isEsm ? 'development' : 'production'),
|
||||
'process.env.NEBULA_VERSION': JSON.stringify(version),
|
||||
'process.env.NEBULA_VERSION_HASH': JSON.stringify(versionHash),
|
||||
}),
|
||||
nodeResolve({
|
||||
extensions: [dev ? '.dev.js' : false, '.js', '.jsx'].filter(Boolean),
|
||||
|
||||
Reference in New Issue
Block a user