gdu 4.0.9 → 4.1.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.
@@ -17,11 +17,6 @@ const buildSSR = async (guruConfig) => {
17
17
  stdio: 'inherit',
18
18
  cwd: roots_1.PROJECT_ROOT,
19
19
  localDir: roots_1.GDU_ROOT,
20
- extendEnv: true,
21
- env: {
22
- NODE_ENV: 'production',
23
- APP_ENV: process.env.APP_ENV || 'prod',
24
- },
25
20
  })
26
21
  .then((result) => {
27
22
  console.log(`${kleur_1.dim('SUCCESS!')}`, `${kleur_1.dim('Listening')}: ${kleur_1.blue(result === null || result === void 0 ? void 0 : result.all)}`);
@@ -11,7 +11,6 @@ declare function _exports(guruConfig: any): {
11
11
  haste: boolean;
12
12
  isDevVariable: string;
13
13
  eagerESModules: boolean;
14
- artifactDirectory: string;
15
14
  })[])[];
16
15
  };
17
16
  export = _exports;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  const { join } = require('path');
3
3
  const browsers = require('browserslist-config-autoguru');
4
- const { PROJECT_ROOT } = require('../lib/roots');
5
4
  module.exports = (guruConfig) => {
6
5
  let hasRelay = false;
7
6
  try {
@@ -41,7 +40,6 @@ module.exports = (guruConfig) => {
41
40
  haste: false,
42
41
  isDevVariable: '__DEV__',
43
42
  eagerESModules: true,
44
- artifactDirectory: join(PROJECT_ROOT, '../../', 'packages', 'relay', '__generated__'),
45
43
  },
46
44
  ],
47
45
  require.resolve('babel-plugin-treat'),
@@ -2,26 +2,21 @@ export declare const withTM: (nextConfig?: {}) => {};
2
2
  export declare const createNextJSConfig: (buildEnv: any) => {
3
3
  distDir: string;
4
4
  reactStrictMode: boolean;
5
- swcMinify: boolean;
6
- assetPrefix: string;
7
5
  experimental: {
8
- concurrentFeatures: boolean;
9
- serverComponents: boolean;
10
- };
11
- i18n: {
12
- locales: string[];
13
- defaultLocale: string;
14
- };
15
- typescript: {
16
- transpileOnly: boolean;
17
- ignoreDevErrors: boolean;
18
- ignoreBuildErrors: boolean;
6
+ esmExternals: boolean;
7
+ externalDir: boolean;
19
8
  };
20
9
  images: {
21
10
  domains: string[];
22
11
  formats: string[];
23
- imageSizes: number[];
24
12
  };
13
+ headers(): Promise<{
14
+ source: string;
15
+ headers: {
16
+ key: string;
17
+ value: string;
18
+ }[];
19
+ }[]>;
25
20
  webpack: (defaultConfig: any) => any;
26
21
  };
27
22
  export declare const createNextJSTranspiledConfig: () => any;
@@ -31,7 +31,6 @@ const webpack_1 = require("webpack");
31
31
  const misc_1 = require("../lib/misc");
32
32
  const roots_1 = require("../lib/roots");
33
33
  const configs_1 = require("../utils/configs");
34
- const config_1 = require("../lib/config");
35
34
  const withVanillaExtract = next_plugin_1.createVanillaExtractPlugin();
36
35
  exports.withTM = next_transpile_modules_1.default([
37
36
  '@autoguru/themes',
@@ -45,39 +44,93 @@ exports.withTM = next_transpile_modules_1.default([
45
44
  '@autoguru/layout',
46
45
  '@popperjs/core',
47
46
  ]);
47
+ const allowedScriptSources = [
48
+ '\'self\'',
49
+ '\'unsafe-inline\'',
50
+ '*.autoguru.com.au',
51
+ '*.googletagmanager.com',
52
+ '*.google-analytics.com',
53
+ '*.google.com',
54
+ '*.google.com.au',
55
+ '*.gstatic.com',
56
+ '*.googleadservices.com',
57
+ '*.heapanalytics.com',
58
+ '*.doubleclick.net',
59
+ '*.mapbox.com',
60
+ '*.quantserve.com',
61
+ '*.wisepops.com',
62
+ '*.tvsquared.com',
63
+ '*.quantcount.com',
64
+ ].join(' ');
65
+ const allowedStyleSources = [
66
+ '\'self\'',
67
+ '\'unsafe-inline\'',
68
+ 'https://*.autoguru.com.au',
69
+ 'https://*.googleapis.com',
70
+ ].join(' ');
71
+ const allowedIFrameSources = [
72
+ '\'self\'',
73
+ 'https://www.youtube.com',
74
+ 'https://www.google.com',
75
+ ].join(' ');
76
+ const allowedImageSources = [
77
+ '\'self\'',
78
+ ].join(' ');
79
+ const allowedDataDomains = [
80
+ 'https://*',
81
+ ].join(' ');
82
+ const allowedFontSources = [
83
+ 'https://*.autoguru.com.au',
84
+ 'https://*.googleapis.com',
85
+ 'https://*.gstatic.com',
86
+ ].join(' ');
87
+ const allowedDataSources = [
88
+ '\'self\'',
89
+ 'blob:',
90
+ ].join(' ');
91
+ const allowedObjectSources = [
92
+ '\'none\'',
93
+ ].join(' ');
94
+ const securityHeaders = [
95
+ {
96
+ key: 'X-DNS-Prefetch-Control',
97
+ value: 'on',
98
+ },
99
+ {
100
+ key: 'X-XSS-Protection',
101
+ value: '1; mode=block',
102
+ },
103
+ {
104
+ key: 'X-Frame-Options',
105
+ value: 'SAMEORIGIN https://*.autoguru.com.au',
106
+ },
107
+ {
108
+ key: 'Content-Security-Policy',
109
+ value: `frame-ancestors https://*.autoguru.com.au; frame-src ${allowedIFrameSources}; style-src ${allowedStyleSources}; img-src ${allowedImageSources} data: ${allowedDataDomains}; font-src ${allowedFontSources}; worker-src ${allowedDataSources}; child-src ${allowedDataSources}; object-src ${allowedObjectSources}';connect-src ${allowedScriptSources}; script-src-elem ${allowedScriptSources}; script-src ${allowedScriptSources};`,
110
+ },
111
+ ];
48
112
  const createNextJSConfig = (buildEnv) => {
49
- var _a;
50
113
  const isDev = !misc_1.isEnvProduction();
51
114
  const env = process.env.APP_ENV || (isDev ? 'dev' : buildEnv);
52
- const assetPrefix = isDev ? '' : (_a = config_1.getGuruConfig()) === null || _a === void 0 ? void 0 : _a.publicPath;
53
115
  return {
54
- distDir: `dist/${env}/${assetPrefix}`,
116
+ distDir: `dist/${env}`,
55
117
  reactStrictMode: true,
56
- swcMinify: true,
57
- assetPrefix,
58
118
  experimental: {
59
- concurrentFeatures: false,
60
- serverComponents: false,
61
- },
62
- i18n: {
63
- locales: ['en'],
64
- defaultLocale: 'en',
65
- },
66
- typescript: {
67
- transpileOnly: true,
68
- ignoreDevErrors: true,
69
- ignoreBuildErrors: true,
119
+ esmExternals: false,
120
+ externalDir: false,
70
121
  },
71
122
  images: {
72
- domains: [
73
- 'cdn.autoguru.com.au',
74
- 'cdn-dev.autoguru.com.au',
75
- 'cdn-test.autoguru.com.au',
76
- 'cdn-uat.autoguru.com.au',
77
- 'cdn-preprod.autoguru.com.au',
78
- ],
123
+ domains: ['cdn.autoguru.com.au'],
79
124
  formats: ['image/avif', 'image/webp'],
80
- imageSizes: [16, 32, 48, 64, 96, 128, 256, 384, 512],
125
+ },
126
+ async headers() {
127
+ return isDev
128
+ ? [] : [
129
+ {
130
+ source: '/(.*)',
131
+ headers: securityHeaders,
132
+ },
133
+ ];
81
134
  },
82
135
  webpack: (defaultConfig) => {
83
136
  defaultConfig.plugins.push(new webpack_1.DefinePlugin({
@@ -102,5 +155,5 @@ const createNextJSConfig = (buildEnv) => {
102
155
  };
103
156
  };
104
157
  exports.createNextJSConfig = createNextJSConfig;
105
- const createNextJSTranspiledConfig = () => withVanillaExtract(exports.withTM(exports.createNextJSConfig('prod')));
158
+ const createNextJSTranspiledConfig = () => withVanillaExtract(exports.withTM(exports.createNextJSConfig('uat')));
106
159
  exports.createNextJSTranspiledConfig = createNextJSTranspiledConfig;
@@ -76,6 +76,7 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
76
76
  mode: isDev ? 'development' : 'production',
77
77
  entry: {
78
78
  main: [
79
+ !isDev && path_1.join(gduEntryPath, '/spa/set-public-path.js'),
79
80
  path_1.join(gduEntryPath, '/polyfill.js'),
80
81
  path_1.join(gduEntryPath, '/spa/client.js'),
81
82
  ].filter(Boolean),
@@ -297,21 +298,22 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
297
298
  ].filter(Boolean),
298
299
  });
299
300
  const { outputPath } = config_1.getGuruConfig();
300
- const makeWebpackConfig = (buildEnv, isMultiEnv) => ({
301
- name: buildEnv,
302
- output: {
303
- path: `${outputPath}/${!isMultiEnv && buildEnv === 'prod' ? '' : buildEnv}`,
304
- publicPath: isDev
305
- ? '/'
306
- : (buildEnv === 'prod' ? `#{PUBLIC_PATH_BASE}${config_1.getProjectName()}` : `https://static-mfe-${buildEnv}.autoguru.io/${config_1.getProjectName()}`),
307
- filename: `${fileMask}.js`,
308
- chunkFilename: `chunks/${fileMask}.js`,
309
- hashFunction: 'sha256',
310
- crossOriginLoading: 'anonymous',
311
- sourceMapFilename: 'sourceMaps/[file].map',
312
- pathinfo: false,
313
- },
314
- });
301
+ const makeWebpackConfig = (buildEnv, isMultiEnv) => {
302
+ var _a, _b;
303
+ return ({
304
+ name: buildEnv,
305
+ output: {
306
+ path: `${outputPath}/${!isMultiEnv && buildEnv === 'prod' ? '' : buildEnv}`,
307
+ publicPath: isDev ? '/' : (_b = (_a = config_1.getGuruConfig()) === null || _a === void 0 ? void 0 : _a.publicPath) !== null && _b !== void 0 ? _b : '/',
308
+ filename: `${fileMask}.js`,
309
+ chunkFilename: `chunks/${fileMask}.js`,
310
+ hashFunction: 'sha256',
311
+ crossOriginLoading: 'anonymous',
312
+ sourceMapFilename: 'sourceMaps/[file].map',
313
+ pathinfo: false,
314
+ },
315
+ });
316
+ };
315
317
  const buildConfigs = () => {
316
318
  const buildEnvs = configs_1.getBuildEnvs();
317
319
  return buildEnvs.map((buildEnv) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdu",
3
- "version": "4.0.9",
3
+ "version": "4.1.0",
4
4
  "private": false,
5
5
  "description": "AutoGuru's development toolkit",
6
6
  "homepage": "https://github.com/autoguru-au/octane/tree/master/packages/gdu#readme",
@@ -40,7 +40,7 @@
40
40
  "babel-loader": "^8.2.2",
41
41
  "babel-plugin-relay": "^11.0.2",
42
42
  "babel-plugin-treat": "^1.6.2",
43
- "browserslist-config-autoguru": "^2.0.1",
43
+ "browserslist-config-autoguru": "^2.1.2",
44
44
  "clean-webpack-plugin": "^4.0.0-alpha.0",
45
45
  "core-js": "^3.9.1",
46
46
  "css-loader": "^6.4.0",
package/CHANGELOG.md DELETED
@@ -1,390 +0,0 @@
1
- # gdu
2
-
3
- ## 4.0.9
4
-
5
- ### Patch Changes
6
-
7
- - GDU: Fixes spa public path for prod env
8
-
9
- ## 4.0.8
10
-
11
- ### Patch Changes
12
-
13
- - GDU: Fixes public path for prod builds
14
-
15
- ## 4.0.7
16
-
17
- ### Patch Changes
18
-
19
- - GDU: sets unique ourput dirs
20
-
21
- ## 4.0.6
22
-
23
- ### Patch Changes
24
-
25
- - GDU: sets octopus var for prod public path
26
-
27
- ## 4.0.5
28
-
29
- ### Patch Changes
30
-
31
- - GDU: Sets public asset paths
32
-
33
- ## 4.0.4
34
-
35
- ### Patch Changes
36
-
37
- - GDU: Passes on app and node envs to build command
38
-
39
- ## 4.0.3
40
-
41
- ### Patch Changes
42
-
43
- - SSR apps: Get changes to their nextjs config defaults
44
-
45
- ## 4.0.2
46
-
47
- ### Patch Changes
48
-
49
- - GDU: Fixes spa relay artifact resoluton
50
-
51
- ## 4.0.1
52
-
53
- ### Patch Changes
54
-
55
- - GDU: Supports artifact directory for relay generated files
56
-
57
- ## 4.0.0
58
-
59
- ### Major Changes
60
-
61
- - Upgrades browserlist
62
- - a08a3f9: GDU: Upgrades babel
63
- - 2486c59: GDU: Applies caching to babel
64
- - 2486c59: GDU fixed build commads
65
-
66
- ### Patch Changes
67
-
68
- - cdd95c9: Fixes ssr builds
69
- - 7c65b2c: GDU: Uses dotenv for env variables
70
- - 7b7fecc: Upgrades webpack dependencies
71
- - c0130be: GDU: Puts prod artifacts in folder when building for multiple envs
72
- - 2adfc80: Adds AG cdn to next image domains
73
- - 0185749: GDU: Improves build maniset plugin
74
- - 7f3b1ac: Add multi env build support for nextJS apps
75
- - 3acac86: GDU: Fixes build manifest plugin
76
- - f7d42ea: Adds fleet
77
- - 4288672: GDU: Exposes naked nextjs configs
78
- - 3acac86: GDU Assumed prod env fro build commands
79
- - 1f93d6c: GDU: Support vanilla extract
80
- - 33c60da: GDU: Moves build cache to project root level
81
- - 2750501: GDU: Allows app level configs
82
- - 33c60da: GDU uses APP_ENV instead of NODE_ENV for environment configs
83
- - 94bb85b: Fixes for ssr apps
84
- - 6c1f212: GDU: Fixed config file paths
85
- - 9a144dc: GDU: Uses next cli dev command to start dev server
86
- - 2486c59: GDU Updated GuruBuildManifest plugin
87
- - 7c65b2c: Dev server: Removed invalid options
88
- - 61f1da4: GDU upgrades webpack dependency to v5
89
- - Updated dependencies [undefined]
90
- - browserslist-config-autoguru@2.0.1
91
-
92
- ## 4.0.0-next.20
93
-
94
- ### Patch Changes
95
-
96
- - Add multi env build support for nextJS apps
97
-
98
- ## 4.0.0-next.19
99
-
100
- ### Patch Changes
101
-
102
- - Fixes ssr builds
103
-
104
- ## 4.0.0-next.18
105
-
106
- ### Patch Changes
107
-
108
- - GDU: Puts prod artifacts in folder when building for multiple envs
109
-
110
- ## 4.0.0-next.17
111
-
112
- ### Patch Changes
113
-
114
- - GDU: Improves build maniset plugin
115
-
116
- ## 4.0.0-next.16
117
-
118
- ### Patch Changes
119
-
120
- - GDU: Fixes build manifest plugin
121
-
122
- ## 4.0.0-next.15
123
-
124
- ### Patch Changes
125
-
126
- - GDU Assumed prod env fro build commands
127
-
128
- ## 4.0.0-next.14
129
-
130
- ### Patch Changes
131
-
132
- - GDU: Exposes naked nextjs configs
133
-
134
- ## 4.0.0-next.13
135
-
136
- ### Patch Changes
137
-
138
- - Adds fleet
139
-
140
- ## 4.0.0-next.12
141
-
142
- ### Patch Changes
143
-
144
- - 2adfc80: Adds AG cdn to next image domains
145
-
146
- ## 4.0.0-next.11
147
-
148
- ### Patch Changes
149
-
150
- - Fixes for ssr apps
151
-
152
- ## 4.0.0-next.10
153
-
154
- ### Patch Changes
155
-
156
- - GDU: Uses next cli dev command to start dev server
157
-
158
- ## 4.0.0-next.9
159
-
160
- ### Patch Changes
161
-
162
- - GDU: Support vanilla extract
163
-
164
- ## 4.0.0-next.8
165
-
166
- ### Major Changes
167
-
168
- - GDU: Applies caching to babel
169
- - GDU fixed build commads
170
-
171
- ## 4.0.0-next.7
172
-
173
- ### Patch Changes
174
-
175
- - GDU Updated GuruBuildManifest plugin
176
-
177
- ## 4.0.0-next.6
178
-
179
- ### Patch Changes
180
-
181
- - GDU: Moves build cache to project root level
182
- - GDU uses APP_ENV instead of NODE_ENV for environment configs
183
-
184
- ## 4.0.0-next.5
185
-
186
- ### Patch Changes
187
-
188
- - GDU: Allows app level configs
189
-
190
- ## 4.0.0-next.4
191
-
192
- ### Patch Changes
193
-
194
- - GDU: Fixed config file paths
195
-
196
- ## 4.0.0-next.3
197
-
198
- ### Patch Changes
199
-
200
- - GDU: Uses dotenv for env variables
201
- - Dev server: Removed invalid options
202
-
203
- ## 4.0.0-next.2
204
-
205
- ### Patch Changes
206
-
207
- - GDU upgrades webpack dependency to v5
208
-
209
- ## 4.0.0-next.1
210
-
211
- ### Patch Changes
212
-
213
- - Upgrades webpack dependencies
214
-
215
- ## 4.0.0-next.0
216
-
217
- ### Major Changes
218
-
219
- - GDU: Upgrades babel
220
-
221
- ## 3.3.0
222
-
223
- ### Minor Changes
224
-
225
- - 55153b1: GDU: Upgrades treat to latest version
226
-
227
- ### Patch Changes
228
-
229
- - Updated dependencies [14e78dc]
230
- - browserslist-config-autoguru@2.0.0
231
-
232
- ## 3.2.1
233
-
234
- ### Patch Changes
235
-
236
- - e625578: GDU: No longer follows "unicorn/prefer-node-protocol" rule
237
-
238
- ## 3.2.0
239
-
240
- ### Minor Changes
241
-
242
- - d80a10b: Unicorn eslint rules: Upgraded to v33
243
-
244
- Prettier: Upgrades to v2.3
245
-
246
- ### Patch Changes
247
-
248
- - Updated dependencies [d80a10b]
249
- - @autoguru/babel-preset@1.2.0
250
- - browserslist-config-autoguru@1.1.0
251
- - @autoguru/utilities@1.1.0
252
-
253
- ## 3.1.0
254
-
255
- ### Minor Changes
256
-
257
- - 7917b5d: graphql config endpoint gets support for optional schema
258
- normalisers patterns
259
- - 4f954f8: graphql config endpoint normaliser pattern gets optional flag
260
-
261
- ## 3.0.1
262
-
263
- ### Patch Changes
264
-
265
- - cdace6e: graphql-schema command expects endpointConfig url to be the
266
- complete url to the schema
267
- - cdace6e: graphql-schema command respects endpointConfig's http method
268
-
269
- ## 3.0.0
270
-
271
- ### Major Changes
272
-
273
- - 41b6042: Uses named webpack chunks
274
-
275
- ## 2.2.2
276
-
277
- ### Patch Changes
278
-
279
- - 3078dbf: Correctly split the chunks such that gdu is included with main
280
-
281
- ## 2.2.1
282
-
283
- ### Patch Changes
284
-
285
- - 5990714: Process all node_modules through babel as well
286
- - ea885c9: Upgrades treat to latest
287
-
288
- ## 2.2.0
289
-
290
- ### Minor Changes
291
-
292
- - 941261e: Supports latest nextjs as well new babel integration
293
- - 68ae99c: Adds support for React Native to use our config strategy.
294
-
295
- Usage:
296
-
297
- ```js
298
- // index.js (the entrypoint)
299
- import 'gdu/react-native/config';
300
- ```
301
-
302
- ```js
303
- // consumer
304
- import * as config from 'gdu/config';
305
- import { api } from 'gdu/config';
306
- import { auth, url as url2 } from 'gdu/config';
307
- ```
308
-
309
- ```js
310
- // babel.config.js
311
-
312
- module.exports = {
313
- plugins: [
314
- require.resolve('babel-plugin-macros'),
315
- require.resolve('gdu/babel/config-plugin'),
316
- ],
317
- };
318
- ```
319
-
320
- > Make sure you have `babel-plugin-macros` added to your project.
321
-
322
- > _**Note**_ Please only use this for react-native projects, config is
323
- > managed via webpack for our browser apps.
324
-
325
- - 00da6cc: Removes sass support, we are now treat through-and-through.
326
-
327
- ### Patch Changes
328
-
329
- - 919e4a0: Upgraded all dev and prod deps
330
- - Updated dependencies [941261e]
331
- - Updated dependencies [919e4a0]
332
- - @autoguru/babel-preset@1.1.0
333
- - browserslist-config-autoguru@1.0.89
334
- - @autoguru/tsconfig@1.0.79
335
- - @autoguru/utilities@1.0.98
336
-
337
- ## 2.1.3
338
-
339
- ### Patch Changes
340
-
341
- - d016ff6: Adds in an intersection observer polyfill
342
-
343
- ## 2.1.2
344
-
345
- ### Patch Changes
346
-
347
- - 4260eb3: Bumps deps and publishes new peerDeeps ranges
348
- - Updated dependencies [4260eb3]
349
- - @autoguru/babel-preset@1.0.98
350
-
351
- ## 2.1.1
352
-
353
- ### Patch Changes
354
-
355
- - 6886f49: GDU will now render a stack trace for errors
356
- - 3deb6b9: Fix issue where the next-babel-loader is at index 0, not 1
357
-
358
- ## 2.1.0
359
-
360
- ### Minor Changes
361
-
362
- - b5c0b8f: Performs schema fetching using HC's `/schema` endpoint
363
- - 69a313d: gdu.d.ts file is now removed in favour of npm maintained file,
364
- allowing for more defined properties and can be _more_ global.
365
-
366
- ### Patch Changes
367
-
368
- - dc79f71: Drops custom sass from NextJs apps
369
-
370
- ## 2.0.46
371
-
372
- ### Patch Changes
373
-
374
- - b0d77f1: Performance metrics added and better global app debug info
375
- - Updated dependencies [b0d77f1]
376
- - @autoguru/babel-preset@1.0.97
377
- - browserslist-config-autoguru@1.0.88
378
- - @autoguru/tsconfig@1.0.78
379
- - @autoguru/utilities@1.0.97
380
-
381
- ## 2.0.39
382
-
383
- ### Patch Changes
384
-
385
- - 724083c: GDU html-webpack-plugin requires template to be a string, and never
386
- undefined.
387
-
388
- **BUG FIXES**
389
-
390
- When no consumer template.html the property should be set to `auto`