gdu 5.0.4 → 5.0.5
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 +8 -8
- package/dist/commands/configure/index.js +3 -3
- package/dist/commands/format.js +3 -3
- package/dist/commands/generateBrowsers.js +4 -4
- package/dist/commands/gh-actions.js +1 -1
- package/dist/commands/graphqlSchema.js +3 -3
- package/dist/commands/index.js +9 -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 +27 -23
- 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 +8 -7
package/dist/cli.js
CHANGED
|
@@ -8,18 +8,18 @@ const tapable_1 = require("tapable");
|
|
|
8
8
|
const commands_1 = __importDefault(require("./commands"));
|
|
9
9
|
require("./polyfill");
|
|
10
10
|
const hooks_1 = require("./utils/hooks");
|
|
11
|
-
const app = sade_1.default('gdu').option('--debug', 'Enable debug mode');
|
|
12
|
-
commands_1.default(app);
|
|
11
|
+
const app = (0, sade_1.default)('gdu').option('--debug', 'Enable debug mode');
|
|
12
|
+
(0, commands_1.default)(app);
|
|
13
13
|
exports.default = (argv) => {
|
|
14
|
-
hooks_1.registerHooks({
|
|
14
|
+
(0, hooks_1.registerHooks)({
|
|
15
15
|
webpackConfig: new tapable_1.SyncWaterfallHook(['config']),
|
|
16
16
|
babelConfig: new tapable_1.SyncWaterfallHook(['config']),
|
|
17
17
|
});
|
|
18
|
-
hooks_1.registerHooks({
|
|
18
|
+
(0, hooks_1.registerHooks)({
|
|
19
19
|
beforeServer: new tapable_1.AsyncSeriesWaterfallHook(['server']),
|
|
20
20
|
afterServer: new tapable_1.AsyncSeriesWaterfallHook(['server']),
|
|
21
21
|
});
|
|
22
|
-
hooks_1.registerHooks({
|
|
22
|
+
(0, hooks_1.registerHooks)({
|
|
23
23
|
nextJSPrepare: new tapable_1.AsyncSeriesWaterfallHook(['app']),
|
|
24
24
|
nextJSConfig: new tapable_1.SyncWaterfallHook(['config']),
|
|
25
25
|
});
|
|
@@ -9,10 +9,10 @@ const webpack_config_1 = __importDefault(require("../../config/webpack/webpack.c
|
|
|
9
9
|
const runWebpack_1 = require("../../lib/runWebpack");
|
|
10
10
|
const hooks_1 = require("../../utils/hooks");
|
|
11
11
|
const buildSPA = async (guruConfig) => {
|
|
12
|
-
const hooks = hooks_1.getHooks();
|
|
13
|
-
const webpackConfigs = hooks.webpackConfig.call(webpack_config_1.default());
|
|
14
|
-
const compiler = webpack_1.default(webpackConfigs);
|
|
15
|
-
runWebpack_1.run(compiler);
|
|
12
|
+
const hooks = (0, hooks_1.getHooks)();
|
|
13
|
+
const webpackConfigs = hooks.webpackConfig.call((0, webpack_config_1.default)());
|
|
14
|
+
const compiler = (0, webpack_1.default)(webpackConfigs);
|
|
15
|
+
(0, runWebpack_1.run)(compiler);
|
|
16
16
|
return {
|
|
17
17
|
artifactPath: guruConfig.outputPath,
|
|
18
18
|
};
|
|
@@ -9,7 +9,7 @@ const utilities_1 = require("@autoguru/utilities");
|
|
|
9
9
|
const execa_1 = __importDefault(require("execa"));
|
|
10
10
|
const kleur_1 = require("kleur");
|
|
11
11
|
const roots_1 = require("../../lib/roots");
|
|
12
|
-
const logger = utilities_1.createLogger('build');
|
|
12
|
+
const logger = (0, utilities_1.createLogger)('build');
|
|
13
13
|
const buildSSR = async (guruConfig) => {
|
|
14
14
|
const start = Date.now();
|
|
15
15
|
execa_1.default
|
|
@@ -24,7 +24,7 @@ const buildSSR = async (guruConfig) => {
|
|
|
24
24
|
},
|
|
25
25
|
})
|
|
26
26
|
.then((result) => {
|
|
27
|
-
console.log(`${kleur_1.dim('SUCCESS!')}`, `${kleur_1.dim('Listening')}: ${kleur_1.blue(result === null || result === void 0 ? void 0 : result.all)}`);
|
|
27
|
+
console.log(`${(0, kleur_1.dim)('SUCCESS!')}`, `${(0, kleur_1.dim)('Listening')}: ${(0, kleur_1.blue)(result === null || result === void 0 ? void 0 : result.all)}`);
|
|
28
28
|
}, (error) => {
|
|
29
29
|
logger.error('response', {
|
|
30
30
|
processingTime: Date.now() - start,
|
|
@@ -35,7 +35,7 @@ const buildSSR = async (guruConfig) => {
|
|
|
35
35
|
throw error;
|
|
36
36
|
});
|
|
37
37
|
return {
|
|
38
|
-
artifactPath: path_1.join(guruConfig.outputPath, 'BUILD_ID'),
|
|
38
|
+
artifactPath: (0, path_1.join)(guruConfig.outputPath, 'BUILD_ID'),
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
exports.buildSSR = buildSSR;
|
|
@@ -9,21 +9,21 @@ const generateBrowsers_1 = require("../generateBrowsers");
|
|
|
9
9
|
const buildSPA_1 = require("./buildSPA");
|
|
10
10
|
const buildSSR_1 = require("./buildSSR");
|
|
11
11
|
exports.default = async () => {
|
|
12
|
-
misc_1.setEnvProd(true);
|
|
13
|
-
const guruConfig = config_1.getGuruConfig();
|
|
14
|
-
banner_1.banner('Building');
|
|
15
|
-
await generateBrowsers_1.buildSupportedBrowsers();
|
|
12
|
+
(0, misc_1.setEnvProd)(true);
|
|
13
|
+
const guruConfig = (0, config_1.getGuruConfig)();
|
|
14
|
+
(0, banner_1.banner)('Building');
|
|
15
|
+
await (0, generateBrowsers_1.buildSupportedBrowsers)();
|
|
16
16
|
let stats;
|
|
17
17
|
if ((guruConfig === null || guruConfig === void 0 ? void 0 : guruConfig.type) === 'ssr') {
|
|
18
|
-
stats = await buildSSR_1.buildSSR(guruConfig);
|
|
18
|
+
stats = await (0, buildSSR_1.buildSSR)(guruConfig);
|
|
19
19
|
}
|
|
20
20
|
else if ((guruConfig === null || guruConfig === void 0 ? void 0 : guruConfig.type) === 'spa') {
|
|
21
|
-
stats = await buildSPA_1.buildSPA(guruConfig);
|
|
21
|
+
stats = await (0, buildSPA_1.buildSPA)(guruConfig);
|
|
22
22
|
}
|
|
23
23
|
if (typeof stats !== 'undefined') {
|
|
24
|
-
githubOutputs_1.genGithubOutputs({
|
|
24
|
+
(0, githubOutputs_1.genGithubOutputs)({
|
|
25
25
|
artifact_path: stats.artifactPath,
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
terminal_1.projectInfo('Done ✅');
|
|
28
|
+
(0, terminal_1.projectInfo)('Done ✅');
|
|
29
29
|
};
|
|
@@ -4,8 +4,8 @@ const configure_1 = require("../../lib/configure");
|
|
|
4
4
|
const main_1 = require("../../main");
|
|
5
5
|
const hooks_1 = require("../../utils/hooks");
|
|
6
6
|
exports.default = async () => {
|
|
7
|
-
hooks_1.bindHooks();
|
|
8
|
-
for (const app of await main_1.getApps()) {
|
|
9
|
-
await configure_1.configure(app);
|
|
7
|
+
(0, hooks_1.bindHooks)();
|
|
8
|
+
for (const app of await (0, main_1.getApps)()) {
|
|
9
|
+
await (0, configure_1.configure)(app);
|
|
10
10
|
}
|
|
11
11
|
};
|
package/dist/commands/format.js
CHANGED
|
@@ -8,13 +8,13 @@ const kleur_1 = require("kleur");
|
|
|
8
8
|
const resolve_1 = require("../lib/resolve");
|
|
9
9
|
const roots_1 = require("../lib/roots");
|
|
10
10
|
exports.default = (options) => {
|
|
11
|
-
console.log(`${kleur_1.cyan('Formatting with prettier...')}`);
|
|
11
|
+
console.log(`${(0, kleur_1.cyan)('Formatting with prettier...')}`);
|
|
12
12
|
const shouldWrite = options['list-different'] === 'false' && options.write === 'true';
|
|
13
|
-
execa_1.default('prettier', [
|
|
13
|
+
(0, execa_1.default)('prettier', [
|
|
14
14
|
'--config',
|
|
15
15
|
require.resolve('../config/prettierConfig.js'),
|
|
16
16
|
'--ignore-path',
|
|
17
|
-
resolve_1.resolvePathFromCaller('.prettierignore'),
|
|
17
|
+
(0, resolve_1.resolvePathFromCaller)('.prettierignore'),
|
|
18
18
|
shouldWrite ? '--write' : '-l',
|
|
19
19
|
'**/*.+(js|jsx|ts|tsx|css|scss|json|yml|gql|graphql|md|mdx)',
|
|
20
20
|
], {
|
|
@@ -6,13 +6,13 @@ const kleur_1 = require("kleur");
|
|
|
6
6
|
const configure_1 = require("../lib/configure");
|
|
7
7
|
const io_1 = require("../lib/io");
|
|
8
8
|
const buildSupportedBrowsers = async () => {
|
|
9
|
-
console.log(`${kleur_1.green('Building supported browsers list')}`);
|
|
10
|
-
const regExp = browserslist_useragent_regexp_1.getUserAgentRegExp({
|
|
9
|
+
console.log(`${(0, kleur_1.green)('Building supported browsers list')}`);
|
|
10
|
+
const regExp = (0, browserslist_useragent_regexp_1.getUserAgentRegExp)({
|
|
11
11
|
allowHigherVersions: true,
|
|
12
12
|
});
|
|
13
|
-
await io_1.writeFileAsync('browsers.ts', configure_1.WRAP_BANNER(`export const AGSupportedBrowsers = ${regExp}`));
|
|
13
|
+
await (0, io_1.writeFileAsync)('browsers.ts', (0, configure_1.WRAP_BANNER)(`export const AGSupportedBrowsers = ${regExp}`));
|
|
14
14
|
};
|
|
15
15
|
exports.buildSupportedBrowsers = buildSupportedBrowsers;
|
|
16
16
|
exports.default = async () => {
|
|
17
|
-
await exports.buildSupportedBrowsers();
|
|
17
|
+
await (0, exports.buildSupportedBrowsers)();
|
|
18
18
|
};
|
|
@@ -4,7 +4,7 @@ const date_fns_1 = require("date-fns");
|
|
|
4
4
|
exports.default = () => {
|
|
5
5
|
const envOutput = {
|
|
6
6
|
safe_branch_name: getBranchName(),
|
|
7
|
-
versioned_release_name: `${date_fns_1.format(new Date(), 'yyyy.MM.dd-HHmmss')}+${getBranchName()}`,
|
|
7
|
+
versioned_release_name: `${(0, date_fns_1.format)(new Date(), 'yyyy.MM.dd-HHmmss')}+${getBranchName()}`,
|
|
8
8
|
};
|
|
9
9
|
Object.entries(envOutput).forEach(([key, value]) => console.log(`::set-env name=gdu__${key}::${value}`));
|
|
10
10
|
};
|
|
@@ -11,7 +11,7 @@ const normalise = (patterns, rawSchema) => Array.isArray(patterns) && typeof raw
|
|
|
11
11
|
? patterns.reduce((schema, normaliser) => schema.replace(new RegExp(normaliser.pattern, normaliser.flags), normaliser.replacer), rawSchema)
|
|
12
12
|
: rawSchema;
|
|
13
13
|
exports.default = async (options) => {
|
|
14
|
-
const graphQLConfig = await graphql_config_1.loadConfig({
|
|
14
|
+
const graphQLConfig = await (0, graphql_config_1.loadConfig)({
|
|
15
15
|
rootDir: roots_1.CALLING_WORKSPACE_ROOT,
|
|
16
16
|
});
|
|
17
17
|
const config = graphQLConfig.getDefault();
|
|
@@ -19,12 +19,12 @@ exports.default = async (options) => {
|
|
|
19
19
|
if (typeof endpointConfig === 'undefined') {
|
|
20
20
|
throw new TypeError(`Endpoint ${options.endpoint} doesnt exist`);
|
|
21
21
|
}
|
|
22
|
-
const response = await node_fetch_1.default(endpointConfig.url, {
|
|
22
|
+
const response = await (0, node_fetch_1.default)(endpointConfig.url, {
|
|
23
23
|
method: endpointConfig.method,
|
|
24
24
|
headers: endpointConfig.headers,
|
|
25
25
|
});
|
|
26
26
|
if ((response === null || response === void 0 ? void 0 : response.ok) || (response === null || response === void 0 ? void 0 : response.body)) {
|
|
27
|
-
await io_1.writeFileAsync(config.schema, normalise(endpointConfig.schemaNormaliserPatterns, await response.text()));
|
|
27
|
+
await (0, io_1.writeFileAsync)(config.schema, normalise(endpointConfig.schemaNormaliserPatterns, await response.text()));
|
|
28
28
|
}
|
|
29
29
|
console.log('~> Schema has been checked, and is ready to use! ✅️');
|
|
30
30
|
};
|
package/dist/commands/index.js
CHANGED
|
@@ -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];
|
|
@@ -22,13 +26,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
22
26
|
const config_1 = require("../lib/config");
|
|
23
27
|
const misc_1 = require("../lib/misc");
|
|
24
28
|
const hooks_1 = require("../utils/hooks");
|
|
25
|
-
const deferredAction = (importee, shouldRun) => misc_1.wrapAction((...args) => {
|
|
29
|
+
const deferredAction = (importee, shouldRun) => (0, misc_1.wrapAction)((...args) => {
|
|
26
30
|
if (typeof shouldRun === 'function') {
|
|
27
|
-
const guruConfig = config_1.getGuruConfig();
|
|
31
|
+
const guruConfig = (0, config_1.getGuruConfig)();
|
|
28
32
|
if (shouldRun(guruConfig) === false)
|
|
29
33
|
throw new Error('Sorry this command is not supported');
|
|
30
34
|
}
|
|
31
|
-
hooks_1.bindHooks();
|
|
35
|
+
(0, hooks_1.bindHooks)();
|
|
32
36
|
return importee().then((item) => {
|
|
33
37
|
return item.default(...args);
|
|
34
38
|
});
|
|
@@ -69,7 +73,7 @@ exports.default = (app) => {
|
|
|
69
73
|
.describe('A command to create GitHub actions things')
|
|
70
74
|
.action(deferredAction(async () => Promise.resolve().then(() => __importStar(require('./gh-actions')))));
|
|
71
75
|
};
|
|
72
|
-
const NOT_READY = misc_1.wrapAction(() => {
|
|
76
|
+
const NOT_READY = (0, misc_1.wrapAction)(() => {
|
|
73
77
|
throw new Error('No ready yet');
|
|
74
78
|
});
|
|
75
79
|
const IS_NOT_ROOT = (config) => {
|
|
@@ -12,7 +12,7 @@ const banner_1 = require("../lib/banner");
|
|
|
12
12
|
const configure_1 = require("../lib/configure");
|
|
13
13
|
const io_1 = require("../lib/io");
|
|
14
14
|
const roots_1 = require("../lib/roots");
|
|
15
|
-
const { debug } = diary_1.diary('gdu:commands:scaffold');
|
|
15
|
+
const { debug } = (0, diary_1.diary)('gdu:commands:scaffold');
|
|
16
16
|
const availableTypes = ['ssr', 'spa'];
|
|
17
17
|
const validateOptions = ({ type }) => {
|
|
18
18
|
if (!availableTypes.includes(type)) {
|
|
@@ -20,15 +20,15 @@ const validateOptions = ({ type }) => {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
const ensureAppFolder = async (app_name) => {
|
|
23
|
-
const appFolder = path_1.join(roots_1.PROJECT_ROOT, `apps/${app_name}/`);
|
|
23
|
+
const appFolder = (0, path_1.join)(roots_1.PROJECT_ROOT, `apps/${app_name}/`);
|
|
24
24
|
debug('scaffolding into %s', appFolder);
|
|
25
|
-
if (fs_1.existsSync(appFolder))
|
|
25
|
+
if ((0, fs_1.existsSync)(appFolder))
|
|
26
26
|
throw new Error(`Target app ${appFolder} already exists!`);
|
|
27
|
-
await io_1.mkdirpAsync(appFolder);
|
|
27
|
+
await (0, io_1.mkdirpAsync)(appFolder);
|
|
28
28
|
return appFolder;
|
|
29
29
|
};
|
|
30
30
|
const baseAppScaff = async (options, outputFiles) => {
|
|
31
|
-
const configFile = ts_dedent_1.default `module.exports = {
|
|
31
|
+
const configFile = (0, ts_dedent_1.default) `module.exports = {
|
|
32
32
|
type: ${options.type === 'ssr' ? "'ssr'" : "'spa'"},
|
|
33
33
|
};`;
|
|
34
34
|
outputFiles.set('guru.config.js', configFile);
|
|
@@ -62,18 +62,18 @@ exports.default = async (type, app_name) => {
|
|
|
62
62
|
const options = { type, app_name };
|
|
63
63
|
debug('running action with %O', options);
|
|
64
64
|
validateOptions(options);
|
|
65
|
-
banner_1.banner('Creating', `@autoguru/${app_name}`);
|
|
65
|
+
(0, banner_1.banner)('Creating', `@autoguru/${app_name}`);
|
|
66
66
|
const outputPath = await (options.type === 'spa'
|
|
67
67
|
? genSPA(options)
|
|
68
68
|
: genSSR(options));
|
|
69
|
-
await configure_1.configure(outputPath);
|
|
70
|
-
console.log(kleur_1.green('Done!'));
|
|
69
|
+
await (0, configure_1.configure)(outputPath);
|
|
70
|
+
console.log((0, kleur_1.green)('Done!'));
|
|
71
71
|
};
|
|
72
72
|
const genSPA = async (options) => {
|
|
73
73
|
const appFolder = await ensureAppFolder(options.app_name);
|
|
74
74
|
const writeFiles = new Map();
|
|
75
75
|
await baseAppScaff(options, writeFiles);
|
|
76
|
-
writeFiles.set('src/App/index.tsx', ts_dedent_1.default `import * as React from 'react';
|
|
76
|
+
writeFiles.set('src/App/index.tsx', (0, ts_dedent_1.default) `import * as React from 'react';
|
|
77
77
|
import '@autoguru/overdrive/reset';
|
|
78
78
|
|
|
79
79
|
import { baseTheme } from '@autoguru/overdrive/themes';
|
|
@@ -86,29 +86,29 @@ const genSPA = async (options) => {
|
|
|
86
86
|
</OverdriveProvider>
|
|
87
87
|
);
|
|
88
88
|
`);
|
|
89
|
-
writeFiles.set('src/scenes/index.tsx', ts_dedent_1.default `import * as React from 'react';
|
|
89
|
+
writeFiles.set('src/scenes/index.tsx', (0, ts_dedent_1.default) `import * as React from 'react';
|
|
90
90
|
import { Heading } from '@autoguru/overdrive';
|
|
91
91
|
|
|
92
92
|
export default () => <Heading is="h1">Welcome to your new SPA application!</Heading>
|
|
93
93
|
`);
|
|
94
|
-
writeFiles.set('src/client.tsx', ts_dedent_1.default `import * as React from 'react';
|
|
94
|
+
writeFiles.set('src/client.tsx', (0, ts_dedent_1.default) `import * as React from 'react';
|
|
95
95
|
import { render } from 'react-dom';
|
|
96
96
|
import App from './App';
|
|
97
97
|
|
|
98
98
|
export default () => void render(<App />, document.getElementById('app'));
|
|
99
99
|
`);
|
|
100
|
-
await io_1.writeFileMap(writeFiles, appFolder);
|
|
100
|
+
await (0, io_1.writeFileMap)(writeFiles, appFolder);
|
|
101
101
|
return appFolder;
|
|
102
102
|
};
|
|
103
103
|
const genSSR = async (options) => {
|
|
104
104
|
const appFolder = await ensureAppFolder(options.app_name);
|
|
105
105
|
const writeFiles = new Map();
|
|
106
106
|
await baseAppScaff(options, writeFiles);
|
|
107
|
-
writeFiles.set('pages/index.tsx', ts_dedent_1.default `
|
|
107
|
+
writeFiles.set('pages/index.tsx', (0, ts_dedent_1.default) `
|
|
108
108
|
import React from 'react';
|
|
109
109
|
import { Heading } from '@autoguru/overdrive';
|
|
110
110
|
|
|
111
111
|
export default () => <Heading is="h1">Welcome to your new SSR application!</Heading>;`);
|
|
112
|
-
await io_1.writeFileMap(writeFiles, appFolder);
|
|
112
|
+
await (0, io_1.writeFileMap)(writeFiles, appFolder);
|
|
113
113
|
return appFolder;
|
|
114
114
|
};
|
|
@@ -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];
|
|
@@ -25,14 +29,14 @@ const config_1 = require("../../lib/config");
|
|
|
25
29
|
const misc_1 = require("../../lib/misc");
|
|
26
30
|
const roots_1 = require("../../lib/roots");
|
|
27
31
|
const generateBrowsers_1 = require("../generateBrowsers");
|
|
28
|
-
const { debug } = diary_1.diary('gdu:commands:start');
|
|
32
|
+
const { debug } = (0, diary_1.diary)('gdu:commands:start');
|
|
29
33
|
exports.default = async ({ port: incomingPort }) => {
|
|
30
34
|
debug('running action with %O', { port: incomingPort });
|
|
31
|
-
const { port = incomingPort, ...otherConfig } = config_1.getGuruConfig(roots_1.PROJECT_ROOT) || {};
|
|
35
|
+
const { port = incomingPort, ...otherConfig } = (0, config_1.getGuruConfig)(roots_1.PROJECT_ROOT) || {};
|
|
32
36
|
const resolvedConfig = { port, ...otherConfig };
|
|
33
|
-
await generateBrowsers_1.buildSupportedBrowsers();
|
|
34
|
-
if (!misc_1.
|
|
35
|
-
banner_1.banner('Starting');
|
|
37
|
+
await (0, generateBrowsers_1.buildSupportedBrowsers)();
|
|
38
|
+
if (!(0, misc_1.isProductionBuild)())
|
|
39
|
+
(0, banner_1.banner)('Starting');
|
|
36
40
|
if ((resolvedConfig === null || resolvedConfig === void 0 ? void 0 : resolvedConfig.type) === 'ssr') {
|
|
37
41
|
const runSSR = await Promise.resolve().then(() => __importStar(require('./runSSR')));
|
|
38
42
|
await runSSR.runNextJS(resolvedConfig);
|
|
@@ -17,8 +17,8 @@ const roots_1 = require("../../lib/roots");
|
|
|
17
17
|
const hooks_1 = require("../../utils/hooks");
|
|
18
18
|
const getConsumerHtmlTemplate = (guruConfig) => {
|
|
19
19
|
try {
|
|
20
|
-
const filePath = path_1.join(guruConfig.__configPath, '/template.html');
|
|
21
|
-
if (fs_1.existsSync(filePath)) {
|
|
20
|
+
const filePath = (0, path_1.join)(guruConfig.__configPath, '/template.html');
|
|
21
|
+
if ((0, fs_1.existsSync)(filePath)) {
|
|
22
22
|
return filePath;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -29,11 +29,11 @@ const getConsumerHtmlTemplate = (guruConfig) => {
|
|
|
29
29
|
const localhost = '0.0.0.0';
|
|
30
30
|
const hosts = ['localhost', localhost];
|
|
31
31
|
const runSPA = async (guruConfig) => {
|
|
32
|
-
const hooks = hooks_1.getHooks();
|
|
33
|
-
console.log(`${kleur_1.cyan('Starting dev server...')}`);
|
|
32
|
+
const hooks = (0, hooks_1.getHooks)();
|
|
33
|
+
console.log(`${(0, kleur_1.cyan)('Starting dev server...')}`);
|
|
34
34
|
const appEnv = process.env.APP_ENV || 'dev';
|
|
35
35
|
const webpackConfig = hooks.webpackConfig
|
|
36
|
-
.call(webpack_config_1.default())
|
|
36
|
+
.call((0, webpack_config_1.default)())
|
|
37
37
|
.find(({ name }) => name === appEnv);
|
|
38
38
|
const consumerHtmlTemplate = getConsumerHtmlTemplate(guruConfig);
|
|
39
39
|
webpackConfig.plugins.push(new html_webpack_plugin_1.default({
|
|
@@ -73,26 +73,26 @@ const runSPA = async (guruConfig) => {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
})());
|
|
76
|
-
const compiler = webpack_1.default(webpackConfig);
|
|
76
|
+
const compiler = (0, webpack_1.default)(webpackConfig);
|
|
77
77
|
let beenReadyBefore = false;
|
|
78
78
|
compiler.hooks.done.tap('runner', () => {
|
|
79
79
|
if (!beenReadyBefore) {
|
|
80
|
-
console.log(ts_dedent_1.default `
|
|
80
|
+
console.log((0, ts_dedent_1.default) `
|
|
81
81
|
|
|
82
|
-
You can now view ${kleur_1.bold(config_1.getProjectName())} in the browser.
|
|
82
|
+
You can now view ${(0, kleur_1.bold)((0, config_1.getProjectName)())} in the browser.
|
|
83
83
|
|
|
84
|
-
Local: ${kleur_1.blue(`http://${hosts[0]}:${guruConfig.port}/`)}
|
|
85
|
-
On Your Network: ${kleur_1.blue(`http://${require('ip').address()}:${guruConfig.port}/`)}
|
|
84
|
+
Local: ${(0, kleur_1.blue)(`http://${hosts[0]}:${guruConfig.port}/`)}
|
|
85
|
+
On Your Network: ${(0, kleur_1.blue)(`http://${require('ip').address()}:${guruConfig.port}/`)}
|
|
86
86
|
|
|
87
87
|
Note that the development build is not optimized.
|
|
88
|
-
To create a production build, use ${kleur_1.cyan('yarn build')}.
|
|
88
|
+
To create a production build, use ${(0, kleur_1.cyan)('yarn build')}.
|
|
89
89
|
|
|
90
90
|
`);
|
|
91
91
|
beenReadyBefore = true;
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
const devServer = new webpack_dev_server_1.default(compiler, {
|
|
95
|
-
static: path_1.join(roots_1.PROJECT_ROOT, 'public'),
|
|
95
|
+
static: (0, path_1.join)(roots_1.PROJECT_ROOT, 'public'),
|
|
96
96
|
host: hosts[0],
|
|
97
97
|
allowedHosts: hosts,
|
|
98
98
|
historyApiFallback: true,
|
|
@@ -100,7 +100,7 @@ const runSPA = async (guruConfig) => {
|
|
|
100
100
|
});
|
|
101
101
|
devServer.listen(guruConfig.port, localhost, (err) => {
|
|
102
102
|
if (err) {
|
|
103
|
-
console.log(kleur_1.red(err));
|
|
103
|
+
console.log((0, kleur_1.red)(err.message));
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
};
|
|
@@ -5,13 +5,13 @@ const diary_1 = require("diary");
|
|
|
5
5
|
const kleur_1 = require("kleur");
|
|
6
6
|
const server_1 = require("../../config/ssr/server");
|
|
7
7
|
const misc_1 = require("../../lib/misc");
|
|
8
|
-
const { debug } = diary_1.diary('gdu:commands:start:ssr');
|
|
8
|
+
const { debug } = (0, diary_1.diary)('gdu:commands:start:ssr');
|
|
9
9
|
const runNextJS = async (guruConfig) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const port = (_a = guruConfig.port) !== null && _a !== void 0 ? _a : 8080;
|
|
12
12
|
debug('next start %o', { port });
|
|
13
|
-
if (!misc_1.
|
|
14
|
-
console.log(`${kleur_1.cyan('Starting dev server...')}`);
|
|
15
|
-
await server_1.run(port);
|
|
13
|
+
if (!(0, misc_1.isProductionBuild)())
|
|
14
|
+
console.log(`${(0, kleur_1.cyan)('Starting dev server...')}`);
|
|
15
|
+
await (0, server_1.run)(port);
|
|
16
16
|
};
|
|
17
17
|
exports.runNextJS = runNextJS;
|
|
@@ -14,14 +14,13 @@ export declare const createNextJSConfig: (buildEnv: any) => {
|
|
|
14
14
|
distDir: string;
|
|
15
15
|
reactStrictMode: boolean;
|
|
16
16
|
swcMinify: boolean;
|
|
17
|
+
poweredByHeader: boolean;
|
|
17
18
|
assetPrefix: string;
|
|
18
19
|
i18n: {
|
|
19
20
|
locales: string[];
|
|
20
21
|
defaultLocale: string;
|
|
21
22
|
};
|
|
22
23
|
typescript: {
|
|
23
|
-
transpileOnly: boolean;
|
|
24
|
-
ignoreDevErrors: boolean;
|
|
25
24
|
ignoreBuildErrors: boolean;
|
|
26
25
|
};
|
|
27
26
|
images: {
|
|
@@ -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],
|
|
@@ -100,11 +104,11 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
100
104
|
extensions: ['.tsx', '.ts', '.mjs', '.jsx', '.js', '.json'],
|
|
101
105
|
plugins: [
|
|
102
106
|
new tsconfig_paths_webpack_plugin_1.TsconfigPathsPlugin({
|
|
103
|
-
configFile: path_1.join(roots_1.PROJECT_ROOT, 'tsconfig.json'),
|
|
107
|
+
configFile: (0, path_1.join)(roots_1.PROJECT_ROOT, 'tsconfig.json'),
|
|
104
108
|
}),
|
|
105
109
|
],
|
|
106
110
|
alias: {
|
|
107
|
-
__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'),
|
|
108
112
|
},
|
|
109
113
|
},
|
|
110
114
|
optimization: {
|
|
@@ -213,7 +217,7 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
213
217
|
envName: isDev
|
|
214
218
|
? 'development'
|
|
215
219
|
: 'production',
|
|
216
|
-
...hooks.babelConfig.call(require('../babel.config')(config_1.getGuruConfig())),
|
|
220
|
+
...hooks.babelConfig.call(require('../babel.config')((0, config_1.getGuruConfig)())),
|
|
217
221
|
},
|
|
218
222
|
},
|
|
219
223
|
],
|
|
@@ -265,7 +269,7 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
265
269
|
'process.browser': JSON.stringify(true),
|
|
266
270
|
'process.env.NODE_ENV': JSON.stringify(isDev ? 'development' : 'production'),
|
|
267
271
|
__DEV__: JSON.stringify(isDev),
|
|
268
|
-
__GDU_APP_NAME__: JSON.stringify(config_1.getProjectName()),
|
|
272
|
+
__GDU_APP_NAME__: JSON.stringify((0, config_1.getProjectName)()),
|
|
269
273
|
__GDU_BUILD_INFO__: JSON.stringify({
|
|
270
274
|
commit,
|
|
271
275
|
branch,
|
|
@@ -274,7 +278,7 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
274
278
|
new webpack_plugin_2.TreatPlugin({
|
|
275
279
|
outputLoaders: [
|
|
276
280
|
{
|
|
277
|
-
loader: misc_1.
|
|
281
|
+
loader: (0, misc_1.isProductionBuild)()
|
|
278
282
|
? mini_css_extract_plugin_1.default.loader
|
|
279
283
|
: require.resolve('style-loader'),
|
|
280
284
|
},
|
|
@@ -288,7 +292,7 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
288
292
|
chunkFilename: `chunks/${fileMask}.css`,
|
|
289
293
|
ignoreOrder: true,
|
|
290
294
|
}),
|
|
291
|
-
...configs_1.getConfigsDirs().flatMap((configsDir) => [
|
|
295
|
+
...(0, configs_1.getConfigsDirs)().flatMap((configsDir) => [
|
|
292
296
|
new dotenv_webpack_1.default({
|
|
293
297
|
path: path_1.default.resolve(configsDir, '.env.defaults'),
|
|
294
298
|
prefix: 'process.env.',
|
|
@@ -303,13 +307,13 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
|
|
|
303
307
|
!isDev &&
|
|
304
308
|
new GuruBuildManifest_1.GuruBuildManifest({
|
|
305
309
|
outputDir: !isMultiEnv && buildEnv === 'prod'
|
|
306
|
-
? path_1.resolve(roots_1.PROJECT_ROOT, 'dist')
|
|
307
|
-
: 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),
|
|
308
312
|
includeChunks: false,
|
|
309
313
|
}),
|
|
310
314
|
].filter(Boolean),
|
|
311
315
|
});
|
|
312
|
-
const { outputPath } = config_1.getGuruConfig();
|
|
316
|
+
const { outputPath } = (0, config_1.getGuruConfig)();
|
|
313
317
|
const makeWebpackConfig = (buildEnv, isMultiEnv) => ({
|
|
314
318
|
name: buildEnv,
|
|
315
319
|
output: {
|
|
@@ -317,8 +321,8 @@ const makeWebpackConfig = (buildEnv, isMultiEnv) => ({
|
|
|
317
321
|
publicPath: isDev
|
|
318
322
|
? '/'
|
|
319
323
|
: buildEnv === 'prod'
|
|
320
|
-
? `#{PUBLIC_PATH_BASE}/${config_1.getProjectFolderName()}/`
|
|
321
|
-
: `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)()}/`,
|
|
322
326
|
filename: `${fileMask}.js`,
|
|
323
327
|
chunkFilename: `chunks/${fileMask}.js`,
|
|
324
328
|
hashFunction: 'sha256',
|
|
@@ -328,7 +332,7 @@ const makeWebpackConfig = (buildEnv, isMultiEnv) => ({
|
|
|
328
332
|
},
|
|
329
333
|
});
|
|
330
334
|
const buildConfigs = () => {
|
|
331
|
-
const buildEnvs = configs_1.getBuildEnvs();
|
|
335
|
+
const buildEnvs = (0, configs_1.getBuildEnvs)();
|
|
332
336
|
return buildEnvs.map((buildEnv) => ({
|
|
333
337
|
...baseOptions(buildEnv, buildEnvs.length > 1),
|
|
334
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;
|
package/dist/main.js
CHANGED
|
@@ -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];
|
package/dist/utils/hooks.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.bindHooks = exports.getHooks = exports.registerHooks = void 0;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
8
|
const config_1 = require("../lib/config");
|
|
9
|
-
const debug = debug_1.default('gdu:hooks');
|
|
9
|
+
const debug = (0, debug_1.default)('gdu:hooks');
|
|
10
10
|
const HOOKS = {};
|
|
11
11
|
const registerHooks = (hooks) => {
|
|
12
12
|
debug('registering hooks %o', Object.keys(hooks));
|
|
@@ -17,10 +17,10 @@ exports.registerHooks = registerHooks;
|
|
|
17
17
|
const getHooks = () => HOOKS;
|
|
18
18
|
exports.getHooks = getHooks;
|
|
19
19
|
const bindHooks = () => {
|
|
20
|
-
const cfg = config_1.getGuruConfig();
|
|
20
|
+
const cfg = (0, config_1.getGuruConfig)();
|
|
21
21
|
if (typeof (cfg === null || cfg === void 0 ? void 0 : cfg.tap) === 'function') {
|
|
22
22
|
debug('running hooks');
|
|
23
|
-
cfg.tap(exports.getHooks());
|
|
23
|
+
cfg.tap((0, exports.getHooks)());
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
exports.bindHooks = bindHooks;
|
package/gdu.d.ts
CHANGED
|
@@ -21,7 +21,14 @@ declare namespace NodeJS {
|
|
|
21
21
|
*/
|
|
22
22
|
readonly browser: boolean;
|
|
23
23
|
readonly env: {
|
|
24
|
-
APP_ENV:
|
|
24
|
+
APP_ENV:
|
|
25
|
+
| 'dev'
|
|
26
|
+
| 'test'
|
|
27
|
+
| 'uat'
|
|
28
|
+
| 'preprod'
|
|
29
|
+
| 'prod'
|
|
30
|
+
| 'dockerprod'
|
|
31
|
+
| string;
|
|
25
32
|
GITHUB_ACTIONS: string;
|
|
26
33
|
GITHUB_REF: string;
|
|
27
34
|
NODE_ENV: 'development' | 'production';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdu",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
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",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@autoguru/babel-preset": "^1.2.0",
|
|
29
29
|
"@autoguru/tsconfig": "1.0.79",
|
|
30
|
-
"@autoguru/utilities": "^1.1.
|
|
30
|
+
"@autoguru/utilities": "^1.1.1",
|
|
31
31
|
"@babel/helper-plugin-utils": "^7.14.5",
|
|
32
32
|
"@babel/preset-typescript": "^7.15.0",
|
|
33
33
|
"@babel/runtime-corejs3": "^7.14.9",
|
|
@@ -79,15 +79,16 @@
|
|
|
79
79
|
"tapable": "^2.2.0",
|
|
80
80
|
"terser-webpack-plugin": "^5.1.4",
|
|
81
81
|
"treat": "2.0.4",
|
|
82
|
-
"ts-dedent": "^2.
|
|
83
|
-
"tsconfig-paths-webpack-plugin": "^3.5.
|
|
82
|
+
"ts-dedent": "^2.2.0",
|
|
83
|
+
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
84
84
|
"url-loader": "^4.1.1",
|
|
85
|
-
"webpack": "^5.
|
|
86
|
-
"webpack-dev-server": "^4.
|
|
85
|
+
"webpack": "^5.74.0",
|
|
86
|
+
"webpack-dev-server": "^4.9.3",
|
|
87
87
|
"whatwg-fetch": "^3.6.2"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@babel/core": "^7.15.0",
|
|
91
|
+
"@next/eslint-plugin-next": "^12.2.3",
|
|
91
92
|
"@types/babel-types": "^7.0.10",
|
|
92
93
|
"@types/glob": "^7.1.4",
|
|
93
94
|
"@types/node": "^16.4.13",
|
|
@@ -96,7 +97,7 @@
|
|
|
96
97
|
"@types/webpack": "^5.28.0",
|
|
97
98
|
"babel-plugin-macros": "^3.1.0",
|
|
98
99
|
"browserslist-config-autoguru": "*",
|
|
99
|
-
"typescript": "4.
|
|
100
|
+
"typescript": "^4.4.3"
|
|
100
101
|
},
|
|
101
102
|
"peerDependencies": {
|
|
102
103
|
"@types/node": ">=10",
|