gdu 4.1.4 → 4.1.7

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.
@@ -31,9 +31,10 @@ const hosts = ['localhost', localhost];
31
31
  const runSPA = async (guruConfig) => {
32
32
  const hooks = hooks_1.getHooks();
33
33
  console.log(`${kleur_1.cyan('Starting dev server...')}`);
34
+ const appEnv = process.env.APP_ENV || 'dev';
34
35
  const webpackConfig = hooks.webpackConfig
35
36
  .call(webpack_config_1.default())
36
- .find(({ name }) => name === process.env.APP_ENV);
37
+ .find(({ name }) => name === appEnv);
37
38
  const consumerHtmlTemplate = getConsumerHtmlTemplate(guruConfig);
38
39
  webpackConfig.plugins.push(new html_webpack_plugin_1.default({
39
40
  template: consumerHtmlTemplate !== null && consumerHtmlTemplate !== void 0 ? consumerHtmlTemplate : 'auto',
@@ -45,6 +45,7 @@ module.exports = (guruConfig) => {
45
45
  },
46
46
  ],
47
47
  require.resolve('babel-plugin-treat'),
48
+ [require.resolve('./pathNormaliser')],
48
49
  ].filter(Boolean),
49
50
  };
50
51
  };
@@ -146,9 +146,13 @@ const createNextJSConfig = (buildEnv) => {
146
146
  .flatMap((configsDir) => [
147
147
  new dotenv_webpack_1.default({
148
148
  path: path_1.default.resolve(configsDir, '.env.defaults'),
149
+ prefix: 'process.env.',
150
+ ignoreStub: true,
149
151
  }),
150
152
  new dotenv_webpack_1.default({
151
153
  path: path_1.default.resolve(configsDir, `.env.${env}`),
154
+ prefix: 'process.env.',
155
+ ignoreStub: true,
152
156
  }),
153
157
  ])
154
158
  .forEach((plugin) => defaultConfig.plugins.push(plugin));
@@ -0,0 +1,12 @@
1
+ export = PathNormaliserPlugin;
2
+ declare function PathNormaliserPlugin(api: any): {
3
+ name: string;
4
+ visitor: {
5
+ CallExpression: {
6
+ enter: (nodePath: any) => void;
7
+ };
8
+ };
9
+ } | {
10
+ name: string;
11
+ visitor?: undefined;
12
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ const replacer = (filepath) => filepath.replace(/\\/g, '/');
3
+ const PathNormaliserPlugin = function (api) {
4
+ if (process.platform === 'win32') {
5
+ const t = api.types;
6
+ return {
7
+ name: 'path-normaliser',
8
+ visitor: {
9
+ CallExpression: {
10
+ enter: function (nodePath) {
11
+ const callee = nodePath.get('callee');
12
+ if (callee.isIdentifier() &&
13
+ callee.equals('name', 'require')) {
14
+ const arg = nodePath.get('arguments.0');
15
+ if (arg && arg.isStringLiteral()) {
16
+ const sourcePath = arg.node.value;
17
+ const targetPath = replacer(sourcePath);
18
+ if (sourcePath !== targetPath) {
19
+ arg.replaceWith(t.stringLiteral(targetPath));
20
+ }
21
+ }
22
+ }
23
+ },
24
+ },
25
+ },
26
+ };
27
+ }
28
+ return {
29
+ name: 'path-normaliser',
30
+ };
31
+ };
32
+ module.exports = PathNormaliserPlugin;
@@ -282,9 +282,13 @@ const baseOptions = (buildEnv, isMultiEnv) => ({
282
282
  ...configs_1.getConfigsDirs().flatMap((configsDir) => [
283
283
  new dotenv_webpack_1.default({
284
284
  path: path_1.default.resolve(configsDir, '.env.defaults'),
285
+ prefix: 'process.env.',
286
+ ignoreStub: true,
285
287
  }),
286
288
  new dotenv_webpack_1.default({
287
289
  path: path_1.default.resolve(configsDir, `.env.${process.env.APP_ENV || (isDev ? 'dev' : buildEnv)}`),
290
+ prefix: 'process.env.',
291
+ ignoreStub: true,
288
292
  }),
289
293
  ]),
290
294
  !isDev &&
package/gdu.d.ts CHANGED
@@ -20,11 +20,12 @@ declare namespace NodeJS {
20
20
  * Will be set to true when building for a browser
21
21
  */
22
22
  readonly browser: boolean;
23
- }
24
-
25
- interface ProcessEnv {
26
- readonly NODE_ENV: 'development' | 'production';
27
- readonly APP_ENV: 'dev' | 'test' | 'uat' | 'preprod' | 'prod' | string;
23
+ readonly env: {
24
+ APP_ENV: 'dev' | 'test' | 'uat' | 'preprod' | 'prod' | string;
25
+ GITHUB_ACTIONS: string;
26
+ GITHUB_REF: string;
27
+ NODE_ENV: 'development' | 'production';
28
+ };
28
29
  }
29
30
  }
30
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdu",
3
- "version": "4.1.4",
3
+ "version": "4.1.7",
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",
@@ -33,12 +33,12 @@
33
33
  "@babel/runtime-corejs3": "^7.14.9",
34
34
  "@babel/template": "^7.14.5",
35
35
  "@graphql-tools/json-file-loader": "^6.2.6",
36
- "@vanilla-extract/babel-plugin": "^1.1.2",
37
- "@vanilla-extract/css": "^1.6.3",
38
- "@vanilla-extract/next-plugin": "^1.0.1",
39
- "@vanilla-extract/webpack-plugin": "^2.1.0",
36
+ "@vanilla-extract/babel-plugin": "^1.1.6",
37
+ "@vanilla-extract/css": "^1.7.1",
38
+ "@vanilla-extract/next-plugin": "^2.0.2",
39
+ "@vanilla-extract/webpack-plugin": "^2.1.10",
40
40
  "babel-loader": "^8.2.2",
41
- "babel-plugin-relay": "^11.0.2",
41
+ "babel-plugin-relay": "^13.2.0",
42
42
  "babel-plugin-treat": "^1.6.2",
43
43
  "browserslist-config-autoguru": "^2.1.2",
44
44
  "clean-webpack-plugin": "^4.0.0-alpha.0",
@@ -48,7 +48,7 @@
48
48
  "date-fns": "^2.17.0",
49
49
  "deepmerge": "^4.2.2",
50
50
  "diary": "^0.0.12",
51
- "dotenv-webpack": "^7.0.3",
51
+ "dotenv-webpack": "^7.1.0",
52
52
  "ensure-gitignore": "^1.1.2",
53
53
  "env-ci": "^5.0.2",
54
54
  "execa": "^5.0.0",
@@ -65,7 +65,7 @@
65
65
  "kleur": "^4.1.4",
66
66
  "mini-css-extract-plugin": "^2.4.2",
67
67
  "mkdirp": "^1.0.4",
68
- "next": "^12.0.2",
68
+ "next": "^12.1.6",
69
69
  "next-transpile-modules": "^9.0.0",
70
70
  "node-fetch": "^2.6.1",
71
71
  "null-loader": "^4.0.1",