@elliemae/pui-cli 7.0.0-alpha.1 → 7.0.0-alpha.4
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/{lib/babel/babel.config.js → dist/cjs/babel/babel.config.cjs} +2 -2
- 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/commitlint.config.cjs +1 -0
- package/{lib/lint/eslint/common.js → dist/cjs/lint/eslint/common.cjs} +8 -8
- package/{lib/lint/eslint/non-react.js → dist/cjs/lint/eslint/non-react.cjs} +2 -2
- package/{lib/lint/eslint/react.js → dist/cjs/lint/eslint/react.cjs} +2 -2
- package/{lib/lint/eslint/typescript/common.js → dist/cjs/lint/eslint/typescript/common.cjs} +1 -1
- package/{lib/lint/eslint/typescript/non-react.js → dist/cjs/lint/eslint/typescript/non-react.cjs} +2 -2
- package/{lib/lint/eslint/typescript/react.js → dist/cjs/lint/eslint/typescript/react.cjs} +2 -2
- package/dist/cjs/lint/lint-staged.config.js +42 -0
- package/{lib/lint/prettier.config.js → dist/cjs/lint/prettier.config.cjs} +1 -1
- package/{lib/lint/stylelint.config.js → dist/cjs/lint/stylelint.config.cjs} +2 -2
- 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/{lib/release/release.config.js → dist/cjs/release/release.config.cjs} +0 -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/{lib/testing/jest.config.js → dist/cjs/testing/jest.config.cjs} +15 -15
- package/{lib/testing/jest.node.config.js → dist/cjs/testing/jest.node.config.cjs} +1 -1
- package/{lib/testing/mocks/axios.js → dist/cjs/testing/mocks/axios.cjs} +0 -0
- package/{lib/testing/mocks/cssModule.js → dist/cjs/testing/mocks/cssModule.cjs} +0 -0
- package/{lib/testing/mocks/html.js → dist/cjs/testing/mocks/html.cjs} +0 -0
- package/{lib/testing/mocks/image.js → dist/cjs/testing/mocks/image.cjs} +0 -0
- package/{lib/testing/mocks/matchMedia.js → dist/cjs/testing/mocks/matchMedia.cjs} +0 -0
- package/{lib/testing/mocks/pui-app-loader.js → dist/cjs/testing/mocks/pui-app-loader.cjs} +0 -0
- package/{lib/testing/mocks/pui-diagnostics.js → dist/cjs/testing/mocks/pui-diagnostics.cjs} +0 -0
- package/{lib/testing/mocks/pui-user-monitoring.js → dist/cjs/testing/mocks/pui-user-monitoring.cjs} +0 -0
- package/{lib/testing/mocks/retry-axios.js → dist/cjs/testing/mocks/retry-axios.cjs} +0 -0
- package/{lib/testing/mocks/svg.js → dist/cjs/testing/mocks/svg.cjs} +0 -0
- package/{lib/testing/mocks/webpack-hmr.js → dist/cjs/testing/mocks/webpack-hmr.cjs} +0 -0
- package/{lib/testing/resolver.js → dist/cjs/testing/resolver.cjs} +0 -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/transpile/swcrc.config.js → dist/cjs/transpile/swcrc.config.cjs} +1 -1
- 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/utils.cjs +20 -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/{lib/webpack/webpack.storybook.js → dist/cjs/webpack/webpack.storybook.cjs} +1 -1
- package/dist/esm/babel/babel.config.cjs +101 -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/commitlint.config.cjs +1 -0
- package/dist/esm/lint/eslint/common.cjs +160 -0
- package/dist/esm/lint/eslint/non-react.cjs +14 -0
- package/dist/esm/lint/eslint/react.cjs +26 -0
- package/dist/esm/lint/eslint/typescript/common.cjs +43 -0
- package/dist/esm/lint/eslint/typescript/non-react.cjs +12 -0
- package/dist/esm/lint/eslint/typescript/react.cjs +19 -0
- package/dist/esm/lint/lint-staged.config.js +19 -0
- package/dist/esm/lint/prettier.config.cjs +8 -0
- package/dist/esm/lint/stylelint.config.cjs +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/release/release.config.cjs +31 -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/dist/esm/server/util/index.js +46 -0
- package/dist/esm/testing/jest.config.cjs +105 -0
- package/dist/esm/testing/jest.node.config.cjs +8 -0
- package/dist/esm/testing/mocks/axios.cjs +15 -0
- package/dist/esm/testing/mocks/cssModule.cjs +1 -0
- package/dist/esm/testing/mocks/html.cjs +1 -0
- package/dist/esm/testing/mocks/image.cjs +1 -0
- package/dist/esm/testing/mocks/matchMedia.cjs +24 -0
- package/dist/esm/testing/mocks/pui-app-loader.cjs +1 -0
- package/dist/esm/testing/mocks/pui-diagnostics.cjs +28 -0
- package/dist/esm/testing/mocks/pui-user-monitoring.cjs +3 -0
- package/dist/esm/testing/mocks/retry-axios.cjs +3 -0
- package/dist/esm/testing/mocks/svg.cjs +5 -0
- package/dist/esm/testing/mocks/webpack-hmr.cjs +1 -0
- package/dist/esm/testing/resolver.cjs +47 -0
- 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/transpile/swcrc.config.cjs +13 -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/utils.cjs +20 -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/esm/webpack/webpack.storybook.cjs +87 -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 +11 -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 +38 -0
- package/dist/types/testing/jest.node.config.d.cts +38 -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 +45 -37
- package/lib/cli-commands/build.js +0 -60
- 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 -49
- 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 -135
- 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/lint-staged.config.js +0 -16
- 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/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/csp.js +0 -74
- package/lib/server/index.js +0 -37
- package/lib/server/logger.js +0 -42
- package/lib/server/middlewares/addDevMiddlewares.js +0 -39
- package/lib/server/middlewares/addProdMiddlewares.js +0 -30
- package/lib/server/middlewares/index.js +0 -37
- package/lib/server/util/index.js +0 -52
- 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/typescript/tsc-files/index.js +0 -66
- package/lib/typescript/util.js +0 -5
- package/lib/webpack/helpers.js +0 -252
- package/lib/webpack/webpack.base.babel.js +0 -242
- package/lib/webpack/webpack.dev.babel.js +0 -137
- 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 -142
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins": ["plugins/markdown"],
|
|
3
|
+
"opts": {
|
|
4
|
+
"template": "node_modules/docdash"
|
|
5
|
+
},
|
|
6
|
+
"docdash": {
|
|
7
|
+
"sort": true,
|
|
8
|
+
"search": true,
|
|
9
|
+
"collapse": true,
|
|
10
|
+
"wrap": true
|
|
11
|
+
},
|
|
12
|
+
"templates": {
|
|
13
|
+
"default": {
|
|
14
|
+
"includeDate": false
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { babelConfig } from "./babel/babel.config.cjs";
|
|
2
|
+
import { esConfig } from "./lint/eslint/non-react.cjs";
|
|
3
|
+
import { esReactConfig } from "./lint/eslint/react.cjs";
|
|
4
|
+
import { stylelintConfig } from "./lint/stylelint.config.cjs";
|
|
5
|
+
import { prettierConfig } from "./lint/prettier.config.cjs";
|
|
6
|
+
import { commitlintConfig } from "./lint/commitlint.config.cjs";
|
|
7
|
+
import { jestConfig } from "./testing/jest.config.cjs";
|
|
8
|
+
import { jestNodeConfig } from "./testing/jest.node.config.cjs";
|
|
9
|
+
import { lintStagedConfig } from "./lint/lint-staged.config.js";
|
|
10
|
+
import { loadRoutes } from "./server/util/index.js";
|
|
11
|
+
export {
|
|
12
|
+
babelConfig,
|
|
13
|
+
commitlintConfig,
|
|
14
|
+
esConfig as eslintBaseConfig,
|
|
15
|
+
esReactConfig as eslintConfig,
|
|
16
|
+
jestConfig,
|
|
17
|
+
jestNodeConfig,
|
|
18
|
+
lintStagedConfig,
|
|
19
|
+
loadRoutes,
|
|
20
|
+
prettierConfig,
|
|
21
|
+
stylelintConfig
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports.commitlintConfig = { extends: ['@commitlint/config-conventional'] };
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
const prettierOptions = require('../prettier.config.cjs');
|
|
3
|
+
// const webpackConfig = require('../../webpack/webpack.prod.babel');
|
|
4
|
+
|
|
5
|
+
exports.baseExtends = [
|
|
6
|
+
'plugin:eslint-comments/recommended',
|
|
7
|
+
'plugin:import/recommended',
|
|
8
|
+
'plugin:prettier/recommended',
|
|
9
|
+
'plugin:jest/recommended',
|
|
10
|
+
'plugin:jsdoc/recommended',
|
|
11
|
+
'plugin:wdio/recommended',
|
|
12
|
+
'plugin:testing-library/dom',
|
|
13
|
+
'plugin:storybook/recommended',
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const basePlugins = ['testing-library', 'jest', 'jsdoc', 'wdio', 'import'];
|
|
17
|
+
exports.basePlugins = basePlugins;
|
|
18
|
+
|
|
19
|
+
exports.baseOverrides = [
|
|
20
|
+
{
|
|
21
|
+
files: ['*.func.spec.js', '*.visual.spec.js'],
|
|
22
|
+
rules: {
|
|
23
|
+
'jest/valid-expect': 'off',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const baseRules = {
|
|
29
|
+
'prettier/prettier': ['error', prettierOptions],
|
|
30
|
+
'arrow-body-style': [2, 'as-needed'],
|
|
31
|
+
'class-methods-use-this': 0,
|
|
32
|
+
'import/imports-first': 0,
|
|
33
|
+
'import/newline-after-import': 0,
|
|
34
|
+
'import/no-dynamic-require': 0,
|
|
35
|
+
'import/no-extraneous-dependencies': 0,
|
|
36
|
+
'import/no-named-as-default': 0,
|
|
37
|
+
'import/no-unresolved': [
|
|
38
|
+
2,
|
|
39
|
+
{ caseSensitive: true, caseSensitiveStrict: true },
|
|
40
|
+
], // Tip: https://github.com/import-js/eslint-plugin-import/issues/1868
|
|
41
|
+
'import/no-webpack-loader-syntax': 0,
|
|
42
|
+
'import/prefer-default-export': 0,
|
|
43
|
+
'import/extensions': [
|
|
44
|
+
2,
|
|
45
|
+
'never',
|
|
46
|
+
{
|
|
47
|
+
json: 'ignorePackages',
|
|
48
|
+
js: 'ignorePackages',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
indent: [
|
|
52
|
+
2,
|
|
53
|
+
2,
|
|
54
|
+
{
|
|
55
|
+
SwitchCase: 1,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
'max-lines': ['error', { max: 120, skipComments: true }],
|
|
59
|
+
complexity: ['error', { max: 10 }],
|
|
60
|
+
'max-depth': ['error', { max: 4 }],
|
|
61
|
+
'max-lines-per-function': 0,
|
|
62
|
+
'max-nested-callbacks': ['error', { max: 3 }],
|
|
63
|
+
'max-params': ['error', { max: 3 }],
|
|
64
|
+
'max-statements': ['error', { max: 20 }],
|
|
65
|
+
'max-len': 0,
|
|
66
|
+
'newline-per-chained-call': 0,
|
|
67
|
+
'no-confusing-arrow': 0,
|
|
68
|
+
'no-console': 1,
|
|
69
|
+
'no-param-reassign': ['error', { props: false }],
|
|
70
|
+
'no-unused-vars': 2,
|
|
71
|
+
'no-use-before-define': 0,
|
|
72
|
+
'prefer-template': 2,
|
|
73
|
+
'require-yield': 0,
|
|
74
|
+
'jsdoc/require-jsdoc': 0,
|
|
75
|
+
'eslint-comments/disable-enable-pair': 0,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
exports.baseRules = baseRules;
|
|
79
|
+
|
|
80
|
+
const reactRules = {
|
|
81
|
+
'jsx-a11y/aria-props': 2,
|
|
82
|
+
'jsx-a11y/heading-has-content': 0,
|
|
83
|
+
'jsx-a11y/label-has-associated-control': [
|
|
84
|
+
2,
|
|
85
|
+
{
|
|
86
|
+
// NOTE: If this error triggers, either disable it or add
|
|
87
|
+
// your custom components, labels and attributes via these options
|
|
88
|
+
// See https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-associated-control.md
|
|
89
|
+
controlComponents: ['Input'],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
'jsx-a11y/label-has-for': 0,
|
|
93
|
+
'jsx-a11y/mouse-events-have-key-events': 2,
|
|
94
|
+
'jsx-a11y/role-has-required-aria-props': 2,
|
|
95
|
+
'jsx-a11y/role-supports-aria-props': 2,
|
|
96
|
+
'react/destructuring-assignment': 0,
|
|
97
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
98
|
+
'react/jsx-closing-tag-location': 0,
|
|
99
|
+
'react/forbid-prop-types': 0,
|
|
100
|
+
'react/jsx-first-prop-new-line': [2, 'multiline'],
|
|
101
|
+
'react/jsx-no-target-blank': 0,
|
|
102
|
+
'react/jsx-props-no-spreading': 0,
|
|
103
|
+
'react/jsx-uses-vars': 2,
|
|
104
|
+
'react/require-default-props': 0,
|
|
105
|
+
'react/require-extension': 0,
|
|
106
|
+
'react/self-closing-comp': 0,
|
|
107
|
+
'react/sort-comp': 0,
|
|
108
|
+
'react/react-in-jsx-scope': 0,
|
|
109
|
+
'react/jsx-filename-extension': [
|
|
110
|
+
1,
|
|
111
|
+
{ extensions: ['.js', '.jsx', '.tsx', '.mdx'] },
|
|
112
|
+
],
|
|
113
|
+
'react/function-component-definition': [
|
|
114
|
+
2,
|
|
115
|
+
{ namedComponents: 'arrow-function' },
|
|
116
|
+
],
|
|
117
|
+
'redux-saga/no-yield-in-race': 2,
|
|
118
|
+
'redux-saga/yield-effects': 2,
|
|
119
|
+
};
|
|
120
|
+
exports.reactRules = reactRules;
|
|
121
|
+
|
|
122
|
+
exports.baseConfig = {
|
|
123
|
+
parser: '@babel/eslint-parser',
|
|
124
|
+
plugins: basePlugins,
|
|
125
|
+
env: {
|
|
126
|
+
jest: true,
|
|
127
|
+
browser: true,
|
|
128
|
+
node: true,
|
|
129
|
+
es2021: true,
|
|
130
|
+
},
|
|
131
|
+
parserOptions: {
|
|
132
|
+
sourceType: 'module',
|
|
133
|
+
ecmaFeatures: {
|
|
134
|
+
jsx: true,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
settings: {
|
|
138
|
+
react: {
|
|
139
|
+
version: 'detect',
|
|
140
|
+
},
|
|
141
|
+
jest: {
|
|
142
|
+
version: 28,
|
|
143
|
+
},
|
|
144
|
+
// 'import/resolver': {
|
|
145
|
+
// webpack: {
|
|
146
|
+
// config: webpackConfig,
|
|
147
|
+
// },
|
|
148
|
+
// },
|
|
149
|
+
},
|
|
150
|
+
ignorePatterns: [
|
|
151
|
+
'/build/**/*',
|
|
152
|
+
'/dist/**/*',
|
|
153
|
+
'/reports/**/*',
|
|
154
|
+
'/coverage/**/*',
|
|
155
|
+
'/demo/**/*',
|
|
156
|
+
'/docs/**/*',
|
|
157
|
+
'/temp/**/*',
|
|
158
|
+
'**/vendor/*.js',
|
|
159
|
+
],
|
|
160
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const {
|
|
2
|
+
baseExtends,
|
|
3
|
+
baseRules,
|
|
4
|
+
baseOverrides,
|
|
5
|
+
baseConfig,
|
|
6
|
+
} = require('./common.cjs');
|
|
7
|
+
const { tsConfig } = require('./typescript/non-react.cjs');
|
|
8
|
+
|
|
9
|
+
exports.esConfig = {
|
|
10
|
+
...baseConfig,
|
|
11
|
+
extends: ['airbnb-base'].concat(baseExtends),
|
|
12
|
+
rules: baseRules,
|
|
13
|
+
overrides: baseOverrides.concat([tsConfig]),
|
|
14
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const {
|
|
2
|
+
baseExtends,
|
|
3
|
+
baseRules,
|
|
4
|
+
baseOverrides,
|
|
5
|
+
baseConfig,
|
|
6
|
+
reactRules,
|
|
7
|
+
} = require('./common.cjs');
|
|
8
|
+
const { tsReactConfig } = require('./typescript/react.cjs');
|
|
9
|
+
|
|
10
|
+
exports.esReactConfig = {
|
|
11
|
+
...baseConfig,
|
|
12
|
+
extends: ['airbnb', 'airbnb/hooks', 'plugin:redux-saga/recommended'].concat(
|
|
13
|
+
baseExtends,
|
|
14
|
+
),
|
|
15
|
+
rules: {
|
|
16
|
+
...baseRules,
|
|
17
|
+
...reactRules,
|
|
18
|
+
},
|
|
19
|
+
overrides: baseOverrides.concat([
|
|
20
|
+
tsReactConfig,
|
|
21
|
+
{
|
|
22
|
+
files: '*.mdx',
|
|
23
|
+
extends: 'plugin:mdx/recommended',
|
|
24
|
+
},
|
|
25
|
+
]),
|
|
26
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const { baseExtends, basePlugins } = require('../common.cjs');
|
|
2
|
+
|
|
3
|
+
exports.tsBaseExtends = [
|
|
4
|
+
'plugin:@typescript-eslint/recommended',
|
|
5
|
+
'plugin:import/typescript',
|
|
6
|
+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
7
|
+
].concat(baseExtends);
|
|
8
|
+
|
|
9
|
+
exports.tsBaseRules = {
|
|
10
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
11
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
12
|
+
'@typescript-eslint/no-use-before-define': [
|
|
13
|
+
'error',
|
|
14
|
+
{ functions: false, classes: true, variables: true, typedefs: true },
|
|
15
|
+
],
|
|
16
|
+
'max-lines': ['error', { max: 200, skipComments: true }],
|
|
17
|
+
'@typescript-eslint/unbound-method': [
|
|
18
|
+
'error',
|
|
19
|
+
{
|
|
20
|
+
ignoreStatic: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.tsBaseConfig = {
|
|
26
|
+
files: ['*.ts', '*.tsx'],
|
|
27
|
+
parser: '@typescript-eslint/parser',
|
|
28
|
+
plugins: ['@typescript-eslint'].concat(basePlugins),
|
|
29
|
+
parserOptions: {
|
|
30
|
+
tsconfigRootDir: process.cwd(),
|
|
31
|
+
project: 'tsconfig.json',
|
|
32
|
+
},
|
|
33
|
+
settings: {
|
|
34
|
+
'import/resolver': {
|
|
35
|
+
typescript: {
|
|
36
|
+
alwaysTryTypes: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
'import/parsers': {
|
|
40
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
const { baseRules } = require('../common.cjs');
|
|
3
|
+
const { tsBaseExtends, tsBaseRules, tsBaseConfig } = require('./common.cjs');
|
|
4
|
+
|
|
5
|
+
exports.tsConfig = {
|
|
6
|
+
...tsBaseConfig,
|
|
7
|
+
extends: ['airbnb-base', 'airbnb-typescript/base'].concat(tsBaseExtends),
|
|
8
|
+
rules: {
|
|
9
|
+
...baseRules,
|
|
10
|
+
...tsBaseRules,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
const { baseRules, reactRules } = require('../common.cjs');
|
|
3
|
+
const { tsBaseExtends, tsBaseRules, tsBaseConfig } = require('./common.cjs');
|
|
4
|
+
|
|
5
|
+
exports.tsReactConfig = {
|
|
6
|
+
...tsBaseConfig,
|
|
7
|
+
extends: [
|
|
8
|
+
'airbnb',
|
|
9
|
+
'airbnb/hooks',
|
|
10
|
+
'plugin:redux-saga/recommended',
|
|
11
|
+
'airbnb-typescript',
|
|
12
|
+
].concat(tsBaseExtends),
|
|
13
|
+
rules: {
|
|
14
|
+
...baseRules,
|
|
15
|
+
...tsBaseRules,
|
|
16
|
+
...reactRules,
|
|
17
|
+
'react/prop-types': 0,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
const npmClient = fs.existsSync(path.join(process.cwd(), "pnpm-lock.yaml")) ? "pnpm" : "npm";
|
|
6
|
+
const lintStagedConfig = {
|
|
7
|
+
"*.{js,ts,jsx,tsx,md,mdx,html,css,json}": ["prettier --write"],
|
|
8
|
+
"*.{ts,tsx}": [
|
|
9
|
+
`node ${path.resolve(__dirname, "../typescript/tsc-files/index.js")} --noEmit --emitDeclarationOnly false`
|
|
10
|
+
],
|
|
11
|
+
"*.{js,ts,jsx,tsx}": [
|
|
12
|
+
`${npmClient} run lint:fix`,
|
|
13
|
+
`${npmClient} run test:staged`,
|
|
14
|
+
`${npmClient} run gendoc`
|
|
15
|
+
]
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
lintStagedConfig
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
exports.stylelintConfig = {
|
|
2
|
+
ignoreFiles: [
|
|
3
|
+
'/dist/**/*',
|
|
4
|
+
'/coverage/**/*',
|
|
5
|
+
'/build/**/*',
|
|
6
|
+
'/reports/**/*',
|
|
7
|
+
'/temp/**/*',
|
|
8
|
+
'/docs/**/*',
|
|
9
|
+
'/demo/**/*',
|
|
10
|
+
'/node_modules/**/*',
|
|
11
|
+
'/vendor/**/*',
|
|
12
|
+
],
|
|
13
|
+
customSyntax: '@stylelint/postcss-css-in-js',
|
|
14
|
+
extends: [
|
|
15
|
+
'stylelint-config-recommended',
|
|
16
|
+
'stylelint-config-styled-components',
|
|
17
|
+
],
|
|
18
|
+
rules: { 'selector-type-no-unknown': null, 'no-extra-semicolons': null, 'function-no-unknown': null },
|
|
19
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
const cwd = process.cwd();
|
|
3
|
+
const execaOptions = { cwd, stdio: "inherit" };
|
|
4
|
+
const semVerRegEx = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
5
|
+
const isSemVersion = (tagName) => semVerRegEx.test(tagName);
|
|
6
|
+
const branchName = (process.env.BRANCH_NAME || "master").toLowerCase();
|
|
7
|
+
const branchTags = {
|
|
8
|
+
master: /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/,
|
|
9
|
+
next: /^v.*-next\.(0|[1-9]\d*)/,
|
|
10
|
+
alpha: /^v.*-alpha\.(0|[1-9]\d*)/,
|
|
11
|
+
beta: /^v.*-beta\.(0|[1-9]\d*)/
|
|
12
|
+
};
|
|
13
|
+
const deleteTags = (cmd, filter) => {
|
|
14
|
+
const result = execSync(cmd, { cwd });
|
|
15
|
+
if (!result)
|
|
16
|
+
return;
|
|
17
|
+
const tags = result.toString().split("\n").join(" ");
|
|
18
|
+
execSync(`git tag -d ${filter ? filter(tags) : tags}`, { cwd });
|
|
19
|
+
};
|
|
20
|
+
const tagsFromOtherBranches = (tags = []) => {
|
|
21
|
+
const regex = branchTags[branchName] || branchTags.master;
|
|
22
|
+
return tags.split(" ").filter((tagName) => isSemVersion(tagName) && !regex.test(tagName)).join(" ");
|
|
23
|
+
};
|
|
24
|
+
const deleteMergedTags = () => {
|
|
25
|
+
try {
|
|
26
|
+
if (branchName) {
|
|
27
|
+
deleteTags(`git tag -l --no-merged ${branchName}`);
|
|
28
|
+
deleteTags(`git tag -l --merged ${branchName}`, tagsFromOtherBranches);
|
|
29
|
+
console.log("Last two tags: ");
|
|
30
|
+
execSync("git tag --sort=-creatordate | head -n 2", execaOptions);
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error(error);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
deleteMergedTags
|
|
38
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import fg from "fast-glob";
|
|
3
|
+
import normalizePath from "normalize-path";
|
|
4
|
+
import { findMonoRepoRoot } from "./utils.js";
|
|
5
|
+
const monorepoRoot = normalizePath(findMonoRepoRoot() || "");
|
|
6
|
+
const setRegistryVersion = async () => {
|
|
7
|
+
const files = await fg([
|
|
8
|
+
`${monorepoRoot}/libs/*/package.json`,
|
|
9
|
+
`${monorepoRoot}/apps/*/package.json`,
|
|
10
|
+
`${monorepoRoot}/package.json`
|
|
11
|
+
]);
|
|
12
|
+
Promise.all(files.map(async (file) => {
|
|
13
|
+
let pkgJSONData = await readFile(file, "utf8");
|
|
14
|
+
const pkgVersion = JSON.parse(pkgJSONData).version;
|
|
15
|
+
pkgJSONData = pkgJSONData.replace(/workspace:\*/g, pkgVersion);
|
|
16
|
+
await writeFile(file, pkgJSONData);
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
setRegistryVersion
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import fg from "fast-glob";
|
|
3
|
+
import normalizePath from "normalize-path";
|
|
4
|
+
import { findMonoRepoRoot } from "./utils.js";
|
|
5
|
+
const monorepoRoot = normalizePath(findMonoRepoRoot() || "");
|
|
6
|
+
const setWorkspaceVersion = async () => {
|
|
7
|
+
const files = await fg([
|
|
8
|
+
`${monorepoRoot}/libs/*/package.json`,
|
|
9
|
+
`${monorepoRoot}/apps/*/package.json`,
|
|
10
|
+
`${monorepoRoot}/package.json`
|
|
11
|
+
]);
|
|
12
|
+
Promise.all(files.map(async (file) => {
|
|
13
|
+
let pkgJSONData = await readFile(file, "utf8");
|
|
14
|
+
const pkgVersion = JSON.parse(pkgJSONData).version;
|
|
15
|
+
pkgJSONData = pkgJSONData.replace(new RegExp(pkgVersion, "g"), "workspace:*");
|
|
16
|
+
pkgJSONData = pkgJSONData.replace(/"version": "workspace:\*"/g, `"version": "${pkgVersion}"`);
|
|
17
|
+
await writeFile(file, pkgJSONData);
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
setWorkspaceVersion
|
|
22
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { findUpSync } from "find-up";
|
|
3
|
+
const WORKSPACE_DIR_ENV_VAR = "NPM_CONFIG_WORKSPACE_DIR";
|
|
4
|
+
const WORKSPACE_MANIFEST_FILENAME = "pnpm-workspace.yaml";
|
|
5
|
+
const findMonoRepoRoot = (cwd = process.cwd()) => {
|
|
6
|
+
const workspaceManifestDirEnvVar = process.env[WORKSPACE_DIR_ENV_VAR] ?? process.env[WORKSPACE_DIR_ENV_VAR.toLowerCase()];
|
|
7
|
+
const workspaceManifestLocation = workspaceManifestDirEnvVar ? path.join(workspaceManifestDirEnvVar, "pnpm-workspace.yaml") : findUpSync([WORKSPACE_MANIFEST_FILENAME, "pnpm-workspace.yml"], { cwd });
|
|
8
|
+
return workspaceManifestLocation && path.dirname(workspaceManifestLocation);
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
findMonoRepoRoot
|
|
12
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { merge } from "lodash";
|
|
4
|
+
const baseConfig = {
|
|
5
|
+
esBuild: {
|
|
6
|
+
target: "es2020"
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
const getPUIConfig = () => {
|
|
10
|
+
const configPath = path.resolve(process.cwd(), "./pui.config.js");
|
|
11
|
+
if (!fs.existsSync(configPath))
|
|
12
|
+
return baseConfig;
|
|
13
|
+
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
14
|
+
return merge(baseConfig, config);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
getPUIConfig
|
|
18
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
branches: [
|
|
3
|
+
'+([0-9])?(.{+([0-9]),x}).x',
|
|
4
|
+
'master',
|
|
5
|
+
'next-major',
|
|
6
|
+
{ name: 'beta', prerelease: true },
|
|
7
|
+
{ name: 'alpha', prerelease: true },
|
|
8
|
+
{ name: 'hotfix', prerelease: true },
|
|
9
|
+
{ name: 'next', prerelease: true },
|
|
10
|
+
],
|
|
11
|
+
plugins: [
|
|
12
|
+
'@semantic-release/commit-analyzer',
|
|
13
|
+
'@semantic-release/release-notes-generator',
|
|
14
|
+
[
|
|
15
|
+
'@semantic-release/changelog',
|
|
16
|
+
{
|
|
17
|
+
changelogTitle:
|
|
18
|
+
'# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines.',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
'@semantic-release/npm',
|
|
22
|
+
'@semantic-release/github',
|
|
23
|
+
[
|
|
24
|
+
'@semantic-release/exec',
|
|
25
|
+
{
|
|
26
|
+
successCmd:
|
|
27
|
+
'scmutil get slack-release-notes && scmutil get contributors',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
],
|
|
31
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import readline from "readline";
|
|
2
|
+
function progress_default(message, amountOfDots = 3) {
|
|
3
|
+
let i = 0;
|
|
4
|
+
return setInterval(() => {
|
|
5
|
+
readline.cursorTo(process.stdout, 0);
|
|
6
|
+
i = (i + 1) % (amountOfDots + 1);
|
|
7
|
+
const dots = new Array(i + 1).join(".");
|
|
8
|
+
process.stdout.write(message + dots);
|
|
9
|
+
}, 500);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
progress_default as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import updateNotifier from "update-notifier";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs/promises";
|
|
4
|
+
var update_notifier_default = async () => {
|
|
5
|
+
const pkgFile = await fs.readFile(path.join(process.cwd(), "./package.json"));
|
|
6
|
+
const pkg = JSON.parse(pkgFile);
|
|
7
|
+
updateNotifier({ pkg }).notify();
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
update_notifier_default as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import cspPolicy from "helmet-csp";
|
|
4
|
+
import crypto from "crypto";
|
|
5
|
+
const sources = [
|
|
6
|
+
"'self'",
|
|
7
|
+
"http://localhost:*",
|
|
8
|
+
"*.elliemae.io",
|
|
9
|
+
"*.elliemae.com",
|
|
10
|
+
"*.elliservices.com",
|
|
11
|
+
"*.ellielabs.com",
|
|
12
|
+
"http://pdx-col.eum-appdynamics.com",
|
|
13
|
+
"https://pdx-col.eum-appdynamics.com/",
|
|
14
|
+
"https://www.google-analytics.com",
|
|
15
|
+
"https://www.googletagmanager.com"
|
|
16
|
+
];
|
|
17
|
+
const sendFileWithCSPNonce = ({
|
|
18
|
+
buildPath,
|
|
19
|
+
page = "index.html",
|
|
20
|
+
nonceRegex = /__CSP_NONCE__/g,
|
|
21
|
+
res,
|
|
22
|
+
fileSystem = fs
|
|
23
|
+
}) => {
|
|
24
|
+
fileSystem.readFile(path.resolve(buildPath, page), "utf8", (err, html) => {
|
|
25
|
+
if (err) {
|
|
26
|
+
res.sendStatus(404);
|
|
27
|
+
} else {
|
|
28
|
+
res.set("Content-Type", "text/html");
|
|
29
|
+
res.send(html.replace(nonceRegex, (res.locals || {}).cspNonce));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const getScriptSrc = () => {
|
|
34
|
+
const scriptSrc = sources.concat([
|
|
35
|
+
(req, res) => `'nonce-${res.locals.cspNonce}'`
|
|
36
|
+
]);
|
|
37
|
+
return true ? scriptSrc.concat(["'unsafe-eval'"]) : scriptSrc;
|
|
38
|
+
};
|
|
39
|
+
const csp = (app) => {
|
|
40
|
+
app.use((req, res, next) => {
|
|
41
|
+
res.locals.cspNonce = crypto.randomBytes(16).toString("hex");
|
|
42
|
+
next();
|
|
43
|
+
});
|
|
44
|
+
app.use(cspPolicy({
|
|
45
|
+
directives: {
|
|
46
|
+
defaultSrc: ["'self'"],
|
|
47
|
+
baseUri: ["'self'"],
|
|
48
|
+
blockAllMixedContent: [],
|
|
49
|
+
connectSrc: sources,
|
|
50
|
+
fontSrc: sources.concat(["data:"]),
|
|
51
|
+
frameAncestors: sources,
|
|
52
|
+
imgSrc: sources.concat(["data:"]),
|
|
53
|
+
objectSrc: ["'none'"],
|
|
54
|
+
scriptSrc: getScriptSrc(),
|
|
55
|
+
scriptSrcAttr: ["'none'"],
|
|
56
|
+
styleSrc: sources.concat(["'unsafe-inline'"]),
|
|
57
|
+
upgradeInsecureRequests: [],
|
|
58
|
+
reportUri: "/v1/csp"
|
|
59
|
+
},
|
|
60
|
+
reportOnly: true
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
csp,
|
|
65
|
+
sendFileWithCSPNonce
|
|
66
|
+
};
|