@elliemae/pui-cli 6.16.0 → 7.0.0-alpha.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/dist/cjs/cli-commands/build.js +72 -0
- package/dist/cjs/cli-commands/codemod.js +51 -0
- package/dist/cjs/cli-commands/gendoc.js +52 -0
- package/dist/cjs/cli-commands/lint.js +86 -0
- package/dist/cjs/cli-commands/pack.js +88 -0
- package/dist/cjs/cli-commands/start.js +61 -0
- package/dist/cjs/cli-commands/storybook.js +63 -0
- package/dist/cjs/cli-commands/test.js +86 -0
- package/dist/cjs/cli-commands/tsc.js +103 -0
- package/dist/cjs/cli-commands/utils.js +137 -0
- package/dist/cjs/cli-commands/version.js +71 -0
- package/dist/cjs/cli-commands/vitest.js +84 -0
- package/dist/cjs/cli.js +47 -0
- package/dist/cjs/docgen/jsdoc.conf.json +17 -0
- package/{lib/dummy.ts → dist/cjs/dummy.js} +0 -0
- package/dist/cjs/index.js +41 -0
- package/dist/cjs/lint/lint-staged.config.js +42 -0
- package/dist/cjs/monorepo/delete-merged-tags.js +57 -0
- package/dist/cjs/monorepo/set-registry-version.js +43 -0
- package/dist/cjs/monorepo/set-workspace-version.js +44 -0
- package/dist/cjs/monorepo/utils.js +34 -0
- package/dist/cjs/package.json +4 -0
- package/dist/cjs/pui-config/index.js +40 -0
- package/dist/cjs/scripts/helpers/checkmark.js +32 -0
- package/dist/cjs/scripts/helpers/get-npm-config.js +27 -0
- package/dist/cjs/scripts/helpers/progress.js +35 -0
- package/dist/cjs/scripts/helpers/xmark.js +31 -0
- package/dist/cjs/scripts/npmcheckversion.js +8 -0
- package/dist/cjs/scripts/update-notifier.js +33 -0
- package/dist/cjs/server/csp.js +88 -0
- package/dist/cjs/server/index.js +29 -0
- package/dist/cjs/server/logger.js +50 -0
- package/dist/cjs/server/middlewares/addProdMiddlewares.js +44 -0
- package/dist/cjs/server/middlewares/index.js +57 -0
- package/dist/cjs/server/util/index.js +68 -0
- package/dist/cjs/testing/setup-react-env.js +18 -0
- package/dist/cjs/testing/setup-tests.js +63 -0
- package/dist/cjs/testing/vitest.config.js +39 -0
- package/{lib/testing/vitest.setup.ts → dist/cjs/testing/vitest.setup.js} +0 -0
- package/dist/cjs/transpile/esbuild.js +138 -0
- package/dist/cjs/transpile/react-shim.js +26 -0
- package/{lib → dist/cjs}/typescript/app.tsconfig.json +0 -0
- package/{lib → dist/cjs}/typescript/library.tsconfig.json +0 -0
- package/dist/cjs/typescript/tsc-files/index.js +68 -0
- package/dist/cjs/typescript/tsc-files/utils.js +31 -0
- package/dist/cjs/typescript/util.js +28 -0
- package/dist/cjs/webpack/helpers.js +216 -0
- package/dist/cjs/webpack/webpack.base.babel.js +262 -0
- package/dist/cjs/webpack/webpack.dev.babel.js +136 -0
- package/dist/cjs/webpack/webpack.lib.base.babel.js +217 -0
- package/dist/cjs/webpack/webpack.lib.dev.babel.js +67 -0
- package/dist/cjs/webpack/webpack.lib.prod.babel.js +92 -0
- package/dist/cjs/webpack/webpack.prod.babel.js +139 -0
- package/dist/esm/cli-commands/build.js +56 -0
- package/dist/esm/cli-commands/codemod.js +29 -0
- package/dist/esm/cli-commands/gendoc.js +29 -0
- package/dist/esm/cli-commands/lint.js +64 -0
- package/dist/esm/cli-commands/pack.js +65 -0
- package/dist/esm/cli-commands/start.js +38 -0
- package/dist/esm/cli-commands/storybook.js +41 -0
- package/dist/esm/cli-commands/test.js +64 -0
- package/dist/esm/cli-commands/tsc.js +83 -0
- package/dist/esm/cli-commands/utils.js +120 -0
- package/dist/esm/cli-commands/version.js +49 -0
- package/dist/esm/cli-commands/vitest.js +61 -0
- package/dist/esm/cli.js +31 -0
- package/dist/esm/docgen/jsdoc.conf.json +17 -0
- package/dist/esm/dummy.js +0 -0
- package/dist/esm/index.js +22 -0
- package/dist/esm/lint/lint-staged.config.js +19 -0
- package/dist/esm/monorepo/delete-merged-tags.js +38 -0
- package/dist/esm/monorepo/set-registry-version.js +21 -0
- package/dist/esm/monorepo/set-workspace-version.js +22 -0
- package/dist/esm/monorepo/utils.js +12 -0
- package/dist/esm/package.json +4 -0
- package/dist/esm/pui-config/index.js +18 -0
- package/dist/esm/scripts/helpers/checkmark.js +10 -0
- package/dist/esm/scripts/helpers/get-npm-config.js +5 -0
- package/dist/esm/scripts/helpers/progress.js +13 -0
- package/dist/esm/scripts/helpers/xmark.js +9 -0
- package/dist/esm/scripts/npmcheckversion.js +8 -0
- package/dist/esm/scripts/update-notifier.js +11 -0
- package/dist/esm/server/csp.js +66 -0
- package/dist/esm/server/index.js +17 -0
- package/dist/esm/server/logger.js +28 -0
- package/dist/esm/server/middlewares/addProdMiddlewares.js +22 -0
- package/dist/esm/server/middlewares/index.js +35 -0
- package/{lib → dist/esm}/server/util/index.js +18 -19
- package/dist/esm/testing/setup-react-env.js +3 -0
- package/dist/esm/testing/setup-tests.js +48 -0
- package/dist/esm/testing/vitest.config.js +17 -0
- package/dist/esm/testing/vitest.setup.js +0 -0
- package/dist/esm/transpile/esbuild.js +117 -0
- package/dist/esm/transpile/react-shim.js +4 -0
- package/dist/esm/typescript/app.tsconfig.json +23 -0
- package/dist/esm/typescript/library.tsconfig.json +23 -0
- package/dist/esm/typescript/tsc-files/index.js +55 -0
- package/{lib → dist/esm}/typescript/tsc-files/utils.js +3 -7
- package/dist/esm/typescript/util.js +6 -0
- package/dist/esm/webpack/helpers.js +196 -0
- package/dist/esm/webpack/webpack.base.babel.js +248 -0
- package/dist/esm/webpack/webpack.dev.babel.js +118 -0
- package/dist/esm/webpack/webpack.lib.base.babel.js +208 -0
- package/dist/esm/webpack/webpack.lib.dev.babel.js +45 -0
- package/dist/esm/webpack/webpack.lib.prod.babel.js +70 -0
- package/dist/esm/webpack/webpack.prod.babel.js +122 -0
- package/dist/types/babel/babel.config.d.cts +59 -0
- package/dist/types/cli-commands/build.d.ts +14 -0
- package/dist/types/cli-commands/codemod.d.ts +6 -0
- package/dist/types/cli-commands/gendoc.d.ts +6 -0
- package/dist/types/cli-commands/lint.d.ts +29 -0
- package/dist/types/cli-commands/pack.d.ts +26 -0
- package/dist/types/cli-commands/start.d.ts +13 -0
- package/dist/types/cli-commands/storybook.d.ts +19 -0
- package/dist/types/cli-commands/test.d.ts +35 -0
- package/dist/types/cli-commands/tsc.d.ts +20 -0
- package/dist/types/cli-commands/utils.d.ts +14 -0
- package/dist/types/cli-commands/version.d.ts +30 -0
- package/dist/types/cli-commands/vitest.d.ts +35 -0
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/dummy.d.ts +0 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/lint/commitlint.config.d.cts +4 -0
- package/dist/types/lint/eslint/common.d.cts +124 -0
- package/dist/types/lint/eslint/non-react.d.cts +88 -0
- package/dist/types/lint/eslint/react.d.cts +118 -0
- package/dist/types/lint/eslint/typescript/common.d.cts +37 -0
- package/dist/types/lint/eslint/typescript/non-react.d.cts +87 -0
- package/dist/types/lint/eslint/typescript/react.d.cts +118 -0
- package/dist/types/lint/lint-staged.config.d.ts +5 -0
- package/dist/types/lint/prettier.config.d.cts +8 -0
- package/dist/types/lint/stylelint.config.d.cts +10 -0
- package/dist/types/monorepo/delete-merged-tags.d.ts +1 -0
- package/dist/types/monorepo/set-registry-version.d.ts +1 -0
- package/dist/types/monorepo/set-workspace-version.d.ts +1 -0
- package/dist/types/monorepo/utils.d.ts +1 -0
- package/dist/types/pui-config/index.d.ts +1 -0
- package/dist/types/release/release.config.d.cts +9 -0
- package/dist/types/scripts/helpers/checkmark.d.ts +7 -0
- package/dist/types/scripts/helpers/get-npm-config.d.ts +2 -0
- package/dist/types/scripts/helpers/progress.d.ts +7 -0
- package/dist/types/scripts/helpers/xmark.d.ts +6 -0
- package/dist/types/scripts/npmcheckversion.d.ts +1 -0
- package/dist/types/scripts/update-notifier.d.ts +2 -0
- package/dist/types/server/csp.d.ts +10 -0
- package/dist/types/server/index.d.ts +1 -0
- package/dist/types/server/logger.d.ts +4 -0
- package/dist/types/server/middlewares/addProdMiddlewares.d.ts +1 -0
- package/dist/types/server/middlewares/index.d.ts +2 -0
- package/dist/types/server/util/index.d.ts +4 -0
- package/dist/types/testing/jest.config.d.cts +39 -0
- package/dist/types/testing/jest.node.config.d.cts +39 -0
- package/dist/types/testing/mocks/axios.d.cts +14 -0
- package/dist/types/testing/mocks/cssModule.d.cts +2 -0
- package/dist/types/testing/mocks/html.d.cts +2 -0
- package/dist/types/testing/mocks/image.d.cts +2 -0
- package/dist/types/testing/mocks/matchMedia.d.cts +2 -0
- package/dist/types/testing/mocks/pui-app-loader.d.cts +1 -0
- package/dist/types/testing/mocks/pui-diagnostics.d.cts +28 -0
- package/dist/types/testing/mocks/pui-user-monitoring.d.cts +3 -0
- package/dist/types/testing/mocks/retry-axios.d.cts +3 -0
- package/dist/types/testing/mocks/svg.d.cts +3 -0
- package/dist/types/testing/mocks/webpack-hmr.d.cts +1 -0
- package/dist/types/testing/resolver.d.cts +2 -0
- package/dist/types/testing/setup-react-env.d.ts +1 -0
- package/dist/types/testing/setup-tests.d.ts +1 -0
- package/dist/types/testing/vitest.config.d.ts +2 -0
- package/dist/types/testing/vitest.setup.d.ts +0 -0
- package/dist/types/transpile/esbuild.d.ts +13 -0
- package/dist/types/transpile/react-shim.d.ts +2 -0
- package/dist/types/transpile/swcrc.config.d.cts +1 -0
- package/dist/types/typescript/tsc-files/index.d.ts +1 -0
- package/dist/types/typescript/tsc-files/utils.d.ts +3 -0
- package/dist/types/typescript/util.d.ts +1 -0
- package/dist/types/utils.d.cts +3 -0
- package/dist/types/webpack/helpers.d.ts +28 -0
- package/dist/types/webpack/webpack.base.babel.d.ts +90 -0
- package/dist/types/webpack/webpack.dev.babel.d.ts +1 -0
- package/dist/types/webpack/webpack.lib.base.babel.d.ts +107 -0
- package/dist/types/webpack/webpack.lib.dev.babel.d.ts +91 -0
- package/dist/types/webpack/webpack.lib.prod.babel.d.ts +91 -0
- package/dist/types/webpack/webpack.prod.babel.d.ts +2 -0
- package/dist/types/webpack/webpack.storybook.d.cts +4 -0
- package/package.json +63 -52
- package/lib/babel/babel.config.js +0 -101
- package/lib/cli-commands/build.js +0 -56
- package/lib/cli-commands/codemod.js +0 -31
- package/lib/cli-commands/gendoc.js +0 -36
- package/lib/cli-commands/lint.js +0 -75
- package/lib/cli-commands/pack.js +0 -67
- package/lib/cli-commands/start.js +0 -44
- package/lib/cli-commands/storybook.js +0 -53
- package/lib/cli-commands/test.js +0 -63
- package/lib/cli-commands/tsc.js +0 -103
- package/lib/cli-commands/utils.js +0 -89
- package/lib/cli-commands/version.js +0 -53
- package/lib/cli-commands/vitest.js +0 -66
- package/lib/cli.js +0 -33
- package/lib/docgen/jsdoc.config.js +0 -17
- package/lib/index.js +0 -25
- package/lib/lint/commitlint.config.js +0 -1
- package/lib/lint/eslint/common.js +0 -160
- package/lib/lint/eslint/non-react.js +0 -14
- package/lib/lint/eslint/react.js +0 -26
- package/lib/lint/eslint/typescript/common.js +0 -43
- package/lib/lint/eslint/typescript/non-react.js +0 -12
- package/lib/lint/eslint/typescript/react.js +0 -19
- package/lib/lint/lint-staged.config.js +0 -16
- package/lib/lint/prettier.config.js +0 -8
- package/lib/lint/stylelint.config.js +0 -19
- package/lib/monorepo/delete-merged-tags.js +0 -48
- package/lib/monorepo/set-registry-version.js +0 -22
- package/lib/monorepo/set-workspace-version.js +0 -29
- package/lib/monorepo/utils.js +0 -15
- package/lib/pui-config/index.js +0 -18
- package/lib/release/release.config.js +0 -31
- package/lib/scripts/helpers/checkmark.js +0 -15
- package/lib/scripts/helpers/get-npm-config.js +0 -3
- package/lib/scripts/helpers/progress.js +0 -19
- package/lib/scripts/helpers/xmark.js +0 -13
- package/lib/scripts/npmcheckversion.js +0 -8
- package/lib/scripts/update-notifier.js +0 -7
- package/lib/server/argv.js +0 -1
- package/lib/server/csp.js +0 -74
- package/lib/server/index.js +0 -69
- package/lib/server/logger.js +0 -42
- package/lib/server/middlewares/addDevMiddlewares.js +0 -39
- package/lib/server/middlewares/addProdMiddlewares.js +0 -31
- package/lib/server/middlewares/frontendMiddleware.js +0 -16
- package/lib/server/port.js +0 -6
- package/lib/testing/jest.config.js +0 -100
- package/lib/testing/jest.node.config.js +0 -8
- package/lib/testing/mocks/axios.js +0 -15
- package/lib/testing/mocks/cssModule.js +0 -1
- package/lib/testing/mocks/html.js +0 -1
- package/lib/testing/mocks/image.js +0 -1
- package/lib/testing/mocks/matchMedia.js +0 -24
- package/lib/testing/mocks/pui-app-loader.js +0 -1
- package/lib/testing/mocks/pui-diagnostics.js +0 -28
- package/lib/testing/mocks/pui-user-monitoring.js +0 -3
- package/lib/testing/mocks/retry-axios.js +0 -3
- package/lib/testing/mocks/svg.js +0 -5
- package/lib/testing/mocks/webpack-hmr.js +0 -1
- package/lib/testing/resolver.js +0 -47
- package/lib/testing/setup-react-env.js +0 -3
- package/lib/testing/setup-tests.js +0 -58
- package/lib/testing/vitest.config.ts +0 -16
- package/lib/transpile/.swcrc +0 -11
- package/lib/transpile/esbuild.js +0 -116
- package/lib/transpile/react-shim.js +0 -2
- package/lib/transpile/swcrc.config.js +0 -13
- package/lib/typescript/tsc-files/index.js +0 -66
- package/lib/typescript/util.js +0 -5
- package/lib/webpack/helpers.js +0 -255
- package/lib/webpack/webpack.base.babel.js +0 -239
- package/lib/webpack/webpack.dev.babel.js +0 -122
- package/lib/webpack/webpack.lib.base.babel.js +0 -205
- package/lib/webpack/webpack.lib.dev.babel.js +0 -49
- package/lib/webpack/webpack.lib.prod.babel.js +0 -77
- package/lib/webpack/webpack.prod.babel.js +0 -164
- package/lib/webpack/webpack.storybook.js +0 -91
package/lib/server/index.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/* eslint consistent-return:0 import/order:0 */
|
|
2
|
-
|
|
3
|
-
const express = require('express');
|
|
4
|
-
const cors = require('cors');
|
|
5
|
-
const { resolve } = require('path');
|
|
6
|
-
const expressPinoLogger = require('express-pino-logger');
|
|
7
|
-
const { csp } = require('./csp');
|
|
8
|
-
const logger = require('./logger');
|
|
9
|
-
const argv = require('./argv');
|
|
10
|
-
const port = require('./port');
|
|
11
|
-
const setup = require('./middlewares/frontendMiddleware');
|
|
12
|
-
const { loadRoutes } = require('./util');
|
|
13
|
-
const { getAssetPath } = require('../webpack/helpers');
|
|
14
|
-
|
|
15
|
-
const pino = expressPinoLogger({
|
|
16
|
-
transport: {
|
|
17
|
-
target: 'pino-pretty',
|
|
18
|
-
options: {
|
|
19
|
-
colorize: true,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
pino.logger.level = 'warn';
|
|
24
|
-
|
|
25
|
-
// const corsOptions = {
|
|
26
|
-
// origin: '*',
|
|
27
|
-
// methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
|
28
|
-
// allowedHeaders: [
|
|
29
|
-
// 'Authorization',
|
|
30
|
-
// 'Content-Type',
|
|
31
|
-
// 'Origin',
|
|
32
|
-
// 'X-Requested-With',
|
|
33
|
-
// 'Accept',
|
|
34
|
-
// ],
|
|
35
|
-
// preflightContinue: false,
|
|
36
|
-
// optionsSuccessStatus: 204,
|
|
37
|
-
// maxAge: 3600,
|
|
38
|
-
// };
|
|
39
|
-
const app = express();
|
|
40
|
-
app.use(pino);
|
|
41
|
-
app.use(cors());
|
|
42
|
-
app.options('*', cors());
|
|
43
|
-
csp(app);
|
|
44
|
-
app.use(express.urlencoded({ extended: false }));
|
|
45
|
-
app.use(express.text({ type: 'text/plain' }));
|
|
46
|
-
app.use(express.json({ type: 'application/json' }));
|
|
47
|
-
app.use(express.json({ type: 'application/csp-report' }));
|
|
48
|
-
|
|
49
|
-
// load all custom routes from the application
|
|
50
|
-
loadRoutes(app);
|
|
51
|
-
|
|
52
|
-
// In production we need to pass these values in instead of relying on webpack
|
|
53
|
-
setup(app, {
|
|
54
|
-
outputPath: resolve(process.cwd(), 'build/public'),
|
|
55
|
-
publicPath: getAssetPath(),
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// get the intended host and port number, use localhost and port 3000 if not provided
|
|
59
|
-
const customHost = argv.host || process.env.HOST;
|
|
60
|
-
const host = customHost || null; // Let http.Server use its default IPv6/4 host
|
|
61
|
-
const prettyHost = customHost || 'localhost';
|
|
62
|
-
|
|
63
|
-
// Start your app.
|
|
64
|
-
app.listen(port, host, async (err) => {
|
|
65
|
-
if (err) {
|
|
66
|
-
return logger.error(err.message);
|
|
67
|
-
}
|
|
68
|
-
logger.appStarted(port, prettyHost);
|
|
69
|
-
});
|
package/lib/server/logger.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
const ip = require('ip');
|
|
5
|
-
|
|
6
|
-
const divider = chalk.gray('\n-----------------------------------');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Logger middleware, you can customize it to make messages more personal
|
|
10
|
-
*/
|
|
11
|
-
const logger = {
|
|
12
|
-
// Called whenever there's an error on the server we want to print
|
|
13
|
-
error: (err) => {
|
|
14
|
-
console.error(chalk.red(err));
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
// Called when express.js app starts on given port w/o errors
|
|
18
|
-
appStarted: (port, host, tunnelStarted) => {
|
|
19
|
-
console.log(`Server started ! ${chalk.green('✓')}`);
|
|
20
|
-
|
|
21
|
-
// If the tunnel started, log that and the URL it's available at
|
|
22
|
-
if (tunnelStarted) {
|
|
23
|
-
console.log(`Tunnel initialised ${chalk.green('✓')}`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const accessUrls = `${chalk.bold('Access URLs:')}${divider}\n`;
|
|
27
|
-
const localHostUrl = `Localhost: ${chalk.magenta(
|
|
28
|
-
`http://${host}:${port}`,
|
|
29
|
-
)}\n`;
|
|
30
|
-
const lanUrl = `LAN: ${chalk.magenta(`http://${ip.address()}:${port}`)}\n`;
|
|
31
|
-
const proxy = tunnelStarted
|
|
32
|
-
? `\n Proxy: ${chalk.magenta(tunnelStarted)}`
|
|
33
|
-
: '';
|
|
34
|
-
|
|
35
|
-
console.log(`${accessUrls}${localHostUrl}${lanUrl}${proxy}${divider}${chalk.blue(
|
|
36
|
-
`\nPress ${chalk.italic('CTRL-C')} to stop`,
|
|
37
|
-
)}
|
|
38
|
-
`);
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
module.exports = logger;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const webpack = require('webpack');
|
|
2
|
-
const expressStaticGzip = require('express-static-gzip');
|
|
3
|
-
const webpackDevMiddleware = require('webpack-dev-middleware');
|
|
4
|
-
const webpackHotMiddleware = require('webpack-hot-middleware');
|
|
5
|
-
const { sendFileWithCSPNonce } = require('../csp');
|
|
6
|
-
|
|
7
|
-
function createWebpackMiddleware(compiler, publicPath) {
|
|
8
|
-
return webpackDevMiddleware(compiler, {
|
|
9
|
-
publicPath,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = function addDevMiddlewares(app, webpackConfig) {
|
|
14
|
-
const compiler = webpack(webpackConfig);
|
|
15
|
-
const middleware = createWebpackMiddleware(
|
|
16
|
-
compiler,
|
|
17
|
-
webpackConfig.output.publicPath,
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
app.use(middleware);
|
|
21
|
-
app.use(
|
|
22
|
-
webpackHotMiddleware(compiler, {
|
|
23
|
-
log: false,
|
|
24
|
-
path: `/__webpack_hmr`,
|
|
25
|
-
heartbeat: 10 * 1000,
|
|
26
|
-
}),
|
|
27
|
-
);
|
|
28
|
-
app.use(expressStaticGzip('cdn'));
|
|
29
|
-
|
|
30
|
-
const { outputFileSystem } = (middleware || {}).context || {};
|
|
31
|
-
|
|
32
|
-
app.get('*', (req, res) => {
|
|
33
|
-
sendFileWithCSPNonce({
|
|
34
|
-
outputPath: compiler.outputPath,
|
|
35
|
-
fileSystem: outputFileSystem,
|
|
36
|
-
res,
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const compression = require('compression');
|
|
3
|
-
const expressStaticGzip = require('express-static-gzip');
|
|
4
|
-
const { sendFileWithCSPNonce } = require('../csp');
|
|
5
|
-
|
|
6
|
-
module.exports = function addProdMiddlewares(app, options) {
|
|
7
|
-
const publicPath = options.publicPath || '/';
|
|
8
|
-
const outputPath =
|
|
9
|
-
options.outputPath || path.resolve(process.cwd(), 'build/public');
|
|
10
|
-
|
|
11
|
-
// compression middleware compresses your server responses which makes them
|
|
12
|
-
// smaller (applies also to assets). You can read more about that technique
|
|
13
|
-
// and other good practices on official Express.js docs http://mxs.is/googmy
|
|
14
|
-
app.use(compression());
|
|
15
|
-
|
|
16
|
-
app.get(publicPath, (req, res) => {
|
|
17
|
-
sendFileWithCSPNonce({ outputPath, res });
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
app.use(
|
|
21
|
-
publicPath,
|
|
22
|
-
expressStaticGzip(outputPath, {
|
|
23
|
-
index: false,
|
|
24
|
-
enableBrotli: true,
|
|
25
|
-
orderPreference: ['br'],
|
|
26
|
-
}),
|
|
27
|
-
);
|
|
28
|
-
app.use(expressStaticGzip('cdn'));
|
|
29
|
-
|
|
30
|
-
app.get('*', (req, res) => sendFileWithCSPNonce({ outputPath, res }));
|
|
31
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable global-require */
|
|
2
|
-
|
|
3
|
-
module.exports = (app, options) => {
|
|
4
|
-
const isProd = process.env.NODE_ENV === 'production';
|
|
5
|
-
|
|
6
|
-
if (isProd) {
|
|
7
|
-
const addProdMiddlewares = require('./addProdMiddlewares');
|
|
8
|
-
addProdMiddlewares(app, options);
|
|
9
|
-
} else {
|
|
10
|
-
const webpackConfig = require('../../webpack/webpack.dev.babel');
|
|
11
|
-
const addDevMiddlewares = require('./addDevMiddlewares');
|
|
12
|
-
addDevMiddlewares(app, webpackConfig);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return app;
|
|
16
|
-
};
|
package/lib/server/port.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const normalizePath = require('normalize-path');
|
|
3
|
-
const { getAppConfig, getAssetPath } = require('../webpack/helpers');
|
|
4
|
-
const swcrcConfig = require('../transpile/swcrc.config.js');
|
|
5
|
-
const { findMonoRepoRoot } = require('../monorepo/utils');
|
|
6
|
-
|
|
7
|
-
let isReactModule = true;
|
|
8
|
-
try {
|
|
9
|
-
/* eslint-disable global-require, import/no-unresolved */
|
|
10
|
-
require('react');
|
|
11
|
-
require('styled-components');
|
|
12
|
-
/* eslint-enable global-require, import/no-unresolved */
|
|
13
|
-
} catch (err) {
|
|
14
|
-
isReactModule = false;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const getMockFilePath = (fileName) =>
|
|
18
|
-
normalizePath(path.resolve(__dirname, './mocks', fileName));
|
|
19
|
-
|
|
20
|
-
const getNodeModulesPath = (fileName) => {
|
|
21
|
-
const monorepoRoot = findMonoRepoRoot(process.cwd());
|
|
22
|
-
return normalizePath(
|
|
23
|
-
monorepoRoot
|
|
24
|
-
? path.join(monorepoRoot, 'node_modules', fileName)
|
|
25
|
-
: `<rootDir>/node_modules/${fileName}`,
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const jestConfig = {
|
|
30
|
-
collectCoverageFrom: [
|
|
31
|
-
'app/**/*.{js,ts,jsx,tsx}',
|
|
32
|
-
'lib/**/*.{js,ts,jsx,tsx}',
|
|
33
|
-
'!app/**/*.d.ts',
|
|
34
|
-
'!lib/**/*.d.ts',
|
|
35
|
-
'!app/**/*.test.{js,ts,jsx,tsx}',
|
|
36
|
-
'!lib/**/*.test.{js,ts,jsx,tsx}',
|
|
37
|
-
'!app/**/*.stories.{js,ts,jsx,tsx}',
|
|
38
|
-
'!lib/**/*.stories.{js,ts,jsx,tsx}',
|
|
39
|
-
'!app/**/*.endpoint.{js,ts,jsx,tsx}',
|
|
40
|
-
'!lib/**/*.endpoint.{js,ts,jsx,tsx}',
|
|
41
|
-
'!app/*/RbGenerated*/*.{js,ts,jsx,tsx}',
|
|
42
|
-
'!app/index.{js,ts,jsx,tsx}',
|
|
43
|
-
'!app/global-styles.{js,ts,jsx,tsx}',
|
|
44
|
-
'!app/**/loadable.{js,ts,jsx,tsx}',
|
|
45
|
-
'!lib/**/loadable.{js,ts,jsx,tsx}',
|
|
46
|
-
],
|
|
47
|
-
coverageThreshold: {
|
|
48
|
-
// Todo: enable the coverage threshold later
|
|
49
|
-
// global: {
|
|
50
|
-
// statements: 95,
|
|
51
|
-
// branches: 90,
|
|
52
|
-
// functions: 95,
|
|
53
|
-
// lines: 95,
|
|
54
|
-
// },
|
|
55
|
-
},
|
|
56
|
-
coverageDirectory: 'reports',
|
|
57
|
-
coverageReporters: ['lcov', 'html', 'text-summary'],
|
|
58
|
-
moduleDirectories: ['node_modules', 'app', 'lib'],
|
|
59
|
-
moduleNameMapper: {
|
|
60
|
-
'.*\\webpack-hmr(.[t|j]s)?$': getMockFilePath('webpack-hmr.js'),
|
|
61
|
-
'.*\\.(css|scss)$': getMockFilePath('cssModule.js'),
|
|
62
|
-
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
|
|
63
|
-
getMockFilePath('image.js'),
|
|
64
|
-
'.*\\.svg$': getMockFilePath('svg.js'),
|
|
65
|
-
'.*\\.(html)$': getMockFilePath('html.js'),
|
|
66
|
-
'@elliemae/pui-user-monitoring': getMockFilePath('pui-user-monitoring.js'),
|
|
67
|
-
'@elliemae/pui-app-loader': getMockFilePath('webpack-hmr.js'),
|
|
68
|
-
'@elliemae/pui-diagnostics': getMockFilePath('pui-app-loader.js'),
|
|
69
|
-
'react-spring/web': getNodeModulesPath('react-spring/web.cjs.js'),
|
|
70
|
-
'react-spring/renderprops': getNodeModulesPath(
|
|
71
|
-
'react-spring/renderprops.cjs.js',
|
|
72
|
-
),
|
|
73
|
-
},
|
|
74
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
75
|
-
setupFilesAfterEnv: [path.resolve(__dirname, './setup-tests.js')],
|
|
76
|
-
setupFiles: ['raf/polyfill', 'whatwg-fetch'],
|
|
77
|
-
testRegex: '(app|lib).*/tests/.*\\.test\\.[jt]sx?$',
|
|
78
|
-
snapshotSerializers: [],
|
|
79
|
-
testResultsProcessor: 'jest-sonar-reporter',
|
|
80
|
-
resolver: path.resolve(__dirname, './resolver.js'),
|
|
81
|
-
transform: {
|
|
82
|
-
'^.+\\.[jt]sx?$': ['@swc/jest', swcrcConfig],
|
|
83
|
-
},
|
|
84
|
-
transformIgnorePatterns: [
|
|
85
|
-
'node_modules/(?!(.*@elliemae/pui-cli|lodash-es|react-select|react-dates)/)',
|
|
86
|
-
],
|
|
87
|
-
globals: {
|
|
88
|
-
APP_CONFIG: getAppConfig(),
|
|
89
|
-
__webpack_public_path__: '/',
|
|
90
|
-
},
|
|
91
|
-
testURL: `http://localhost:3111${getAssetPath()}`,
|
|
92
|
-
testEnvironment: 'jsdom',
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
if (isReactModule && jestConfig.setupFilesAfterEnv)
|
|
96
|
-
jestConfig.setupFilesAfterEnv.push(
|
|
97
|
-
path.resolve(__dirname, './setup-react-env.js'),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
exports.jestConfig = jestConfig;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
defaults: {},
|
|
3
|
-
interceptors: {
|
|
4
|
-
request: {
|
|
5
|
-
use: jest.fn(),
|
|
6
|
-
},
|
|
7
|
-
response: {
|
|
8
|
-
use: jest.fn(),
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
create: jest.fn().mockReturnThis(),
|
|
12
|
-
get: jest.fn().mockResolvedValue({ data: {} }),
|
|
13
|
-
post: jest.fn().mockResolvedValue({ data: {} }),
|
|
14
|
-
put: jest.fn().mockResolvedValue({ data: {} }),
|
|
15
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = 'CSS_MODULE';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = 'HTML_MODULE';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = 'IMAGE_MOCK';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*/
|
|
4
|
-
export default () => {
|
|
5
|
-
Object.defineProperty(window, 'matchMedia', {
|
|
6
|
-
writable: true,
|
|
7
|
-
value: jest.fn().mockImplementation((query) => ({
|
|
8
|
-
matches: false,
|
|
9
|
-
media: query,
|
|
10
|
-
onchange: null,
|
|
11
|
-
addListener: jest.fn(), // Deprecated
|
|
12
|
-
removeListener: jest.fn(), // Deprecated
|
|
13
|
-
addEventListener: jest.fn(),
|
|
14
|
-
removeEventListener: jest.fn(),
|
|
15
|
-
dispatchEvent: jest.fn(),
|
|
16
|
-
})),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
Object.defineProperty(window, 'getComputedStyle', {
|
|
20
|
-
value: () => ({
|
|
21
|
-
getPropertyValue: () => {},
|
|
22
|
-
}),
|
|
23
|
-
});
|
|
24
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const load = () => {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export const logger = () => ({
|
|
2
|
-
setLogLevel() {},
|
|
3
|
-
setOptions() {},
|
|
4
|
-
info() {},
|
|
5
|
-
warn() {},
|
|
6
|
-
error() {},
|
|
7
|
-
trace() {},
|
|
8
|
-
debug() {},
|
|
9
|
-
audit() {},
|
|
10
|
-
fatal() {},
|
|
11
|
-
});
|
|
12
|
-
export const LogLevel = {
|
|
13
|
-
info: 'info',
|
|
14
|
-
debug: 'debug',
|
|
15
|
-
trace: 'trace',
|
|
16
|
-
warn: 'warn',
|
|
17
|
-
error: 'error',
|
|
18
|
-
audit: 'audit',
|
|
19
|
-
fatal: 'fatal',
|
|
20
|
-
};
|
|
21
|
-
export const Console = () => ({
|
|
22
|
-
log: () => {},
|
|
23
|
-
});
|
|
24
|
-
export const http = () => ({
|
|
25
|
-
log() {},
|
|
26
|
-
});
|
|
27
|
-
export const webvitals = () => {};
|
|
28
|
-
export const logUnhandledErrors = () => {};
|
package/lib/testing/mocks/svg.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
exports.enableHotReloading = () => {};
|
package/lib/testing/resolver.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const resolutions = [
|
|
2
|
-
{
|
|
3
|
-
matcher: /\.jsx?$/i,
|
|
4
|
-
extensions: ['.tsx', '.ts'],
|
|
5
|
-
},
|
|
6
|
-
{
|
|
7
|
-
matcher: /\.mjs$/i,
|
|
8
|
-
extensions: ['.mts'],
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
matcher: /\.cjs$/i,
|
|
12
|
-
extensions: ['.cts'],
|
|
13
|
-
},
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
const resolveConfig = {
|
|
17
|
-
conditionNames: ['import', 'node', 'default'],
|
|
18
|
-
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.node'],
|
|
19
|
-
modules: ['node_modules', 'app', 'lib'],
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const importResolver = require('enhanced-resolve').create.sync(resolveConfig);
|
|
23
|
-
const requireResolver = require('enhanced-resolve').create.sync({
|
|
24
|
-
...resolveConfig,
|
|
25
|
-
conditionNames: ['require', 'node', 'default'],
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
module.exports = (request, options) => {
|
|
29
|
-
let resolver = requireResolver;
|
|
30
|
-
if (options.conditions?.includes('import')) {
|
|
31
|
-
resolver = importResolver;
|
|
32
|
-
}
|
|
33
|
-
const resolution = resolutions.find(({ matcher }) => matcher.test(request));
|
|
34
|
-
if (resolution) {
|
|
35
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
36
|
-
for (const extension of resolution.extensions) {
|
|
37
|
-
try {
|
|
38
|
-
return resolver(
|
|
39
|
-
options.basedir,
|
|
40
|
-
request.replace(resolution.matcher, extension),
|
|
41
|
-
);
|
|
42
|
-
// eslint-disable-next-line no-empty
|
|
43
|
-
} catch {}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return resolver(options.basedir, request);
|
|
47
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// needed for regenerator-runtime
|
|
2
|
-
// (ES7 generator support is required by redux-saga)
|
|
3
|
-
import 'core-js/stable';
|
|
4
|
-
import 'regenerator-runtime/runtime';
|
|
5
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
6
|
-
import jestAxe from 'jest-axe';
|
|
7
|
-
import ResizeObserver from 'resize-observer-polyfill';
|
|
8
|
-
import addMatchMedia from './mocks/matchMedia.js';
|
|
9
|
-
import { logger } from './mocks/pui-diagnostics.js';
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line no-console
|
|
12
|
-
const originalError = console.error;
|
|
13
|
-
// eslint-disable-next-line no-console
|
|
14
|
-
console.error = (...args) => {
|
|
15
|
-
const ignoreList = [
|
|
16
|
-
`Warning: Can't perform a React state update on an unmounted component`,
|
|
17
|
-
`Warning: Function components cannot be given refs`,
|
|
18
|
-
`Warning: Failed %s type:`,
|
|
19
|
-
`Warning: Invalid DOM property`,
|
|
20
|
-
`Warning: Each child in a list should have a unique`,
|
|
21
|
-
'Warning: Received `%s` for a non-boolean attribute',
|
|
22
|
-
'Warning: <%s /> is using incorrect casing.',
|
|
23
|
-
'Warning: The tag <%s> is unrecognized in this browser',
|
|
24
|
-
'Warning: Invalid arguments supplied to oneOf',
|
|
25
|
-
];
|
|
26
|
-
if (
|
|
27
|
-
ignoreList.find(
|
|
28
|
-
(ignoreMsg) => !!args.find((arg) => arg?.includes?.(ignoreMsg)),
|
|
29
|
-
)
|
|
30
|
-
)
|
|
31
|
-
return false;
|
|
32
|
-
return originalError(...args);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
if (expect) expect.extend(jestAxe.toHaveNoViolations);
|
|
36
|
-
jest.setTimeout(60000);
|
|
37
|
-
|
|
38
|
-
const addElementToBody = (element) => {
|
|
39
|
-
const documentEle = (window || {}).document;
|
|
40
|
-
if (!documentEle) return null;
|
|
41
|
-
const bodyEle = documentEle.body;
|
|
42
|
-
const newEle = documentEle.createElement(...element);
|
|
43
|
-
if (!newEle) return null;
|
|
44
|
-
bodyEle.appendChild(newEle);
|
|
45
|
-
return newEle;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const addRootElement = (id) => {
|
|
49
|
-
const rootEle = addElementToBody('div');
|
|
50
|
-
if (rootEle) rootEle.id = id;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
addRootElement('root');
|
|
54
|
-
|
|
55
|
-
addMatchMedia();
|
|
56
|
-
window.ResizeObserver = ResizeObserver;
|
|
57
|
-
window.emui = {};
|
|
58
|
-
window.emui.logger = logger();
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="vitest" />
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
test: {
|
|
7
|
-
globals: true,
|
|
8
|
-
root: process.cwd(),
|
|
9
|
-
exclude: ['node_modules', 'dist', '.idea', '.git', '.cache', 'e2e'],
|
|
10
|
-
setupFiles: [path.resolve(__dirname, './vitest.setup.ts')],
|
|
11
|
-
coverage: {
|
|
12
|
-
reportsDirectory: './reports/coverage',
|
|
13
|
-
},
|
|
14
|
-
environment: 'happy-dom',
|
|
15
|
-
},
|
|
16
|
-
});
|
package/lib/transpile/.swcrc
DELETED
package/lib/transpile/esbuild.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
const { build } = require('esbuild');
|
|
2
|
-
const fg = require('fast-glob');
|
|
3
|
-
const { writeFile, copyFile, readFile, mkdir } = require('fs/promises');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const browserslistToEsbuild = require('browserslist-to-esbuild');
|
|
6
|
-
|
|
7
|
-
const TARGETS = {
|
|
8
|
-
browserslist: browserslistToEsbuild(),
|
|
9
|
-
web: 'es2020',
|
|
10
|
-
node: 'node14',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const ESBUILD_FORMAT = {
|
|
14
|
-
CJS: 'cjs',
|
|
15
|
-
ESM: 'esm',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const NODE_MODULE_TYPES = {
|
|
19
|
-
CJS: 'commonjs',
|
|
20
|
-
ESM: 'module',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const getCommonConfig = ({ injectReactShim }) => ({
|
|
24
|
-
bundle: false,
|
|
25
|
-
loader: { '.js': 'jsx' },
|
|
26
|
-
mainFields: ['module', 'browser', 'main'],
|
|
27
|
-
inject: [
|
|
28
|
-
injectReactShim ? path.resolve(__dirname, './react-shim.js') : '',
|
|
29
|
-
].filter(Boolean),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const copyFiles = async ({ srcdir, outdir }) => {
|
|
33
|
-
const files = await fg([
|
|
34
|
-
`${srcdir}/**/*.*`,
|
|
35
|
-
`!${srcdir}/**/*.{js,jsx,ts,tsx,cjs,mjs}`,
|
|
36
|
-
]);
|
|
37
|
-
await Promise.all(
|
|
38
|
-
files.map(async (srcFilePath) => {
|
|
39
|
-
const destFilePath = srcFilePath.replace(srcdir, outdir);
|
|
40
|
-
const fileDir = path.dirname(destFilePath);
|
|
41
|
-
await mkdir(fileDir, { recursive: true });
|
|
42
|
-
await copyFile(srcFilePath, destFilePath);
|
|
43
|
-
}),
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const getSideEffects = async () => {
|
|
48
|
-
const data = await readFile(path.join(process.cwd(), './package.json'));
|
|
49
|
-
const packageJSON = JSON.parse(data);
|
|
50
|
-
return packageJSON?.sideEffects || false;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const createPackageJson = async ({ outdir, type = NODE_MODULE_TYPES.ESM }) => {
|
|
54
|
-
const filePath = path.join(process.cwd(), outdir, 'package.json');
|
|
55
|
-
const packageJSON = JSON.stringify(
|
|
56
|
-
{
|
|
57
|
-
type,
|
|
58
|
-
sideEffects: await getSideEffects(),
|
|
59
|
-
},
|
|
60
|
-
null,
|
|
61
|
-
2,
|
|
62
|
-
);
|
|
63
|
-
await writeFile(filePath, packageJSON);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
exports.esBuild = async ({
|
|
67
|
-
srcdir,
|
|
68
|
-
outdir = 'dist',
|
|
69
|
-
esmOnly = false,
|
|
70
|
-
target = TARGETS.browserslist,
|
|
71
|
-
injectReactShim = true,
|
|
72
|
-
skipNestedPackageJSON = false,
|
|
73
|
-
}) => {
|
|
74
|
-
const inputFiles = [
|
|
75
|
-
`${srcdir}/**/*.{js,jsx,ts,tsx}`,
|
|
76
|
-
`!${srcdir}/**/*.d.ts`,
|
|
77
|
-
`!${srcdir}/**/*.test.{js,jsx,ts,tsx}`,
|
|
78
|
-
`!${srcdir}/**/*.stories.{js,jsx,ts,tsx}`,
|
|
79
|
-
`!${srcdir}/**/*.endpoint.{js,jsx,ts,tsx}`,
|
|
80
|
-
];
|
|
81
|
-
|
|
82
|
-
// build commonjs
|
|
83
|
-
if (!esmOnly) {
|
|
84
|
-
const cjsOutdir = `${outdir}/cjs`;
|
|
85
|
-
const commonJSEntryPoints = await fg(inputFiles);
|
|
86
|
-
await build({
|
|
87
|
-
entryPoints: commonJSEntryPoints,
|
|
88
|
-
...getCommonConfig({ injectReactShim }),
|
|
89
|
-
outdir: cjsOutdir,
|
|
90
|
-
format: ESBUILD_FORMAT.CJS,
|
|
91
|
-
target,
|
|
92
|
-
});
|
|
93
|
-
// copy files that are not built by esbuild
|
|
94
|
-
await copyFiles({ srcdir, outdir: cjsOutdir });
|
|
95
|
-
await createPackageJson({ outdir: cjsOutdir, type: NODE_MODULE_TYPES.CJS });
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// build esm
|
|
99
|
-
const esmOutdir = esmOnly ? outdir : `${outdir}/esm`;
|
|
100
|
-
const entryPoints = await fg(
|
|
101
|
-
inputFiles.concat([`!${srcdir}/**/cjs/**/*.{js,jsx,ts,tsx}`]),
|
|
102
|
-
);
|
|
103
|
-
await build({
|
|
104
|
-
entryPoints,
|
|
105
|
-
...getCommonConfig({ injectReactShim }),
|
|
106
|
-
outdir: esmOutdir,
|
|
107
|
-
format: ESBUILD_FORMAT.ESM,
|
|
108
|
-
target,
|
|
109
|
-
});
|
|
110
|
-
// copy files that are not built by esbuild
|
|
111
|
-
await copyFiles({ srcdir, outdir: esmOutdir });
|
|
112
|
-
if (!skipNestedPackageJSON)
|
|
113
|
-
await createPackageJson({ outdir: esmOutdir, type: NODE_MODULE_TYPES.ESM });
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
exports.TARGETS = TARGETS;
|