gdu 4.0.0-next.9 → 4.0.3
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 +119 -0
- package/dist/commands/build/buildSSR.js +26 -7
- package/dist/commands/start/index.d.ts +1 -1
- package/dist/commands/start/index.js +1 -1
- package/dist/commands/start/runSPA.js +4 -2
- 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 +26 -1
- package/dist/config/next.config.js +89 -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 -45
- package/dist/config/webpack/webpack.config.js +42 -29
- 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 +7 -6
- package/dist/.DS_Store +0 -0
- package/dist/commands/.DS_Store +0 -0
- package/dist/config/.DS_Store +0 -0
- package/dist/config/webpack/blocks/common.d.ts +0 -4
- package/dist/config/webpack/blocks/common.js +0 -15
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,124 @@
|
|
|
1
1
|
# gdu
|
|
2
2
|
|
|
3
|
+
## 4.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- SSR apps: Get changes to their nextjs config defaults
|
|
8
|
+
|
|
9
|
+
## 4.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- GDU: Fixes spa relay artifact resoluton
|
|
14
|
+
|
|
15
|
+
## 4.0.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- GDU: Supports artifact directory for relay generated files
|
|
20
|
+
|
|
21
|
+
## 4.0.0
|
|
22
|
+
|
|
23
|
+
### Major Changes
|
|
24
|
+
|
|
25
|
+
- Upgrades browserlist
|
|
26
|
+
- a08a3f9: GDU: Upgrades babel
|
|
27
|
+
- 2486c59: GDU: Applies caching to babel
|
|
28
|
+
- 2486c59: GDU fixed build commads
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- cdd95c9: Fixes ssr builds
|
|
33
|
+
- 7c65b2c: GDU: Uses dotenv for env variables
|
|
34
|
+
- 7b7fecc: Upgrades webpack dependencies
|
|
35
|
+
- c0130be: GDU: Puts prod artifacts in folder when building for multiple envs
|
|
36
|
+
- 2adfc80: Adds AG cdn to next image domains
|
|
37
|
+
- 0185749: GDU: Improves build maniset plugin
|
|
38
|
+
- 7f3b1ac: Add multi env build support for nextJS apps
|
|
39
|
+
- 3acac86: GDU: Fixes build manifest plugin
|
|
40
|
+
- f7d42ea: Adds fleet
|
|
41
|
+
- 4288672: GDU: Exposes naked nextjs configs
|
|
42
|
+
- 3acac86: GDU Assumed prod env fro build commands
|
|
43
|
+
- 1f93d6c: GDU: Support vanilla extract
|
|
44
|
+
- 33c60da: GDU: Moves build cache to project root level
|
|
45
|
+
- 2750501: GDU: Allows app level configs
|
|
46
|
+
- 33c60da: GDU uses APP_ENV instead of NODE_ENV for environment configs
|
|
47
|
+
- 94bb85b: Fixes for ssr apps
|
|
48
|
+
- 6c1f212: GDU: Fixed config file paths
|
|
49
|
+
- 9a144dc: GDU: Uses next cli dev command to start dev server
|
|
50
|
+
- 2486c59: GDU Updated GuruBuildManifest plugin
|
|
51
|
+
- 7c65b2c: Dev server: Removed invalid options
|
|
52
|
+
- 61f1da4: GDU upgrades webpack dependency to v5
|
|
53
|
+
- Updated dependencies [undefined]
|
|
54
|
+
- browserslist-config-autoguru@2.0.1
|
|
55
|
+
|
|
56
|
+
## 4.0.0-next.20
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- Add multi env build support for nextJS apps
|
|
61
|
+
|
|
62
|
+
## 4.0.0-next.19
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Fixes ssr builds
|
|
67
|
+
|
|
68
|
+
## 4.0.0-next.18
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- GDU: Puts prod artifacts in folder when building for multiple envs
|
|
73
|
+
|
|
74
|
+
## 4.0.0-next.17
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- GDU: Improves build maniset plugin
|
|
79
|
+
|
|
80
|
+
## 4.0.0-next.16
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- GDU: Fixes build manifest plugin
|
|
85
|
+
|
|
86
|
+
## 4.0.0-next.15
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- GDU Assumed prod env fro build commands
|
|
91
|
+
|
|
92
|
+
## 4.0.0-next.14
|
|
93
|
+
|
|
94
|
+
### Patch Changes
|
|
95
|
+
|
|
96
|
+
- GDU: Exposes naked nextjs configs
|
|
97
|
+
|
|
98
|
+
## 4.0.0-next.13
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- Adds fleet
|
|
103
|
+
|
|
104
|
+
## 4.0.0-next.12
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- 2adfc80: Adds AG cdn to next image domains
|
|
109
|
+
|
|
110
|
+
## 4.0.0-next.11
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- Fixes for ssr apps
|
|
115
|
+
|
|
116
|
+
## 4.0.0-next.10
|
|
117
|
+
|
|
118
|
+
### Patch Changes
|
|
119
|
+
|
|
120
|
+
- GDU: Uses next cli dev command to start dev server
|
|
121
|
+
|
|
3
122
|
## 4.0.0-next.9
|
|
4
123
|
|
|
5
124
|
### Patch Changes
|
|
@@ -1,16 +1,35 @@
|
|
|
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
|
+
extendEnv: true,
|
|
21
|
+
env: { NODE_ENV: 'production' },
|
|
22
|
+
})
|
|
23
|
+
.then((result) => {
|
|
24
|
+
console.log(`${kleur_1.dim('SUCCESS!')}`, `${kleur_1.dim('Listening')}: ${kleur_1.blue(result === null || result === void 0 ? void 0 : result.all)}`);
|
|
25
|
+
}, (error) => {
|
|
26
|
+
logger.error('response', {
|
|
27
|
+
processingTime: Date.now() - start,
|
|
28
|
+
responseHeaders: Object.fromEntries(Object.entries(error.getHeaders())),
|
|
29
|
+
url: 'incomingPath',
|
|
30
|
+
statusCode: error.statusCode,
|
|
31
|
+
});
|
|
32
|
+
throw error;
|
|
14
33
|
});
|
|
15
34
|
return {
|
|
16
35
|
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 };
|
|
@@ -31,7 +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
|
|
34
|
+
const webpackConfig = hooks.webpackConfig
|
|
35
|
+
.call(webpack_config_1.default())
|
|
36
|
+
.find(({ name }) => name === process.env.APP_ENV);
|
|
35
37
|
const consumerHtmlTemplate = getConsumerHtmlTemplate(guruConfig);
|
|
36
38
|
webpackConfig.plugins.push(new html_webpack_plugin_1.default({
|
|
37
39
|
template: consumerHtmlTemplate !== null && consumerHtmlTemplate !== void 0 ? consumerHtmlTemplate : 'auto',
|
|
@@ -53,7 +55,7 @@ const runSPA = async (guruConfig) => {
|
|
|
53
55
|
src: `${compilation.options.output
|
|
54
56
|
.publicPath || ''}${file}`,
|
|
55
57
|
},
|
|
56
|
-
meta: {
|
|
58
|
+
meta: { plugin: 'html-webpack-plugin' },
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
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: join(PROJECT_ROOT, '../../', 'packages', 'relay', '__generated__'),
|
|
43
45
|
},
|
|
44
46
|
],
|
|
45
47
|
require.resolve('babel-plugin-treat'),
|
|
@@ -1 +1,26 @@
|
|
|
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
|
+
serverComponents: boolean;
|
|
9
|
+
};
|
|
10
|
+
i18n: {
|
|
11
|
+
locales: string[];
|
|
12
|
+
defaultLocale: string;
|
|
13
|
+
};
|
|
14
|
+
typescript: {
|
|
15
|
+
transpileOnly: boolean;
|
|
16
|
+
ignoreDevErrors: boolean;
|
|
17
|
+
ignoreBuildErrors: boolean;
|
|
18
|
+
};
|
|
19
|
+
images: {
|
|
20
|
+
domains: string[];
|
|
21
|
+
formats: string[];
|
|
22
|
+
imageSizes: number[];
|
|
23
|
+
};
|
|
24
|
+
webpack: (defaultConfig: any) => any;
|
|
25
|
+
};
|
|
26
|
+
export declare const createNextJSTranspiledConfig: () => any;
|
|
@@ -1,92 +1,102 @@
|
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
+
serverComponents: false,
|
|
57
|
+
},
|
|
58
|
+
i18n: {
|
|
59
|
+
locales: ["en"],
|
|
60
|
+
defaultLocale: "en",
|
|
61
|
+
},
|
|
62
|
+
typescript: {
|
|
63
|
+
transpileOnly: true,
|
|
64
|
+
ignoreDevErrors: true,
|
|
65
|
+
ignoreBuildErrors: true,
|
|
66
|
+
},
|
|
67
|
+
images: {
|
|
68
|
+
domains: [
|
|
69
|
+
'cdn.autoguru.com.au',
|
|
70
|
+
'cdn-dev.autoguru.com.au',
|
|
71
|
+
'cdn-test.autoguru.com.au',
|
|
72
|
+
'cdn-uat.autoguru.com.au',
|
|
73
|
+
'cdn-preprod.autoguru.com.au',
|
|
74
|
+
],
|
|
75
|
+
formats: ['image/avif', 'image/webp'],
|
|
76
|
+
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384, 512],
|
|
77
|
+
},
|
|
78
|
+
webpack: (defaultConfig) => {
|
|
79
|
+
defaultConfig.plugins.push(new webpack_1.DefinePlugin({
|
|
80
|
+
__DEV__: isDev,
|
|
81
|
+
}));
|
|
82
|
+
configs_1.getConfigsDirs()
|
|
83
|
+
.flatMap((configsDir) => [
|
|
84
|
+
new dotenv_webpack_1.default({
|
|
85
|
+
path: path_1.default.resolve(configsDir, '.env.defaults'),
|
|
86
|
+
}),
|
|
87
|
+
new dotenv_webpack_1.default({
|
|
88
|
+
path: path_1.default.resolve(configsDir, `.env.${env}`),
|
|
89
|
+
}),
|
|
90
|
+
])
|
|
91
|
+
.forEach((plugin) => defaultConfig.plugins.push(plugin));
|
|
92
|
+
defaultConfig.resolve.alias['react'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/react/');
|
|
93
|
+
defaultConfig.resolve.alias['react-dom'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/react-dom/');
|
|
94
|
+
defaultConfig.resolve.alias['@autoguru/icons'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/@autoguru/icons/');
|
|
95
|
+
defaultConfig.resolve.alias['next'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/next/');
|
|
96
|
+
return defaultConfig;
|
|
88
97
|
},
|
|
89
98
|
};
|
|
90
|
-
return hooks.nextJSConfig.call(nextJsConfig);
|
|
91
99
|
};
|
|
92
100
|
exports.createNextJSConfig = createNextJSConfig;
|
|
101
|
+
const createNextJSTranspiledConfig = () => withVanillaExtract(exports.withTM(exports.createNextJSConfig('uat')));
|
|
102
|
+
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 {};
|
|
@@ -1,55 +1,103 @@
|
|
|
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.GuruBuildManifest = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const emptyResults = {
|
|
10
|
+
hash: '',
|
|
11
|
+
assets: {
|
|
12
|
+
js: [],
|
|
13
|
+
css: [],
|
|
14
|
+
},
|
|
15
|
+
chunks: {
|
|
16
|
+
js: [],
|
|
17
|
+
css: [],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const pluginName = 'GuruBuildManifestPlugin';
|
|
21
|
+
const defaultOptions = {
|
|
22
|
+
excludeFile: /\.hot-update\.js$/,
|
|
23
|
+
chunkGroupName: (filename) => /\.([\da-z]+(\.map)?)(\?.*)?$/.exec(filename)[1],
|
|
24
|
+
outputDir: process.cwd(),
|
|
25
|
+
filename: 'build-manifest.json',
|
|
26
|
+
objectToString: (result) => JSON.stringify(result),
|
|
27
|
+
includeChunks: true,
|
|
28
|
+
publicPath: '',
|
|
29
|
+
};
|
|
4
30
|
class GuruBuildManifest {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
31
|
+
constructor(options) {
|
|
32
|
+
this.options = {};
|
|
33
|
+
this.result = emptyResults;
|
|
34
|
+
this.options = Object.assign({}, defaultOptions, options);
|
|
35
|
+
this.result = {
|
|
36
|
+
...emptyResults,
|
|
9
37
|
};
|
|
10
|
-
|
|
11
|
-
|
|
38
|
+
}
|
|
39
|
+
apply(compiler) {
|
|
40
|
+
compiler.hooks.emit.tap(pluginName, (compilation) => {
|
|
41
|
+
this.result = { ...emptyResults };
|
|
42
|
+
this.result.hash = compilation.hash;
|
|
43
|
+
compilation.chunks.forEach((chunk) => {
|
|
44
|
+
chunk.files.forEach((filename) => {
|
|
45
|
+
if (this._excludeChunk(this.options.excludeFile, filename, chunk) === true) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const ext = this.options.chunkGroupName(filename, chunk);
|
|
49
|
+
if (chunk.name)
|
|
50
|
+
this.result.assets[ext].push(`${this.options.publicPath}${filename}`);
|
|
51
|
+
else if (this.options.includeChunks)
|
|
52
|
+
this.result.chunks[ext].push(`${this.options.publicPath}${filename}`);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
if (!this.options.includeChunks)
|
|
56
|
+
this.result.chunks = void 0;
|
|
57
|
+
this.saveJson();
|
|
12
58
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
css.push(file);
|
|
59
|
+
}
|
|
60
|
+
saveJson() {
|
|
61
|
+
if (this._shouldFolderBeCreated(this.options.outputDir) === true) {
|
|
62
|
+
let pathStep = process.cwd();
|
|
63
|
+
const normalizedOutputPath = this._normalizeOutputDir(this.options.outputDir);
|
|
64
|
+
normalizedOutputPath.split('/').forEach((folder) => {
|
|
65
|
+
pathStep = path_1.join(pathStep, folder);
|
|
66
|
+
try {
|
|
67
|
+
fs_1.default.mkdirSync(pathStep);
|
|
23
68
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
69
|
+
catch {
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
const file = path_1.resolve(this.options.outputDir, this.options.filename);
|
|
74
|
+
const blob = this.options.objectToString(this.result);
|
|
75
|
+
try {
|
|
76
|
+
fs_1.default.writeFileSync(file, blob, { flag: 'w' });
|
|
77
|
+
console.log(`File successfully created - ${file}`);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
console.error(error);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
_excludeChunk(excludeCriterium, filename, chunk) {
|
|
84
|
+
if (typeof excludeCriterium === 'function') {
|
|
85
|
+
return excludeCriterium(filename, chunk);
|
|
86
|
+
}
|
|
87
|
+
if (excludeCriterium instanceof RegExp) {
|
|
88
|
+
return excludeCriterium.test(filename);
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
_shouldFolderBeCreated(outputDir) {
|
|
93
|
+
const isAbsolutePathWithProjectRoot = outputDir.includes(process.cwd());
|
|
94
|
+
const isPathWithinProjectRoot = !outputDir.startsWith('/');
|
|
95
|
+
return (isAbsolutePathWithProjectRoot || isPathWithinProjectRoot || false);
|
|
96
|
+
}
|
|
97
|
+
_normalizeOutputDir(outputDir) {
|
|
98
|
+
const removedRelativePrefix = outputDir.replace(/^\.\//, '');
|
|
99
|
+
const removeAbsolutePrefix = removedRelativePrefix.replace(process.cwd(), '');
|
|
100
|
+
return removeAbsolutePrefix;
|
|
41
101
|
}
|
|
42
102
|
}
|
|
43
103
|
exports.GuruBuildManifest = GuruBuildManifest;
|
|
44
|
-
const makeSource = (contents) => ({
|
|
45
|
-
source() {
|
|
46
|
-
return Buffer.from(contents);
|
|
47
|
-
},
|
|
48
|
-
size() {
|
|
49
|
-
return Buffer.byteLength(contents);
|
|
50
|
-
},
|
|
51
|
-
updateHash: null,
|
|
52
|
-
map: null,
|
|
53
|
-
sourceAndMap: null,
|
|
54
|
-
buffer: null,
|
|
55
|
-
});
|
|
@@ -23,23 +23,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
const path_1 = __importStar(require("path"));
|
|
26
|
+
const webpack_plugin_1 = require("@vanilla-extract/webpack-plugin");
|
|
26
27
|
const browserslist_config_autoguru_1 = __importDefault(require("browserslist-config-autoguru"));
|
|
27
28
|
const clean_webpack_plugin_1 = require("clean-webpack-plugin");
|
|
28
29
|
const dotenv_webpack_1 = __importDefault(require("dotenv-webpack"));
|
|
29
|
-
const
|
|
30
|
+
const env_ci_1 = __importDefault(require("env-ci"));
|
|
30
31
|
const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
31
32
|
const terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin"));
|
|
32
|
-
const
|
|
33
|
-
const { VanillaExtractPlugin } = require('@vanilla-extract/webpack-plugin');
|
|
33
|
+
const webpack_plugin_2 = require("treat/webpack-plugin");
|
|
34
34
|
const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin");
|
|
35
35
|
const webpack_1 = require("webpack");
|
|
36
36
|
const config_1 = require("../../lib/config");
|
|
37
37
|
const misc_1 = require("../../lib/misc");
|
|
38
38
|
const roots_1 = require("../../lib/roots");
|
|
39
|
+
const configs_1 = require("../../utils/configs");
|
|
39
40
|
const hooks_1 = require("../../utils/hooks");
|
|
40
|
-
const common_1 = require("./blocks/common");
|
|
41
41
|
const GuruBuildManifest_1 = require("./plugins/GuruBuildManifest");
|
|
42
|
-
const { branch = 'null', commit = 'null' } =
|
|
42
|
+
const { branch = 'null', commit = 'null' } = env_ci_1.default();
|
|
43
43
|
const terserOptions = {
|
|
44
44
|
ie8: false,
|
|
45
45
|
output: {
|
|
@@ -63,10 +63,6 @@ const terserOptions = {
|
|
|
63
63
|
const frameworkRegex = /(?<!node_modules.*)[/\\]node_modules[/\\](react|react-dom|scheduler|prop-types|use-subscription|relay-runtime|react-relay)[/\\]/;
|
|
64
64
|
const hooks = hooks_1.getHooks();
|
|
65
65
|
const isDev = !misc_1.isEnvProduction();
|
|
66
|
-
const configsDirs = [
|
|
67
|
-
find_up_1.default.sync('.gdu_config', { type: 'directory' }),
|
|
68
|
-
find_up_1.default.sync('.gdu_app_config', { type: 'directory' }),
|
|
69
|
-
].filter(Boolean);
|
|
70
66
|
const gduEntryPath = path_1.join(roots_1.GDU_ROOT, 'entry');
|
|
71
67
|
const ourCodePaths = [
|
|
72
68
|
path_1.join(gduEntryPath, '/client/spa'),
|
|
@@ -75,7 +71,7 @@ const ourCodePaths = [
|
|
|
75
71
|
/@autoguru[/\\]/,
|
|
76
72
|
].filter(Boolean);
|
|
77
73
|
const fileMask = isDev ? '[name]' : '[name]-[contenthash:8]';
|
|
78
|
-
const baseOptions = {
|
|
74
|
+
const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
79
75
|
context: roots_1.PROJECT_ROOT,
|
|
80
76
|
mode: isDev ? 'development' : 'production',
|
|
81
77
|
entry: {
|
|
@@ -85,16 +81,18 @@ const baseOptions = {
|
|
|
85
81
|
path_1.join(gduEntryPath, '/spa/client.js'),
|
|
86
82
|
].filter(Boolean),
|
|
87
83
|
},
|
|
84
|
+
experiments: {
|
|
85
|
+
layers: true,
|
|
86
|
+
},
|
|
88
87
|
cache: {
|
|
89
88
|
type: 'filesystem',
|
|
90
89
|
cacheLocation: path_1.resolve(roots_1.PROJECT_ROOT, '.build_cache'),
|
|
91
|
-
allowCollectingMemory: true,
|
|
90
|
+
allowCollectingMemory: isDev ? true : false,
|
|
92
91
|
buildDependencies: {
|
|
93
92
|
config: [__filename],
|
|
94
93
|
},
|
|
95
94
|
},
|
|
96
95
|
devtool: isDev ? 'eval-cheap-module-source-map' : 'source-map',
|
|
97
|
-
bail: !isDev || !process.env.APP_ENV,
|
|
98
96
|
resolve: {
|
|
99
97
|
extensions: ['.tsx', '.ts', '.mjs', '.jsx', '.js', '.json'],
|
|
100
98
|
plugins: [
|
|
@@ -111,10 +109,13 @@ const baseOptions = {
|
|
|
111
109
|
minimize: !isDev,
|
|
112
110
|
concatenateModules: !isDev,
|
|
113
111
|
splitChunks: {
|
|
114
|
-
|
|
115
|
-
maxInitialRequests: Number.POSITIVE_INFINITY,
|
|
112
|
+
chunks: 'async',
|
|
116
113
|
minSize: 20000,
|
|
117
|
-
|
|
114
|
+
minRemainingSize: 0,
|
|
115
|
+
minChunks: 1,
|
|
116
|
+
maxAsyncRequests: 30,
|
|
117
|
+
maxInitialRequests: 30,
|
|
118
|
+
enforceSizeThreshold: 50000,
|
|
118
119
|
cacheGroups: {
|
|
119
120
|
default: false,
|
|
120
121
|
defaultVendors: false,
|
|
@@ -159,7 +160,6 @@ const baseOptions = {
|
|
|
159
160
|
module: {
|
|
160
161
|
strictExportPresence: true,
|
|
161
162
|
rules: [
|
|
162
|
-
...common_1.commonLoaders().before,
|
|
163
163
|
{
|
|
164
164
|
test: /\.css$/i,
|
|
165
165
|
oneOf: [
|
|
@@ -176,9 +176,10 @@ const baseOptions = {
|
|
|
176
176
|
],
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
test: /^((?!\.vanilla)[\S\s])*\.css$/i,
|
|
180
|
+
use: [mini_css_extract_plugin_1.default.loader, 'css-loader'],
|
|
181
|
+
},
|
|
182
|
+
],
|
|
182
183
|
},
|
|
183
184
|
{
|
|
184
185
|
test: /\.(js|mjs|jsx|ts|tsx)$/,
|
|
@@ -262,7 +263,7 @@ const baseOptions = {
|
|
|
262
263
|
branch,
|
|
263
264
|
}),
|
|
264
265
|
}),
|
|
265
|
-
new
|
|
266
|
+
new webpack_plugin_2.TreatPlugin({
|
|
266
267
|
outputLoaders: [
|
|
267
268
|
{
|
|
268
269
|
loader: misc_1.isEnvProduction()
|
|
@@ -273,30 +274,36 @@ const baseOptions = {
|
|
|
273
274
|
minify: !isDev,
|
|
274
275
|
browsers: browserslist_config_autoguru_1.default,
|
|
275
276
|
}),
|
|
276
|
-
new VanillaExtractPlugin(),
|
|
277
|
+
new webpack_plugin_1.VanillaExtractPlugin(),
|
|
277
278
|
new mini_css_extract_plugin_1.default({
|
|
278
279
|
filename: `${fileMask}.css`,
|
|
279
280
|
chunkFilename: `chunks/${fileMask}.css`,
|
|
280
281
|
ignoreOrder: true,
|
|
281
282
|
}),
|
|
282
|
-
|
|
283
|
-
|
|
283
|
+
...configs_1.getConfigsDirs().flatMap((configsDir) => [
|
|
284
|
+
new dotenv_webpack_1.default({
|
|
284
285
|
path: path_1.default.resolve(configsDir, '.env.defaults'),
|
|
285
286
|
}),
|
|
286
287
|
new dotenv_webpack_1.default({
|
|
287
|
-
path: path_1.default.resolve(configsDir, `.env.${process.env.APP_ENV || 'dev'}`),
|
|
288
|
+
path: path_1.default.resolve(configsDir, `.env.${process.env.APP_ENV || (isDev ? 'dev' : buildEnv)}`),
|
|
288
289
|
}),
|
|
289
290
|
]),
|
|
291
|
+
!isDev &&
|
|
292
|
+
new GuruBuildManifest_1.GuruBuildManifest({
|
|
293
|
+
outputDir: !isMultiEnv && buildEnv === 'prod'
|
|
294
|
+
? path_1.resolve(roots_1.PROJECT_ROOT, 'dist')
|
|
295
|
+
: path_1.resolve(roots_1.PROJECT_ROOT, 'dist', buildEnv),
|
|
296
|
+
includeChunks: false,
|
|
297
|
+
}),
|
|
290
298
|
].filter(Boolean),
|
|
291
|
-
};
|
|
292
|
-
const buildEnvs = process.env.APP_ENV ? [process.env.APP_ENV] : ['dev', 'uat', 'test', 'preprod', 'prod'];
|
|
299
|
+
});
|
|
293
300
|
const { outputPath } = config_1.getGuruConfig();
|
|
294
|
-
const makeWebpackConfig = (buildEnv) => {
|
|
301
|
+
const makeWebpackConfig = (buildEnv, isMultiEnv) => {
|
|
295
302
|
var _a, _b;
|
|
296
303
|
return ({
|
|
297
304
|
name: buildEnv,
|
|
298
305
|
output: {
|
|
299
|
-
path: `${outputPath}/${buildEnv}`,
|
|
306
|
+
path: `${outputPath}/${!isMultiEnv && buildEnv === 'prod' ? '' : buildEnv}`,
|
|
300
307
|
publicPath: isDev ? '/' : (_b = (_a = config_1.getGuruConfig()) === null || _a === void 0 ? void 0 : _a.publicPath) !== null && _b !== void 0 ? _b : '/',
|
|
301
308
|
filename: `${fileMask}.js`,
|
|
302
309
|
chunkFilename: `chunks/${fileMask}.js`,
|
|
@@ -307,5 +314,11 @@ const makeWebpackConfig = (buildEnv) => {
|
|
|
307
314
|
},
|
|
308
315
|
});
|
|
309
316
|
};
|
|
310
|
-
const buildConfigs = () =>
|
|
317
|
+
const buildConfigs = () => {
|
|
318
|
+
const buildEnvs = configs_1.getBuildEnvs();
|
|
319
|
+
return buildEnvs.map((buildEnv) => ({
|
|
320
|
+
...baseOptions(buildEnv, buildEnvs.length > 1),
|
|
321
|
+
...makeWebpackConfig(buildEnv, buildEnvs.length > 1),
|
|
322
|
+
}));
|
|
323
|
+
};
|
|
311
324
|
exports.default = buildConfigs;
|
package/dist/lib/runWebpack.js
CHANGED
|
@@ -20,7 +20,13 @@ const done = (resolve, reject) => (err, stats) => {
|
|
|
20
20
|
}
|
|
21
21
|
resolve();
|
|
22
22
|
};
|
|
23
|
-
const run = async (compiler) => new Promise((resolve, reject) => compiler.run(
|
|
23
|
+
const run = async (compiler) => new Promise((resolve, reject) => compiler.run((err, stats) => {
|
|
24
|
+
compiler.close((err2) => {
|
|
25
|
+
console.log(stats);
|
|
26
|
+
resolve(err || err2);
|
|
27
|
+
});
|
|
28
|
+
done(resolve, reject);
|
|
29
|
+
}));
|
|
24
30
|
exports.run = run;
|
|
25
31
|
const watch = async (compiler) => new Promise((resolve, reject) => compiler.watch({}, done(resolve, reject)));
|
|
26
32
|
exports.watch = watch;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getBuildFolder = exports.getConfigsDirs = exports.getBuildEnvs = void 0;
|
|
7
|
+
const find_up_1 = __importDefault(require("find-up"));
|
|
8
|
+
const getBuildEnvs = () => process.env.APP_ENV
|
|
9
|
+
? [process.env.APP_ENV]
|
|
10
|
+
: ['dev', 'uat', 'test', 'preprod', 'prod'];
|
|
11
|
+
exports.getBuildEnvs = getBuildEnvs;
|
|
12
|
+
const getConfigsDirs = () => [
|
|
13
|
+
find_up_1.default.sync('.gdu_config', { type: 'directory' }),
|
|
14
|
+
find_up_1.default.sync('.gdu_app_config', { type: 'directory' }),
|
|
15
|
+
].filter(Boolean);
|
|
16
|
+
exports.getConfigsDirs = getConfigsDirs;
|
|
17
|
+
const getBuildFolder = () => [
|
|
18
|
+
find_up_1.default.sync('.gdu_config', { type: 'directory' }),
|
|
19
|
+
find_up_1.default.sync('.gdu_app_config', { type: 'directory' }),
|
|
20
|
+
].filter(Boolean);
|
|
21
|
+
exports.getBuildFolder = getBuildFolder;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdu",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
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",
|
|
@@ -35,11 +35,12 @@
|
|
|
35
35
|
"@graphql-tools/json-file-loader": "^6.2.6",
|
|
36
36
|
"@vanilla-extract/babel-plugin": "^1.1.2",
|
|
37
37
|
"@vanilla-extract/css": "^1.6.3",
|
|
38
|
+
"@vanilla-extract/next-plugin": "^1.0.1",
|
|
38
39
|
"@vanilla-extract/webpack-plugin": "^2.1.0",
|
|
39
40
|
"babel-loader": "^8.2.2",
|
|
40
41
|
"babel-plugin-relay": "^11.0.2",
|
|
41
42
|
"babel-plugin-treat": "^1.6.2",
|
|
42
|
-
"browserslist-config-autoguru": "^2.0.
|
|
43
|
+
"browserslist-config-autoguru": "^2.0.1",
|
|
43
44
|
"clean-webpack-plugin": "^4.0.0-alpha.0",
|
|
44
45
|
"core-js": "^3.9.1",
|
|
45
46
|
"css-loader": "^6.4.0",
|
|
@@ -64,10 +65,10 @@
|
|
|
64
65
|
"kleur": "^4.1.4",
|
|
65
66
|
"mini-css-extract-plugin": "^2.4.2",
|
|
66
67
|
"mkdirp": "^1.0.4",
|
|
67
|
-
"next": "
|
|
68
|
+
"next": "^12.0.2",
|
|
69
|
+
"next-transpile-modules": "^9.0.0",
|
|
68
70
|
"node-fetch": "^2.6.1",
|
|
69
71
|
"null-loader": "^4.0.1",
|
|
70
|
-
"polka": "^0.5.2",
|
|
71
72
|
"postcss-flexbugs-fixes": "^4.2.1",
|
|
72
73
|
"postcss-loader": "^3.0.0",
|
|
73
74
|
"postcss-preset-env": "^6.7.0",
|
|
@@ -81,8 +82,8 @@
|
|
|
81
82
|
"ts-dedent": "^2.0.0",
|
|
82
83
|
"tsconfig-paths-webpack-plugin": "^3.5.1",
|
|
83
84
|
"url-loader": "^4.1.1",
|
|
84
|
-
"webpack": "^5.
|
|
85
|
-
"webpack-dev-server": "^4.
|
|
85
|
+
"webpack": "^5.64.2",
|
|
86
|
+
"webpack-dev-server": "^4.5.0",
|
|
86
87
|
"whatwg-fetch": "^3.6.2"
|
|
87
88
|
},
|
|
88
89
|
"devDependencies": {
|
package/dist/.DS_Store
DELETED
|
Binary file
|
package/dist/commands/.DS_Store
DELETED
|
Binary file
|
package/dist/config/.DS_Store
DELETED
|
Binary file
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.commonLoaders = void 0;
|
|
4
|
-
const commonLoaders = () => {
|
|
5
|
-
return {
|
|
6
|
-
before: [
|
|
7
|
-
{
|
|
8
|
-
test: /\.mjs$/,
|
|
9
|
-
include: /node_modules/,
|
|
10
|
-
type: 'javascript/auto',
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
exports.commonLoaders = commonLoaders;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeImagesLoader = void 0;
|
|
4
|
-
const misc_1 = require("../../../lib/misc");
|
|
5
|
-
const makeImagesLoader = () => {
|
|
6
|
-
return {
|
|
7
|
-
loader: require.resolve('url-loader'),
|
|
8
|
-
options: {
|
|
9
|
-
limit: 10000,
|
|
10
|
-
name: `static/media/${misc_1.isEnvProduction() ? '' : '[name]-'}[contenthash:8].[ext]`,
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
exports.makeImagesLoader = makeImagesLoader;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare const makeCssLoader: ({ isServer }: {
|
|
2
|
-
isServer?: boolean;
|
|
3
|
-
}) => ({
|
|
4
|
-
loader: any;
|
|
5
|
-
options?: undefined;
|
|
6
|
-
} | {
|
|
7
|
-
loader: string;
|
|
8
|
-
options: {
|
|
9
|
-
importLoaders: number;
|
|
10
|
-
localsConvention: string;
|
|
11
|
-
sourceMap: boolean;
|
|
12
|
-
plugins?: undefined;
|
|
13
|
-
};
|
|
14
|
-
} | {
|
|
15
|
-
loader: string;
|
|
16
|
-
options: {
|
|
17
|
-
sourceMap: boolean;
|
|
18
|
-
plugins: any[];
|
|
19
|
-
importLoaders?: undefined;
|
|
20
|
-
localsConvention?: undefined;
|
|
21
|
-
};
|
|
22
|
-
})[];
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.makeCssLoader = void 0;
|
|
7
|
-
const browserslist_config_autoguru_1 = __importDefault(require("browserslist-config-autoguru"));
|
|
8
|
-
const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
9
|
-
const misc_1 = require("../../../lib/misc");
|
|
10
|
-
const makeCssLoader = ({ isServer = false }) => {
|
|
11
|
-
return [
|
|
12
|
-
misc_1.isEnvProduction() &&
|
|
13
|
-
!isServer && {
|
|
14
|
-
loader: mini_css_extract_plugin_1.default.loader,
|
|
15
|
-
},
|
|
16
|
-
!misc_1.isEnvProduction() &&
|
|
17
|
-
!isServer && {
|
|
18
|
-
loader: require.resolve('style-loader'),
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
loader: require.resolve('css-loader'),
|
|
22
|
-
options: {
|
|
23
|
-
importLoaders: 1,
|
|
24
|
-
localsConvention: 'camelCase',
|
|
25
|
-
sourceMap: true,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
loader: require.resolve('postcss-loader'),
|
|
30
|
-
options: {
|
|
31
|
-
sourceMap: true,
|
|
32
|
-
plugins: [
|
|
33
|
-
require('postcss-flexbugs-fixes'),
|
|
34
|
-
require('postcss-preset-env')({
|
|
35
|
-
browsers: browserslist_config_autoguru_1.default,
|
|
36
|
-
autoprefixer: {
|
|
37
|
-
flexbox: 'no-2009',
|
|
38
|
-
},
|
|
39
|
-
stage: 3,
|
|
40
|
-
}),
|
|
41
|
-
require('cssnano')({
|
|
42
|
-
browsers: browserslist_config_autoguru_1.default,
|
|
43
|
-
}),
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
].filter(Boolean);
|
|
48
|
-
};
|
|
49
|
-
exports.makeCssLoader = makeCssLoader;
|
package/entry/.DS_Store
DELETED
|
Binary file
|