gdu 5.0.2 → 5.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.
- package/dist/cli.js +5 -5
- package/dist/commands/build/buildSPA.js +4 -4
- package/dist/commands/build/buildSSR.js +3 -3
- package/dist/commands/build/index.js +9 -9
- package/dist/commands/configure/index.js +3 -3
- package/dist/commands/format.js +3 -3
- package/dist/commands/generateBrowsers.js +6 -6
- package/dist/commands/gh-actions.js +1 -1
- package/dist/commands/graphqlDiff.d.ts +2 -0
- package/dist/commands/graphqlDiff.js +50 -0
- package/dist/commands/graphqlSchema.d.ts +11 -0
- package/dist/commands/graphqlSchema.js +11 -6
- package/dist/commands/index.js +17 -5
- package/dist/commands/scaffold.js +14 -14
- package/dist/commands/start/index.js +10 -6
- package/dist/commands/start/runSPA.js +13 -13
- package/dist/commands/start/runSSR.js +4 -4
- package/dist/config/next.config.d.ts +1 -2
- package/dist/config/next.config.js +33 -15
- package/dist/config/ssr/server.js +3 -3
- package/dist/config/webpack/plugins/GuruBuildManifest.js +2 -2
- package/dist/config/webpack/webpack.config.js +37 -24
- package/dist/lib/apps.js +2 -2
- package/dist/lib/banner.js +5 -5
- package/dist/lib/config.js +13 -11
- package/dist/lib/configure.js +10 -10
- package/dist/lib/format.js +1 -1
- package/dist/lib/getConsumerRuntimeConfig.js +4 -4
- package/dist/lib/io.js +6 -6
- package/dist/lib/misc.d.ts +1 -1
- package/dist/lib/misc.js +5 -5
- package/dist/lib/resolve.js +2 -2
- package/dist/lib/roots.js +5 -5
- package/dist/lib/runWebpack.js +2 -2
- package/dist/lib/terminal.js +1 -1
- package/dist/main.js +5 -1
- package/dist/utils/hooks.js +3 -3
- package/gdu.d.ts +8 -1
- package/package.json +113 -109
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -32,8 +36,8 @@ const config_1 = require("../lib/config");
|
|
|
32
36
|
const misc_1 = require("../lib/misc");
|
|
33
37
|
const roots_1 = require("../lib/roots");
|
|
34
38
|
const configs_1 = require("../utils/configs");
|
|
35
|
-
const withVanillaExtract = next_plugin_1.createVanillaExtractPlugin();
|
|
36
|
-
exports.withTM = next_transpile_modules_1.default([
|
|
39
|
+
const withVanillaExtract = (0, next_plugin_1.createVanillaExtractPlugin)();
|
|
40
|
+
exports.withTM = (0, next_transpile_modules_1.default)([
|
|
37
41
|
'@autoguru/themes',
|
|
38
42
|
'@autoguru/overdrive',
|
|
39
43
|
'@autoguru/icons',
|
|
@@ -52,7 +56,13 @@ exports.CSPDefaultsList = [
|
|
|
52
56
|
},
|
|
53
57
|
{
|
|
54
58
|
key: 'frame-src',
|
|
55
|
-
values: [
|
|
59
|
+
values: [
|
|
60
|
+
"'self'",
|
|
61
|
+
'https://www.youtube.com',
|
|
62
|
+
'https://www.google.com',
|
|
63
|
+
'https://*.doubleclick.net',
|
|
64
|
+
'https://*.googleadservices.com',
|
|
65
|
+
],
|
|
56
66
|
},
|
|
57
67
|
{
|
|
58
68
|
key: 'style-src',
|
|
@@ -61,6 +71,7 @@ exports.CSPDefaultsList = [
|
|
|
61
71
|
"'unsafe-inline'",
|
|
62
72
|
'https://*.autoguru.com.au',
|
|
63
73
|
'https://*.googleapis.com',
|
|
74
|
+
'https://*.googleadservices.com',
|
|
64
75
|
],
|
|
65
76
|
},
|
|
66
77
|
{
|
|
@@ -76,6 +87,7 @@ exports.CSPDefaultsList = [
|
|
|
76
87
|
'https://*.tvsquared.com',
|
|
77
88
|
'https://*.google.com',
|
|
78
89
|
'https://*.google.com.au',
|
|
90
|
+
'https://*.googleadservices.com',
|
|
79
91
|
'https://*.gstatic.com',
|
|
80
92
|
'https://*.quantserve.com',
|
|
81
93
|
],
|
|
@@ -148,6 +160,7 @@ exports.CSPDefaultsList = [
|
|
|
148
160
|
"'self'",
|
|
149
161
|
"'unsafe-eval'",
|
|
150
162
|
'https://*.autoguru.com.au',
|
|
163
|
+
'https://*.googleadservices.com',
|
|
151
164
|
'https://*.googletagmanager.com',
|
|
152
165
|
'https://*.google.com.au',
|
|
153
166
|
'https://*.gstatic.com',
|
|
@@ -175,23 +188,28 @@ exports.defaultSecurityHeaders = [
|
|
|
175
188
|
value: 'SAMEORIGIN https://*.autoguru.com.au',
|
|
176
189
|
},
|
|
177
190
|
];
|
|
191
|
+
const productionEnvs = new Set([
|
|
192
|
+
'prod',
|
|
193
|
+
'dockerprod',
|
|
194
|
+
'preprod',
|
|
195
|
+
]);
|
|
178
196
|
const createNextJSConfig = (buildEnv) => {
|
|
179
197
|
var _a, _b;
|
|
180
|
-
const isDev = !misc_1.
|
|
198
|
+
const isDev = !(0, misc_1.isProductionBuild)();
|
|
181
199
|
const env = process.env.APP_ENV || (isDev ? 'dev' : buildEnv);
|
|
182
|
-
const
|
|
200
|
+
const isProductionSite = productionEnvs.has(process.env.APP_ENV);
|
|
201
|
+
const assetPrefix = isDev ? '' : (_b = (_a = (0, config_1.getGuruConfig)()) === null || _a === void 0 ? void 0 : _a.publicPath) !== null && _b !== void 0 ? _b : '';
|
|
183
202
|
return {
|
|
184
203
|
distDir: `dist/${env}`,
|
|
185
|
-
reactStrictMode:
|
|
204
|
+
reactStrictMode: !isProductionSite,
|
|
186
205
|
swcMinify: true,
|
|
206
|
+
poweredByHeader: !isProductionSite,
|
|
187
207
|
assetPrefix,
|
|
188
208
|
i18n: {
|
|
189
209
|
locales: ['en'],
|
|
190
210
|
defaultLocale: 'en',
|
|
191
211
|
},
|
|
192
212
|
typescript: {
|
|
193
|
-
transpileOnly: true,
|
|
194
|
-
ignoreDevErrors: true,
|
|
195
213
|
ignoreBuildErrors: true,
|
|
196
214
|
},
|
|
197
215
|
images: {
|
|
@@ -216,7 +234,7 @@ const createNextJSConfig = (buildEnv) => {
|
|
|
216
234
|
defaultConfig.plugins.push(new webpack_1.DefinePlugin({
|
|
217
235
|
__DEV__: isDev,
|
|
218
236
|
}));
|
|
219
|
-
configs_1.getConfigsDirs()
|
|
237
|
+
(0, configs_1.getConfigsDirs)()
|
|
220
238
|
.flatMap((configsDir) => [
|
|
221
239
|
new dotenv_webpack_1.default({
|
|
222
240
|
path: path_1.default.resolve(configsDir, '.env.defaults'),
|
|
@@ -230,14 +248,14 @@ const createNextJSConfig = (buildEnv) => {
|
|
|
230
248
|
}),
|
|
231
249
|
])
|
|
232
250
|
.forEach((plugin) => defaultConfig.plugins.push(plugin));
|
|
233
|
-
defaultConfig.resolve.alias['react'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/react/');
|
|
234
|
-
defaultConfig.resolve.alias['react-dom'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/react-dom/');
|
|
235
|
-
defaultConfig.resolve.alias['@autoguru/icons'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/@autoguru/icons/');
|
|
236
|
-
defaultConfig.resolve.alias['next'] = path_1.resolve(roots_1.PROJECT_ROOT, '../../', 'node_modules/next/');
|
|
251
|
+
defaultConfig.resolve.alias['react'] = (0, path_1.resolve)(roots_1.PROJECT_ROOT, '../../', 'node_modules/react/');
|
|
252
|
+
defaultConfig.resolve.alias['react-dom'] = (0, path_1.resolve)(roots_1.PROJECT_ROOT, '../../', 'node_modules/react-dom/');
|
|
253
|
+
defaultConfig.resolve.alias['@autoguru/icons'] = (0, path_1.resolve)(roots_1.PROJECT_ROOT, '../../', 'node_modules/@autoguru/icons/');
|
|
254
|
+
defaultConfig.resolve.alias['next'] = (0, path_1.resolve)(roots_1.PROJECT_ROOT, '../../', 'node_modules/next/');
|
|
237
255
|
return defaultConfig;
|
|
238
256
|
},
|
|
239
257
|
};
|
|
240
258
|
};
|
|
241
259
|
exports.createNextJSConfig = createNextJSConfig;
|
|
242
|
-
const createNextJSTranspiledConfig = () => withVanillaExtract(exports.withTM(exports.createNextJSConfig('prod')));
|
|
260
|
+
const createNextJSTranspiledConfig = () => withVanillaExtract((0, exports.withTM)((0, exports.createNextJSConfig)('prod')));
|
|
243
261
|
exports.createNextJSTranspiledConfig = createNextJSTranspiledConfig;
|
|
@@ -9,17 +9,17 @@ const execa_1 = __importDefault(require("execa"));
|
|
|
9
9
|
const kleur_1 = require("kleur");
|
|
10
10
|
const misc_1 = require("../../lib/misc");
|
|
11
11
|
const roots_1 = require("../../lib/roots");
|
|
12
|
-
const logger = utilities_1.createLogger('server');
|
|
12
|
+
const logger = (0, utilities_1.createLogger)('server');
|
|
13
13
|
const run = async (port) => {
|
|
14
14
|
const start = Date.now();
|
|
15
15
|
execa_1.default
|
|
16
|
-
.command(`next ${misc_1.
|
|
16
|
+
.command(`next ${(0, misc_1.isProductionBuild)() ? 'start' : 'dev'} -p ${port}`, {
|
|
17
17
|
stdio: 'inherit',
|
|
18
18
|
cwd: roots_1.PROJECT_ROOT,
|
|
19
19
|
localDir: roots_1.GDU_ROOT,
|
|
20
20
|
})
|
|
21
21
|
.then(() => {
|
|
22
|
-
console.log(`${kleur_1.dim('Listening')}: ${kleur_1.blue(`http://localhost:${port}/`)}`);
|
|
22
|
+
console.log(`${(0, kleur_1.dim)('Listening')}: ${(0, kleur_1.blue)(`http://localhost:${port}/`)}`);
|
|
23
23
|
}, (error) => {
|
|
24
24
|
logger.error('response', {
|
|
25
25
|
processingTime: Date.now() - start,
|
|
@@ -62,7 +62,7 @@ class GuruBuildManifest {
|
|
|
62
62
|
let pathStep = process.cwd();
|
|
63
63
|
const normalizedOutputPath = this._normalizeOutputDir(this.options.outputDir);
|
|
64
64
|
normalizedOutputPath.split('/').forEach((folder) => {
|
|
65
|
-
pathStep = path_1.join(pathStep, folder);
|
|
65
|
+
pathStep = (0, path_1.join)(pathStep, folder);
|
|
66
66
|
try {
|
|
67
67
|
fs_1.default.mkdirSync(pathStep);
|
|
68
68
|
}
|
|
@@ -70,7 +70,7 @@ class GuruBuildManifest {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
const file = path_1.resolve(this.options.outputDir, this.options.filename);
|
|
73
|
+
const file = (0, path_1.resolve)(this.options.outputDir, this.options.filename);
|
|
74
74
|
const blob = this.options.objectToString(this.result);
|
|
75
75
|
try {
|
|
76
76
|
fs_1.default.writeFileSync(file, blob, { flag: 'w' });
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -39,7 +43,7 @@ const roots_1 = require("../../lib/roots");
|
|
|
39
43
|
const configs_1 = require("../../utils/configs");
|
|
40
44
|
const hooks_1 = require("../../utils/hooks");
|
|
41
45
|
const GuruBuildManifest_1 = require("./plugins/GuruBuildManifest");
|
|
42
|
-
const { branch = 'null', commit = 'null' } = env_ci_1.default();
|
|
46
|
+
const { branch = 'null', commit = 'null' } = (0, env_ci_1.default)();
|
|
43
47
|
const terserOptions = {
|
|
44
48
|
ie8: false,
|
|
45
49
|
output: {
|
|
@@ -61,13 +65,13 @@ const terserOptions = {
|
|
|
61
65
|
mangle: { safari10: true },
|
|
62
66
|
};
|
|
63
67
|
const frameworkRegex = /(?<!node_modules.*)[/\\]node_modules[/\\](react|react-dom|scheduler|prop-types|use-subscription|relay-runtime|react-relay)[/\\]/;
|
|
64
|
-
const hooks = hooks_1.getHooks();
|
|
65
|
-
const isDev = !misc_1.
|
|
66
|
-
const gduEntryPath = path_1.join(roots_1.GDU_ROOT, 'entry');
|
|
68
|
+
const hooks = (0, hooks_1.getHooks)();
|
|
69
|
+
const isDev = !(0, misc_1.isProductionBuild)();
|
|
70
|
+
const gduEntryPath = (0, path_1.join)(roots_1.GDU_ROOT, 'entry');
|
|
67
71
|
const ourCodePaths = [
|
|
68
|
-
path_1.join(gduEntryPath, '/client/spa'),
|
|
69
|
-
...config_1.getGuruConfig().srcPaths.map((item) => path_1.join(roots_1.PROJECT_ROOT, item)),
|
|
70
|
-
roots_1.CALLING_WORKSPACE_ROOT && path_1.join(roots_1.CALLING_WORKSPACE_ROOT, 'packages'),
|
|
72
|
+
(0, path_1.join)(gduEntryPath, '/client/spa'),
|
|
73
|
+
...(0, config_1.getGuruConfig)().srcPaths.map((item) => (0, path_1.join)(roots_1.PROJECT_ROOT, item)),
|
|
74
|
+
roots_1.CALLING_WORKSPACE_ROOT && (0, path_1.join)(roots_1.CALLING_WORKSPACE_ROOT, 'packages'),
|
|
71
75
|
/@autoguru[/\\]/,
|
|
72
76
|
].filter(Boolean);
|
|
73
77
|
const fileMask = isDev ? '[name]' : '[name]-[contenthash:8]';
|
|
@@ -76,8 +80,8 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
76
80
|
mode: isDev ? 'development' : 'production',
|
|
77
81
|
entry: {
|
|
78
82
|
main: [
|
|
79
|
-
path_1.join(gduEntryPath, '/polyfill.js'),
|
|
80
|
-
path_1.join(gduEntryPath, '/spa/client.js'),
|
|
83
|
+
(0, path_1.join)(gduEntryPath, '/polyfill.js'),
|
|
84
|
+
(0, path_1.join)(gduEntryPath, '/spa/client.js'),
|
|
81
85
|
].filter(Boolean),
|
|
82
86
|
},
|
|
83
87
|
experiments: {
|
|
@@ -85,7 +89,7 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
85
89
|
},
|
|
86
90
|
cache: {
|
|
87
91
|
type: 'filesystem',
|
|
88
|
-
cacheLocation: path_1.resolve(roots_1.PROJECT_ROOT, '.build_cache'),
|
|
92
|
+
cacheLocation: (0, path_1.resolve)(roots_1.PROJECT_ROOT, '.build_cache'),
|
|
89
93
|
allowCollectingMemory: isDev ? true : false,
|
|
90
94
|
buildDependencies: {
|
|
91
95
|
config: [__filename],
|
|
@@ -93,14 +97,18 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
93
97
|
},
|
|
94
98
|
devtool: isDev ? 'eval-cheap-module-source-map' : 'source-map',
|
|
95
99
|
resolve: {
|
|
100
|
+
fallback: {
|
|
101
|
+
path: false,
|
|
102
|
+
util: false,
|
|
103
|
+
},
|
|
96
104
|
extensions: ['.tsx', '.ts', '.mjs', '.jsx', '.js', '.json'],
|
|
97
105
|
plugins: [
|
|
98
106
|
new tsconfig_paths_webpack_plugin_1.TsconfigPathsPlugin({
|
|
99
|
-
configFile: path_1.join(roots_1.PROJECT_ROOT, 'tsconfig.json'),
|
|
107
|
+
configFile: (0, path_1.join)(roots_1.PROJECT_ROOT, 'tsconfig.json'),
|
|
100
108
|
}),
|
|
101
109
|
],
|
|
102
110
|
alias: {
|
|
103
|
-
__GDU_CONSUMER_CLIENT__: path_1.join(roots_1.PROJECT_ROOT, 'src/client.tsx'),
|
|
111
|
+
__GDU_CONSUMER_CLIENT__: (0, path_1.join)(roots_1.PROJECT_ROOT, 'src/client.tsx'),
|
|
104
112
|
},
|
|
105
113
|
},
|
|
106
114
|
optimization: {
|
|
@@ -209,13 +217,13 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
209
217
|
envName: isDev
|
|
210
218
|
? 'development'
|
|
211
219
|
: 'production',
|
|
212
|
-
...hooks.babelConfig.call(require('../babel.config')(config_1.getGuruConfig())),
|
|
220
|
+
...hooks.babelConfig.call(require('../babel.config')((0, config_1.getGuruConfig)())),
|
|
213
221
|
},
|
|
214
222
|
},
|
|
215
223
|
],
|
|
216
224
|
},
|
|
217
225
|
{
|
|
218
|
-
exclude:
|
|
226
|
+
exclude: /(@babel(?:\/|\\{1,2})runtime)|(\/node_modules\/next\/)/,
|
|
219
227
|
use: [
|
|
220
228
|
{
|
|
221
229
|
loader: require.resolve('babel-loader'),
|
|
@@ -251,12 +259,17 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
251
259
|
],
|
|
252
260
|
},
|
|
253
261
|
plugins: [
|
|
262
|
+
new webpack_1.IgnorePlugin({
|
|
263
|
+
checkResource(resource) {
|
|
264
|
+
return /(\/next\/)/.test(resource);
|
|
265
|
+
},
|
|
266
|
+
}),
|
|
254
267
|
!isDev && new clean_webpack_plugin_1.CleanWebpackPlugin(),
|
|
255
268
|
new webpack_1.DefinePlugin({
|
|
256
269
|
'process.browser': JSON.stringify(true),
|
|
257
270
|
'process.env.NODE_ENV': JSON.stringify(isDev ? 'development' : 'production'),
|
|
258
271
|
__DEV__: JSON.stringify(isDev),
|
|
259
|
-
__GDU_APP_NAME__: JSON.stringify(config_1.getProjectName()),
|
|
272
|
+
__GDU_APP_NAME__: JSON.stringify((0, config_1.getProjectName)()),
|
|
260
273
|
__GDU_BUILD_INFO__: JSON.stringify({
|
|
261
274
|
commit,
|
|
262
275
|
branch,
|
|
@@ -265,7 +278,7 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
265
278
|
new webpack_plugin_2.TreatPlugin({
|
|
266
279
|
outputLoaders: [
|
|
267
280
|
{
|
|
268
|
-
loader: misc_1.
|
|
281
|
+
loader: (0, misc_1.isProductionBuild)()
|
|
269
282
|
? mini_css_extract_plugin_1.default.loader
|
|
270
283
|
: require.resolve('style-loader'),
|
|
271
284
|
},
|
|
@@ -279,7 +292,7 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
279
292
|
chunkFilename: `chunks/${fileMask}.css`,
|
|
280
293
|
ignoreOrder: true,
|
|
281
294
|
}),
|
|
282
|
-
...configs_1.getConfigsDirs().flatMap((configsDir) => [
|
|
295
|
+
...(0, configs_1.getConfigsDirs)().flatMap((configsDir) => [
|
|
283
296
|
new dotenv_webpack_1.default({
|
|
284
297
|
path: path_1.default.resolve(configsDir, '.env.defaults'),
|
|
285
298
|
prefix: 'process.env.',
|
|
@@ -294,13 +307,13 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
294
307
|
!isDev &&
|
|
295
308
|
new GuruBuildManifest_1.GuruBuildManifest({
|
|
296
309
|
outputDir: !isMultiEnv && buildEnv === 'prod'
|
|
297
|
-
? path_1.resolve(roots_1.PROJECT_ROOT, 'dist')
|
|
298
|
-
: path_1.resolve(roots_1.PROJECT_ROOT, 'dist', buildEnv),
|
|
310
|
+
? (0, path_1.resolve)(roots_1.PROJECT_ROOT, 'dist')
|
|
311
|
+
: (0, path_1.resolve)(roots_1.PROJECT_ROOT, 'dist', buildEnv),
|
|
299
312
|
includeChunks: false,
|
|
300
313
|
}),
|
|
301
314
|
].filter(Boolean),
|
|
302
315
|
});
|
|
303
|
-
const { outputPath } = config_1.getGuruConfig();
|
|
316
|
+
const { outputPath } = (0, config_1.getGuruConfig)();
|
|
304
317
|
const makeWebpackConfig = (buildEnv, isMultiEnv) => ({
|
|
305
318
|
name: buildEnv,
|
|
306
319
|
output: {
|
|
@@ -308,8 +321,8 @@ const makeWebpackConfig = (buildEnv, isMultiEnv) => ({
|
|
|
308
321
|
publicPath: isDev
|
|
309
322
|
? '/'
|
|
310
323
|
: buildEnv === 'prod'
|
|
311
|
-
? `#{PUBLIC_PATH_BASE}/${config_1.getProjectFolderName()}/`
|
|
312
|
-
: `https://static-mfe-${buildEnv}.autoguru.io/${config_1.getProjectFolderName()}/`,
|
|
324
|
+
? `#{PUBLIC_PATH_BASE}/${(0, config_1.getProjectFolderName)()}/`
|
|
325
|
+
: `https://static-mfe-${buildEnv}.autoguru.io/${(0, config_1.getProjectFolderName)()}/`,
|
|
313
326
|
filename: `${fileMask}.js`,
|
|
314
327
|
chunkFilename: `chunks/${fileMask}.js`,
|
|
315
328
|
hashFunction: 'sha256',
|
|
@@ -319,7 +332,7 @@ const makeWebpackConfig = (buildEnv, isMultiEnv) => ({
|
|
|
319
332
|
},
|
|
320
333
|
});
|
|
321
334
|
const buildConfigs = () => {
|
|
322
|
-
const buildEnvs = configs_1.getBuildEnvs();
|
|
335
|
+
const buildEnvs = (0, configs_1.getBuildEnvs)();
|
|
323
336
|
return buildEnvs.map((buildEnv) => ({
|
|
324
337
|
...baseOptions(buildEnv, buildEnvs.length > 1),
|
|
325
338
|
...makeWebpackConfig(buildEnv, buildEnvs.length > 1),
|
package/dist/lib/apps.js
CHANGED
|
@@ -8,9 +8,9 @@ const path_1 = require("path");
|
|
|
8
8
|
const recursive_readdir_1 = __importDefault(require("recursive-readdir"));
|
|
9
9
|
const roots_1 = require("./roots");
|
|
10
10
|
const getApps = async () => {
|
|
11
|
-
const files = await recursive_readdir_1.default(roots_1.PROJECT_ROOT, ['*node_modules*']);
|
|
11
|
+
const files = await (0, recursive_readdir_1.default)(roots_1.PROJECT_ROOT, ['*node_modules*']);
|
|
12
12
|
return files
|
|
13
13
|
.filter((file) => file.endsWith('guru.config.js'))
|
|
14
|
-
.map((configLocation) => path_1.dirname(configLocation));
|
|
14
|
+
.map((configLocation) => (0, path_1.dirname)(configLocation));
|
|
15
15
|
};
|
|
16
16
|
exports.getApps = getApps;
|
package/dist/lib/banner.js
CHANGED
|
@@ -11,12 +11,12 @@ const config_1 = require("./config");
|
|
|
11
11
|
const roots_1 = require("./roots");
|
|
12
12
|
const terminal_1 = require("./terminal");
|
|
13
13
|
const banner = (verb, app_name) => {
|
|
14
|
-
const projectName = app_name !== null && app_name !== void 0 ? app_name : require(path_1.join(config_1.getGuruConfig().__configPath, './package.json')).name;
|
|
15
|
-
console.log(ts_dedent_1.default `${kleur_1.dim(terminal_1.columnLoop('-'))}
|
|
14
|
+
const projectName = app_name !== null && app_name !== void 0 ? app_name : require((0, path_1.join)((0, config_1.getGuruConfig)().__configPath, './package.json')).name;
|
|
15
|
+
console.log((0, ts_dedent_1.default) `${(0, kleur_1.dim)((0, terminal_1.columnLoop)('-'))}
|
|
16
16
|
|
|
17
|
-
${verb} ${kleur_1.green(projectName)}
|
|
18
|
-
${kleur_1.dim(`gdu: v${require(path_1.join(roots_1.GDU_ROOT, './package.json')).version}`)}
|
|
17
|
+
${verb} ${(0, kleur_1.green)(projectName)}
|
|
18
|
+
${(0, kleur_1.dim)(`gdu: v${require((0, path_1.join)(roots_1.GDU_ROOT, './package.json')).version}`)}
|
|
19
19
|
|
|
20
|
-
${kleur_1.dim(terminal_1.columnLoop('-'))}`);
|
|
20
|
+
${(0, kleur_1.dim)((0, terminal_1.columnLoop)('-'))}`);
|
|
21
21
|
};
|
|
22
22
|
exports.banner = banner;
|
package/dist/lib/config.js
CHANGED
|
@@ -5,17 +5,17 @@ const path_1 = require("path");
|
|
|
5
5
|
const diary_1 = require("diary");
|
|
6
6
|
const resolve_1 = require("./resolve");
|
|
7
7
|
const roots_1 = require("./roots");
|
|
8
|
-
const { debug } = diary_1.diary('gdu:config');
|
|
8
|
+
const { debug } = (0, diary_1.diary)('gdu:config');
|
|
9
9
|
const readCache = new Map();
|
|
10
10
|
const getGuruConfig = (location = roots_1.PROJECT_ROOT) => {
|
|
11
|
-
const normalizePath = path_1.join(location, '/');
|
|
12
|
-
const guruFilePath = path_1.join(normalizePath, 'guru.config.js');
|
|
11
|
+
const normalizePath = (0, path_1.join)(location, '/');
|
|
12
|
+
const guruFilePath = (0, path_1.join)(normalizePath, 'guru.config.js');
|
|
13
13
|
try {
|
|
14
14
|
if (readCache.has(normalizePath)) {
|
|
15
15
|
return readCache.get(normalizePath);
|
|
16
16
|
}
|
|
17
17
|
debug('resolving guru config @ %s', normalizePath);
|
|
18
|
-
const config = resolve_1.requireFromCaller(guruFilePath);
|
|
18
|
+
const config = (0, resolve_1.requireFromCaller)(guruFilePath);
|
|
19
19
|
debug('resolved guru config %o', config);
|
|
20
20
|
if (typeof config.type !== 'string') {
|
|
21
21
|
throw new TypeError('Type is required');
|
|
@@ -24,7 +24,7 @@ const getGuruConfig = (location = roots_1.PROJECT_ROOT) => {
|
|
|
24
24
|
...config,
|
|
25
25
|
__configPath: normalizePath,
|
|
26
26
|
};
|
|
27
|
-
const storeThis = exports.decorateConfig(resolvedConfig);
|
|
27
|
+
const storeThis = (0, exports.decorateConfig)(resolvedConfig);
|
|
28
28
|
debug('decorated guru config %o', storeThis);
|
|
29
29
|
readCache.set(normalizePath, storeThis);
|
|
30
30
|
return storeThis;
|
|
@@ -39,18 +39,20 @@ const decorateConfig = (guruConfig) => {
|
|
|
39
39
|
var _a, _b, _c, _d;
|
|
40
40
|
const project_root = guruConfig.__configPath;
|
|
41
41
|
guruConfig.srcPaths =
|
|
42
|
-
((_a = guruConfig.srcPaths) !== null && _a !== void 0 ? _a : Boolean(guruConfig.type === 'ssr'))
|
|
42
|
+
((_a = guruConfig.srcPaths) !== null && _a !== void 0 ? _a : Boolean(guruConfig.type === 'ssr'))
|
|
43
|
+
? ['./pages/', './components/', './scenes/']
|
|
43
44
|
: ['./src/'];
|
|
44
|
-
guruConfig.outputPath =
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
guruConfig.outputPath =
|
|
46
|
+
(_b = guruConfig.outputPath) !== null && _b !== void 0 ? _b : (0, path_1.join)(project_root, guruConfig.type === 'ssr' ? './.next' : './dist');
|
|
47
|
+
if (!(0, path_1.isAbsolute)(guruConfig.outputPath))
|
|
48
|
+
guruConfig.outputPath = (0, path_1.join)(project_root, guruConfig.outputPath);
|
|
47
49
|
guruConfig.publicPath =
|
|
48
50
|
((_c = guruConfig.publicPath) !== null && _c !== void 0 ? _c : '/').replace(/(\/+)$/g, '') + '/';
|
|
49
51
|
guruConfig.isRoot = (_d = guruConfig.isRoot) !== null && _d !== void 0 ? _d : false;
|
|
50
52
|
return guruConfig;
|
|
51
53
|
};
|
|
52
54
|
exports.decorateConfig = decorateConfig;
|
|
53
|
-
const getProjectName = (location = roots_1.PROJECT_ROOT) => require(path_1.join(exports.getGuruConfig(location).__configPath, './package.json')).name;
|
|
55
|
+
const getProjectName = (location = roots_1.PROJECT_ROOT) => require((0, path_1.join)((0, exports.getGuruConfig)(location).__configPath, './package.json')).name;
|
|
54
56
|
exports.getProjectName = getProjectName;
|
|
55
|
-
const getProjectFolderName = (location = roots_1.PROJECT_ROOT) => path_1.basename(path_1.join(exports.getGuruConfig(location).__configPath));
|
|
57
|
+
const getProjectFolderName = (location = roots_1.PROJECT_ROOT) => (0, path_1.basename)((0, path_1.join)((0, exports.getGuruConfig)(location).__configPath));
|
|
56
58
|
exports.getProjectFolderName = getProjectFolderName;
|
package/dist/lib/configure.js
CHANGED
|
@@ -11,12 +11,12 @@ const ts_dedent_1 = __importDefault(require("ts-dedent"));
|
|
|
11
11
|
const config_1 = require("./config");
|
|
12
12
|
const io_1 = require("./io");
|
|
13
13
|
const terminal_1 = require("./terminal");
|
|
14
|
-
const { debug } = diary_1.diary('gdu:configure');
|
|
14
|
+
const { debug } = (0, diary_1.diary)('gdu:configure');
|
|
15
15
|
const WRAP_BANNER = (extra) => `/** THIS FILE IS GENERATED, ALL CHANGES WILL NOT PERSIST **/\n${extra}`;
|
|
16
16
|
exports.WRAP_BANNER = WRAP_BANNER;
|
|
17
17
|
const configure = async (app_location) => {
|
|
18
18
|
debug('attempting a configure @ %s', app_location);
|
|
19
|
-
const guruConfig = config_1.getGuruConfig(app_location);
|
|
19
|
+
const guruConfig = (0, config_1.getGuruConfig)(app_location);
|
|
20
20
|
if (guruConfig.isRoot)
|
|
21
21
|
return;
|
|
22
22
|
const writeFiles = new Map();
|
|
@@ -32,13 +32,13 @@ const configure = async (app_location) => {
|
|
|
32
32
|
if ((guruConfig === null || guruConfig === void 0 ? void 0 : guruConfig.type) === 'ssr') {
|
|
33
33
|
gitIgnorePatterns.push('.next/');
|
|
34
34
|
}
|
|
35
|
-
await ensure_gitignore_1.default({
|
|
36
|
-
filepath: path_1.join(app_location, '.gitignore'),
|
|
35
|
+
await (0, ensure_gitignore_1.default)({
|
|
36
|
+
filepath: (0, path_1.join)(app_location, '.gitignore'),
|
|
37
37
|
comment: 'autoguru-au:gdu managed',
|
|
38
38
|
patterns: [...gitIgnorePatterns, 'tsconfig.json'],
|
|
39
39
|
});
|
|
40
|
-
await ensure_gitignore_1.default({
|
|
41
|
-
filepath: path_1.join(app_location, '.prettierignore'),
|
|
40
|
+
await (0, ensure_gitignore_1.default)({
|
|
41
|
+
filepath: (0, path_1.join)(app_location, '.prettierignore'),
|
|
42
42
|
comment: 'autoguru-au:gdu managed',
|
|
43
43
|
patterns: gitIgnorePatterns,
|
|
44
44
|
});
|
|
@@ -64,13 +64,13 @@ const configure = async (app_location) => {
|
|
|
64
64
|
].filter(Boolean),
|
|
65
65
|
exclude: ['node_modules'],
|
|
66
66
|
};
|
|
67
|
-
writeFiles.set('tsconfig.json', exports.WRAP_BANNER(JSON.stringify(tsConfig, null, 4)));
|
|
68
|
-
writeFiles.set('.browserslistrc', ts_dedent_1.default `
|
|
67
|
+
writeFiles.set('tsconfig.json', (0, exports.WRAP_BANNER)(JSON.stringify(tsConfig, null, 4)));
|
|
68
|
+
writeFiles.set('.browserslistrc', (0, ts_dedent_1.default) `
|
|
69
69
|
# FILE IS MANAGED BY GDU, CHANGES WILL NOT PERSIST.
|
|
70
70
|
|
|
71
71
|
extends browserslist-config-autoguru
|
|
72
72
|
`);
|
|
73
|
-
await io_1.writeFileMap(writeFiles, app_location);
|
|
74
|
-
terminal_1.projectInfo('configured ✅', app_location);
|
|
73
|
+
await (0, io_1.writeFileMap)(writeFiles, app_location);
|
|
74
|
+
(0, terminal_1.projectInfo)('configured ✅', app_location);
|
|
75
75
|
};
|
|
76
76
|
exports.configure = configure;
|
package/dist/lib/format.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.format = void 0;
|
|
7
7
|
const prettier_1 = require("prettier");
|
|
8
8
|
const prettierConfig_1 = __importDefault(require("../config/prettierConfig"));
|
|
9
|
-
const format = (code, parser = 'babel') => prettier_1.format(code, {
|
|
9
|
+
const format = (code, parser = 'babel') => (0, prettier_1.format)(code, {
|
|
10
10
|
...prettierConfig_1.default,
|
|
11
11
|
parser,
|
|
12
12
|
});
|
|
@@ -11,7 +11,7 @@ const js_yaml_1 = require("js-yaml");
|
|
|
11
11
|
const roots_1 = require("./roots");
|
|
12
12
|
const reader = (path) => {
|
|
13
13
|
try {
|
|
14
|
-
return fs_1.readFileSync(path, 'utf8');
|
|
14
|
+
return (0, fs_1.readFileSync)(path, 'utf8');
|
|
15
15
|
}
|
|
16
16
|
catch {
|
|
17
17
|
return '';
|
|
@@ -20,13 +20,13 @@ const reader = (path) => {
|
|
|
20
20
|
function* getConsumerRuntimeConfig() {
|
|
21
21
|
const configFiles = [
|
|
22
22
|
roots_1.CALLING_WORKSPACE_ROOT
|
|
23
|
-
? path_1.join(roots_1.CALLING_WORKSPACE_ROOT, 'config.yml')
|
|
23
|
+
? (0, path_1.join)(roots_1.CALLING_WORKSPACE_ROOT, 'config.yml')
|
|
24
24
|
: null,
|
|
25
|
-
path_1.join(roots_1.PROJECT_ROOT, 'config.yml'),
|
|
25
|
+
(0, path_1.join)(roots_1.PROJECT_ROOT, 'config.yml'),
|
|
26
26
|
].filter(Boolean);
|
|
27
27
|
const configFilesContent = configFiles
|
|
28
28
|
.map((i) => reader(i))
|
|
29
|
-
.flatMap((i) => js_yaml_1.loadAll(i))
|
|
29
|
+
.flatMap((i) => (0, js_yaml_1.loadAll)(i))
|
|
30
30
|
.filter(Boolean);
|
|
31
31
|
const bases = configFilesContent.filter((item) => !item.env);
|
|
32
32
|
const envs = configFilesContent.filter((item) => item.env);
|
package/dist/lib/io.js
CHANGED
|
@@ -10,19 +10,19 @@ const util_1 = require("util");
|
|
|
10
10
|
const diary_1 = require("diary");
|
|
11
11
|
const mkdirp_1 = __importDefault(require("mkdirp"));
|
|
12
12
|
const roots_1 = require("./roots");
|
|
13
|
-
const { debug } = diary_1.diary('gdu:io');
|
|
13
|
+
const { debug } = (0, diary_1.diary)('gdu:io');
|
|
14
14
|
exports.mkdirpAsync = mkdirp_1.default;
|
|
15
|
-
const writeFileAsyncFn = util_1.promisify(fs_1.writeFile);
|
|
15
|
+
const writeFileAsyncFn = (0, util_1.promisify)(fs_1.writeFile);
|
|
16
16
|
const writeFileAsync = async (fileName, body) => {
|
|
17
|
-
await exports.mkdirpAsync(path_1.dirname(fileName));
|
|
17
|
+
await (0, exports.mkdirpAsync)((0, path_1.dirname)(fileName));
|
|
18
18
|
return writeFileAsyncFn(fileName, body);
|
|
19
19
|
};
|
|
20
20
|
exports.writeFileAsync = writeFileAsync;
|
|
21
21
|
const writeFileMap = async (writeFiles, base = '') => {
|
|
22
22
|
for (const [name, body] of writeFiles) {
|
|
23
|
-
const fileName = path_1.join(base, name);
|
|
24
|
-
debug('writing file %s', path_1.relative(roots_1.PROJECT_ROOT, fileName));
|
|
25
|
-
await exports.writeFileAsync(fileName, body);
|
|
23
|
+
const fileName = (0, path_1.join)(base, name);
|
|
24
|
+
debug('writing file %s', (0, path_1.relative)(roots_1.PROJECT_ROOT, fileName));
|
|
25
|
+
await (0, exports.writeFileAsync)(fileName, body);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
exports.writeFileMap = writeFileMap;
|
package/dist/lib/misc.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const wrapAction: (handler: any) => (...args: any[]) => void;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const isProductionBuild: () => boolean;
|
|
3
3
|
export declare const setEnvProd: (which: any) => void;
|
|
4
4
|
export declare const hashString: (str: any) => string;
|
|
5
5
|
export declare const isGithubActions: string | boolean;
|
package/dist/lib/misc.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.isGithubActions = exports.hashString = exports.setEnvProd = exports.
|
|
4
|
+
exports.isGithubActions = exports.hashString = exports.setEnvProd = exports.isProductionBuild = exports.wrapAction = void 0;
|
|
5
5
|
const crypto_1 = require("crypto");
|
|
6
6
|
const kleur_1 = require("kleur");
|
|
7
7
|
const wrapAction = (handler) => (...args) => {
|
|
8
8
|
handler(...args).catch((error) => {
|
|
9
|
-
console.error(kleur_1.red('An error occurred during command running.'));
|
|
9
|
+
console.error((0, kleur_1.red)('An error occurred during command running.'));
|
|
10
10
|
console.error(error);
|
|
11
11
|
process.exit(1);
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
14
|
exports.wrapAction = wrapAction;
|
|
15
15
|
let prodEnv = process.env.NODE_ENV === 'production';
|
|
16
|
-
const
|
|
17
|
-
exports.
|
|
16
|
+
const isProductionBuild = () => prodEnv;
|
|
17
|
+
exports.isProductionBuild = isProductionBuild;
|
|
18
18
|
const setEnvProd = (which) => {
|
|
19
19
|
if (which === true) {
|
|
20
20
|
process.env.NODE_ENV = 'production';
|
|
@@ -24,7 +24,7 @@ const setEnvProd = (which) => {
|
|
|
24
24
|
};
|
|
25
25
|
exports.setEnvProd = setEnvProd;
|
|
26
26
|
const hashString = (str) => {
|
|
27
|
-
const hasher = crypto_1.createHash('sha256');
|
|
27
|
+
const hasher = (0, crypto_1.createHash)('sha256');
|
|
28
28
|
return hasher.update(str).digest('hex');
|
|
29
29
|
};
|
|
30
30
|
exports.hashString = hashString;
|
package/dist/lib/resolve.js
CHANGED
|
@@ -7,6 +7,6 @@ exports.requireFromCaller = exports.resolvePathFromCaller = void 0;
|
|
|
7
7
|
const module_1 = __importDefault(require("module"));
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const roots_1 = require("./roots");
|
|
10
|
-
const resolvePathFromCaller = (file) => path_1.resolve(path_1.join(roots_1.PROJECT_ROOT, file));
|
|
10
|
+
const resolvePathFromCaller = (file) => (0, path_1.resolve)((0, path_1.join)(roots_1.PROJECT_ROOT, file));
|
|
11
11
|
exports.resolvePathFromCaller = resolvePathFromCaller;
|
|
12
|
-
exports.requireFromCaller = module_1.default.createRequire(path_1.join(roots_1.PROJECT_ROOT, 'node_modules'));
|
|
12
|
+
exports.requireFromCaller = module_1.default.createRequire((0, path_1.join)(roots_1.PROJECT_ROOT, 'node_modules'));
|
package/dist/lib/roots.js
CHANGED
|
@@ -7,12 +7,12 @@ exports.CALLING_WORKSPACE_ROOT = exports.PROJECT_ROOT = exports.GDU_ROOT = void
|
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const diary_1 = require("diary");
|
|
9
9
|
const find_yarn_workspace_root_1 = __importDefault(require("find-yarn-workspace-root"));
|
|
10
|
-
const { debug } = diary_1.diary('gdu:roots');
|
|
11
|
-
exports.GDU_ROOT = path_1.join(__dirname, '../../');
|
|
12
|
-
exports.PROJECT_ROOT = path_1.join(process.cwd(), '/');
|
|
13
|
-
const maybeYarnWorkspacesRoot = find_yarn_workspace_root_1.default(exports.PROJECT_ROOT);
|
|
10
|
+
const { debug } = (0, diary_1.diary)('gdu:roots');
|
|
11
|
+
exports.GDU_ROOT = (0, path_1.join)(__dirname, '../../');
|
|
12
|
+
exports.PROJECT_ROOT = (0, path_1.join)(process.cwd(), '/');
|
|
13
|
+
const maybeYarnWorkspacesRoot = (0, find_yarn_workspace_root_1.default)(exports.PROJECT_ROOT);
|
|
14
14
|
exports.CALLING_WORKSPACE_ROOT = maybeYarnWorkspacesRoot
|
|
15
|
-
? path_1.join(maybeYarnWorkspacesRoot, '/')
|
|
15
|
+
? (0, path_1.join)(maybeYarnWorkspacesRoot, '/')
|
|
16
16
|
: null;
|
|
17
17
|
debug('%O', {
|
|
18
18
|
GDU_ROOT: exports.GDU_ROOT,
|
package/dist/lib/runWebpack.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.watch = exports.run = void 0;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
8
|
const kleur_1 = require("kleur");
|
|
9
|
-
const debug = debug_1.default('gdu:webpack:compile');
|
|
9
|
+
const debug = (0, debug_1.default)('gdu:webpack:compile');
|
|
10
10
|
const done = (resolve, reject) => (err, stats) => {
|
|
11
11
|
if (err || stats.hasErrors()) {
|
|
12
12
|
reject(err || stats.toString('errors-only'));
|
|
@@ -14,7 +14,7 @@ const done = (resolve, reject) => (err, stats) => {
|
|
|
14
14
|
}
|
|
15
15
|
if (stats.hasWarnings()) {
|
|
16
16
|
const { warnings } = stats.toJson();
|
|
17
|
-
console.log(kleur_1.yellow(`Compiled with ${warnings.length} warning${warnings.length > 1 ? 's' : ''}.`));
|
|
17
|
+
console.log((0, kleur_1.yellow)(`Compiled with ${warnings.length} warning${warnings.length > 1 ? 's' : ''}.`));
|
|
18
18
|
for (const i of warnings)
|
|
19
19
|
debug(i);
|
|
20
20
|
}
|
package/dist/lib/terminal.js
CHANGED
|
@@ -6,6 +6,6 @@ const config_1 = require("./config");
|
|
|
6
6
|
const columnLoop = (char) => Array.from({ length: process.stdout.columns }).fill('').join(char);
|
|
7
7
|
exports.columnLoop = columnLoop;
|
|
8
8
|
const projectInfo = (message, location) => {
|
|
9
|
-
console.log(`${kleur_1.bold(kleur_1.bgMagenta(` ${config_1.getProjectName(location)} `))} ${message}`);
|
|
9
|
+
console.log(`${(0, kleur_1.bold)((0, kleur_1.bgMagenta)(` ${(0, config_1.getProjectName)(location)} `))} ${message}`);
|
|
10
10
|
};
|
|
11
11
|
exports.projectInfo = projectInfo;
|