From 31ce7d0d6bee37527cb2f32270ce5845d7c983b7 Mon Sep 17 00:00:00 2001 From: alex-ketch Date: Tue, 7 Apr 2020 10:42:46 -0400 Subject: [PATCH] fix(Thema): Simplify Thema version resolution logic --- src/browser/index.ts | 4 ++-- webpack.config.js | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/browser/index.ts b/src/browser/index.ts index a7419397f..ed23bb736 100644 --- a/src/browser/index.ts +++ b/src/browser/index.ts @@ -1,4 +1,5 @@ import { themes } from '../themes' +import { version } from '../../package.json' export { themes } @@ -7,8 +8,7 @@ export interface ThemaAssets { scripts: string[] } -const themaVersion = process.env.VERSION ?? '1' -const themaMajor = themaVersion.split('.')[0] +const themaMajor = version.split('.')[0] /** * The path to a theme in this package diff --git a/webpack.config.js b/webpack.config.js index b0495638b..06f51f1ae 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,5 @@ const globby = require('globby') const path = require('path') -const pkgJson = require('./package.json') const MiniCssExtractPlugin = require('mini-css-extract-plugin') const FileManagerPlugin = require('filemanager-webpack-plugin') @@ -103,10 +102,7 @@ module.exports = (env = {}, { mode }) => { new CleanWebpackPlugin(), new DefinePlugin({ 'process.env.ASSET_PATH': JSON.stringify(ASSET_PATH), - 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), - 'process.env.VERSION': JSON.stringify( - process.env.VERSION || pkgJson.version - ) + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) }), new MiniCssExtractPlugin(), ...docsPlugins,