hof 24.0.0-vite-beta.10 → 24.0.0-vite-beta.12

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,3 +1,13 @@
1
+ ## 2025-11-18, Version 24.0.0 (Stable), @PaolaDMadd-Pro @Rhodine-orleans-lindsay
2
+ ### Changed
3
+ - Replaced Browserify with Vite
4
+ - removed browserify dependencies including in tests
5
+ - added vite configuration and related tests
6
+ - Updated readme.md
7
+ - Potential **breaking changes**:
8
+ - Node version required for Vite is `20.19.0 || >=22.12.0`
9
+ - Vite uses Rollup in production and requires optional rollup dependencies to be loaded. Setting `--ignore-optional flag` in Dockerfiles will result in "Module not found" errors in CI/CD or Docker.
10
+
1
11
  ## 2025-10-10, Version 22.10.4 (Stable), @dk4g
2
12
  ### Security
3
13
  - Upgraded axios version to address a security vulnerability
package/README.md CHANGED
@@ -60,7 +60,7 @@ It is recommended to alias `hof-build` to an npm script in your package.json.
60
60
 
61
61
  ## Tasks
62
62
 
63
- - `browserify` - compiles client-side js with browserify
63
+ - `vite` - compiles client-side js with vite in development and rollup in production. Requires node version `^20.19.0 || >=22.12.0`.
64
64
  - `sass` - compiles sass
65
65
  - `images` - copies images from ./assets/images directory to ./public/images
66
66
  - `translate` - compiles translation files
@@ -70,20 +70,6 @@ Note: For SASS compilation it's possible to additionally configure the following
70
70
  - `quietDeps` - This controls whether you get deprecation warning shown in the console output, if set to false (default) SASS deprecation warnings will be shown in the console, if set to true then deprecation warnings will not be shown in the console output.
71
71
  - `sourceMaps` - This controls whether the build will output css sourcemaps to help with debugging. These will be output to the same directory as the css output as a .map file. This option is not currently available in production.
72
72
 
73
- For JavaScript compilation, browserify can be set to debug mode by setting the `debug` option to true. This will cause browserify to output JavaScript sourcemaps as a .js.map file to the same directory as the js bundle.
74
-
75
- Debugging example (in hof.settings or your build config)
76
- ```
77
- "build": {
78
- "sass": {
79
- "sourceMaps": true
80
- },
81
- "browserify": {
82
- "debug": true
83
- }
84
- }
85
- ```
86
-
87
73
  ## Watch
88
74
 
89
75
  You can additionally run a `watch` task to start a server instance, which will automatically restart based on changes to files. This will also re-perform the tasks above when relevant files change.
@@ -109,7 +95,7 @@ hof-build watch --env .envdev
109
95
 
110
96
  ## Configuration
111
97
 
112
- The default settings will match those for an app generated using [`hof-generator`](https://npmjs.com/hof-generator).
98
+ The default settings will match those for an app generated using [`hof-generator`](https://npmjs.com/hof-generator) (⚠️ This package has been deprecated).
113
99
 
114
100
  If a `hof.settings.json` file is found in the application root, then the `build` section of the settings file will be used to override [the default configuration](./defaults.js).
115
101
 
@@ -119,17 +105,9 @@ Alternatively you can define a path to a local config file by passing a `--confi
119
105
  hof-build --config /path/to/my/config.js
120
106
  ```
121
107
 
122
- Any task can be disabled by setting its configuration to `false` (or any falsy value).
123
-
124
- ```js
125
- module.exports = {
126
- browserify: false,
127
- };
128
- ```
129
-
130
108
  ### Configuration options
131
109
 
132
- Each task has a common configuration format with the following options:
110
+ Each task (except Vite) has a common configuration format with the following options:
133
111
 
134
112
  - `src` - defines the input file or files for the build task
135
113
  - `out` - defines the output location of the built code where relevant
@@ -1,37 +1,19 @@
1
- /* eslint-disable no-console */
2
1
  'use strict';
3
2
 
4
3
  const vite = require('vite');
5
4
  const path = require('path');
6
5
  const viteConfig = path.resolve(__dirname, './vite.config.js');
7
6
  const hofDefaults = require('../../../config/hof-defaults');
8
- module.exports = config => {
9
- // The config.production’s value is set up with a command flag
10
- // in the package.json’s script. process.env.NODE_ENV);
11
- console.log('Vite build - production:', config.production, 'env: ', config.env);
12
- console.log('hofDefaults:', hofDefaults);
13
7
 
14
- // if (config.production === true) {
15
- // return vite.build({
16
- // configFile: viteConfig
17
- // });
18
- // }
19
- // process.env.NODE_ENV = 'development'; // TO DO make this dynamic to Ensure
20
- // // the environment is set to development for non-production build
21
- // return vite.build({
22
- // configFile: viteConfig,
23
- // mode: 'development'
24
- // });
8
+ module.exports = config => {
25
9
  process.env.NODE_ENV = hofDefaults.env;
26
10
 
27
11
  if(!config.production) {
28
- console.log('Vite build - expecting development/local:', process.env.NODE_ENV);
29
12
  return vite.build({
30
13
  configFile: viteConfig,
31
14
  mode: 'development'
32
15
  });
33
16
  }
34
- console.log('Vite build - expecting production:', process.env.NODE_ENV);
35
17
  return vite.build({
36
18
  configFile: viteConfig
37
19
  });
@@ -1,4 +1,6 @@
1
1
  <div class="govuk-panel govuk-panel--confirmation" role="alert">
2
2
  <h1 govuk-panel__title>{{#t}}journey.confirmation.message{{/t}}</h1>
3
- <div class="govuk-panel__body">{{#t}}journey.confirmation.details{{/t}}</div>
3
+ <div class="govuk-panel__body">
4
+ {{#t}}journey.confirmation.details{{/t}}
5
+ </div>
4
6
  </div>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "24.0.0-vite-beta.10",
4
+ "version": "24.0.0-vite-beta.12",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -21,21 +21,18 @@
21
21
  "url": "https://github.com/UKHomeOfficeForms/hof/issues"
22
22
  },
23
23
  "scripts": {
24
- "test": "yarn run unit && yarn run test:jest && yarn run test:functional && yarn run test:client && yarn run test:lint",
24
+ "test": "yarn run unit && yarn run test:jest && yarn run test:functional && yarn run test:vite && yarn run test:lint",
25
25
  "unit": "LOG_LEVEL=error nyc _mocha \"test/**/*.spec.js\" \"sandbox/test/**/*.spec.js\"",
26
26
  "unit:nocov": "LOG_LEVEL=error mocha \"test/**/*.spec.js\" \"sandbox/test/**/*.spec.js\"",
27
27
  "test:lint": "eslint . --config ./node_modules/eslint-config-hof/default.js",
28
28
  "test:functional": "funkie mocha ./test/functional-tests --timeout 20000 --exit",
29
- "test:client": "karma start test/frontend/toolkit/karma.conf.js",
29
+ "test:vite": "vitest run --config test/frontend/toolkit/vitest.config.js",
30
30
  "test:jest": "jest test/frontend/jest test/integration/index test/utilities/helpers/jest",
31
31
  "test:acceptance": "TAGS=\"${TAGS:=@feature}\" yarn run test:cucumber",
32
32
  "test:acceptance_browser": "ACCEPTANCE_WITH_BROWSER=true TAGS=\"${TAGS:=@feature}\" yarn run test:cucumber",
33
33
  "test:cucumber": "cucumber-js -f @cucumber/pretty-formatter \"sandbox/test/_features/**/*.feature\" --require sandbox/test/_features/test.setup.js --require \"sandbox/test/_features/step_definitions/**/*.js\" --tags $TAGS",
34
34
  "ci": "travis-conditions",
35
- "postversion": "git push && git push --tags",
36
- "dev": "vite",
37
- "build": "vite build",
38
- "preview": "vite preview"
35
+ "postversion": "git push && git push --tags"
39
36
  },
40
37
  "dependencies": {
41
38
  "@rollup/plugin-commonjs": "^29.0.0",
@@ -103,6 +100,7 @@
103
100
  "@cucumber/cucumber": "^7.3.2",
104
101
  "@cucumber/pretty-formatter": "^1.0.1",
105
102
  "@types/jest": "^26.0.24",
103
+ "@vitest/coverage-v8": "^4.0.8",
106
104
  "@xmldom/xmldom": "~0.8.11",
107
105
  "chai": "^3.5.0",
108
106
  "chai-as-promised": "^7.1.2",
@@ -116,12 +114,6 @@
116
114
  "istanbul": "^0.4.5",
117
115
  "jest": "^26.6.3",
118
116
  "jquery": "^3.7.1",
119
- "karma": "^6.4.4",
120
- "karma-browserify": "^8.1.0",
121
- "karma-chai": "^0.1.0",
122
- "karma-cli": "^2.0.0",
123
- "karma-mocha": "^2.0.1",
124
- "karma-phantomjs-launcher": "^1.0.4",
125
117
  "mocha": "^8.4.0",
126
118
  "mocha-sandbox": "^1.0.0",
127
119
  "node-mocks-http": "^1.17.2",
@@ -135,6 +127,7 @@
135
127
  "sinon-chai": "^3.7.0",
136
128
  "supertest": "^3.4.2",
137
129
  "travis-conditions": "0.0.0",
130
+ "vitest": "^4.0.8",
138
131
  "watchify": "^4.0.0",
139
132
  "webdriverio": "^4.14.4"
140
133
  },