@madgex/fert 7.0.0 → 7.0.2

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.
@@ -6,6 +6,7 @@ import { buildExternalAssets } from './build-external-assets.js';
6
6
  import { log } from '../../utils/logging.js';
7
7
  import { getAssetsPath } from '../../utils/get-assets-path.js';
8
8
  import { buildTemplates } from './build-templates.js';
9
+ import { createAbsoluteManifest } from './create-absolute-manifest.js';
9
10
 
10
11
  export async function bundleEntry(fertConfig, options = {}) {
11
12
  let dynamicOptions = {};
@@ -37,6 +38,8 @@ export async function bundleEntry(fertConfig, options = {}) {
37
38
 
38
39
  await vite.build(viteConfig);
39
40
 
41
+ createAbsoluteManifest(fertConfig.workingDir, assetsPath.href);
42
+
40
43
  await buildTemplates(fertConfig, assetsPath.href);
41
44
 
42
45
  await buildExternalAssets(fertConfig);
@@ -0,0 +1,34 @@
1
+ import path from 'node:path';
2
+ import fs from 'node:fs';
3
+ import { log } from '../../utils/logging.js';
4
+
5
+ /**
6
+ * Writes a new file based on Vite's `manifest.json`, but re-write the file paths to be absolute URLs pointing using `assetsPath`.
7
+ *
8
+ * @param {string} workingDir
9
+ * @param {string} assetsPath absolute URL to prefix all file paths in manifest
10
+ */
11
+ export function createAbsoluteManifest(workingDir, assetsPath) {
12
+ const distDir = path.resolve(workingDir, './dist/');
13
+
14
+ if (!fs.existsSync(path.resolve(distDir, 'manifest.json'))) return;
15
+
16
+ const originalManifest = JSON.parse(fs.readFileSync(path.resolve(distDir, 'manifest.json'), 'utf8'));
17
+
18
+ for (const key in originalManifest) {
19
+ const entry = originalManifest[key];
20
+
21
+ // Update asset path to use asset-relay url
22
+ if (entry.file) {
23
+ entry.file = `${assetsPath}/${entry.file}`;
24
+ }
25
+ }
26
+
27
+ fs.writeFileSync(
28
+ path.resolve(distDir, 'manifest.absolute-urls.json'),
29
+ JSON.stringify(originalManifest, null, 2),
30
+ 'utf8',
31
+ );
32
+
33
+ log.success('manifest.absolute-urls.json created');
34
+ }
@@ -1,5 +1,12 @@
1
1
  import { ASSET_RELAY_API } from '../../constants.js';
2
2
 
3
+ /**
4
+ * fetch the Absolute URL `publicUrl` from asset-relay API, for current client & service
5
+ *
6
+ * @param {object} fertConfig
7
+ * @param {object} environment
8
+ * @returns {URL} Absoloute Public URL for assets
9
+ */
3
10
  export async function getAssetsPath(fertConfig, environment) {
4
11
  const { clientPropertyId, serviceName, client, config } = fertConfig;
5
12
 
@@ -31,5 +38,7 @@ export async function getAssetsPath(fertConfig, environment) {
31
38
  const data = await response.json();
32
39
  const { publicUrl } = Array.isArray(data) ? data[0] : data;
33
40
 
34
- return new URL(`${publicUrl}/${environment}`);
41
+ // TODO: temporarily removing environment for production until all repos are on new version
42
+ // return new URL(`${publicUrl}/${environment}`);
43
+ return new URL(`${publicUrl}${environment === 'dev' ? '/dev' : ''}`);
35
44
  }
package/constants.js CHANGED
@@ -59,22 +59,24 @@ export const MOCK_AUTH_OBJECT = {
59
59
  username: 'Samus Aran',
60
60
  },
61
61
  artifacts: {
62
- recruiters: [
63
- {
64
- id: 1,
65
- name: 'Recruiter 1',
66
- basketCount: 0,
67
- isPrimary: true,
68
- hasCredits: true,
69
- },
70
- {
71
- id: 2,
72
- name: 'Recruiter 2',
73
- basketCount: 0,
74
- isPrimary: false,
75
- hasCredits: false,
76
- },
77
- ],
62
+ recruiterSummary: {
63
+ recruiters: [
64
+ {
65
+ id: 1,
66
+ name: 'Recruiter 1',
67
+ basketCount: 0,
68
+ isPrimary: true,
69
+ hasCredits: true,
70
+ },
71
+ {
72
+ id: 2,
73
+ name: 'Recruiter 2',
74
+ basketCount: 0,
75
+ isPrimary: false,
76
+ hasCredits: false,
77
+ },
78
+ ],
79
+ },
78
80
  },
79
81
  },
80
82
  'jobseekers-frontend': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madgex/fert",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
4
4
  "description": "Tool to help build the V6 branding",
5
5
  "bin": {
6
6
  "fert": "./bin/cli.js"
@@ -0,0 +1,34 @@
1
+ {
2
+ "public/fonts/mdgx-icons.eot": {
3
+ "file": "https://asset-relay.madgexjb.com/big-work-bag-6tORXNlh/assets/mdgx-icons-nszT880f.eot",
4
+ "src": "public/fonts/mdgx-icons.eot"
5
+ },
6
+ "public/fonts/mdgx-icons.svg": {
7
+ "file": "https://asset-relay.madgexjb.com/big-work-bag-6tORXNlh/assets/mdgx-icons-CLXOai0m.svg",
8
+ "src": "public/fonts/mdgx-icons.svg"
9
+ },
10
+ "public/fonts/mdgx-icons.ttf": {
11
+ "file": "https://asset-relay.madgexjb.com/big-work-bag-6tORXNlh/assets/mdgx-icons-dLFZ0BjQ.ttf",
12
+ "src": "public/fonts/mdgx-icons.ttf"
13
+ },
14
+ "public/fonts/mdgx-icons.woff": {
15
+ "file": "https://asset-relay.madgexjb.com/big-work-bag-6tORXNlh/assets/mdgx-icons-CmuOtNp9.woff",
16
+ "src": "public/fonts/mdgx-icons.woff"
17
+ },
18
+ "src/index.js": {
19
+ "file": "https://asset-relay.madgexjb.com/big-work-bag-6tORXNlh/assets/index-PBIhszZ7.js",
20
+ "name": "index",
21
+ "src": "src/index.js",
22
+ "isEntry": true,
23
+ "assets": [
24
+ "assets/mdgx-icons-nszT880f.eot",
25
+ "assets/mdgx-icons-CmuOtNp9.woff",
26
+ "assets/mdgx-icons-dLFZ0BjQ.ttf",
27
+ "assets/mdgx-icons-CLXOai0m.svg"
28
+ ]
29
+ },
30
+ "style.css": {
31
+ "file": "https://asset-relay.madgexjb.com/big-work-bag-6tORXNlh/assets/style-BzoEQQhI.css",
32
+ "src": "style.css"
33
+ }
34
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "public/fonts/mdgx-icons.eot": {
3
+ "file": "assets/mdgx-icons-nszT880f.eot",
4
+ "src": "public/fonts/mdgx-icons.eot"
5
+ },
6
+ "public/fonts/mdgx-icons.svg": {
7
+ "file": "assets/mdgx-icons-CLXOai0m.svg",
8
+ "src": "public/fonts/mdgx-icons.svg"
9
+ },
10
+ "public/fonts/mdgx-icons.ttf": {
11
+ "file": "assets/mdgx-icons-dLFZ0BjQ.ttf",
12
+ "src": "public/fonts/mdgx-icons.ttf"
13
+ },
14
+ "public/fonts/mdgx-icons.woff": {
15
+ "file": "assets/mdgx-icons-CmuOtNp9.woff",
16
+ "src": "public/fonts/mdgx-icons.woff"
17
+ },
18
+ "src/index.js": {
19
+ "file": "assets/index-PBIhszZ7.js",
20
+ "name": "index",
21
+ "src": "src/index.js",
22
+ "isEntry": true,
23
+ "assets": [
24
+ "assets/mdgx-icons-nszT880f.eot",
25
+ "assets/mdgx-icons-CmuOtNp9.woff",
26
+ "assets/mdgx-icons-dLFZ0BjQ.ttf",
27
+ "assets/mdgx-icons-CLXOai0m.svg"
28
+ ]
29
+ },
30
+ "style.css": {
31
+ "file": "assets/style-BzoEQQhI.css",
32
+ "src": "style.css"
33
+ }
34
+ }