gdu 4.1.0 → 4.1.4
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/dist/commands/build/buildSSR.js +5 -0
- package/dist/config/babel.config.d.ts +1 -0
- package/dist/config/babel.config.js +2 -0
- package/dist/config/next.config.d.ts +17 -11
- package/dist/config/next.config.js +41 -35
- package/dist/config/webpack/webpack.config.js +17 -17
- package/dist/lib/config.d.ts +1 -0
- package/dist/lib/config.js +3 -1
- package/package.json +1 -1
|
@@ -17,6 +17,11 @@ 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
|
+
},
|
|
20
25
|
})
|
|
21
26
|
.then((result) => {
|
|
22
27
|
console.log(`${kleur_1.dim('SUCCESS!')}`, `${kleur_1.dim('Listening')}: ${kleur_1.blue(result === null || result === void 0 ? void 0 : result.all)}`);
|
|
@@ -1,6 +1,7 @@
|
|
|
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');
|
|
4
5
|
module.exports = (guruConfig) => {
|
|
5
6
|
let hasRelay = false;
|
|
6
7
|
try {
|
|
@@ -40,6 +41,7 @@ module.exports = (guruConfig) => {
|
|
|
40
41
|
haste: false,
|
|
41
42
|
isDevVariable: '__DEV__',
|
|
42
43
|
eagerESModules: true,
|
|
44
|
+
artifactDirectory: join(PROJECT_ROOT, '../../', 'packages', 'relay', '__generated__'),
|
|
43
45
|
},
|
|
44
46
|
],
|
|
45
47
|
require.resolve('babel-plugin-treat'),
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
export declare const withTM: (nextConfig?: {}) => {};
|
|
2
|
+
export declare const defaultSecurityHeaders: {
|
|
3
|
+
key: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}[];
|
|
2
6
|
export declare const createNextJSConfig: (buildEnv: any) => {
|
|
3
7
|
distDir: string;
|
|
4
8
|
reactStrictMode: boolean;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
swcMinify: boolean;
|
|
10
|
+
assetPrefix: string;
|
|
11
|
+
i18n: {
|
|
12
|
+
locales: string[];
|
|
13
|
+
defaultLocale: string;
|
|
14
|
+
};
|
|
15
|
+
typescript: {
|
|
16
|
+
transpileOnly: boolean;
|
|
17
|
+
ignoreDevErrors: boolean;
|
|
18
|
+
ignoreBuildErrors: boolean;
|
|
8
19
|
};
|
|
9
20
|
images: {
|
|
10
|
-
domains: string[];
|
|
11
21
|
formats: string[];
|
|
22
|
+
deviceSizes: number[];
|
|
23
|
+
imageSizes: number[];
|
|
24
|
+
domains: string[];
|
|
12
25
|
};
|
|
13
|
-
headers(): Promise<{
|
|
14
|
-
source: string;
|
|
15
|
-
headers: {
|
|
16
|
-
key: string;
|
|
17
|
-
value: string;
|
|
18
|
-
}[];
|
|
19
|
-
}[]>;
|
|
20
26
|
webpack: (defaultConfig: any) => any;
|
|
21
27
|
};
|
|
22
28
|
export declare const createNextJSTranspiledConfig: () => any;
|
|
@@ -22,12 +22,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.createNextJSTranspiledConfig = exports.createNextJSConfig = exports.withTM = void 0;
|
|
25
|
+
exports.createNextJSTranspiledConfig = exports.createNextJSConfig = exports.defaultSecurityHeaders = exports.withTM = void 0;
|
|
26
26
|
const path_1 = __importStar(require("path"));
|
|
27
27
|
const next_plugin_1 = require("@vanilla-extract/next-plugin");
|
|
28
28
|
const dotenv_webpack_1 = __importDefault(require("dotenv-webpack"));
|
|
29
29
|
const next_transpile_modules_1 = __importDefault(require("next-transpile-modules"));
|
|
30
30
|
const webpack_1 = require("webpack");
|
|
31
|
+
const config_1 = require("../lib/config");
|
|
31
32
|
const misc_1 = require("../lib/misc");
|
|
32
33
|
const roots_1 = require("../lib/roots");
|
|
33
34
|
const configs_1 = require("../utils/configs");
|
|
@@ -45,8 +46,8 @@ exports.withTM = next_transpile_modules_1.default([
|
|
|
45
46
|
'@popperjs/core',
|
|
46
47
|
]);
|
|
47
48
|
const allowedScriptSources = [
|
|
48
|
-
'
|
|
49
|
-
'
|
|
49
|
+
"'self'",
|
|
50
|
+
"'unsafe-inline'",
|
|
50
51
|
'*.autoguru.com.au',
|
|
51
52
|
'*.googletagmanager.com',
|
|
52
53
|
'*.google-analytics.com',
|
|
@@ -55,6 +56,7 @@ const allowedScriptSources = [
|
|
|
55
56
|
'*.gstatic.com',
|
|
56
57
|
'*.googleadservices.com',
|
|
57
58
|
'*.heapanalytics.com',
|
|
59
|
+
'heapanalytics.com',
|
|
58
60
|
'*.doubleclick.net',
|
|
59
61
|
'*.mapbox.com',
|
|
60
62
|
'*.quantserve.com',
|
|
@@ -63,35 +65,26 @@ const allowedScriptSources = [
|
|
|
63
65
|
'*.quantcount.com',
|
|
64
66
|
].join(' ');
|
|
65
67
|
const allowedStyleSources = [
|
|
66
|
-
'
|
|
67
|
-
'
|
|
68
|
+
"'self'",
|
|
69
|
+
"'unsafe-inline'",
|
|
68
70
|
'https://*.autoguru.com.au',
|
|
69
71
|
'https://*.googleapis.com',
|
|
70
72
|
].join(' ');
|
|
71
73
|
const allowedIFrameSources = [
|
|
72
|
-
'
|
|
74
|
+
"'self'",
|
|
73
75
|
'https://www.youtube.com',
|
|
74
76
|
'https://www.google.com',
|
|
75
77
|
].join(' ');
|
|
76
|
-
const allowedImageSources = [
|
|
77
|
-
|
|
78
|
-
].join(' ');
|
|
79
|
-
const allowedDataDomains = [
|
|
80
|
-
'https://*',
|
|
81
|
-
].join(' ');
|
|
78
|
+
const allowedImageSources = ["'self'"].join(' ');
|
|
79
|
+
const allowedDataDomains = ['https://*'].join(' ');
|
|
82
80
|
const allowedFontSources = [
|
|
83
81
|
'https://*.autoguru.com.au',
|
|
84
82
|
'https://*.googleapis.com',
|
|
85
83
|
'https://*.gstatic.com',
|
|
86
84
|
].join(' ');
|
|
87
|
-
const allowedDataSources = [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
].join(' ');
|
|
91
|
-
const allowedObjectSources = [
|
|
92
|
-
'\'none\'',
|
|
93
|
-
].join(' ');
|
|
94
|
-
const securityHeaders = [
|
|
85
|
+
const allowedDataSources = ["'self'", 'blob:'].join(' ');
|
|
86
|
+
const allowedObjectSources = ["'none'"].join(' ');
|
|
87
|
+
exports.defaultSecurityHeaders = [
|
|
95
88
|
{
|
|
96
89
|
key: 'X-DNS-Prefetch-Control',
|
|
97
90
|
value: 'on',
|
|
@@ -106,31 +99,44 @@ const securityHeaders = [
|
|
|
106
99
|
},
|
|
107
100
|
{
|
|
108
101
|
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}
|
|
102
|
+
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
103
|
},
|
|
111
104
|
];
|
|
112
105
|
const createNextJSConfig = (buildEnv) => {
|
|
106
|
+
var _a, _b;
|
|
113
107
|
const isDev = !misc_1.isEnvProduction();
|
|
114
108
|
const env = process.env.APP_ENV || (isDev ? 'dev' : buildEnv);
|
|
109
|
+
const assetPrefix = isDev ? '' : (_b = (_a = config_1.getGuruConfig()) === null || _a === void 0 ? void 0 : _a.publicPath) !== null && _b !== void 0 ? _b : '';
|
|
115
110
|
return {
|
|
116
111
|
distDir: `dist/${env}`,
|
|
117
112
|
reactStrictMode: true,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
swcMinify: true,
|
|
114
|
+
assetPrefix,
|
|
115
|
+
i18n: {
|
|
116
|
+
locales: ['en'],
|
|
117
|
+
defaultLocale: 'en',
|
|
118
|
+
},
|
|
119
|
+
typescript: {
|
|
120
|
+
transpileOnly: true,
|
|
121
|
+
ignoreDevErrors: true,
|
|
122
|
+
ignoreBuildErrors: true,
|
|
121
123
|
},
|
|
122
124
|
images: {
|
|
123
|
-
domains: ['cdn.autoguru.com.au'],
|
|
124
125
|
formats: ['image/avif', 'image/webp'],
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
126
|
+
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
|
|
127
|
+
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
|
|
128
|
+
domains: [
|
|
129
|
+
'www.autoguru.com.au',
|
|
130
|
+
'dev.autoguru.com.au',
|
|
131
|
+
'test.autoguru.com.au',
|
|
132
|
+
'uat.autoguru.com.au',
|
|
133
|
+
'preprod.autoguru.com.au',
|
|
134
|
+
'cdn.autoguru.com.au',
|
|
135
|
+
'cdn-dev.autoguru.com.au',
|
|
136
|
+
'cdn-test.autoguru.com.au',
|
|
137
|
+
'cdn-uat.autoguru.com.au',
|
|
138
|
+
'cdn-preprod.autoguru.com.au',
|
|
139
|
+
],
|
|
134
140
|
},
|
|
135
141
|
webpack: (defaultConfig) => {
|
|
136
142
|
defaultConfig.plugins.push(new webpack_1.DefinePlugin({
|
|
@@ -155,5 +161,5 @@ const createNextJSConfig = (buildEnv) => {
|
|
|
155
161
|
};
|
|
156
162
|
};
|
|
157
163
|
exports.createNextJSConfig = createNextJSConfig;
|
|
158
|
-
const createNextJSTranspiledConfig = () => withVanillaExtract(exports.withTM(exports.createNextJSConfig('
|
|
164
|
+
const createNextJSTranspiledConfig = () => withVanillaExtract(exports.withTM(exports.createNextJSConfig('prod')));
|
|
159
165
|
exports.createNextJSTranspiledConfig = createNextJSTranspiledConfig;
|
|
@@ -76,7 +76,6 @@ 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'),
|
|
80
79
|
path_1.join(gduEntryPath, '/polyfill.js'),
|
|
81
80
|
path_1.join(gduEntryPath, '/spa/client.js'),
|
|
82
81
|
].filter(Boolean),
|
|
@@ -298,22 +297,23 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
298
297
|
].filter(Boolean),
|
|
299
298
|
});
|
|
300
299
|
const { outputPath } = config_1.getGuruConfig();
|
|
301
|
-
const makeWebpackConfig = (buildEnv, isMultiEnv) => {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
300
|
+
const makeWebpackConfig = (buildEnv, isMultiEnv) => ({
|
|
301
|
+
name: buildEnv,
|
|
302
|
+
output: {
|
|
303
|
+
path: `${outputPath}/${!isMultiEnv && buildEnv === 'prod' ? '' : buildEnv}`,
|
|
304
|
+
publicPath: isDev
|
|
305
|
+
? '/'
|
|
306
|
+
: buildEnv === 'prod'
|
|
307
|
+
? `#{PUBLIC_PATH_BASE}/${config_1.getProjectFolderName()}/`
|
|
308
|
+
: `https://static-mfe-${buildEnv}.autoguru.io/${config_1.getProjectFolderName()}/`,
|
|
309
|
+
filename: `${fileMask}.js`,
|
|
310
|
+
chunkFilename: `chunks/${fileMask}.js`,
|
|
311
|
+
hashFunction: 'sha256',
|
|
312
|
+
crossOriginLoading: 'anonymous',
|
|
313
|
+
sourceMapFilename: 'sourceMaps/[file].map',
|
|
314
|
+
pathinfo: false,
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
317
|
const buildConfigs = () => {
|
|
318
318
|
const buildEnvs = configs_1.getBuildEnvs();
|
|
319
319
|
return buildEnvs.map((buildEnv) => ({
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export interface GuruConfig {
|
|
|
12
12
|
export declare const getGuruConfig: (location?: string) => GuruConfig | null;
|
|
13
13
|
export declare const decorateConfig: (guruConfig: Partial<GuruConfig>) => GuruConfig;
|
|
14
14
|
export declare const getProjectName: (location?: string) => any;
|
|
15
|
+
export declare const getProjectFolderName: (location?: string) => string;
|
package/dist/lib/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProjectName = exports.decorateConfig = exports.getGuruConfig = void 0;
|
|
3
|
+
exports.getProjectFolderName = exports.getProjectName = exports.decorateConfig = exports.getGuruConfig = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const diary_1 = require("diary");
|
|
6
6
|
const resolve_1 = require("./resolve");
|
|
@@ -52,3 +52,5 @@ const decorateConfig = (guruConfig) => {
|
|
|
52
52
|
exports.decorateConfig = decorateConfig;
|
|
53
53
|
const getProjectName = (location = roots_1.PROJECT_ROOT) => require(path_1.join(exports.getGuruConfig(location).__configPath, './package.json')).name;
|
|
54
54
|
exports.getProjectName = getProjectName;
|
|
55
|
+
const getProjectFolderName = (location = roots_1.PROJECT_ROOT) => path_1.basename(path_1.join(exports.getGuruConfig(location).__configPath));
|
|
56
|
+
exports.getProjectFolderName = getProjectFolderName;
|