@abcnews/aunty 13.2.1 → 14.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abcnews/aunty",
3
- "version": "13.2.1",
3
+ "version": "14.0.0",
4
4
  "description": "A toolkit for working with ABC News projects",
5
5
  "repository": "abcnews/aunty",
6
6
  "license": "MIT",
@@ -70,8 +70,6 @@
70
70
  "node-fetch": "^2.6.0",
71
71
  "ora": "^5.0.0",
72
72
  "pify": "^5.0.0",
73
- "postcss": "^8.3.6",
74
- "postcss-loader": "^6.1.1",
75
73
  "prettier": "^2.0.5",
76
74
  "requireg": "^0.2.2",
77
75
  "rsyncwrapper": "^3.0.1",
@@ -92,9 +90,6 @@
92
90
  "yeoman-environment": "^3.2.0",
93
91
  "yeoman-generator": "^5.2.0"
94
92
  },
95
- "optionalDependencies": {
96
- "@abcaustralia/postcss-config": "^11.2.5"
97
- },
98
93
  "devDependencies": {
99
94
  "babel-eslint": "^10.1.0",
100
95
  "eslint": "^7.7.0",
@@ -4,7 +4,6 @@ const { join, resolve } = require('path');
4
4
 
5
5
  // External
6
6
  const importLazy = require('import-lazy')(require);
7
- const getContext = importLazy('@abcaustralia/postcss-config/getContext'); // optional dependency
8
7
  const CopyPlugin = importLazy('copy-webpack-plugin');
9
8
  const Dotenv = importLazy('dotenv-webpack');
10
9
  const ForkTsCheckerWebpackPlugin = importLazy('fork-ts-checker-webpack-plugin');
@@ -147,6 +146,8 @@ function createWebpackConfig({ isModernJS } = {}) {
147
146
  const { pkg, root, hasTS, type, webpack: projectWebpackConfig } = getProjectConfig();
148
147
  const { entry, extractCSS, from, includedDependencies, staticDir, to, useCSSModules } = getBuildConfig();
149
148
  const isProd = process.env.NODE_ENV === 'production';
149
+ const hasEnvFile = existsSync(join(root, '.env'));
150
+ const hasEnvExampleFile = existsSync(join(root, '.env.example'));
150
151
 
151
152
  const config = merge(
152
153
  {
@@ -232,9 +233,11 @@ function createWebpackConfig({ isModernJS } = {}) {
232
233
  },
233
234
  plugins: [
234
235
  new EnvironmentPlugin(Object.keys(process.env)),
235
- new Dotenv({
236
- safe: true
237
- }),
236
+ hasEnvFile || hasEnvExampleFile
237
+ ? new Dotenv({
238
+ safe: hasEnvExampleFile
239
+ })
240
+ : null,
238
241
  hasTS
239
242
  ? new ForkTsCheckerWebpackPlugin({
240
243
  logger: { infrastructure: 'silent', issues: 'silent' },
@@ -261,7 +264,6 @@ function createWebpackConfig({ isModernJS } = {}) {
261
264
  moduleIds: isProd ? 'deterministic' : 'named'
262
265
  }
263
266
  },
264
- conditionallyEnableABCAustraliaStyles,
265
267
  PROJECT_TYPES_CONFIG[type],
266
268
  projectWebpackConfig
267
269
  );
@@ -283,74 +285,3 @@ function createWebpackConfig({ isModernJS } = {}) {
283
285
  function getHintedRule(config, hint) {
284
286
  return config.module.rules.find(rule => rule.__hint__ === hint);
285
287
  }
286
-
287
- const ABC_POSTCSS_CONTEXT_SUGGESTION = `
288
-
289
- To compile @abcaustralia/* styles, you need to add the following to your package.json:
290
-
291
- "abc": {
292
- "css": {
293
- "libraryDir": "./node_modules/@abcaustralia/nucleus/css",
294
- "logVariables": "false"
295
- }
296
- }
297
- `;
298
-
299
- function getABCAustraliaPostCSSContext(isDev) {
300
- try {
301
- return getContext(isDev);
302
- } catch (err) {
303
- if (err.message.indexOf('css') > -1) {
304
- err.message += ABC_POSTCSS_CONTEXT_SUGGESTION;
305
- }
306
-
307
- throw err;
308
- }
309
- }
310
-
311
- const ABC_PACKAGE_PATTERN = /(node_modules\/@abcaustralia\/*)/;
312
-
313
- function conditionallyEnableABCAustraliaStyles(config) {
314
- const { pkg } = getProjectConfig();
315
-
316
- // Only enable if we have an @abcaustralia/* dependency
317
- if (!Object.keys(pkg.dependencies || {}).find(x => x.indexOf('@abcaustralia/') === 0)) {
318
- return config;
319
- }
320
-
321
- const isProd = config.mode === 'production';
322
- const stylesRule = getHintedRule(config, 'styles');
323
-
324
- stylesRule.exclude = ABC_PACKAGE_PATTERN;
325
-
326
- config.module.rules.push({
327
- __hint__: 'styles/@abcaustralia',
328
- test: /\.css$/,
329
- include: ABC_PACKAGE_PATTERN,
330
- use: [
331
- stylesRule.use[0],
332
- {
333
- loader: require.resolve('css-loader'),
334
- options: {
335
- importLoaders: 1,
336
- modules: {
337
- exportLocalsConvention: 'camelCase',
338
- localIdentName: `${isProd ? '' : '[name]__[local]--'}[contenthash:base64:5]`
339
- },
340
- url: false
341
- }
342
- },
343
- {
344
- loader: require.resolve('postcss-loader'),
345
- options: {
346
- postcssOptions: {
347
- config: require.resolve('@abcaustralia/postcss-config'),
348
- ...getABCAustraliaPostCSSContext(!isProd)
349
- }
350
- }
351
- }
352
- ]
353
- });
354
-
355
- return config;
356
- }
@@ -17,7 +17,8 @@ module.exports.getWebpackDevServerConfig = async () => {
17
17
  allowedHosts: 'all',
18
18
  client: {
19
19
  logging: 'warn',
20
- overlay: true
20
+ overlay: true,
21
+ webSocketURL: `ws${https ? 's' : ''}://${host}:${port}/ws`
21
22
  },
22
23
  devMiddleware: {
23
24
  publicPath: `http${https ? 's' : ''}://${host}:${port}/`
@@ -14,11 +14,5 @@
14
14
  "start": "aunty serve",
15
15
  "dev": "aunty serve",
16
16
  "test": "aunty test"
17
- }<% if (projectType === "react") { %>,
18
- "abc": {
19
- "css": {
20
- "libraryDir": "./node_modules/@abcaustralia/nucleus/css",
21
- "logVariables": "false"
22
- }
23
- }<% } %>
17
+ }
24
18
  }
@@ -27,7 +27,7 @@ if (module.hot) {
27
27
  module.hot.accept('./components/App', () => {
28
28
  try {
29
29
  renderApp();
30
- } catch (err) {
30
+ } catch (err: any) {
31
31
  import('./components/ErrorBox').then(({ default: ErrorBox }) => {
32
32
  root.render(<ErrorBox error={err} />);
33
33
  });