lbh-frontend 3.6.1 → 3.7.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.
@@ -1,8 +1,6 @@
1
1
  const path = require("path");
2
- const util = require("util");
3
2
 
4
- const sass = require("node-sass");
5
- const sassRender = util.promisify(sass.render);
3
+ const sassRender = require("../test/sass-render.cjs");
6
4
 
7
5
  describe("The helpers layer", () => {
8
6
  it("should not output any CSS", async () => {
@@ -1,12 +1,7 @@
1
- /* eslint-env jest */
2
-
3
- const util = require("util");
4
-
5
1
  // const configPaths = require("../../config/paths.json");
6
2
 
7
3
  const outdent = require("outdent");
8
- const sass = require("node-sass");
9
- const sassRender = util.promisify(sass.render);
4
+ const sassRender = require("../test/sass-render.cjs");
10
5
 
11
6
  const sassConfig = {
12
7
  includePaths: ["lbh/"],
@@ -1,7 +1,4 @@
1
- const util = require("util");
2
- const sass = require("node-sass");
3
-
4
- const sassRender = util.promisify(sass.render);
1
+ const sassRender = require("../test/sass-render.cjs");
5
2
 
6
3
  describe("The objects layer", () => {
7
4
  it("renders to CSS without errors", async () => {
@@ -1,10 +1,6 @@
1
- /* eslint-env jest */
2
-
3
1
  const path = require("path");
4
- const util = require("util");
5
2
 
6
- const sass = require("node-sass");
7
- const sassRender = util.promisify(sass.render);
3
+ const sassRender = require("../test/sass-render.cjs");
8
4
 
9
5
  describe("The settings layer", () => {
10
6
  it("should not output any CSS", async () => {
@@ -0,0 +1,63 @@
1
+ const { execFileSync } = require("child_process");
2
+ const fs = require("fs");
3
+ const path = require("path");
4
+ const PROJECT_ROOT = path.dirname(require.resolve("../../package.json"));
5
+
6
+ const OUTPUT_STYLE_MAP = {
7
+ nested: "expanded",
8
+ compact: "expanded",
9
+ };
10
+
11
+ function resolveFromRoot (filePath) {
12
+ return path.isAbsolute(filePath)
13
+ ? filePath
14
+ : path.join(PROJECT_ROOT, filePath);
15
+ }
16
+
17
+ const SASS_CLI = path.join(PROJECT_ROOT, "node_modules/sass/sass.js");
18
+
19
+ function renderWithCli ({ input, includePaths, outputStyle }) {
20
+ const style = OUTPUT_STYLE_MAP[outputStyle] || outputStyle || "expanded";
21
+ const args = [
22
+ "--stdin",
23
+ `--style=${style}`,
24
+ "--no-source-map",
25
+ ...includePaths.flatMap((dir) => [`--load-path=${dir}`]),
26
+ ];
27
+
28
+ const css = execFileSync(process.execPath, [SASS_CLI, ...args], {
29
+ cwd: PROJECT_ROOT,
30
+ input,
31
+ encoding: "utf8",
32
+ });
33
+
34
+ return { css: Buffer.from(css) };
35
+ }
36
+
37
+ function sassRender (options) {
38
+ const file = options.file && resolveFromRoot(options.file);
39
+ const includePaths = [PROJECT_ROOT];
40
+ if (options.includePaths) {
41
+ includePaths.push(...options.includePaths.map(resolveFromRoot));
42
+ }
43
+ if (file) {
44
+ includePaths.push(path.dirname(file));
45
+ }
46
+
47
+ try {
48
+ const input = file ? fs.readFileSync(file, "utf8") : options.data;
49
+ const result = renderWithCli({
50
+ input,
51
+ includePaths,
52
+ outputStyle: options.outputStyle,
53
+ });
54
+ return Promise.resolve({ css: result.css });
55
+ } catch (err) {
56
+ if (err.stdout) {
57
+ err.message = err.stderr?.toString() || err.message;
58
+ }
59
+ return Promise.reject(err);
60
+ }
61
+ }
62
+
63
+ module.exports = sassRender;
@@ -1,9 +1,4 @@
1
- /* eslint-env jest */
2
-
3
- const util = require("util");
4
-
5
- const sass = require("node-sass");
6
- const sassRender = util.promisify(sass.render);
1
+ const sassRender = require("../test/sass-render.cjs");
7
2
 
8
3
  const sassConfig = {
9
4
  includePaths: ["lbh/"],
package/package.json CHANGED
@@ -1,94 +1,87 @@
1
1
  {
2
2
  "name": "lbh-frontend",
3
- "version": "3.6.1",
3
+ "version": "3.7.0",
4
4
  "description": "Everything you need to make digital services for Hackney",
5
5
  "license": "MIT",
6
6
  "homepage": "https://design-system.hackney.gov.uk",
7
7
  "main": "lbh/all.js",
8
8
  "types": "lbh/index.d.ts",
9
+ "files": [
10
+ "lbh",
11
+ "dist",
12
+ "CHANGELOG.md"
13
+ ],
14
+ "engines": {
15
+ "node": "24.14"
16
+ },
9
17
  "scripts": {
10
- "build:sass": "cross-var sass lbh/all.scss dist/lbh-frontend-$npm_package_version.min.css --load-path=./ --no-source-map",
11
- "build:sass-ie8": "cross-var sass lbh/all-ie8.scss dist/lbh-frontend-ie8-$npm_package_version.min.css --load-path=./ --no-source-map",
12
- "build:js": "cross-var parcel build lbh/all.js --out-dir dist --global LBHFrontend --out-file lbh-frontend-$npm_package_version.min.js --no-source-maps",
13
- "build:sassdoc": "sassdoc lbh --dest static/sassdoc",
18
+ "build:sass": "sass lbh/all.scss dist/lbh-frontend-$npm_package_version.min.css --load-path=./ --no-source-map",
19
+ "build:js": "node scripts/build-js.js",
14
20
  "build:docs": "docusaurus build",
15
21
  "build:assets": "copyfiles lbh/assets/**/**/**/* dist/assets -u 2",
22
+ "build:dist": "npm-run-all build:sass build:js build:assets",
16
23
  "build": "npm-run-all build:*",
17
24
  "clean:docs": "docusaurus clear",
18
25
  "clean:dist": "rimraf dist",
19
26
  "clean": "npm-run-all clean:*",
20
27
  "start": "docusaurus start",
21
- "semantic-release": "semantic-release",
22
28
  "test": "jest",
29
+ "lint": "eslint lbh",
30
+ "verify:pack": "node scripts/verify-pack.js",
31
+ "audit:ci": "npm audit --audit-level=moderate",
23
32
  "prepublishOnly": "npm-run-all -s clean build"
24
33
  },
25
34
  "devDependencies": {
26
- "@babel/preset-env": "^7.13.15",
27
- "@babel/preset-react": "^7.13.13",
28
- "@babel/preset-typescript": "^7.13.0",
29
- "@docusaurus/core": "2.0.0-alpha.70",
30
- "@docusaurus/preset-classic": "2.0.0-alpha.70",
31
- "@mdx-js/react": "^1.6.21",
32
- "@semantic-release/changelog": "^5.0.1",
33
- "@semantic-release/git": "^9.0.0",
34
- "@testing-library/react": "^11.2.6",
35
- "@types/jest": "^26.0.22",
35
+ "@babel/preset-env": "^7.26.0",
36
+ "@babel/preset-react": "^7.26.0",
37
+ "@babel/preset-typescript": "^7.26.0",
38
+ "@docusaurus/core": "3.10.1",
39
+ "@docusaurus/module-type-aliases": "3.10.1",
40
+ "@docusaurus/preset-classic": "3.10.1",
41
+ "@docusaurus/types": "3.10.1",
42
+ "@eslint/js": "^9.39.1",
43
+ "@mdx-js/react": "^3.1.0",
44
+ "@testing-library/react": "^14.3.1",
45
+ "@types/jest": "^29.5.14",
46
+ "ajv": "^8.20.0",
47
+ "browserslist-to-esbuild": "^2.1.1",
36
48
  "copyfiles": "^2.4.1",
37
- "cross-var": "^1.1.0",
38
- "docusaurus-image-loader": "^1.0.1",
39
- "docusaurus-plugin-sass": "^0.1.11",
40
- "jest": "^26.6.3",
49
+ "docusaurus-plugin-sass": "0.2.6",
50
+ "esbuild": "^0.25.0",
51
+ "eslint": "^9.39.1",
52
+ "globals": "^16.5.0",
53
+ "jest": "^29.7.0",
54
+ "jest-environment-jsdom": "^29.7.0",
41
55
  "npm-run-all": "^4.1.5",
42
56
  "outdent": "^0.8.0",
43
- "parcel-bundler": "^1.12.4",
44
- "react": "^16.8.4",
45
- "react-dom": "^16.8.4",
46
- "rimraf": "^3.0.2",
47
- "sass": "^1.32.8",
48
- "sassdoc": "^2.7.0",
49
- "semantic-release": "^17.3.9",
50
- "standard": "^13.1.0"
57
+ "react": "^18.3.1",
58
+ "react-dom": "^18.3.1",
59
+ "rimraf": "^5.0.10",
60
+ "sass": "^1.32.8"
51
61
  },
52
62
  "optionalDependencies": {
53
63
  "fsevents": "*"
54
64
  },
55
- "browserslist": [
56
- ">0.1%",
57
- "last 2 Chrome versions",
58
- "last 2 Firefox versions",
59
- "last 2 Edge versions",
60
- "last 2 Samsung versions",
61
- "Safari >= 9",
62
- "ie 8-11",
63
- "iOS >= 9"
64
- ],
65
- "standard": {
66
- "globals": [
67
- "page",
68
- "browser",
69
- "context"
70
- ],
71
- "ignore": [
72
- "/dist/**/*.js",
73
- "/package/**/*.js",
74
- "/src/vendor/polyfills/**/*.js"
65
+ "jest": {
66
+ "testEnvironment": "jsdom",
67
+ "testPathIgnorePatterns": [
68
+ "/node_modules/",
69
+ "/dist/"
75
70
  ]
76
71
  },
77
72
  "dependencies": {
78
- "@reach/dialog": "^0.15.0",
79
- "@tippyjs/react": "^4.2.5",
80
- "dialog-polyfill": "^0.5.6",
81
- "govuk-frontend": "^3.11.0",
82
- "leaflet": "^1.7.1",
83
- "underscore": "^1.9.1"
73
+ "@radix-ui/react-dialog": "^1.1.15",
74
+ "@tippyjs/react": "^4.2.6",
75
+ "govuk-frontend": "^3.15.0",
76
+ "leaflet": "^1.9.4"
84
77
  },
85
78
  "sasslintConfig": "config/.sass-lint.yml",
86
79
  "bugs": {
87
- "url": "https://github.com/LBHackney-IT/LBH-frontend/issues"
80
+ "url": "https://github.com/LBHackney-IT/lbh-frontend/issues"
88
81
  },
89
82
  "repository": {
90
83
  "type": "git",
91
- "url": "https://github.com/LBHackney-IT/LBH-frontend.git"
84
+ "url": "https://github.com/LBHackney-IT/lbh-frontend.git"
92
85
  },
93
86
  "keywords": [
94
87
  "govuk",
@@ -96,33 +89,5 @@
96
89
  "design system",
97
90
  "template",
98
91
  "hackney"
99
- ],
100
- "release": {
101
- "branches": [
102
- "main"
103
- ],
104
- "plugins": [
105
- "@semantic-release/commit-analyzer",
106
- "@semantic-release/release-notes-generator",
107
- "@semantic-release/npm",
108
- "@semantic-release/github",
109
- [
110
- "@semantic-release/changelog",
111
- {
112
- "changelogFile": "CHANGELOG.md"
113
- }
114
- ],
115
- [
116
- "@semantic-release/git",
117
- {
118
- "assets": [
119
- "dist",
120
- "package.json",
121
- "CHANGELOG.md"
122
- ],
123
- "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
124
- }
125
- ]
126
- ]
127
- }
92
+ ]
128
93
  }