@studyportals/webpack-helper 3.2.6 → 4.0.0-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -264,3 +264,7 @@ In order to comply to [Studyportals' definition of done](https://knowledge-vault
264
264
 
265
265
  - `.babelrc`: A standard configuration for babel that loads the `babel-env` and `babel-typescripts` presets. You might need to add more plugins for your specific project.
266
266
  - `.browserslistrc`: A configuration file for browserslist. This is used by `babel-env` to determine which browsers to transpile the code for. Within this file the configuration for student facing products will be loaded by default but other configurations can be easily loaded by uncommenting some lines.
267
+
268
+ ## Unit testing
269
+
270
+ From version `3.2.6` onwards, any dependencies that are required to run unit tests with Jest are included in the `package.json` of `webpack-helper`. As a result, these no longer have to be installed in individual microservices.
@@ -1,3 +1,3 @@
1
- #extends @studyportals/browserslist-config/clients
2
- #extends @studyportals/browserslist-config/internal
1
+ #extends @studyportals/browserslist-config/clients
2
+ #extends @studyportals/browserslist-config/internal
3
3
  extends @studyportals/browserslist-config/student
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyportals/webpack-helper",
3
- "version": "3.2.6",
3
+ "version": "4.0.0-0",
4
4
  "description": "A collection of standard configurations and helpers for webpack.",
5
5
  "main": "src/main.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  "@studyportals/bob-manifest-generator": "^3.0.0",
32
32
  "@studyportals/browserslist-config": "^1.2.0",
33
33
  "@studyportals/dll-availability-tracker": "^2.0.0",
34
- "@studyportals/vue-config": "^4.1.2",
34
+ "@studyportals/vue-config": "^4.1.3-1",
35
35
  "@types/jest": "^27.0.0",
36
36
  "@vue/cli-plugin-babel": "^5.0.4",
37
37
  "@vue/cli-plugin-unit-jest": "^5.0.4",
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProductionConfig = void 0;
4
4
  const webpack = require('webpack');
5
- const cssMinimizerPlugin = require('css-minimizer-webpack-plugin');
5
+ const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
6
6
  const DllAvailabilityTracker = require('@studyportals/dll-availability-tracker');
7
- const ProductionConfig = (bobConfig) => {
7
+ exports.ProductionConfig = (bobConfig) => {
8
8
  let dllDependencies = ['library'];
9
9
  if (bobConfig && bobConfig.hasOwnProperty('dllPackages')) {
10
10
  bobConfig.dllPackages.forEach((dependency) => dllDependencies.push(dependency.manifest.name));
@@ -19,8 +19,8 @@ const ProductionConfig = (bobConfig) => {
19
19
  NODE_ENV: '"production"'
20
20
  }
21
21
  }),
22
- new cssMinimizerPlugin({
23
- minimizerOptions: {
22
+ new OptimizeCSSAssetsPlugin({
23
+ cssProcessorPluginOptions: {
24
24
  preset: [
25
25
  'default',
26
26
  {
@@ -59,4 +59,3 @@ const ProductionConfig = (bobConfig) => {
59
59
  }
60
60
  };
61
61
  };
62
- exports.ProductionConfig = ProductionConfig;
@@ -6,5 +6,4 @@ var Preset;
6
6
  Preset["VUE_TYPESCRIPT"] = "vue-typescript";
7
7
  Preset["TYPESCRIPT"] = "typescript";
8
8
  Preset["JAVASCRIPT"] = "javascript";
9
- Preset["VUE_TYPESCRIPT_NO_CODE_SPLITTING"] = "vue-typescript-no-code-splitting";
10
9
  })(Preset = exports.Preset || (exports.Preset = {}));
@@ -9,7 +9,6 @@ const preset_1 = require("../enums/preset");
9
9
  const vue_typescript_preset_1 = require("../presets/vue-typescript.preset");
10
10
  const typescript_preset_1 = require("../presets/typescript.preset");
11
11
  const javascript_preset_1 = require("../presets/javascript.preset");
12
- const vue_typescript_no_code_splitting_preset_1 = require("../presets/vue-typescript-no-code-splitting.preset");
13
12
  const mode_1 = require("../enums/mode");
14
13
  const production_config_1 = require("../defaults/production.config");
15
14
  const development_config_1 = require("../defaults/development.config");
@@ -31,9 +30,8 @@ class Configuration {
31
30
  const configPrd = options[mode_1.Mode.PRODUCTION] ? options[mode_1.Mode.PRODUCTION] : {};
32
31
  this.environmentSpecificConfig = {
33
32
  [mode_1.Mode.DEVELOPMENT]: merge([configDev, development_config_1.DevelopmentConfig]) || development_config_1.DevelopmentConfig,
34
- [mode_1.Mode.PRODUCTION]: merge([configPrd, (0, production_config_1.ProductionConfig)(this.bob)]) || (0, production_config_1.ProductionConfig)(this.bob)
33
+ [mode_1.Mode.PRODUCTION]: merge([configPrd, production_config_1.ProductionConfig(this.bob)]) || production_config_1.ProductionConfig(this.bob)
35
34
  };
36
- this.fileName = options.output.fileName || "[name]";
37
35
  }
38
36
  get(mode) {
39
37
  this.detectPresets(mode);
@@ -65,9 +63,6 @@ class Configuration {
65
63
  case preset_1.Preset.JAVASCRIPT:
66
64
  this.injectPreset(new javascript_preset_1.JavascriptPreset());
67
65
  break;
68
- case preset_1.Preset.VUE_TYPESCRIPT_NO_CODE_SPLITTING:
69
- this.injectPreset(new vue_typescript_no_code_splitting_preset_1.VueTypescriptNoCodeSplittingPreset(mode));
70
- break;
71
66
  default:
72
67
  break;
73
68
  }
@@ -113,13 +108,12 @@ class Configuration {
113
108
  return dependencies;
114
109
  }
115
110
  getCSSFileName() {
116
- const fileName = this.fileName || `style`;
117
111
  if (this.hash === false
118
112
  || typeof this.hash.css !== 'undefined'
119
113
  && this.hash.css === false) {
120
- return `${fileName}.css`;
114
+ return 'style.css';
121
115
  }
122
- return `${fileName}.[fullhash].css`;
116
+ return 'style.[fullhash].css';
123
117
  }
124
118
  }
125
119
  exports.Configuration = Configuration;
@@ -30,24 +30,13 @@ class TypeScriptPreset {
30
30
  },
31
31
  {
32
32
  test: /\.tsx?$/,
33
- exclude: /node_modules\/(?!@studyportals\/).*/,
34
- use: [
35
- {
36
- loader: 'babel-loader',
37
- },
38
- {
39
- loader: 'ts-loader'
40
- }
41
- ],
33
+ loader: 'ts-loader',
34
+ exclude: /node_modules\/(?!@studyportals\/).*/
42
35
  },
43
36
  {
44
37
  test: /\.js$/,
45
- exclude: /node_modules\/(?!@studyportals\/).*/,
46
- use: [
47
- {
48
- loader: 'babel-loader',
49
- }
50
- ]
38
+ loader: 'babel-loader',
39
+ exclude: /node_modules\/(?!@studyportals\/).*/
51
40
  },
52
41
  {
53
42
  test: /\.(png|jpg|gif|svg)$/,
@@ -15,8 +15,7 @@ class VueTypeScriptPreset {
15
15
  manifest: require(`@studyportals/vue-config/dist/vue3_library${this.mode === mode_1.Mode.PRODUCTION ? '.min' : ''}.json`)
16
16
  }),
17
17
  new MiniCssExtractPlugin({
18
- filename,
19
- ignoreOrder: true
18
+ filename
20
19
  }),
21
20
  new VueLoaderPlugin()
22
21
  ];
@@ -55,26 +54,15 @@ class VueTypeScriptPreset {
55
54
  },
56
55
  {
57
56
  test: /\.tsx?$/,
58
- use: [
59
- {
60
- loader: 'babel-loader'
61
- },
62
- {
63
- loader: 'ts-loader',
64
- options: {
65
- appendTsSuffixTo: [/\.vue$/]
66
- }
67
- }
68
- ],
69
- exclude: /node_modules\/(?!@studyportals\/).*/
57
+ loader: 'ts-loader',
58
+ exclude: /node_modules\/(?!@studyportals\/).*/,
59
+ options: {
60
+ appendTsSuffixTo: [/\.vue$/]
61
+ },
70
62
  },
71
63
  {
72
64
  test: /\.js$/,
73
- use: [
74
- {
75
- loader: 'babel-loader'
76
- }
77
- ],
65
+ loader: 'babel-loader',
78
66
  exclude: /node_modules\/(?!@studyportals\/).*/
79
67
  },
80
68
  {
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VueTypescriptNoCodeSplittingPreset = void 0;
4
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5
- const VueLoaderPlugin = require('vue-loader').VueLoaderPlugin;
6
- const vue_typescript_preset_1 = require("./vue-typescript.preset");
7
- class VueTypescriptNoCodeSplittingPreset extends vue_typescript_preset_1.VueTypeScriptPreset {
8
- constructor(mode) {
9
- super(mode);
10
- }
11
- getPlugins(filename) {
12
- return [
13
- new MiniCssExtractPlugin({
14
- filename
15
- }),
16
- new VueLoaderPlugin()
17
- ];
18
- }
19
- }
20
- exports.VueTypescriptNoCodeSplittingPreset = VueTypescriptNoCodeSplittingPreset;