@madgex/fert 5.0.15 → 6.0.1
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
|
@@ -79,12 +79,11 @@ e.g.
|
|
|
79
79
|
|
|
80
80
|
`/services/<service-folder>/fert.service.config.js` [required] – a service configuration file in the service folder, specifying the following config to both the Fert dev server and the production asset build:
|
|
81
81
|
|
|
82
|
-
| Option
|
|
83
|
-
|
|
|
84
|
-
| `serviceName` <String>
|
|
85
|
-
| `entry` <String>
|
|
86
|
-
| `externalAssets` <Object>
|
|
87
|
-
|
|
82
|
+
| Option | |
|
|
83
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
84
|
+
| `serviceName` <String> | Which service to display and deploy, e.g. `jobseekers-frontend`, `recruiterservices-frontend`. |
|
|
85
|
+
| `entry` <String> | The JavaScript entry file. Any assets (CSS/SCSS/SVGs) included will be processed and be part of the output. Defaults to `['src/index.js']` |
|
|
86
|
+
| `externalAssets` <Object> | |
|
|
88
87
|
|
|
89
88
|
The `entry` will be used by Vite to create production bundles.
|
|
90
89
|
|
|
@@ -1,97 +1,36 @@
|
|
|
1
1
|
const Path = require('node:path');
|
|
2
2
|
const fs = require('node:fs/promises');
|
|
3
|
-
const
|
|
4
|
-
const { registerTransforms } = require('@madgex/design-system/tasks/registerTransforms');
|
|
5
|
-
const colorTransforms = require('@madgex/design-system/tasks/colorTransforms');
|
|
3
|
+
const { createStyleDictionary } = require('@madgex/design-system/style-dictionary');
|
|
6
4
|
const { ensureTrailingSlash, exists } = require('../../utils');
|
|
7
5
|
const { log } = require('../../utils/logging');
|
|
8
|
-
const { TMP_DIR } = require('../../../constants');
|
|
9
|
-
|
|
10
|
-
const dsTokensPath = Path.dirname(require.resolve('@madgex/design-system/src/tokens/_config.js'));
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line no-unused-vars
|
|
13
|
-
const createTempBrandFile = async (dir = './') => {
|
|
14
|
-
// Generate unique name to bust style dict cache
|
|
15
|
-
const timestamp = Date.now();
|
|
16
|
-
const tmpBrandFile = Path.join(TMP_DIR, `/fert/brand-${timestamp}.json`);
|
|
17
|
-
const dirPath = Path.dirname(tmpBrandFile);
|
|
18
|
-
|
|
19
|
-
if (!(await exists(dirPath))) {
|
|
20
|
-
await fs.mkdir(dirPath, { recursive: true });
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return tmpBrandFile;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// Style Dictionary is noisy and annoying, this suppresses its output
|
|
27
|
-
async function runSilently(fn) {
|
|
28
|
-
const originalLog = console.log;
|
|
29
|
-
console.log = () => {};
|
|
30
|
-
await fn();
|
|
31
|
-
console.log = originalLog;
|
|
32
|
-
}
|
|
33
6
|
|
|
34
7
|
module.exports = async function buildCssFromTokens(_srcTokensPath, _buildPath) {
|
|
35
8
|
const srcTokensPath = ensureTrailingSlash(Path.resolve(_srcTokensPath));
|
|
36
9
|
const buildPath = ensureTrailingSlash(Path.resolve(_buildPath));
|
|
37
10
|
|
|
38
|
-
const brandFile = Path.join(srcTokensPath, 'brand.json');
|
|
39
|
-
|
|
40
11
|
if (!(await exists(buildPath))) {
|
|
41
12
|
await fs.mkdir(buildPath, { recursive: true });
|
|
42
13
|
}
|
|
43
14
|
|
|
44
|
-
//
|
|
45
|
-
const brandObj = JSON.parse(await fs.readFile(brandFile, { encoding: 'utf8' }));
|
|
46
|
-
const tmpBrandFile = await createTempBrandFile(srcTokensPath);
|
|
47
|
-
|
|
48
|
-
await fs.writeFile(Path.join(tmpBrandFile), JSON.stringify(colorTransforms(brandObj)));
|
|
49
|
-
|
|
50
|
-
// TODO - Investigate whether we can retrieve from DS instead of redefining
|
|
51
|
-
// e.g. const { registerTransforms } = require('@madgex/design-system/tasks/registerTransforms');
|
|
52
|
-
const transforms = ['attribute/cti', 'name/cti/kebab', 'color/css', 'css/rawData'];
|
|
53
|
-
const prefix = 'mds';
|
|
54
|
-
|
|
55
|
-
// TODO - Investigate whether we can retrieve from DS instead of redefining
|
|
15
|
+
// pass brand token overrides and configure output paths
|
|
56
16
|
const styleDictionaryConfig = {
|
|
57
|
-
|
|
58
|
-
source: [tmpBrandFile],
|
|
17
|
+
source: [Path.join(srcTokensPath, 'brand.json')],
|
|
59
18
|
platforms: {
|
|
60
19
|
'css-variables': {
|
|
61
|
-
transforms,
|
|
62
|
-
prefix,
|
|
63
20
|
buildPath: Path.join(buildPath, 'css-vars/'),
|
|
64
|
-
files: [
|
|
65
|
-
{
|
|
66
|
-
destination: `variables.css`,
|
|
67
|
-
format: 'css/variables',
|
|
68
|
-
filter: 'removePrivate',
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
21
|
},
|
|
72
22
|
'json-variables': {
|
|
73
|
-
transforms,
|
|
74
|
-
prefix,
|
|
75
23
|
buildPath: Path.join(buildPath, 'json/'),
|
|
76
|
-
files: [
|
|
77
|
-
{
|
|
78
|
-
destination: `variables.json`,
|
|
79
|
-
format: 'json/nested',
|
|
80
|
-
filter: 'removePrivate',
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
24
|
},
|
|
84
25
|
},
|
|
85
26
|
};
|
|
86
27
|
|
|
87
28
|
// Use StyleDictionary to build a tokens SCSS file
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
await registerTransforms(StyleDictionary);
|
|
91
|
-
await runSilently(StyleDictionary.buildAllPlatforms.bind(StyleDictionary));
|
|
29
|
+
const { styleDictionary, cleanTempFiles } = await createStyleDictionary(styleDictionaryConfig);
|
|
92
30
|
|
|
93
|
-
|
|
94
|
-
await
|
|
31
|
+
await styleDictionary.buildPlatform('css-variables');
|
|
32
|
+
await styleDictionary.buildPlatform('json-variables');
|
|
33
|
+
await cleanTempFiles();
|
|
95
34
|
|
|
96
35
|
log.success('Token build complete (CSS & JSON).');
|
|
97
36
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madgex/fert",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Tool to help build the V6 branding",
|
|
5
5
|
"bin": {
|
|
6
6
|
"fert": "./bin/cli.js"
|
|
@@ -24,37 +24,36 @@
|
|
|
24
24
|
"author": "Madgex",
|
|
25
25
|
"license": "UNLICENSED",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aws-sdk/client-cloudfront": "^3.
|
|
28
|
-
"@aws-sdk/client-ssm": "^3.
|
|
27
|
+
"@aws-sdk/client-cloudfront": "^3.799.0",
|
|
28
|
+
"@aws-sdk/client-ssm": "^3.799.0",
|
|
29
29
|
"@hapi/hapi": "^21.4.0",
|
|
30
30
|
"@hapi/hoek": "^11.0.7",
|
|
31
31
|
"@hapi/inert": "^7.1.0",
|
|
32
32
|
"@hapi/vision": "^7.0.3",
|
|
33
33
|
"@hapipal/toys": "^4.0.0",
|
|
34
|
-
"@madgex/
|
|
35
|
-
"@madgex/
|
|
34
|
+
"@madgex/design-system": "^10.0.2",
|
|
35
|
+
"@madgex/config-api-sdk": "^1.8.0",
|
|
36
36
|
"@private/header-footer-podlet-server": "github:wiley/madgex-header-footer-podlet",
|
|
37
|
-
"axios": "^1.
|
|
37
|
+
"axios": "^1.9.0",
|
|
38
38
|
"cac": "^6.7.14",
|
|
39
39
|
"chalk": "4.1.2",
|
|
40
40
|
"chokidar": "^3.5.3",
|
|
41
41
|
"debug": "^4.4.0",
|
|
42
42
|
"dedent": "^1.5.3",
|
|
43
|
-
"find-up-simple": "^1.0.
|
|
43
|
+
"find-up-simple": "^1.0.1",
|
|
44
44
|
"flat-cache": "^4.0.0",
|
|
45
|
-
"form-data": "^4.0.
|
|
45
|
+
"form-data": "^4.0.2",
|
|
46
46
|
"lodash": "^4.17.21",
|
|
47
47
|
"nunjucks": "^3.2.4",
|
|
48
48
|
"open": "8.4.2",
|
|
49
49
|
"ora": "5.4.1",
|
|
50
50
|
"prompts": "^2.4.2",
|
|
51
51
|
"rimraf": "^5.0.5",
|
|
52
|
-
"sass": "^1.
|
|
52
|
+
"sass": "^1.87.0",
|
|
53
53
|
"simple-git": "^3.27.0",
|
|
54
54
|
"simple-update-notifier": "^2.0.0",
|
|
55
|
-
"style-dictionary": "3.9.0",
|
|
56
55
|
"uuid-validate": "^0.0.3",
|
|
57
|
-
"vite": "^4.5.
|
|
56
|
+
"vite": "^4.5.14",
|
|
58
57
|
"vite-plugin-static-copy": "^0.17.1"
|
|
59
58
|
},
|
|
60
59
|
"devDependencies": {
|
|
@@ -62,16 +61,13 @@
|
|
|
62
61
|
"@commitlint/config-conventional": "^19.8.0",
|
|
63
62
|
"@madgex/eslint-config-madgex": "^2.3.0",
|
|
64
63
|
"@madgex/prettier-config-madgex": "^2.0.0",
|
|
65
|
-
"eslint": "^9.
|
|
64
|
+
"eslint": "^9.25.1",
|
|
66
65
|
"husky": "^9.1.7",
|
|
67
66
|
"joi": "^17.13.3",
|
|
68
|
-
"lint-staged": "^15.5.
|
|
67
|
+
"lint-staged": "^15.5.1",
|
|
69
68
|
"prettier": "^3.5.3",
|
|
70
69
|
"semantic-release": "^24.2.3"
|
|
71
70
|
},
|
|
72
|
-
"peerDependencies": {
|
|
73
|
-
"@ctrl/tinycolor": "^3.6.0"
|
|
74
|
-
},
|
|
75
71
|
"lint-staged": {
|
|
76
72
|
"*.{js,json}": [
|
|
77
73
|
"prettier --write",
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
"color": {
|
|
3
3
|
"brand": {
|
|
4
4
|
"1": {
|
|
5
|
-
"base": { "value": "#005689" }
|
|
5
|
+
"base": { "$value": "#005689" }
|
|
6
6
|
},
|
|
7
7
|
"2": {
|
|
8
|
-
"base": { "value": "#343434" }
|
|
8
|
+
"base": { "$value": "#343434" }
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"button": {
|
|
12
12
|
"bg": {
|
|
13
|
-
"base": { "value": "
|
|
13
|
+
"base": { "$value": "{color.brand.1.base}" }
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"font": {
|
|
18
18
|
"family": {
|
|
19
19
|
"button": {
|
|
20
|
-
"base": { "value": "Arial" }
|
|
20
|
+
"base": { "$value": "Arial" }
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|