mod-build 4.0.26 → 4.0.27

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/CHANGELOG.md CHANGED
@@ -1,10 +1,16 @@
1
- ## 4.0.24 - 4.0.27
1
+ #
2
+
3
+ ## 4.0.27
4
+
5
+ - Installed `vite-plugin-minify` plugin to minify the html files
6
+
7
+ ## 4.0.24 - 4.0.26
2
8
 
3
9
  - Disabling JSlint `failOnError` so we can rebuild BestCompany sites to grab the most recent TCPA update
4
10
 
5
11
  ## 4.0.23
6
12
 
7
- - Adding `exit(1)` to Axios errors so that the build will fail if shared scripts / components are not successfully created.
13
+ - Adding `exit(1)` to Axios errors so that the build will fail if shared scripts / components are not successfully created.
8
14
 
9
15
  ## 4.0.22
10
16
 
@@ -85,13 +91,13 @@
85
91
  ## 4.0.0-beta.5
86
92
 
87
93
  - Updated the `transformIndexHtml` hook to use the `writeBundle` hook in the ViteConfig.
88
- - This change ensures that all assets are transformed before adding the `pathSubdirectory` to the assets and local resources.
94
+ - This change ensures that all assets are transformed before adding the `pathSubdirectory` to the assets and local resources.
89
95
 
90
96
  - Updated the `grab-shared-scripts` task to run more sequentially.
91
- - All files are now downloaded and hashed before going through the functions to replace local paths.
97
+ - All files are now downloaded and hashed before going through the functions to replace local paths.
92
98
 
93
99
  - Changed global resources to download to the site's `/public` folder instead of inside `/src`.
94
- - This prevents Vite from bundling them during the build process as they are static JS files.
100
+ - This prevents Vite from bundling them during the build process as they are static JS files.
95
101
 
96
102
  ## 4.0.0-beta.3
97
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "4.0.26",
3
+ "version": "4.0.27",
4
4
  "description": "Share components for S3 sites.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -27,6 +27,7 @@
27
27
  "stylelint-order": "^6.0.4",
28
28
  "vite": "^5.0.0",
29
29
  "vite-plugin-eslint": "^1.8.1",
30
+ "vite-plugin-minify": "^2.0.0",
30
31
  "vite-plugin-static-copy": "^1.0.0",
31
32
  "vite-plugin-stylelint": "^5.3.1",
32
33
  "vituum": "^1.1.0"
package/vite.config.js CHANGED
@@ -1,14 +1,15 @@
1
- import handlebars from '@vituum/vite-plugin-handlebars'
2
- import vituum from 'vituum'
3
- import eslint from 'vite-plugin-eslint'
1
+ import handlebars from '@vituum/vite-plugin-handlebars';
2
+ import vituum from 'vituum';
3
+ import eslint from 'vite-plugin-eslint';
4
4
  import stylelint from 'vite-plugin-stylelint';
5
- import { defaultSettings } from './src/data/config.js'
6
- import { defineConfig } from 'vite'
7
- import { startModBuild } from './tasks/serve.js'
8
- import { updateConfig, STATIC_COPY_TARGETS, updateHandlebarsOnWatch } from './src/scripts/plugins.js'
9
- import { viteStaticCopy } from 'vite-plugin-static-copy'
10
- import { glob } from 'glob'
5
+ import { defaultSettings } from './src/data/config.js';
6
+ import { defineConfig } from 'vite';
7
+ import { startModBuild } from './tasks/serve.js';
8
+ import { updateConfig, STATIC_COPY_TARGETS, updateHandlebarsOnWatch } from './src/scripts/plugins.js';
9
+ import { viteStaticCopy } from 'vite-plugin-static-copy';
10
+ import { glob } from 'glob';
11
11
  import fs from "node:fs";
12
+ import { ViteMinifyPlugin } from 'vite-plugin-minify';
12
13
 
13
14
  export default defineConfig((config) => ({
14
15
  build: {
@@ -27,6 +28,7 @@ export default defineConfig((config) => ({
27
28
  directory: 'src/templates/',
28
29
  }
29
30
  }),
31
+ ViteMinifyPlugin({}),
30
32
  updateConfig(config),
31
33
  viteStaticCopy({
32
34
  targets: STATIC_COPY_TARGETS,
@@ -59,10 +61,10 @@ export default defineConfig((config) => ({
59
61
  defaultSettings.distFolder + '/**/index.html',
60
62
  defaultSettings.distFolder + '/assets/*.css',
61
63
  ];
62
-
64
+
63
65
  for (const globFile of globFiles) {
64
66
  const files = glob.sync(globFile);
65
-
67
+
66
68
  for (const file of files) {
67
69
  console.log(file);
68
70
  let contents = await fs.promises.readFile(file, 'utf-8');
@@ -73,7 +75,7 @@ export default defineConfig((config) => ({
73
75
  .replace(/(src|data-load)="\/?src\//g, `$1="${config.pathSubdirectory}`)
74
76
  .replace(/(src|srcset|data-load|href)="\/?assets\//g, `$1="${config.pathSubdirectory}assets/`)
75
77
  .replace(/(src|data-load|href)="\/?resources\//g, `$1="${config.pathSubdirectory}resources/`)
76
- .replace(/url\((\/?assets\/)/g, `url(${config.pathSubdirectory}assets/`)
78
+ .replace(/url\((\/?assets\/)/g, `url(${config.pathSubdirectory}assets/`);
77
79
  } else {
78
80
  updatedContents = contents.replace(/(src|data-load)="\/?src\//g, '$1="/');
79
81
  }
@@ -89,4 +91,4 @@ export default defineConfig((config) => ({
89
91
  define: {
90
92
  'process.env': process.env
91
93
  }
92
- }))
94
+ }));