@madgex/fert 1.6.0 → 1.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.
@@ -19,11 +19,23 @@ jobs:
19
19
  uses: actions/setup-node@v2
20
20
  with:
21
21
  cache: npm
22
- node-version: 14
22
+ node-version: 20
23
+
24
+ - name: Setup SSH Keys and known_hosts
25
+ env:
26
+ SSH_AUTH_SOCK: /tmp/ssh_agent.sock
27
+ run: |
28
+ ssh-agent -a $SSH_AUTH_SOCK > /dev/null
29
+ ssh-add - <<< "${{ secrets.MADGEX_GITHUB_SSH_KEY }}"
30
+
23
31
  - name: Install dependencies
24
32
  run: npm ci
33
+ env:
34
+ SSH_AUTH_SOCK: /tmp/ssh_agent.sock
35
+ NPM_TOKEN: ${{ secrets.MADGEX_NPM_TOKEN }}
36
+
25
37
  - name: Release
26
38
  env:
27
39
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
40
+ NPM_TOKEN: ${{ secrets.MADGEX_NPM_TOKEN }}
29
41
  run: npx semantic-release
@@ -33,6 +33,7 @@ module.exports = class AssetStoreUploader {
33
33
 
34
34
  const form = new FormData();
35
35
  form.append('data', fs.createReadStream(file));
36
+ form.append('invalidateCache', 'false'); // opt out as will invalidate whole path (*) at end
36
37
  form.append('modifiedById', ASSET_STORE_USER_GUID);
37
38
 
38
39
  const spinner = ora(`${chalk.yellow('Uploading')}: ${label}`).start();
@@ -77,6 +78,34 @@ module.exports = class AssetStoreUploader {
77
78
  };
78
79
  }
79
80
 
81
+ /**
82
+ * Invalidate files on all CloudFront edge locations
83
+ * @param {array} paths Paths to invalidate
84
+ */
85
+ async invalidatePaths(paths) {
86
+ const invalidateUrl = new URL('api/assets/invalidate', this.apiUrl);
87
+
88
+ log.debug('invalidating', { paths });
89
+
90
+ const payload = {
91
+ modifiedById: ASSET_STORE_USER_GUID,
92
+ paths,
93
+ };
94
+
95
+ await axios.post(invalidateUrl.href, payload, {
96
+ headers: {
97
+ apikey: this.apiKey,
98
+ },
99
+ });
100
+
101
+ log.info(
102
+ `CloudFront cache invalidation sent for the following paths:\n${JSON.stringify(
103
+ paths
104
+ )}\n\nNote this may take upto ${chalk.yellow(
105
+ '30 seconds'
106
+ )} to complete.\n`
107
+ );
108
+ }
80
109
  // Returns array of all files in provided directory (recursive)
81
110
  _getFilesFromDir = (dir, files = []) => {
82
111
  fs.readdirSync(dir).forEach((entry) => {
@@ -10,6 +10,7 @@ const {
10
10
  AWS_PARAM_NAME,
11
11
  REMOTE_UPLOAD_BASE,
12
12
  UPLOAD_DIR,
13
+ INVALIDATION_PATH,
13
14
  } = require('../../constants');
14
15
 
15
16
  module.exports = async (root, options) => {
@@ -32,6 +33,7 @@ module.exports = async (root, options) => {
32
33
  const apiUrl = Hoek.reachTemplate(templateCtx, ASSET_STORE_API);
33
34
  const remoteBasePath = Hoek.reachTemplate(templateCtx, REMOTE_UPLOAD_BASE);
34
35
  const apiKeyParamPath = Hoek.reachTemplate(templateCtx, AWS_PARAM_NAME);
36
+ const invalidationPath = Hoek.reachTemplate(templateCtx, INVALIDATION_PATH);
35
37
 
36
38
  const apiKey = await getAwsParam(apiKeyParamPath);
37
39
 
@@ -49,4 +51,6 @@ module.exports = async (root, options) => {
49
51
  const result = await assetStore.uploadDir(localDir);
50
52
 
51
53
  log.success(`Publish complete in ${(result.duration / 1000).toFixed(0)}s\n`);
54
+
55
+ await assetStore.invalidatePaths([invalidationPath]);
52
56
  };
package/constants.js CHANGED
@@ -23,6 +23,7 @@ module.exports = {
23
23
  '/api/assets/jobseekers-frontend/{fertConfig.clientPropertyId}',
24
24
  AWS_PARAM_NAME:
25
25
  '/{Environement_Name}/jobboard/kong/internal/consumer-key/jobseekers-frontend_{fertConfig.client.rootClientPropertyId}',
26
+ INVALIDATION_PATH: `/jobseekers-frontend/{fertConfig.clientPropertyId}/*`,
26
27
  ASSET_STORE_USER_GUID: 'a386d4b6-f2df-4b80-ad1f-0349e23f530b',
27
28
  TEMPLATES: [
28
29
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madgex/fert",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Tool to help build the V6 branding",
5
5
  "bin": {
6
6
  "fert": "./bin/cli.js"
@@ -23,8 +23,8 @@
23
23
  "author": "Madgex",
24
24
  "license": "UNLICENSED",
25
25
  "dependencies": {
26
- "@aws-sdk/client-ssm": "^3.370.0",
27
- "@aws-sdk/credential-providers": "^3.370.0",
26
+ "@aws-sdk/client-ssm": "^3.453.0",
27
+ "@aws-sdk/credential-providers": "^3.451.0",
28
28
  "@hapi/hapi": "^21.3.2",
29
29
  "@hapi/hoek": "^11.0.2",
30
30
  "@hapi/inert": "^7.1.0",
@@ -32,11 +32,11 @@
32
32
  "@hapipal/toys": "^4.0.0",
33
33
  "@madgex/design-system": "*",
34
34
  "@private/header-footer-podlet-server": "github:wiley/madgex-header-footer-podlet",
35
- "axios": "^1.5.0",
35
+ "axios": "^1.6.2",
36
36
  "cac": "^6.7.14",
37
37
  "chalk": "4.1.2",
38
38
  "chokidar": "^3.5.3",
39
- "dayjs": "^1.11.9",
39
+ "dayjs": "^1.11.10",
40
40
  "debug": "^4.3.4",
41
41
  "form-data": "^4.0.0",
42
42
  "lodash": "^4.17.21",
@@ -45,26 +45,26 @@
45
45
  "open": "8.4.2",
46
46
  "ora": "5.4.1",
47
47
  "prompts": "^2.4.2",
48
- "rimraf": "^5.0.1",
49
- "sass": "^1.66.1",
48
+ "rimraf": "^5.0.5",
49
+ "sass": "^1.69.5",
50
50
  "simple-update-notifier": "^2.0.0",
51
- "style-dictionary": "^3.8.0",
51
+ "style-dictionary": "^3.9.0",
52
52
  "uuid-validate": "^0.0.3",
53
53
  "vite": "^4.4.9",
54
- "vite-plugin-static-copy": "^0.17.0"
54
+ "vite-plugin-static-copy": "^0.17.1"
55
55
  },
56
56
  "devDependencies": {
57
- "@commitlint/cli": "^17.6.7",
58
- "@commitlint/config-conventional": "^17.7.0",
57
+ "@commitlint/cli": "^18.4.2",
58
+ "@commitlint/config-conventional": "^18.4.2",
59
59
  "commitizen": "^4.3.0",
60
60
  "cz-conventional-changelog": "^3.3.0",
61
- "eslint": "^8.49.0",
61
+ "eslint": "^8.53.0",
62
62
  "eslint-config-prettier": "^9.0.0",
63
- "eslint-plugin-prettier": "^5.0.0",
63
+ "eslint-plugin-prettier": "^5.0.1",
64
64
  "husky": "^8.0.3",
65
- "lint-staged": "^14.0.1",
66
- "prettier": "^3.0.3",
67
- "semantic-release": "^21.1.1"
65
+ "lint-staged": "^15.1.0",
66
+ "prettier": "^3.1.0",
67
+ "semantic-release": "^22.0.8"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@ctrl/tinycolor": "^3.6.0"
package/delivery/git.cer DELETED
@@ -1,22 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDmzCCAoOgAwIBAgIQFausXHONQJZAJThAIzsEMzANBgkqhkiG9w0BAQsFADBC
3
- MRUwEwYKCZImiZPyLGQBGRYFbG9jYWwxGDAWBgoJkiaJk/IsZAEZFghDbGFyZW5j
4
- ZTEPMA0GA1UEAxMGcm9vdGNhMB4XDTIyMDgxNzE0MDgxNVoXDTMyMDgxODEwMTAx
5
- NVowQjEVMBMGCgmSJomT8ixkARkWBWxvY2FsMRgwFgYKCZImiZPyLGQBGRYIQ2xh
6
- cmVuY2UxDzANBgNVBAMTBnJvb3RjYTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
7
- AQoCggEBAKBP9oZ923t+O3ydOoZtptE70cxFA9B7BM9tNVWvKU93LeUc/Sj1nd0M
8
- nToMElEfKasUWPBOaNS1Nkz7UZ8FhibNzqGp5LwFQxFzYoCIEB5eWumECUV5mrey
9
- 4wKt5cZypQ33bwAhlvtP2MHBaYd/GBfYVww7k81SWaOTMfZLO4jPbTrPe2vJo4Zr
10
- 4YXkK/ntGGlUrYG+L7cEAC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