@abcnews/aunty 12.0.3 → 12.1.2
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": "12.
|
|
3
|
+
"version": "12.1.2",
|
|
4
4
|
"description": "A toolkit for working with ABC News projects",
|
|
5
5
|
"repository": "abcnews/aunty",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"babel-core": "^7.0.0-bridge.0",
|
|
40
40
|
"babel-jest": "^26.1.0",
|
|
41
41
|
"babel-loader": "^8.2.2",
|
|
42
|
-
"chalk": "^4.1.
|
|
42
|
+
"chalk": "^4.1.2",
|
|
43
43
|
"cli-select": "^1.1.0",
|
|
44
44
|
"copy-webpack-plugin": "^8.1.1",
|
|
45
45
|
"css-loader": "^5.2.1",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"execa": "^5.0.0",
|
|
50
50
|
"file-loader": "^6.2.0",
|
|
51
51
|
"fork-ts-checker-webpack-plugin": "^6.2.1",
|
|
52
|
-
"ftp-deploy": "^2.3.
|
|
52
|
+
"ftp-deploy": "^2.3.8",
|
|
53
53
|
"get-all-paths": "^1.0.1",
|
|
54
54
|
"guess-root-path": "^1.0.0",
|
|
55
55
|
"html-loader": "^2.1.2",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"node-fetch": "^2.6.0",
|
|
67
67
|
"ora": "^5.0.0",
|
|
68
68
|
"pify": "^5.0.0",
|
|
69
|
-
"postcss": "^8.
|
|
70
|
-
"postcss-loader": "^
|
|
69
|
+
"postcss": "^8.3.6",
|
|
70
|
+
"postcss-loader": "^6.1.1",
|
|
71
71
|
"prettier": "^2.0.5",
|
|
72
72
|
"requireg": "^0.2.2",
|
|
73
73
|
"rsyncwrapper": "^3.0.1",
|
|
@@ -83,14 +83,14 @@
|
|
|
83
83
|
"update-notifier": "^5.1.0",
|
|
84
84
|
"url-loader": "^4.1.1",
|
|
85
85
|
"webpack": "^5.33.2",
|
|
86
|
-
"webpack-bundle-analyzer": "^4.
|
|
87
|
-
"webpack-dev-server": "^
|
|
86
|
+
"webpack-bundle-analyzer": "^4.5.0",
|
|
87
|
+
"webpack-dev-server": "^4.6.0",
|
|
88
88
|
"write-json-file": "^4.2.0",
|
|
89
89
|
"yeoman-environment": "^3.2.0",
|
|
90
90
|
"yeoman-generator": "^5.2.0"
|
|
91
91
|
},
|
|
92
92
|
"optionalDependencies": {
|
|
93
|
-
"@abcaustralia/postcss-config": "^
|
|
93
|
+
"@abcaustralia/postcss-config": "^11.2.5"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"eslint": "^7.7.0",
|
|
@@ -3,15 +3,20 @@ const { cmd, hvy, opt, sec } = require('../../utils/color');
|
|
|
3
3
|
|
|
4
4
|
const BUNDLE_ANALYZER_CONFIG = (module.exports.BUNDLE_ANALYZER_CONFIG = {
|
|
5
5
|
analyzerHost: '127.0.0.1',
|
|
6
|
-
logLevel: '
|
|
6
|
+
logLevel: 'error',
|
|
7
7
|
openAnalyzer: false
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
module.exports.MESSAGES = {
|
|
11
11
|
analysis: ({ analyzerHost, analyzerPort }) => `http://${analyzerHost}:${analyzerPort}`,
|
|
12
|
-
serve: ({ hot,
|
|
12
|
+
serve: ({ bundleAnalysisPath, hot, publicPath }) => `Serve (${hvy(process.env.NODE_ENV)}):${
|
|
13
|
+
bundleAnalysisPath
|
|
14
|
+
? `
|
|
15
|
+
┣ ${hvy('bundle analysis')}: ${bundleAnalysisPath}`
|
|
16
|
+
: ''
|
|
17
|
+
}
|
|
13
18
|
┣ ${hvy('hot')}: ${cmd(hot ? 'yes' : 'no')}
|
|
14
|
-
┗ ${hvy('
|
|
19
|
+
┗ ${hvy('publicPath')}: ${publicPath}`,
|
|
15
20
|
// TODO: Add aunty config section to usage
|
|
16
21
|
usage: name => `Usage: ${cmd(`aunty ${name}`)} ${opt('[options]')}
|
|
17
22
|
|
package/src/cli/serve/index.js
CHANGED
|
@@ -23,69 +23,74 @@ module.exports = command(
|
|
|
23
23
|
usage: MESSAGES.usage
|
|
24
24
|
},
|
|
25
25
|
async argv => {
|
|
26
|
-
const { port } = getServeConfig();
|
|
26
|
+
const { hasBundleAnalysis, port } = getServeConfig();
|
|
27
27
|
const webpackConfig = getWebpackConfig();
|
|
28
28
|
const webpackDevServerConfig = getWebpackDevServerConfig();
|
|
29
|
-
const { hot,
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const { hot, devMiddleware } = webpackDevServerConfig;
|
|
30
|
+
const { publicPath } = devMiddleware;
|
|
31
|
+
const bundleAnalyzerConfig = hasBundleAnalysis
|
|
32
|
+
? combine(BUNDLE_ANALYZER_CONFIG, {
|
|
33
|
+
analyzerPort: +port + Math.floor(port / 1000) * 100 // e.g. 8000 -> 8800
|
|
34
|
+
})
|
|
35
|
+
: null;
|
|
33
36
|
|
|
34
37
|
webpackConfig.forEach((config, index) => {
|
|
35
38
|
config.output.publicPath = publicPath;
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
config.infrastructureLogging = {
|
|
41
|
+
level: 'warn'
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
if (bundleAnalyzerConfig) {
|
|
45
|
+
config.plugins.push(
|
|
46
|
+
new BundleAnalyzerPlugin(
|
|
47
|
+
combine(bundleAnalyzerConfig, {
|
|
48
|
+
analyzerPort: bundleAnalyzerConfig.analyzerPort + index * 10 // e.g. 8800, 8810...
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
);
|
|
40
52
|
}
|
|
41
|
-
|
|
42
|
-
config.plugins.push(
|
|
43
|
-
new BundleAnalyzerPlugin(
|
|
44
|
-
combine(bundleAnalyzerConfig, {
|
|
45
|
-
analyzerPort: bundleAnalyzerConfig.analyzerPort + index * 10 // e.g. 8800, 8810...
|
|
46
|
-
})
|
|
47
|
-
)
|
|
48
|
-
);
|
|
49
53
|
});
|
|
50
54
|
|
|
51
55
|
if (argv.dry) {
|
|
52
56
|
return dry({
|
|
53
57
|
'Webpack config': webpackConfig,
|
|
54
58
|
'WebpackDevServer config': webpackDevServerConfig,
|
|
55
|
-
|
|
59
|
+
...(bundleAnalyzerConfig
|
|
60
|
+
? {
|
|
61
|
+
'BundleAnalyzerPlugin config': bundleAnalyzerConfig
|
|
62
|
+
}
|
|
63
|
+
: {})
|
|
56
64
|
});
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
throws(await cleanCommand(['--quiet']));
|
|
60
68
|
|
|
61
|
-
info(
|
|
69
|
+
info(
|
|
70
|
+
MESSAGES.serve({
|
|
71
|
+
bundleAnalysisPath: bundleAnalyzerConfig ? MESSAGES.analysis(bundleAnalyzerConfig) : null,
|
|
72
|
+
hot,
|
|
73
|
+
publicPath
|
|
74
|
+
})
|
|
75
|
+
);
|
|
62
76
|
|
|
63
77
|
const compiler = webpack(webpackConfig);
|
|
64
|
-
const server = new WebpackDevServer(
|
|
65
|
-
|
|
66
|
-
// Grab reference to native info logger
|
|
67
|
-
const _info = console.info;
|
|
68
|
-
let spinner;
|
|
78
|
+
const server = new WebpackDevServer(webpackDevServerConfig, compiler);
|
|
79
|
+
const [gracefullyInterrupt, restore] = gracefullyHandleLogging();
|
|
69
80
|
|
|
70
81
|
return new Promise((resolve, reject) => {
|
|
71
|
-
server.
|
|
82
|
+
server.startCallback(err => {
|
|
72
83
|
if (err) {
|
|
73
84
|
return reject(err);
|
|
74
85
|
}
|
|
75
86
|
|
|
76
|
-
// Start spinner
|
|
77
87
|
spinner = spin('Server running');
|
|
78
|
-
|
|
79
|
-
// Gracefully interrupt spinner to log info
|
|
80
|
-
console.info = msg => {
|
|
81
|
-
spinner.clear();
|
|
82
|
-
_info(msg);
|
|
83
|
-
spinner.start();
|
|
84
|
-
};
|
|
88
|
+
gracefullyInterrupt(spinner);
|
|
85
89
|
});
|
|
86
90
|
|
|
87
|
-
process.on('SIGINT',
|
|
88
|
-
|
|
91
|
+
process.on('SIGINT', () => {
|
|
92
|
+
spinner.clear();
|
|
93
|
+
server.stopCallback(() => {
|
|
89
94
|
if (spinner) {
|
|
90
95
|
spinner.succeed('Server closed');
|
|
91
96
|
}
|
|
@@ -93,28 +98,32 @@ module.exports = command(
|
|
|
93
98
|
resolve();
|
|
94
99
|
});
|
|
95
100
|
});
|
|
96
|
-
}).finally(() =>
|
|
97
|
-
// Always restore native info logger
|
|
98
|
-
console.info = _info;
|
|
99
|
-
});
|
|
101
|
+
}).finally(() => restore());
|
|
100
102
|
}
|
|
101
103
|
);
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
require.resolve('webpack/hot/dev-server')
|
|
107
|
-
];
|
|
105
|
+
const gracefullyHandleLogging = () => {
|
|
106
|
+
const METHODS = ['debug', 'error', 'info', 'log', 'warn'];
|
|
107
|
+
const reference = {};
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
for (let method of METHODS) {
|
|
110
|
+
reference[method] = console[method];
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
113
|
+
return [
|
|
114
|
+
spinner => {
|
|
115
|
+
for (let method of METHODS) {
|
|
116
|
+
console[method] = (...args) => {
|
|
117
|
+
spinner.clear();
|
|
118
|
+
reference[method](...args);
|
|
119
|
+
spinner.start();
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
() => {
|
|
124
|
+
for (let method of METHODS) {
|
|
125
|
+
console[method] = reference[method];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
};
|
package/src/config/serve.js
CHANGED
|
@@ -16,11 +16,7 @@ const SERVER_CERT_FILENAME = (module.exports.SERVER_CERT_FILENAME = 'server.crt'
|
|
|
16
16
|
const SERVER_KEY_FILENAME = (module.exports.SERVER_KEY_FILENAME = 'server.key');
|
|
17
17
|
const INTERNAL_SUFFIX = '.aus.aunty.abc.net.au';
|
|
18
18
|
const DEFAULT_HOST = (module.exports.DEFAULT_HOST = probe(`nucwed${INTERNAL_SUFFIX}`)
|
|
19
|
-
? `${
|
|
20
|
-
hostname()
|
|
21
|
-
.toLowerCase()
|
|
22
|
-
.split('.')[0]
|
|
23
|
-
}${INTERNAL_SUFFIX}` // hostname _may_ include INTERNAL_SUFFIX
|
|
19
|
+
? `${hostname().toLowerCase().split('.')[0]}${INTERNAL_SUFFIX}` // hostname _may_ include INTERNAL_SUFFIX
|
|
24
20
|
: 'localhost');
|
|
25
21
|
const DEFAULT_PORT = 8000;
|
|
26
22
|
|
|
@@ -29,6 +25,7 @@ module.exports.getServeConfig = () => {
|
|
|
29
25
|
|
|
30
26
|
return combine(
|
|
31
27
|
{
|
|
28
|
+
hasBundleAnalysis: false,
|
|
32
29
|
host: DEFAULT_HOST,
|
|
33
30
|
hot: process.env.NODE_ENV === 'development',
|
|
34
31
|
https: true,
|
|
@@ -14,20 +14,30 @@ module.exports.getWebpackDevServerConfig = () => {
|
|
|
14
14
|
|
|
15
15
|
return combine(
|
|
16
16
|
{
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
allowedHosts: 'all',
|
|
18
|
+
client: {
|
|
19
|
+
logging: 'warn',
|
|
20
|
+
overlay: true
|
|
21
|
+
},
|
|
22
|
+
devMiddleware: {
|
|
23
|
+
publicPath: `http${https ? 's' : ''}://${host}:${port}/`
|
|
24
|
+
},
|
|
19
25
|
headers: {
|
|
20
26
|
'Access-Control-Allow-Origin': '*'
|
|
21
27
|
},
|
|
22
|
-
host,
|
|
28
|
+
host: '0.0.0.0',
|
|
23
29
|
hot,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
port,
|
|
31
|
+
server: https
|
|
32
|
+
? typeof https === 'object'
|
|
33
|
+
? {
|
|
34
|
+
type: 'https',
|
|
35
|
+
options: https
|
|
36
|
+
}
|
|
37
|
+
: 'https'
|
|
38
|
+
: 'http',
|
|
39
|
+
static: {
|
|
40
|
+
directory: join(root, staticDir)
|
|
31
41
|
}
|
|
32
42
|
},
|
|
33
43
|
projectWebpackDevServerConfig
|
|
@@ -27,7 +27,7 @@ if (module.hot) {
|
|
|
27
27
|
renderApp();
|
|
28
28
|
} catch (err) {
|
|
29
29
|
import('./components/ErrorBox').then(({ default: ErrorBox }) => {
|
|
30
|
-
render(new ErrorBox({ error: err }).el, appMountEl);
|
|
30
|
+
render(new ErrorBox({ error: err<% if (isTS) { %> as Error<% } %> }).el, appMountEl);
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
});
|