@abcnews/aunty 16.0.1 → 17.0.0-next.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.
Files changed (104) hide show
  1. package/README.md +1 -160
  2. package/package.json +39 -82
  3. package/src/bin/aunty.ts +60 -0
  4. package/assets/done.mp3 +0 -0
  5. package/scripts/postinstall.js +0 -44
  6. package/src/api/index.js +0 -5
  7. package/src/bin/aunty.js +0 -27
  8. package/src/cli/build/constants.js +0 -46
  9. package/src/cli/build/index.js +0 -100
  10. package/src/cli/clean/constants.js +0 -10
  11. package/src/cli/clean/index.js +0 -40
  12. package/src/cli/constants.js +0 -114
  13. package/src/cli/deploy/constants.js +0 -40
  14. package/src/cli/deploy/index.js +0 -151
  15. package/src/cli/generate/constants.js +0 -39
  16. package/src/cli/generate/index.js +0 -72
  17. package/src/cli/index.js +0 -154
  18. package/src/cli/release/constants.js +0 -67
  19. package/src/cli/release/index.js +0 -162
  20. package/src/cli/serve/constants.js +0 -33
  21. package/src/cli/serve/index.js +0 -128
  22. package/src/cli/sign-cert/constants.js +0 -42
  23. package/src/cli/sign-cert/index.js +0 -50
  24. package/src/cli/test/constants.js +0 -15
  25. package/src/cli/test/index.js +0 -30
  26. package/src/config/babel.js +0 -75
  27. package/src/config/build.js +0 -39
  28. package/src/config/deploy.js +0 -143
  29. package/src/config/jest/index.js +0 -20
  30. package/src/config/jest/transformer-default.js +0 -27
  31. package/src/config/jest/transformer-svelte-preprocess.js +0 -8
  32. package/src/config/jest/transformer-svelte.js +0 -32
  33. package/src/config/project.js +0 -57
  34. package/src/config/serve.js +0 -144
  35. package/src/config/webpack.js +0 -325
  36. package/src/config/webpackDevServer.js +0 -46
  37. package/src/constants.js +0 -7
  38. package/src/generators/component/index.js +0 -172
  39. package/src/generators/component/templates/_non_sfc/styles.scss +0 -6
  40. package/src/generators/component/templates/basic/component-with-d3.test.ts +0 -7
  41. package/src/generators/component/templates/basic/component-with-d3.ts +0 -30
  42. package/src/generators/component/templates/basic/component.test.ts +0 -7
  43. package/src/generators/component/templates/basic/component.ts +0 -11
  44. package/src/generators/component/templates/preact/component-with-d3.test.tsx +0 -16
  45. package/src/generators/component/templates/preact/component-with-d3.tsx +0 -45
  46. package/src/generators/component/templates/preact/component.test.tsx +0 -18
  47. package/src/generators/component/templates/preact/component.tsx +0 -14
  48. package/src/generators/component/templates/react/component-with-d3.test.tsx +0 -13
  49. package/src/generators/component/templates/react/component-with-d3.tsx +0 -44
  50. package/src/generators/component/templates/react/component.test.tsx +0 -13
  51. package/src/generators/component/templates/react/component.tsx +0 -14
  52. package/src/generators/component/templates/svelte/component-with-d3.svelte +0 -46
  53. package/src/generators/component/templates/svelte/component-with-d3.test.ts +0 -10
  54. package/src/generators/component/templates/svelte/component.svelte +0 -17
  55. package/src/generators/component/templates/svelte/component.test.ts +0 -10
  56. package/src/generators/project/index.js +0 -244
  57. package/src/generators/project/templates/_common/.editorconfig +0 -12
  58. package/src/generators/project/templates/_common/.prettierrc +0 -6
  59. package/src/generators/project/templates/_common/LICENSE +0 -21
  60. package/src/generators/project/templates/_common/README.md +0 -3
  61. package/src/generators/project/templates/_common/_.gitignore +0 -12
  62. package/src/generators/project/templates/_common/package.json +0 -18
  63. package/src/generators/project/templates/_common/public/index.html +0 -21
  64. package/src/generators/project/templates/_common/src/components/Worm/worm.svg +0 -4
  65. package/src/generators/project/templates/_common/tsconfig.json +0 -4
  66. package/src/generators/project/templates/_non_sfc/src/components/App/styles.scss +0 -23
  67. package/src/generators/project/templates/_non_sfc/src/components/ErrorBox/styles.scss +0 -16
  68. package/src/generators/project/templates/_non_sfc/src/components/Worm/styles.scss +0 -4
  69. package/src/generators/project/templates/basic/src/components/App/index.test.ts +0 -9
  70. package/src/generators/project/templates/basic/src/components/App/index.ts +0 -22
  71. package/src/generators/project/templates/basic/src/components/ErrorBox/index.ts +0 -24
  72. package/src/generators/project/templates/basic/src/components/Worm/index.test.ts +0 -7
  73. package/src/generators/project/templates/basic/src/components/Worm/index.ts +0 -12
  74. package/src/generators/project/templates/basic/src/index.ts +0 -50
  75. package/src/generators/project/templates/preact/src/components/App/index.test.tsx +0 -21
  76. package/src/generators/project/templates/preact/src/components/App/index.tsx +0 -21
  77. package/src/generators/project/templates/preact/src/components/ErrorBox/index.tsx +0 -15
  78. package/src/generators/project/templates/preact/src/components/Worm/index.test.tsx +0 -14
  79. package/src/generators/project/templates/preact/src/components/Worm/index.tsx +0 -9
  80. package/src/generators/project/templates/preact/src/index.tsx +0 -42
  81. package/src/generators/project/templates/react/src/components/App/index.test.tsx +0 -14
  82. package/src/generators/project/templates/react/src/components/App/index.tsx +0 -21
  83. package/src/generators/project/templates/react/src/components/ErrorBox/index.tsx +0 -14
  84. package/src/generators/project/templates/react/src/components/Worm/index.test.tsx +0 -13
  85. package/src/generators/project/templates/react/src/components/Worm/index.tsx +0 -9
  86. package/src/generators/project/templates/react/src/index.tsx +0 -40
  87. package/src/generators/project/templates/svelte/src/components/App/App.svelte +0 -37
  88. package/src/generators/project/templates/svelte/src/components/App/App.test.ts +0 -18
  89. package/src/generators/project/templates/svelte/src/components/Worm/Worm.svelte +0 -12
  90. package/src/generators/project/templates/svelte/src/components/Worm/Worm.test.ts +0 -16
  91. package/src/generators/project/templates/svelte/src/index.ts +0 -26
  92. package/src/utils/async.js +0 -13
  93. package/src/utils/audio.js +0 -30
  94. package/src/utils/branding.js +0 -57
  95. package/src/utils/color.js +0 -12
  96. package/src/utils/ftp.js +0 -80
  97. package/src/utils/git.js +0 -127
  98. package/src/utils/logging.js +0 -74
  99. package/src/utils/npm.js +0 -59
  100. package/src/utils/remote.js +0 -81
  101. package/src/utils/structures.js +0 -33
  102. package/src/utils/text.js +0 -64
  103. package/ts/config.json +0 -22
  104. package/ts/custom.d.ts +0 -120
@@ -1,162 +0,0 @@
1
- // Native
2
- const { existsSync } = require('fs');
3
- const { join } = require('path');
4
-
5
- // External
6
- const importLazy = require('import-lazy')(require);
7
- const cliSelect = importLazy('cli-select');
8
- const loadJsonFile = importLazy('load-json-file');
9
- const semver = importLazy('semver');
10
- const writeJsonFile = importLazy('write-json-file');
11
-
12
- // Ours
13
- const { getProjectConfig } = require('../../config/project');
14
- const { throws } = require('../../utils/async');
15
- const { dim, opt } = require('../../utils/color');
16
- const {
17
- commitAll,
18
- createTag,
19
- getChangelog,
20
- getCurrentLabel,
21
- getDefaultBranch,
22
- getRemotes,
23
- getSemverTags,
24
- hasChanges,
25
- isRepo,
26
- push,
27
- pushTag
28
- } = require('../../utils/git');
29
- const { dry, log, spin } = require('../../utils/logging');
30
- const { combine } = require('../../utils/structures');
31
- const { command } = require('../');
32
- const buildCommand = require('../build');
33
- const deployCommand = require('../deploy');
34
- const { MESSAGES, OPTIONS, VALID_BUMPS } = require('./constants');
35
-
36
- module.exports = command(
37
- {
38
- name: 'release',
39
- options: OPTIONS,
40
- usage: MESSAGES.usage
41
- },
42
- async argv => {
43
- const { pkg, root } = getProjectConfig();
44
-
45
- // 1) Ensure the project is a git repo and determine remotes
46
-
47
- if (!(await isRepo())) {
48
- throw MESSAGES.notRepo;
49
- }
50
-
51
- const remotes = await getRemotes();
52
- const remote = argv['git-remote'];
53
-
54
- // 2) Ensure the default branch is checked out (skippable)
55
-
56
- const label = await getCurrentLabel();
57
- const defaultBranch = await getDefaultBranch(remote);
58
-
59
- if (!argv.force && label !== defaultBranch) {
60
- throw MESSAGES.notDefaultBranch(label, defaultBranch);
61
- }
62
-
63
- // 3) Ensure the project no un-committed changes (skippable)
64
-
65
- if (!argv.force && (await hasChanges())) {
66
- throw MESSAGES.hasChanges;
67
- }
68
-
69
- // 4) Determine the release version
70
-
71
- if (argv.bump && !VALID_BUMPS.has(argv.bump)) {
72
- throw MESSAGES.invalidBump(argv.bump);
73
- }
74
-
75
- const pkgVersion = pkg.version;
76
- const isPrerelease = semver.prerelease(pkgVersion);
77
- let bump = !argv.force && VALID_BUMPS.has(argv.bump) && argv.bump;
78
-
79
- if (!argv.force && !isPrerelease && !bump) {
80
- log(MESSAGES.changes(pkgVersion, await getSemverTags(), await getChangelog(pkgVersion)));
81
- log(MESSAGES.bumpQuestion(argv.dry));
82
-
83
- const bumpSelection = (
84
- await cliSelect({
85
- defaultValue: 0,
86
- selected: opt('❯'),
87
- unselected: ' ',
88
- values: [...VALID_BUMPS].reverse().map(bump => ({
89
- bump,
90
- label: `${bump.replace(/^\w/, c => c.toUpperCase())} (${semver.inc(pkgVersion, bump)})`
91
- })),
92
- valueRenderer: ({ label }, selected) => (selected ? opt(label) : label)
93
- })
94
- ).value;
95
- bump = bumpSelection.bump;
96
- log(`${dim(bumpSelection.label)}\n`);
97
- }
98
-
99
- const version =
100
- (isPrerelease || bump) && semver.valid(pkgVersion)
101
- ? isPrerelease
102
- ? pkgVersion.split('-')[0]
103
- : semver.inc(pkgVersion, bump)
104
- : pkgVersion;
105
-
106
- if (argv.dry) {
107
- return dry({
108
- Release: {
109
- bump,
110
- version,
111
- 'git-remote': remote
112
- }
113
- });
114
- }
115
-
116
- // 5) Build with the new version to ensure there are no errors
117
-
118
- throws(await buildCommand(['--id', version]));
119
-
120
- // 6) Bump the project's version number (optional, skippable)
121
-
122
- let spinner;
123
-
124
- if (!argv.force && version !== pkgVersion) {
125
- spinner = spin(MESSAGES.createCommit(pkgVersion, version));
126
- updateJsonFile(join(root, 'package.json'), { version });
127
- updateJsonFile(join(root, 'package-lock.json'), { version });
128
- await commitAll(version);
129
- spinner.succeed();
130
-
131
- if (remotes.has(remote)) {
132
- spinner = spin(MESSAGES.pushCommit(remote));
133
- await push();
134
- spinner.succeed();
135
- }
136
- }
137
-
138
- // 7) Tag a new release (skippable)
139
-
140
- if (!argv.force) {
141
- spinner = spin(MESSAGES.createTag(version));
142
- await createTag(version);
143
- spinner.succeed();
144
-
145
- if (remotes.has(remote)) {
146
- spinner = spin(MESSAGES.pushTag(version, remote));
147
- await pushTag(remote, version);
148
- spinner.succeed();
149
- }
150
- }
151
-
152
- // 8) Deploy
153
-
154
- throws(await deployCommand());
155
- }
156
- );
157
-
158
- const updateJsonFile = (path, source) => {
159
- if (existsSync(path)) {
160
- writeJsonFile.sync(path, combine(loadJsonFile.sync(path), source));
161
- }
162
- };
@@ -1,33 +0,0 @@
1
- // Ours
2
- const { cmd, hvy, opt, sec } = require('../../utils/color');
3
-
4
- module.exports.BUNDLE_ANALYZER_CONFIG = {
5
- analyzerHost: '127.0.0.1',
6
- logLevel: 'error',
7
- openAnalyzer: false
8
- };
9
-
10
- module.exports.MESSAGES = {
11
- port: ({ port, errorType }) => `Port ${port} could not be used (${errorType}). Attempting to use port ${port + 1}`,
12
- analysis: ({ analyzerHost, analyzerPort }) => `http://${analyzerHost}:${analyzerPort}`,
13
- serve: ({ bundleAnalysisPath, hot, publicPath }) => `Serve (${hvy(process.env.NODE_ENV)}):${
14
- bundleAnalysisPath
15
- ? `
16
- ┣ ${hvy('bundle analysis')}: ${bundleAnalysisPath}`
17
- : ''
18
- }
19
- ┣ ${hvy('hot')}: ${cmd(hot ? 'yes' : 'no')}
20
- ┗ ${hvy('publicPath')}: ${publicPath}`,
21
- // TODO: Add aunty config section to usage
22
- usage: name => `Usage: ${cmd(`aunty ${name}`)} ${opt('[options]')}
23
-
24
- ${sec('Options')}
25
-
26
- ${opt('-d')}, ${opt('--dry')} Output the generated webpack & dev server configuration, then exit
27
-
28
- ${sec('Environment variables')}
29
-
30
- • Builds will assume you have set ${cmd('NODE_ENV=development')}, unless you specify otherwise.
31
- • You can override the host and port the server listens on by setting ${cmd('AUNTY_HOST')} and ${cmd('AUNTY_PORT')}.
32
- `
33
- };
@@ -1,128 +0,0 @@
1
- // External
2
- const importLazy = require('import-lazy')(require);
3
- const webpack = importLazy('webpack');
4
- const WebpackDevServer = importLazy('webpack-dev-server');
5
- const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
6
-
7
- // Ours
8
- const { getServeConfig } = require('../../config/serve');
9
- const { getWebpackConfig } = require('../../config/webpack');
10
- const { getWebpackDevServerConfig } = require('../../config/webpackDevServer');
11
- const { throws } = require('../../utils/async');
12
- const { dry, info, spin } = require('../../utils/logging');
13
- const { combine } = require('../../utils/structures');
14
- const { command } = require('../');
15
- const cleanCommand = require('../clean');
16
- const { BUNDLE_ANALYZER_CONFIG, MESSAGES } = require('./constants');
17
-
18
- module.exports = command(
19
- {
20
- name: 'serve',
21
- nodeEnv: 'development',
22
- usage: MESSAGES.usage
23
- },
24
- async argv => {
25
- const { hasBundleAnalysis, port } = await getServeConfig();
26
- const webpackConfig = getWebpackConfig();
27
- const webpackDevServerConfig = await getWebpackDevServerConfig();
28
- const { hot, devMiddleware } = webpackDevServerConfig;
29
- const { publicPath } = devMiddleware;
30
- const bundleAnalyzerConfig = hasBundleAnalysis
31
- ? combine(BUNDLE_ANALYZER_CONFIG, {
32
- analyzerPort: +port + Math.floor(port / 1000) * 100 // e.g. 8000 -> 8800
33
- })
34
- : null;
35
-
36
- webpackConfig.forEach((config, index) => {
37
- config.output.publicPath = publicPath;
38
-
39
- config.infrastructureLogging = {
40
- level: 'warn'
41
- };
42
-
43
- if (bundleAnalyzerConfig) {
44
- config.plugins.push(
45
- new BundleAnalyzerPlugin(
46
- combine(bundleAnalyzerConfig, {
47
- analyzerPort: bundleAnalyzerConfig.analyzerPort + index * 10 // e.g. 8800, 8810...
48
- })
49
- )
50
- );
51
- }
52
- });
53
-
54
- if (argv.dry) {
55
- return dry({
56
- 'Webpack config': webpackConfig,
57
- 'WebpackDevServer config': webpackDevServerConfig,
58
- ...(bundleAnalyzerConfig
59
- ? {
60
- 'BundleAnalyzerPlugin config': bundleAnalyzerConfig
61
- }
62
- : {})
63
- });
64
- }
65
-
66
- throws(await cleanCommand(['--quiet']));
67
-
68
- info(
69
- MESSAGES.serve({
70
- bundleAnalysisPath: bundleAnalyzerConfig ? MESSAGES.analysis(bundleAnalyzerConfig) : null,
71
- hot,
72
- publicPath
73
- })
74
- );
75
-
76
- const compiler = webpack(webpackConfig);
77
- const server = new WebpackDevServer(webpackDevServerConfig, compiler);
78
- const [gracefullyInterrupt, restore] = gracefullyHandleLogging();
79
-
80
- return new Promise((resolve, reject) => {
81
- server.startCallback(err => {
82
- if (err) {
83
- return reject(err);
84
- }
85
-
86
- spinner = spin('Server running');
87
- gracefullyInterrupt(spinner);
88
- });
89
-
90
- process.on('SIGINT', () => {
91
- spinner.clear();
92
- server.stopCallback(() => {
93
- if (spinner) {
94
- spinner.succeed('Server closed');
95
- }
96
-
97
- resolve();
98
- });
99
- });
100
- }).finally(() => restore());
101
- }
102
- );
103
-
104
- const gracefullyHandleLogging = () => {
105
- const METHODS = ['debug', 'error', 'info', 'log', 'warn'];
106
- const reference = {};
107
-
108
- for (let method of METHODS) {
109
- reference[method] = console[method];
110
- }
111
-
112
- return [
113
- spinner => {
114
- for (let method of METHODS) {
115
- console[method] = (...args) => {
116
- spinner.clear();
117
- reference[method](...args);
118
- spinner.start();
119
- };
120
- }
121
- },
122
- () => {
123
- for (let method of METHODS) {
124
- console[method] = reference[method];
125
- }
126
- }
127
- ];
128
- };
@@ -1,42 +0,0 @@
1
- // Ours
2
- const { cmd, opt, sec } = require('../../utils/color');
3
-
4
- module.exports.MESSAGES = {
5
- opensslArgs: (host, keyout, out) => [
6
- 'req',
7
- '-newkey',
8
- 'rsa:2048',
9
- '-x509',
10
- '-nodes',
11
- '-keyout',
12
- keyout,
13
- '-new',
14
- '-out',
15
- out,
16
- '-subj',
17
- `/CN=${host}`,
18
- '-reqexts',
19
- 'SAN',
20
- '-extensions',
21
- 'SAN',
22
- '-config',
23
- `<(cat /System/Library/OpenSSL/openssl.cnf <(printf '[SAN]\nsubjectAltName=DNS:${host}'))`,
24
- '-sha256',
25
- '-days',
26
- '3650'
27
- ],
28
- manual: path => `You should install this certificate in your Mac OS Keychain:
29
- ${path}
30
- `,
31
- platform: `Sorry, this command is only supported on MacOS (for now)`,
32
- usage: name => `Usage: ${cmd(`aunty ${name}`)} ${opt('[options]')}
33
-
34
- ${sec('Options')}
35
-
36
- ${opt('-d')}, ${opt('--dry')} Output the assumed host, file paths & openssl command that would have run, then exit
37
-
38
- ${sec('Environment variables')}
39
-
40
- • You can override the host the certificate would be generated for by setting ${cmd('AUNTY_HOST')}
41
- `
42
- };
@@ -1,50 +0,0 @@
1
- // Native
2
- const { spawnSync } = require('child_process');
3
-
4
- // External
5
- const importLazy = require('import-lazy')(require);
6
- const makeDir = importLazy('make-dir');
7
-
8
- // Ours
9
- const { DEFAULT_HOST, SERVER_CERT_FILENAME, SERVER_KEY_FILENAME, getSSLPath } = require('../../config/serve');
10
- const { dry, info, spin } = require('../../utils/logging');
11
- const { command } = require('../');
12
- const { MESSAGES } = require('./constants');
13
-
14
- module.exports = command(
15
- {
16
- name: 'sign-cert',
17
- usage: MESSAGES.usage
18
- },
19
- async argv => {
20
- if (process.platform !== 'darwin') {
21
- throw new Error(MESSAGES.platform);
22
- }
23
-
24
- const host = process.env.AUNTY_HOST || DEFAULT_HOST;
25
- const files = {
26
- cert: getSSLPath(host, SERVER_CERT_FILENAME),
27
- key: getSSLPath(host, SERVER_KEY_FILENAME)
28
- };
29
- const opensslArgs = MESSAGES.opensslArgs(host, files.key, files.cert);
30
- const cmd = `openssl ${opensslArgs.join(' ')}`;
31
-
32
- if (argv.dry) {
33
- return dry({
34
- 'OpenSSL config': {
35
- host,
36
- files,
37
- cmd
38
- }
39
- });
40
- }
41
-
42
- let spinner = spin(`Creating SSL certificate`);
43
-
44
- await makeDir(getSSLPath(host));
45
- spawnSync('bash', ['-c', cmd]);
46
-
47
- spinner.succeed('SSL certificate created');
48
- info(MESSAGES.manual(files.cert));
49
- }
50
- );
@@ -1,15 +0,0 @@
1
- // Ours
2
- const { cmd, opt, sec } = require('../../utils/color');
3
-
4
- module.exports.MESSAGES = {
5
- usage: name => `Usage: ${cmd(`aunty ${name}`)} ${opt('[options]')} -- ${opt('[jest_options]')}
6
-
7
- ${sec('Options')}
8
-
9
- ${opt('-d')}, ${opt('--dry')} Output the generated jest configuration, then exit
10
-
11
- ${sec('Environment variables')}
12
-
13
- • Tests will assume you have set ${cmd('NODE_ENV=test')}, unless you specify otherwise.
14
- `
15
- };
@@ -1,30 +0,0 @@
1
- // External
2
- const importLazy = require('import-lazy')(require);
3
- const jest = importLazy('jest');
4
-
5
- // Ours
6
- const { command } = require('../');
7
- const { getJestConfig } = require('../../config/jest');
8
- const { dry } = require('../../utils/logging');
9
- const { MESSAGES } = require('./constants');
10
-
11
- module.exports = command(
12
- {
13
- name: 'test',
14
- nodeEnv: 'test',
15
- usage: MESSAGES.usage
16
- },
17
- async argv => {
18
- const config = getJestConfig();
19
- const jestArgs = ['--config', JSON.stringify(config)].concat(argv['--']);
20
-
21
- if (argv.dry) {
22
- return dry({
23
- 'Jest config': config,
24
- 'Jest args': jestArgs
25
- });
26
- }
27
-
28
- await jest.run(jestArgs);
29
- }
30
- );
@@ -1,75 +0,0 @@
1
- // External
2
- const importLazy = require('import-lazy')(require);
3
- const mem = require('mem');
4
- const semver = importLazy('semver');
5
-
6
- // Ours
7
- const { merge } = require('../utils/structures');
8
- const { getProjectConfig } = require('./project');
9
-
10
- const PROJECT_TYPES_CONFIG = {
11
- preact: {
12
- plugins: [
13
- [
14
- require.resolve('@babel/plugin-transform-react-jsx'),
15
- {
16
- pragma: 'h'
17
- }
18
- ]
19
- ]
20
- },
21
- react: {
22
- presets: [require.resolve('@babel/preset-react')]
23
- }
24
- };
25
-
26
- module.exports.getBabelConfig = mem(
27
- ({ isModernJS } = {}) => {
28
- const { babel: projectBabelConfig, pkg, hasTS, type } = getProjectConfig();
29
-
30
- let corejs = '3';
31
-
32
- // Minor version should be specified, if possible
33
- // https://babeljs.io/docs/en/babel-preset-env#corejs
34
- if (pkg.dependencies && pkg.dependencies['core-js']) {
35
- const corejsSemVer = semver.coerce(pkg.dependencies['core-js']);
36
-
37
- corejs = `${corejsSemVer.major}.${corejsSemVer.minor}`;
38
- }
39
-
40
- return merge(
41
- {
42
- presets: [
43
- [
44
- require.resolve('@babel/preset-env'),
45
- {
46
- targets: {
47
- browsers: isModernJS
48
- ? ['Chrome >= 80', 'Safari >= 12.1', 'iOS >= 12.3', 'Firefox >= 72', 'Edge >= 18']
49
- : pkg.browserslist || ['> 1% in AU', 'Firefox ESR', 'IE 11']
50
- },
51
- useBuiltIns: 'entry',
52
- corejs,
53
- modules: process.env.NODE_ENV === 'test' ? 'commonjs' : false
54
- }
55
- ]
56
- ].concat(
57
- hasTS
58
- ? [
59
- [
60
- require.resolve('@babel/preset-typescript'),
61
- {
62
- onlyRemoveTypeImports: true
63
- }
64
- ]
65
- ]
66
- : []
67
- ),
68
- plugins: [require.resolve('@babel/plugin-syntax-dynamic-import')]
69
- },
70
- PROJECT_TYPES_CONFIG[type],
71
- projectBabelConfig
72
- );
73
- },
74
- { cacheKey: ({ isModernJS }) => isModernJS }
75
- );
@@ -1,39 +0,0 @@
1
- // Native
2
- const { join } = require('path');
3
-
4
- // External
5
- const mem = require('mem');
6
-
7
- // Ours
8
- const { BUILD_DIRECTORY_NAME, OUTPUT_DIRECTORY_NAME } = require('../constants');
9
- const { combine } = require('../utils/structures');
10
- const { getProjectConfig } = require('./project');
11
-
12
- const PROJECT_TYPES_CONFIG = {
13
- svelte: {
14
- useCSSModules: false
15
- }
16
- };
17
- const DEFAULT_ENTRY_FILE_NAME = 'index';
18
- const DEFAULT_SOURCE_DIRECTORY_NAME = 'src';
19
- const DEFAULT_STATIC_DIRECTORY_NAME = 'public';
20
-
21
- module.exports.getBuildConfig = mem(() => {
22
- const { build: projectBuildConfig, type } = getProjectConfig();
23
-
24
- return combine(
25
- {
26
- entry: DEFAULT_ENTRY_FILE_NAME,
27
- from: DEFAULT_SOURCE_DIRECTORY_NAME,
28
- to: join(OUTPUT_DIRECTORY_NAME, BUILD_DIRECTORY_NAME),
29
- staticDir: DEFAULT_STATIC_DIRECTORY_NAME,
30
- addModernJS: false,
31
- includedDependencies: [],
32
- extractCSS: false,
33
- useCSSModules: true,
34
- showDeprecations: false
35
- },
36
- PROJECT_TYPES_CONFIG[type],
37
- projectBuildConfig
38
- );
39
- });