gdu 4.0.0-next.7 → 4.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/CHANGELOG.md +120 -0
- package/dist/commands/build/buildSPA.js +4 -6
- package/dist/commands/build/buildSSR.js +24 -7
- package/dist/commands/start/index.d.ts +1 -1
- package/dist/commands/start/index.js +1 -1
- package/dist/commands/start/runSPA.js +5 -5
- package/dist/commands/start/runSSR.js +2 -21
- package/dist/config/babel.config.d.ts +1 -0
- package/dist/config/babel.config.js +2 -0
- package/dist/config/next.config.d.ts +16 -1
- package/dist/config/next.config.js +79 -79
- package/dist/config/ssr/server.d.ts +1 -1
- package/dist/config/ssr/server.js +20 -41
- package/dist/config/webpack/plugins/GuruBuildManifest.d.ts +17 -0
- package/dist/config/webpack/plugins/GuruBuildManifest.js +93 -46
- package/dist/config/webpack/webpack.config.d.ts +2 -4
- package/dist/config/webpack/webpack.config.js +249 -221
- package/dist/lib/configure.js +2 -1
- package/dist/lib/runWebpack.d.ts +2 -2
- package/dist/lib/runWebpack.js +7 -1
- package/dist/utils/configs.d.ts +3 -0
- package/dist/utils/configs.js +21 -0
- package/package.json +13 -9
- package/dist/config/webpack/blocks/common.d.ts +0 -5
- package/dist/config/webpack/blocks/common.js +0 -22
- package/dist/config/webpack/blocks/images.d.ts +0 -7
- package/dist/config/webpack/blocks/images.js +0 -14
- package/dist/config/webpack/blocks/styles.d.ts +0 -22
- package/dist/config/webpack/blocks/styles.js +0 -49
- package/entry/.DS_Store +0 -0
- package/entry/spa/set-public-path.js +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,125 @@
|
|
|
1
1
|
# gdu
|
|
2
2
|
|
|
3
|
+
## 4.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- GDU: Supports artifact directory for relay generated files
|
|
8
|
+
|
|
9
|
+
## 4.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- Upgrades browserlist
|
|
14
|
+
- a08a3f9: GDU: Upgrades babel
|
|
15
|
+
- 2486c59: GDU: Applies caching to babel
|
|
16
|
+
- 2486c59: GDU fixed build commads
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- cdd95c9: Fixes ssr builds
|
|
21
|
+
- 7c65b2c: GDU: Uses dotenv for env variables
|
|
22
|
+
- 7b7fecc: Upgrades webpack dependencies
|
|
23
|
+
- c0130be: GDU: Puts prod artifacts in folder when building for multiple envs
|
|
24
|
+
- 2adfc80: Adds AG cdn to next image domains
|
|
25
|
+
- 0185749: GDU: Improves build maniset plugin
|
|
26
|
+
- 7f3b1ac: Add multi env build support for nextJS apps
|
|
27
|
+
- 3acac86: GDU: Fixes build manifest plugin
|
|
28
|
+
- f7d42ea: Adds fleet
|
|
29
|
+
- 4288672: GDU: Exposes naked nextjs configs
|
|
30
|
+
- 3acac86: GDU Assumed prod env fro build commands
|
|
31
|
+
- 1f93d6c: GDU: Support vanilla extract
|
|
32
|
+
- 33c60da: GDU: Moves build cache to project root level
|
|
33
|
+
- 2750501: GDU: Allows app level configs
|
|
34
|
+
- 33c60da: GDU uses APP_ENV instead of NODE_ENV for environment configs
|
|
35
|
+
- 94bb85b: Fixes for ssr apps
|
|
36
|
+
- 6c1f212: GDU: Fixed config file paths
|
|
37
|
+
- 9a144dc: GDU: Uses next cli dev command to start dev server
|
|
38
|
+
- 2486c59: GDU Updated GuruBuildManifest plugin
|
|
39
|
+
- 7c65b2c: Dev server: Removed invalid options
|
|
40
|
+
- 61f1da4: GDU upgrades webpack dependency to v5
|
|
41
|
+
- Updated dependencies [undefined]
|
|
42
|
+
- browserslist-config-autoguru@2.0.1
|
|
43
|
+
|
|
44
|
+
## 4.0.0-next.20
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- Add multi env build support for nextJS apps
|
|
49
|
+
|
|
50
|
+
## 4.0.0-next.19
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- Fixes ssr builds
|
|
55
|
+
|
|
56
|
+
## 4.0.0-next.18
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- GDU: Puts prod artifacts in folder when building for multiple envs
|
|
61
|
+
|
|
62
|
+
## 4.0.0-next.17
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- GDU: Improves build maniset plugin
|
|
67
|
+
|
|
68
|
+
## 4.0.0-next.16
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- GDU: Fixes build manifest plugin
|
|
73
|
+
|
|
74
|
+
## 4.0.0-next.15
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- GDU Assumed prod env fro build commands
|
|
79
|
+
|
|
80
|
+
## 4.0.0-next.14
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- GDU: Exposes naked nextjs configs
|
|
85
|
+
|
|
86
|
+
## 4.0.0-next.13
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- Adds fleet
|
|
91
|
+
|
|
92
|
+
## 4.0.0-next.12
|
|
93
|
+
|
|
94
|
+
### Patch Changes
|
|
95
|
+
|
|
96
|
+
- 2adfc80: Adds AG cdn to next image domains
|
|
97
|
+
|
|
98
|
+
## 4.0.0-next.11
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- Fixes for ssr apps
|
|
103
|
+
|
|
104
|
+
## 4.0.0-next.10
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- GDU: Uses next cli dev command to start dev server
|
|
109
|
+
|
|
110
|
+
## 4.0.0-next.9
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- GDU: Support vanilla extract
|
|
115
|
+
|
|
116
|
+
## 4.0.0-next.8
|
|
117
|
+
|
|
118
|
+
### Major Changes
|
|
119
|
+
|
|
120
|
+
- GDU: Applies caching to babel
|
|
121
|
+
- GDU fixed build commads
|
|
122
|
+
|
|
3
123
|
## 4.0.0-next.7
|
|
4
124
|
|
|
5
125
|
### Patch Changes
|
|
@@ -5,16 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.buildSPA = void 0;
|
|
7
7
|
const webpack_1 = __importDefault(require("webpack"));
|
|
8
|
-
const webpack_config_1 = require("../../config/webpack/webpack.config");
|
|
8
|
+
const webpack_config_1 = __importDefault(require("../../config/webpack/webpack.config"));
|
|
9
9
|
const runWebpack_1 = require("../../lib/runWebpack");
|
|
10
10
|
const hooks_1 = require("../../utils/hooks");
|
|
11
11
|
const buildSPA = async (guruConfig) => {
|
|
12
12
|
const hooks = hooks_1.getHooks();
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const compiler = webpack_1.default(webpackConfig);
|
|
17
|
-
await runWebpack_1.run(compiler);
|
|
13
|
+
const webpackConfigs = hooks.webpackConfig.call(webpack_config_1.default());
|
|
14
|
+
const compiler = webpack_1.default(webpackConfigs);
|
|
15
|
+
runWebpack_1.run(compiler);
|
|
18
16
|
return {
|
|
19
17
|
artifactPath: guruConfig.outputPath,
|
|
20
18
|
};
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.buildSSR = void 0;
|
|
4
7
|
const path_1 = require("path");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
8
|
+
const utilities_1 = require("@autoguru/utilities");
|
|
9
|
+
const execa_1 = __importDefault(require("execa"));
|
|
10
|
+
const kleur_1 = require("kleur");
|
|
7
11
|
const roots_1 = require("../../lib/roots");
|
|
12
|
+
const logger = utilities_1.createLogger('build');
|
|
8
13
|
const buildSSR = async (guruConfig) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
const start = Date.now();
|
|
15
|
+
execa_1.default
|
|
16
|
+
.command(`next build --profile`, {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
cwd: roots_1.PROJECT_ROOT,
|
|
19
|
+
localDir: roots_1.GDU_ROOT,
|
|
20
|
+
})
|
|
21
|
+
.then((result) => {
|
|
22
|
+
console.log(`${kleur_1.dim('SUCCESS!')}`, `${kleur_1.dim('Listening')}: ${kleur_1.blue(result === null || result === void 0 ? void 0 : result.all)}`);
|
|
23
|
+
}, (error) => {
|
|
24
|
+
logger.error('response', {
|
|
25
|
+
processingTime: Date.now() - start,
|
|
26
|
+
responseHeaders: Object.fromEntries(Object.entries(error.getHeaders())),
|
|
27
|
+
url: 'incomingPath',
|
|
28
|
+
statusCode: error.statusCode,
|
|
29
|
+
});
|
|
30
|
+
throw error;
|
|
14
31
|
});
|
|
15
32
|
return {
|
|
16
33
|
artifactPath: path_1.join(guruConfig.outputPath, 'BUILD_ID'),
|
|
@@ -25,7 +25,7 @@ const config_1 = require("../../lib/config");
|
|
|
25
25
|
const misc_1 = require("../../lib/misc");
|
|
26
26
|
const roots_1 = require("../../lib/roots");
|
|
27
27
|
const { debug } = diary_1.diary('gdu:commands:start');
|
|
28
|
-
exports.default = async ({ port: incomingPort
|
|
28
|
+
exports.default = async ({ port: incomingPort }) => {
|
|
29
29
|
debug('running action with %O', { port: incomingPort });
|
|
30
30
|
const { port = incomingPort, ...otherConfig } = config_1.getGuruConfig(roots_1.PROJECT_ROOT) || {};
|
|
31
31
|
const resolvedConfig = { port, ...otherConfig };
|
|
@@ -11,7 +11,7 @@ const kleur_1 = require("kleur");
|
|
|
11
11
|
const ts_dedent_1 = __importDefault(require("ts-dedent"));
|
|
12
12
|
const webpack_1 = __importDefault(require("webpack"));
|
|
13
13
|
const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
|
|
14
|
-
const webpack_config_1 = require("../../config/webpack/webpack.config");
|
|
14
|
+
const webpack_config_1 = __importDefault(require("../../config/webpack/webpack.config"));
|
|
15
15
|
const config_1 = require("../../lib/config");
|
|
16
16
|
const roots_1 = require("../../lib/roots");
|
|
17
17
|
const hooks_1 = require("../../utils/hooks");
|
|
@@ -31,9 +31,9 @@ const hosts = ['localhost', localhost];
|
|
|
31
31
|
const runSPA = async (guruConfig) => {
|
|
32
32
|
const hooks = hooks_1.getHooks();
|
|
33
33
|
console.log(`${kleur_1.cyan('Starting dev server...')}`);
|
|
34
|
-
const webpackConfig = hooks.webpackConfig
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const webpackConfig = hooks.webpackConfig
|
|
35
|
+
.call(webpack_config_1.default())
|
|
36
|
+
.find(({ name }) => name === process.env.APP_ENV);
|
|
37
37
|
const consumerHtmlTemplate = getConsumerHtmlTemplate(guruConfig);
|
|
38
38
|
webpackConfig.plugins.push(new html_webpack_plugin_1.default({
|
|
39
39
|
template: consumerHtmlTemplate !== null && consumerHtmlTemplate !== void 0 ? consumerHtmlTemplate : 'auto',
|
|
@@ -55,7 +55,7 @@ const runSPA = async (guruConfig) => {
|
|
|
55
55
|
src: `${compilation.options.output
|
|
56
56
|
.publicPath || ''}${file}`,
|
|
57
57
|
},
|
|
58
|
-
meta: {
|
|
58
|
+
meta: { plugin: 'html-webpack-plugin' },
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -1,36 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runNextJS = void 0;
|
|
4
|
-
const utilities_1 = require("@autoguru/utilities");
|
|
5
4
|
const diary_1 = require("diary");
|
|
6
5
|
const kleur_1 = require("kleur");
|
|
7
6
|
const server_1 = require("../../config/ssr/server");
|
|
8
7
|
const misc_1 = require("../../lib/misc");
|
|
9
|
-
const hooks_1 = require("../../utils/hooks");
|
|
10
8
|
const { debug } = diary_1.diary('gdu:commands:start:ssr');
|
|
11
|
-
const log = utilities_1.createLogger('server');
|
|
12
9
|
const runNextJS = async (guruConfig) => {
|
|
13
10
|
var _a;
|
|
14
11
|
const port = (_a = guruConfig.port) !== null && _a !== void 0 ? _a : 8080;
|
|
15
12
|
debug('next start %o', { port });
|
|
16
|
-
const hooks = hooks_1.getHooks();
|
|
17
13
|
if (!misc_1.isEnvProduction())
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
hooks.afterServer.tap('runner', (server) => {
|
|
22
|
-
var _a;
|
|
23
|
-
server.listen((_a = guruConfig.port) !== null && _a !== void 0 ? _a : 8080, (err) => {
|
|
24
|
-
if (err)
|
|
25
|
-
throw err;
|
|
26
|
-
if (misc_1.isEnvProduction()) {
|
|
27
|
-
log.info('Started accepting requests...');
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
console.log(`${kleur_1.dim('Listening')}: ${kleur_1.blue(`http://localhost:${port}/`)}`);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
await server_1.run();
|
|
14
|
+
console.log(`${kleur_1.cyan('Starting dev server...')}`);
|
|
15
|
+
await server_1.run(port);
|
|
35
16
|
};
|
|
36
17
|
exports.runNextJS = runNextJS;
|
|
@@ -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: `./../../packages/relay/__generated__`,
|
|
43
45
|
},
|
|
44
46
|
],
|
|
45
47
|
require.resolve('babel-plugin-treat'),
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const withTM: (nextConfig?: {}) => {};
|
|
2
|
+
export declare const createNextJSConfig: (buildEnv: any) => {
|
|
3
|
+
distDir: string;
|
|
4
|
+
reactStrictMode: boolean;
|
|
5
|
+
swcMinify: boolean;
|
|
6
|
+
experimental: {
|
|
7
|
+
concurrentFeatures: boolean;
|
|
8
|
+
};
|
|
9
|
+
images: {
|
|
10
|
+
domains: string[];
|
|
11
|
+
formats: string[];
|
|
12
|
+
imageSizes: number[];
|
|
13
|
+
};
|
|
14
|
+
webpack: (defaultConfig: any) => any;
|
|
15
|
+
};
|
|
16
|
+
export declare const createNextJSTranspiledConfig: () => any;
|
|
@@ -1,92 +1,92 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
2
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
23
|
};
|
|
5
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createNextJSConfig = void 0;
|
|
7
|
-
const path_1 = require("path");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
|
|
25
|
+
exports.createNextJSTranspiledConfig = exports.createNextJSConfig = exports.withTM = void 0;
|
|
26
|
+
const path_1 = __importStar(require("path"));
|
|
27
|
+
const next_plugin_1 = require("@vanilla-extract/next-plugin");
|
|
28
|
+
const dotenv_webpack_1 = __importDefault(require("dotenv-webpack"));
|
|
29
|
+
const next_transpile_modules_1 = __importDefault(require("next-transpile-modules"));
|
|
12
30
|
const webpack_1 = require("webpack");
|
|
13
|
-
const config_1 = require("../lib/config");
|
|
14
31
|
const misc_1 = require("../lib/misc");
|
|
15
32
|
const roots_1 = require("../lib/roots");
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
const configs_1 = require("../utils/configs");
|
|
34
|
+
const withVanillaExtract = next_plugin_1.createVanillaExtractPlugin();
|
|
35
|
+
exports.withTM = next_transpile_modules_1.default([
|
|
36
|
+
'@autoguru/themes',
|
|
37
|
+
'@autoguru/overdrive',
|
|
38
|
+
'@autoguru/icons',
|
|
39
|
+
'@autoguru/components',
|
|
40
|
+
'@autoguru/fleet',
|
|
41
|
+
'@autoguru/relay',
|
|
42
|
+
'@autoguru/auth',
|
|
43
|
+
'@autoguru/components',
|
|
44
|
+
'@autoguru/layout',
|
|
45
|
+
'@popperjs/core',
|
|
46
|
+
]);
|
|
47
|
+
const createNextJSConfig = (buildEnv) => {
|
|
20
48
|
const isDev = !misc_1.isEnvProduction();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (Array.isArray(use)) {
|
|
60
|
-
use = use[1];
|
|
61
|
-
}
|
|
62
|
-
use.options = {
|
|
63
|
-
...use.options,
|
|
64
|
-
hasReactRefresh: false,
|
|
65
|
-
overrides: [babelConfig],
|
|
66
|
-
};
|
|
67
|
-
compiler.options.module.rules[0] = {
|
|
68
|
-
...oldLoader,
|
|
69
|
-
include: [...oldLoader.include, ...ourCodePaths],
|
|
70
|
-
exclude(path) {
|
|
71
|
-
const orig = oldLoader === null || oldLoader === void 0
|
|
72
|
-
? void 0
|
|
73
|
-
: oldLoader.exclude(path);
|
|
74
|
-
return orig
|
|
75
|
-
? !ourCodePaths.some((r) => {
|
|
76
|
-
if (r instanceof RegExp) {
|
|
77
|
-
return r.test(path);
|
|
78
|
-
}
|
|
79
|
-
return path.includes(r);
|
|
80
|
-
})
|
|
81
|
-
: false;
|
|
82
|
-
},
|
|
83
|
-
use,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
})());
|
|
87
|
-
return hooks.webpackConfig.call(originalConfig);
|
|
49
|
+
const env = process.env.APP_ENV || (isDev ? 'dev' : buildEnv);
|
|
50
|
+
return {
|
|
51
|
+
distDir: `dist/${env}`,
|
|
52
|
+
reactStrictMode: true,
|
|
53
|
+
swcMinify: true,
|
|
54
|
+
experimental: {
|
|
55
|
+
concurrentFeatures: false,
|
|
56
|
+
},
|
|
57
|
+
images: {
|
|
58
|
+
domains: [
|
|
59
|
+
'cdn.autoguru.com.au',
|
|
60
|
+
'cdn-dev.autoguru.com.au',
|
|
61
|
+
'cdn-test.autoguru.com.au',
|
|
62
|
+
'cdn-uat.autoguru.com.au',
|
|
63
|
+
'cdn-preprod.autoguru.com.au',
|
|
64
|
+
],
|
|
65
|
+
formats: ['image/avif', 'image/webp'],
|
|
66
|
+
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384, 512],
|
|
67
|
+
},
|
|
68
|
+
webpack: (defaultConfig) => {
|
|
69
|
+
defaultConfig.plugins.push(new webpack_1.DefinePlugin({
|
|
70
|
+
__DEV__: isDev,
|
|
71
|
+
}));
|
|
72
|
+
configs_1.getConfigsDirs()
|
|
73
|
+
.flatMap((configsDir) => [
|
|
74
|
+
new dotenv_webpack_1.default({
|
|
75
|
+
path: path_1.default.resolve(configsDir, '.env.defaults'),
|
|
76
|
+
}),
|
|
77
|
+
new dotenv_webpack_1.default({
|
|
78
|
+
path: path_1.default.resolve(configsDir, `.env.${env}`),
|
|
79
|
+
}),
|
|
80
|
+
])
|
|
81
|
+
.forEach((plugin) => defaultConfig.plugins.push(plugin));
|
|
82
|
+
defaultConfig.resolve.alias['react'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/react/');
|
|
83
|
+
defaultConfig.resolve.alias['react-dom'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/react-dom/');
|
|
84
|
+
defaultConfig.resolve.alias['@autoguru/icons'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/@autoguru/icons/');
|
|
85
|
+
defaultConfig.resolve.alias['next'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/next/');
|
|
86
|
+
return defaultConfig;
|
|
88
87
|
},
|
|
89
88
|
};
|
|
90
|
-
return hooks.nextJSConfig.call(nextJsConfig);
|
|
91
89
|
};
|
|
92
90
|
exports.createNextJSConfig = createNextJSConfig;
|
|
91
|
+
const createNextJSTranspiledConfig = () => withVanillaExtract(exports.withTM(exports.createNextJSConfig('uat')));
|
|
92
|
+
exports.createNextJSTranspiledConfig = createNextJSTranspiledConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const run: () => Promise<void>;
|
|
1
|
+
export declare const run: (port: number) => Promise<void>;
|
|
@@ -5,50 +5,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.run = void 0;
|
|
7
7
|
const utilities_1 = require("@autoguru/utilities");
|
|
8
|
-
const
|
|
8
|
+
const execa_1 = __importDefault(require("execa"));
|
|
9
|
+
const kleur_1 = require("kleur");
|
|
9
10
|
const misc_1 = require("../../lib/misc");
|
|
10
|
-
const resolve_1 = require("../../lib/resolve");
|
|
11
11
|
const roots_1 = require("../../lib/roots");
|
|
12
|
-
const hooks_1 = require("../../utils/hooks");
|
|
13
|
-
const next_config_1 = require("../next.config");
|
|
14
12
|
const logger = utilities_1.createLogger('server');
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
server.use(async (req, res, next) => {
|
|
32
|
-
const start = Date.now();
|
|
33
|
-
const incomingPath = req.originalUrl;
|
|
34
|
-
const isPageWeCareAbout = dynamicRoutes.some(({ match }) => match(incomingPath)) ||
|
|
35
|
-
(await pageChecker(incomingPath));
|
|
36
|
-
await next();
|
|
37
|
-
isPageWeCareAbout &&
|
|
38
|
-
logger.info('response', {
|
|
39
|
-
processingTime: Date.now() - start,
|
|
40
|
-
responseHeaders: Object.fromEntries(Object.entries(res.getHeaders())),
|
|
41
|
-
url: incomingPath,
|
|
42
|
-
statusCode: res.statusCode,
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
if (((_a = nextJsConfig.assetPrefix) !== null && _a !== void 0 ? _a : '/') !== '/') {
|
|
46
|
-
server.get(`${nextJsConfig.assetPrefix}*`, async (req, res) => {
|
|
47
|
-
req.url = req.originalUrl.replace(`${nextJsConfig.assetPrefix}`, '/');
|
|
48
|
-
return handle(req, res);
|
|
13
|
+
const run = async (port) => {
|
|
14
|
+
const start = Date.now();
|
|
15
|
+
execa_1.default
|
|
16
|
+
.command(`next ${misc_1.isEnvProduction() ? 'start' : 'dev'} -p ${port}`, {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
cwd: roots_1.PROJECT_ROOT,
|
|
19
|
+
localDir: roots_1.GDU_ROOT,
|
|
20
|
+
})
|
|
21
|
+
.then(() => {
|
|
22
|
+
console.log(`${kleur_1.dim('Listening')}: ${kleur_1.blue(`http://localhost:${port}/`)}`);
|
|
23
|
+
}, (error) => {
|
|
24
|
+
logger.error('response', {
|
|
25
|
+
processingTime: Date.now() - start,
|
|
26
|
+
responseHeaders: Object.fromEntries(Object.entries(error.getHeaders())),
|
|
27
|
+
url: 'incomingPath',
|
|
28
|
+
statusCode: error.statusCode,
|
|
49
29
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
await hooks.afterServer.promise(server);
|
|
30
|
+
throw error;
|
|
31
|
+
});
|
|
53
32
|
};
|
|
54
33
|
exports.run = run;
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { Compiler } from 'webpack';
|
|
2
|
+
declare const defaultOptions: {
|
|
3
|
+
excludeFile: RegExp;
|
|
4
|
+
chunkGroupName: (filename: any) => string;
|
|
5
|
+
outputDir: string;
|
|
6
|
+
filename: string;
|
|
7
|
+
objectToString: (result: any) => string;
|
|
8
|
+
includeChunks: boolean;
|
|
9
|
+
publicPath: string;
|
|
10
|
+
};
|
|
2
11
|
export declare class GuruBuildManifest {
|
|
12
|
+
private options;
|
|
13
|
+
private result;
|
|
14
|
+
constructor(options: Partial<typeof defaultOptions>);
|
|
3
15
|
apply(compiler: Compiler): void;
|
|
16
|
+
saveJson(): void;
|
|
17
|
+
_excludeChunk(excludeCriterium: any, filename: any, chunk: any): any;
|
|
18
|
+
_shouldFolderBeCreated(outputDir: any): any;
|
|
19
|
+
_normalizeOutputDir(outputDir: any): any;
|
|
4
20
|
}
|
|
21
|
+
export {};
|