linear-react-components-ui 1.1.19-beta.0 → 1.1.19-beta.1

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.
@@ -65,8 +65,6 @@ const TreeNode = props => {
65
65
  const checked = selectedIds && selectedIds.includes(node[valuePropName]) || required;
66
66
  if (node !== props.node) {
67
67
  setNode(props.node);
68
- setIsVisible(startNodesOpened && nodeHasItens(node));
69
- setWasOpened(startNodesOpened && nodeHasItens(node));
70
68
  }
71
69
  const openCloseTree = currentNode => {
72
70
  if (!wasOpened && handlerOnNodeOpen) {
@@ -180,6 +178,10 @@ const TreeNode = props => {
180
178
  customClass: "node-toolbarelements"
181
179
  }, /*#__PURE__*/_react.default.createElement(_toolbar.ToolBarGroup, null, updatedNodeRightElements)) : null;
182
180
  };
181
+ (0, _react.useEffect)(() => {
182
+ setIsVisible(startNodesOpened && nodeHasItens(node));
183
+ setWasOpened(startNodesOpened && nodeHasItens(node));
184
+ }, [node]);
183
185
  return /*#__PURE__*/_react.default.createElement("li", {
184
186
  className: "treeviewitem"
185
187
  }, getSpan(), /*#__PURE__*/_react.default.createElement("div", {
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.1.19-beta.0",
3
+ "version": "1.1.19-beta.1",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",
7
+ "files": [
8
+ "lib"
9
+ ],
7
10
  "scripts": {
8
11
  "lib": "babel src/lib/ -d lib/ --extensions \".js,.jsx,.ts,.tsx\" --ignore **/*.spec.tsx && babel src/lib/assets -d lib/assets --copy-files && npm run lib:types",
9
12
  "lib:types": "tsup --dts-only --dts --external react",
package/.editorconfig DELETED
@@ -1,19 +0,0 @@
1
- # EditorConfig is awesome: http://EditorConfig.org
2
-
3
- # top-most EditorConfig file
4
- root = true
5
-
6
- [*.md]
7
- trim_trailing_whitespace = false
8
-
9
- [*.js]
10
- trim_trailing_whitespace = true
11
-
12
- # Unix-style newlines with a newline ending every file
13
- [*]
14
- indent_style = space
15
- indent_size = 2
16
- end_of_line = lf
17
- charset = utf-8
18
- insert_final_newline = true
19
- max_line_length = 100
package/.eslintrc.json DELETED
@@ -1,68 +0,0 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "jest": true
5
- },
6
- "extends": [
7
- "eslint:recommended",
8
- "plugin:react/recommended",
9
- "plugin:react-hooks/recommended",
10
- "plugin:import/recommended",
11
- "airbnb-typescript"
12
- ],
13
- "parser": "@typescript-eslint/parser",
14
- "parserOptions": {
15
- "ecmaFeatures": { "jsx": true },
16
- "ecmaVersion": "latest",
17
- "sourceType": "module",
18
- "project": ["./tsconfig.json", "./images.d.ts"]
19
- },
20
- "plugins": ["react", "@typescript-eslint", "jsx-a11y"],
21
- "rules": {
22
- "react/jsx-filename-extension": [1, { "extensions": [".tsx", ".jsx"] }],
23
- "import/no-extraneous-dependencies": ["off", {"devDependencies": false, "optionalDependencies": false, "peerDependencies": false}],
24
- "jsx-a11y/no-static-element-interactions": "off",
25
- "react/jsx-indent": "off",
26
- "react/jsx-uses-react": "off",
27
- "react/react-in-jsx-scope": "off",
28
- "@typescript-eslint/indent": ["error", 2],
29
- "import/prefer-default-export": [0],
30
- "prefer-destructuring": ["error", {"object": true, "array": false}],
31
- "react/forbid-prop-types": ["error", { "forbid": ["array"] }],
32
- "react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
33
- "react/jsx-closing-bracket-location": ["error", "after-props"],
34
- "react/no-unused-prop-types": [0],
35
- "jsx-a11y/heading-has-content": "off",
36
- "jsx-a11y/anchor-has-content": "off",
37
- "jsx-a11y/anchor-is-valid": [ "error", {
38
- "components": [ "Link" ],
39
- "specialLink": [ "hrefLeft", "hrefRight" ],
40
- "aspects": ["preferButton" ]
41
- }],
42
- "jsx-a11y/no-autofocus": [0],
43
- "object-curly-newline": [0],
44
- "jsx-a11y/label-has-for": [0],
45
- "@typescript-eslint/no-useless-constructor": "off",
46
- "@typescript-eslint/no-throw-literal": "off",
47
- "react/function-component-definition": "off",
48
- "arrow-parens": "off",
49
- "react-hooks/exhaustive-deps": "off",
50
- "react/jsx-props-no-spreading": "off",
51
- "implicit-arrow-linebreak": "off",
52
- "function-paren-newline": "off",
53
- "react/destructuring-assignment": "off",
54
- "react/jsx-no-constructed-context-values": "off",
55
- "@typescript-eslint/no-unused-vars": "off",
56
- "react/no-unknown-property": ["error", { "ignore": ["align"] }],
57
- "no-console": "warn"
58
- },
59
- "settings": {
60
- "react": {
61
- "version": "detect"
62
- },
63
- "import/extensions": [".js", ".mjs", ".jsx", ".ts", ".tsx", ".d.ts"],
64
- "import/parser": {
65
- "@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"]
66
- }
67
- }
68
- }
package/.gitlab-ci.yml DELETED
@@ -1,27 +0,0 @@
1
- stages:
2
- - lint
3
- - tests-units
4
-
5
- cache:
6
- key:
7
- files:
8
- - package-lock.json
9
- paths:
10
- - .npm
11
- - .eslintcache
12
-
13
- lint:
14
- stage: lint
15
- image: node:20.11.0
16
- before_script:
17
- - npm ci --legacy-peer-deps --cache .npm --prefer-offline
18
- script:
19
- - npm run check:js
20
-
21
- units:
22
- stage: tests-units
23
- image: node:20.11.0
24
- before_script:
25
- - npm ci --legacy-peer-deps --cache .npm --prefer-offline
26
- script:
27
- - npm run test
package/.husky/pre-push DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npm run check:js
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- v20.11.0
package/.stylelintrc DELETED
@@ -1,26 +0,0 @@
1
- #https://stylelint.io/user-guide/
2
- {
3
- "rules": {
4
- "block-no-empty": null,
5
- "color-no-invalid-hex": true,
6
- "comment-empty-line-before": [ "always", {
7
- "ignore": ["stylelint-commands", "after-comment"]
8
- } ],
9
- "declaration-colon-space-after": "always",
10
- "indentation": [2, {
11
- "except": ["value"]
12
- }],
13
- "max-empty-lines": 2,
14
- "rule-empty-line-before": [ "never", {
15
- "except": ["after-rule", "after-single-line-comment"],
16
- "ignore": ["after-comment", "inside-block"]
17
- } ],
18
- "unit-whitelist": ["em", "rem", "%", "px", "ms", "fr", "s", "deg"],
19
- "block-opening-brace-space-before": "always",
20
- "block-closing-brace-newline-before": "always",
21
- "comment-no-empty": true,
22
- "no-extra-semicolons": true,
23
- "shorthand-property-no-redundant-values": true,
24
- "declaration-block-no-redundant-longhand-properties": true,
25
- }
26
- }
@@ -1,15 +0,0 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "type": "pwa-chrome",
9
- "request": "launch",
10
- "name": "Launch Chrome against localhost",
11
- "url": "http://localhost:3001",
12
- "webRoot": "${workspaceFolder}"
13
- }
14
- ]
15
- }
@@ -1,22 +0,0 @@
1
- {
2
- "files.exclude": {
3
- "config": true,
4
- "coverage": true,
5
- "node_modules": true,
6
- "scripts": true,
7
- ".eslintrc.js": true,
8
- ".gitignore": true,
9
- "package-lock.json": true,
10
- ".nvmrc": true,
11
- ".npmignore": true,
12
- ".editorconfig": true,
13
- ".stylelintrc": true,
14
- "jest.config.js": true,
15
- "tsup.config.ts": true,
16
- "LICENSE": true,
17
- "babel.config.json": true,
18
- },
19
- "editor.codeActionsOnSave": {
20
- "source.fixAll.eslint": "explicit"
21
- },
22
- }
package/babel.config.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "presets": [
3
- "@babel/preset-env",
4
- "@babel/preset-react",
5
- "@babel/preset-typescript"
6
- ],
7
- "plugins": [
8
- "@babel/plugin-transform-object-rest-spread",
9
- "@babel/plugin-transform-class-properties"
10
- ]
11
- }
@@ -1,56 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const crypto = require('crypto');
4
- const chalk = require('react-dev-utils/chalk');
5
- const paths = require('./paths');
6
-
7
- // Ensure the certificate and key provided are valid and if not
8
- // throw an easy to debug error
9
- function validateKeyAndCerts({ cert, key, keyFile, crtFile }) {
10
- let encrypted;
11
- try {
12
- // publicEncrypt will throw an error with an invalid cert
13
- encrypted = crypto.publicEncrypt(cert, Buffer.from('test'));
14
- } catch (err) {
15
- throw new Error(`The certificate "${chalk.yellow(crtFile)}" is invalid.\n${err.message}`);
16
- }
17
-
18
- try {
19
- // privateDecrypt will throw an error with an invalid key
20
- crypto.privateDecrypt(key, encrypted);
21
- } catch (err) {
22
- throw new Error(`The certificate key "${chalk.yellow(keyFile)}" is invalid.\n${
23
- err.message
24
- }`);
25
- }
26
- }
27
-
28
- // Read file and throw an error if it doesn't exist
29
- function readEnvFile(file, type) {
30
- if (!fs.existsSync(file)) {
31
- throw new Error(`You specified ${chalk.cyan(type)} in your env, but the file "${chalk.yellow(file)}" can't be found.`);
32
- }
33
- return fs.readFileSync(file);
34
- }
35
-
36
- // Get the https config
37
- // Return cert files if provided in env, otherwise just true or false
38
- function getHttpsConfig() {
39
- const { SSL_CRT_FILE, SSL_KEY_FILE, HTTPS } = process.env;
40
- const isHttps = HTTPS === 'true';
41
-
42
- if (isHttps && SSL_CRT_FILE && SSL_KEY_FILE) {
43
- const crtFile = path.resolve(paths.appPath, SSL_CRT_FILE);
44
- const keyFile = path.resolve(paths.appPath, SSL_KEY_FILE);
45
- const config = {
46
- cert: readEnvFile(crtFile, 'SSL_CRT_FILE'),
47
- key: readEnvFile(keyFile, 'SSL_KEY_FILE'),
48
- };
49
-
50
- validateKeyAndCerts({ ...config, keyFile, crtFile });
51
- return config;
52
- }
53
- return isHttps;
54
- }
55
-
56
- module.exports = getHttpsConfig;
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- // This is a custom Jest transformer turning style imports into empty objects.
4
- // http://facebook.github.io/jest/docs/en/webpack.html
5
-
6
- module.exports = {
7
- process() {
8
- return 'module.exports = {};';
9
- },
10
- getCacheKey() {
11
- // The output is always the same.
12
- return 'cssTransform';
13
- },
14
- };
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
-
5
- // This is a custom Jest transformer turning file imports into filenames.
6
- // http://facebook.github.io/jest/docs/en/webpack.html
7
-
8
- module.exports = {
9
- process(src, filename) {
10
- return `module.exports = ${JSON.stringify(path.basename(filename))};`;
11
- },
12
- };
@@ -1,40 +0,0 @@
1
- export const sessionStorageValueMock = '{"SG_CADASTROS":[{"nome":"Empresas","codigo":"SG_CADASTROS_EMPRESAS","permissoes":[{"codigo":"SG_CADASTROS_EMPRESAS_GRAVAR"},{"codigo":"SG_CADASTROS_EMPRESAS_CONSULTAR"},{"codigo":"SG_CADASTROS_EMPRESAS_EXCLUIR"},{"codigo":"SG_CADASTROS_EMPRESAS_RESTAURAR"},{"codigo":"SG_CADASTROS_EMPRESAS_ATIVAR"},{"codigo":"SG_CADASTROS_EMPRESAS_INATIVAR"}],"descricao":"Gestão das Empresas","itens":[]},{"nome":"Parceiros","codigo":"SG_CADASTROS_PARCEIROS","permissoes":[{"codigo":"SG_CADASTROS_PARCEIROS_GRAVAR"},{"codigo":"SG_CADASTROS_PARCEIROS_CONSULTAR"},{"codigo":"SG_CADASTROS_PARCEIROS_EXCLUIR"},{"codigo":"SG_CADASTROS_PARCEIROS_CONTATOS_GRAVAR"},{"codigo":"SG_CADASTROS_PARCEIROS_CONTATOS_CONSULTAR"},{"codigo":"SG_CADASTROS_PARCEIROS_RESTAURAR"},{"codigo":"SG_CADASTROS_PARCEIROS_ATIVAR"},{"codigo":"SG_CADASTROS_PARCEIROS_INATIVAR"}],"descricao":"Gestão de Pessoas que se relacionam com as Empresas","itens":[]},{"nome":"Produtos","codigo":"SG_CADASTROS_PRODUTOS","permissoes":[],"itens":[{"nome":"Produtos em Promoção","codigo":"SG_CADASTROS_PRODUTOS_EM_PROMOCAO","permissoes":[{"codigo":"SG_CADASTROS_PRODUTOS_EM_PROMOCAO_CONSULTAR"},{"codigo":"SG_CADASTROS_PRODUTOS_EM_PROMOCAO_VISUALIZAR"},{"codigo":"SG_CADASTROS_PRODUTOS_EM_PROMOCAO_NAO_EXPIRADAS"},{"codigo":"SG_CADASTROS_PRODUTOS_EM_PROMOCAO_UPLOAD_IMAGEM"},{"codigo":"SG_CADASTROS_PRODUTOS_EM_PROMOCAO_TROCAR_IMAGEM"}],"descricao":"Manutenção de Produtos em Promoção E-PROMO","itens":[]},{"nome":"Imagens dos Produtos","codigo":"SG_CADASTROS_PRODUTOS_IMAGENS","permissoes":[{"codigo":"SG_CADASTROS_PRODUTOS_IMAGENS_CONSULTAR"},{"codigo":"SG_CADASTROS_PRODUTOS_IMAGENS_VISUALIZAR"},{"codigo":"SG_CADASTROS_PRODUTOS_IMAGENS_INCLUIR"},{"codigo":"SG_CADASTROS_PRODUTOS_IMAGENS_EDITAR"},{"codigo":"SG_CADASTROS_PRODUTOS_IMAGENS_EXCLUIR"}],"descricao":"Manutenção das imagens privadas dos produtos","itens":[]}]},{"nome":"Tabelas Auxiliares","codigo":"SG_CADASTROS_TABELAS_AUXILIARES","permissoes":[],"descricao":"Cadastros de Tabelas Auxliliares","itens":[{"nome":"Grupo vendedor","codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_VENDEDOR","permissoes":[{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_VENDEDOR_INCLUIR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_VENDEDOR_ALTERAR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_VENDEDOR_PESQUISAR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_VENDEDOR_VISUALIZAR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_VENDEDOR_EXCLUIR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_VENDEDOR_RESTAURAR"}],"descricao":"Gestão de grupos de vendedores","itens":[]},{"nome":"Cadastro de Setor Colaborador","codigo":"SG_CADASTROS_TABELAS_AUXILIARES_SETOR_COLABORADOR","permissoes":[{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_SETOR_COLABORADOR_INCLUIR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_SETOR_COLABORADOR_ALTERAR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_SETOR_COLABORADOR_PESQUISAR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_SETOR_COLABORADOR_VISUALIZAR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_SETOR_COLABORADOR_EXCLUIR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_SETOR_COLABORADOR_RESTAURAR"}],"descricao":"Permite o cadastro de setor colaborador","itens":[]},{"nome":"Grupos de empresas","codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_EMPRESA","permissoes":[{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_EMPRESA_INCLUIR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_EMPRESA_ALTERAR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_EMPRESA_PESQUISAR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_EMPRESA_VISUALIZAR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_EMPRESA_EXCLUIR"},{"codigo":"SG_CADASTROS_TABELAS_AUXILIARES_GRUPO_EMPRESA_RESTAURAR"}],"descricao":"Gestão de grupos de empresas","itens":[]}]},{"nome":"Cadastro de turnos","codigo":"SG_CADASTROS_TURNO","permissoes":[{"codigo":"SG_CADASTROS_TURNO_INCLUIR"},{"codigo":"SG_CADASTROS_TURNO_ALTERAR"},{"codigo":"SG_CADASTROS_TURNO_PESQUISAR"},{"codigo":"SG_CADASTROS_TURNO_VISUALIZAR"},{"codigo":"SG_CADASTROS_TURNO_EXCLUIR"},{"codigo":"SG_CADASTROS_TURNO_RESTAURAR"}],"descricao":"Permite o cadastro de turnos","itens":[],"codigoPaiExibicao":"SG_ADMINISTRATIVO_TABELAS_SISTEMA"}]}';
2
-
3
- const storageMock = () => {
4
- const storage = {
5
- permissionsStorage: sessionStorageValueMock,
6
- };
7
-
8
- return {
9
- setItem: (key, value) => {
10
- storage[key] = value || '';
11
- },
12
- getItem: key => storage[key] || null,
13
- removeItem: (key) => {
14
- delete storage[key];
15
- },
16
- get length() {
17
- return Object.keys(storage).length;
18
- },
19
- key: (i) => {
20
- const keys = Object.keys(storage);
21
- return keys[i] || null;
22
- },
23
- };
24
- };
25
-
26
- export default storageMock;
27
-
28
- export const permissionAttrMockAuthorized = onDenied => ({
29
- module: 'SG_CADASTROS',
30
- feature: 'SG_CADASTROS_EMPRESAS',
31
- operation: 'SG_CADASTROS_EMPRESAS_GRAVAR',
32
- onDenied,
33
- });
34
-
35
- export const permissionAttrMockUnauthorized = onDenied => ({
36
- module: 'SG_COMPRAS_CADASTROS',
37
- feature: 'SG_COMPRAS_CADASTROS_MOTIVO_BAIXAS_PEDIDOS_COMPRAS',
38
- operation: 'SG_COMPRAS_CADASTROS_MOTIVO_BAIXAS_PEDIDOS_COMPRAS_INCLUIR',
39
- onDenied,
40
- });
package/config/paths.js DELETED
@@ -1,140 +0,0 @@
1
- /* eslint-disable import/no-dynamic-require */
2
-
3
- const path = require('path');
4
- const fs = require('fs');
5
-
6
- // Make sure any symlinks in the project folder are resolved:
7
- // https://github.com/facebook/create-react-app/issues/637
8
- const appDirectory = fs.realpathSync(process.cwd());
9
- const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
10
-
11
- // We use `PUBLIC_URL` environment variable or "homepage" field to infer
12
- // "public path" at which the app is served.
13
- // webpack needs to know it to put the right <script> hrefs into HTML even in
14
- // single-page apps that may serve index.html for nested URLs like /todos/42.
15
- // We can't use a relative path in HTML because we don't want to load something
16
- // like /todos/42/static/js/bundle.7289d.js. We have to know the root.
17
- const publicUrlOrPath = '/';
18
-
19
- const buildPath = process.env.BUILD_PATH || 'build';
20
-
21
- const moduleFileExtensions = [
22
- 'web.mjs',
23
- 'mjs',
24
- 'web.js',
25
- 'js',
26
- 'web.ts',
27
- 'ts',
28
- 'web.tsx',
29
- 'tsx',
30
- 'json',
31
- 'web.jsx',
32
- 'jsx',
33
- ];
34
-
35
- // Resolve file paths in the same order as webpack
36
- const resolveModule = (resolveFn, filePath) => {
37
- const extension = moduleFileExtensions.find(ext =>
38
- fs.existsSync(resolveFn(`${filePath}.${ext}`)));
39
-
40
- if (extension) {
41
- return resolveFn(`${filePath}.${extension}`);
42
- }
43
-
44
- return resolveFn(`${filePath}.js`);
45
- };
46
-
47
- // config after eject: we're in ./config/
48
- module.exports = {
49
- dotenv: resolveApp('.env'),
50
- appPath: resolveApp('.'),
51
- appBuild: resolveApp(buildPath),
52
- appPublic: resolveApp('src/demo'),
53
- appHtml: resolveApp('src/demo/index.html'),
54
- appIndexJs: resolveModule(resolveApp, 'src/demo/index'),
55
- appPackageJson: resolveApp('package.json'),
56
- appSrc: resolveApp('src'),
57
- appTsConfig: resolveApp('tsconfig.json'),
58
- appJsConfig: resolveApp('jsconfig.json'),
59
- yarnLockFile: resolveApp('yarn.lock'),
60
- testsSetup: resolveModule(resolveApp, 'src/setupTests'),
61
- proxySetup: resolveApp('src/setupProxy.js'),
62
- appNodeModules: resolveApp('node_modules'),
63
- appWebpackCache: resolveApp('node_modules/.cache'),
64
- appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
65
- swSrc: resolveModule(resolveApp, 'src/service-worker'),
66
- publicUrlOrPath,
67
- };
68
-
69
- // @remove-on-eject-begin
70
- const resolveOwn = relativePath => path.resolve(__dirname, '..', relativePath);
71
-
72
- // config before eject: we're in ./node_modules/react-scripts/config/
73
- module.exports = {
74
- dotenv: resolveApp('.env'),
75
- appPath: resolveApp('.'),
76
- appBuild: resolveApp(buildPath),
77
- appPublic: resolveApp('src/demo'),
78
- appHtml: resolveApp('src/demo/index.html'),
79
- appIndexJs: resolveModule(resolveApp, 'src/demo/index'),
80
- appPackageJson: resolveApp('package.json'),
81
- appSrc: resolveApp('src'),
82
- appTsConfig: resolveApp('tsconfig.json'),
83
- appJsConfig: resolveApp('jsconfig.json'),
84
- yarnLockFile: resolveApp('yarn.lock'),
85
- testsSetup: resolveModule(resolveApp, 'src/setupTests'),
86
- proxySetup: resolveApp('src/setupProxy.js'),
87
- appNodeModules: resolveApp('node_modules'),
88
- appWebpackCache: resolveApp('node_modules/.cache'),
89
- appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
90
- swSrc: resolveModule(resolveApp, 'src/service-worker'),
91
- publicUrlOrPath,
92
- // These properties only exist before ejecting:
93
- ownPath: resolveOwn('.'),
94
- ownNodeModules: resolveOwn('node_modules'), // This is empty on npm 3
95
- appTypeDeclarations: resolveApp('src/react-app-env.d.ts'),
96
- ownTypeDeclarations: resolveOwn('lib/react-app.d.ts'),
97
- };
98
-
99
- const ownPackageJson = require('../package.json');
100
-
101
- const reactScriptsPath = resolveApp(`node_modules/${ownPackageJson.name}`);
102
- const reactScriptsLinked =
103
- fs.existsSync(reactScriptsPath) &&
104
- fs.lstatSync(reactScriptsPath).isSymbolicLink();
105
-
106
- // config before publish: we're in ./packages/react-scripts/config/
107
- if (
108
- !reactScriptsLinked &&
109
- __dirname.indexOf(path.join('packages', 'react-scripts', 'config')) !== -1
110
- ) {
111
- const templatePath = '../cra-template/template';
112
- module.exports = {
113
- dotenv: resolveOwn(`${templatePath}/.env`),
114
- appPath: resolveApp('.'),
115
- appBuild: resolveOwn(path.join('../..', buildPath)),
116
- appPublic: resolveOwn(`${templatePath}/public`),
117
- appHtml: resolveOwn(`${templatePath}/public/index.html`),
118
- appIndexJs: resolveModule(resolveOwn, `${templatePath}/src/index`),
119
- appPackageJson: resolveOwn('package.json'),
120
- appSrc: resolveOwn(`${templatePath}/src`),
121
- appTsConfig: resolveOwn(`${templatePath}/tsconfig.json`),
122
- appJsConfig: resolveOwn(`${templatePath}/jsconfig.json`),
123
- yarnLockFile: resolveOwn(`${templatePath}/yarn.lock`),
124
- testsSetup: resolveModule(resolveOwn, `${templatePath}/src/setupTests`),
125
- proxySetup: resolveOwn(`${templatePath}/src/setupProxy.js`),
126
- appNodeModules: resolveOwn('node_modules'),
127
- appWebpackCache: resolveOwn('node_modules/.cache'),
128
- appTsBuildInfoFile: resolveOwn('node_modules/.cache/tsconfig.tsbuildinfo'),
129
- swSrc: resolveModule(resolveOwn, `${templatePath}/src/service-worker`),
130
- publicUrlOrPath,
131
- // These properties only exist before ejecting:
132
- ownPath: resolveOwn('.'),
133
- ownNodeModules: resolveOwn('node_modules'),
134
- appTypeDeclarations: resolveOwn(`${templatePath}/src/react-app-env.d.ts`),
135
- ownTypeDeclarations: resolveOwn('lib/react-app.d.ts'),
136
- };
137
- }
138
- // @remove-on-eject-end
139
-
140
- module.exports.moduleFileExtensions = moduleFileExtensions;
@@ -1,128 +0,0 @@
1
- /* eslint-disable global-require */
2
- /* eslint-disable import/no-dynamic-require */
3
-
4
- const fs = require('fs');
5
- const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware');
6
- const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
7
- const ignoredFiles = require('react-dev-utils/ignoredFiles');
8
- const redirectServedPath = require('react-dev-utils/redirectServedPathMiddleware');
9
- const paths = require('./paths');
10
- const getHttpsConfig = require('./getHttpsConfig');
11
-
12
- const host = process.env.HOST || '0.0.0.0';
13
- const sockHost = process.env.WDS_SOCKET_HOST;
14
- const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
15
- const sockPort = process.env.WDS_SOCKET_PORT;
16
-
17
- module.exports = function (proxy, allowedHost) {
18
- const disableFirewall =
19
- !proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true';
20
- return {
21
- // WebpackDevServer 2.4.3 introduced a security fix that prevents remote
22
- // websites from potentially accessing local content through DNS rebinding:
23
- // https://github.com/webpack/webpack-dev-server/issues/887
24
- // https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
25
- // However, it made several existing use cases such as development in cloud
26
- // environment or subdomains in development significantly more complicated:
27
- // https://github.com/facebook/create-react-app/issues/2271
28
- // https://github.com/facebook/create-react-app/issues/2233
29
- // While we're investigating better solutions, for now we will take a
30
- // compromise. Since our WDS configuration only serves files in the `public`
31
- // folder we won't consider accessing them a vulnerability. However, if you
32
- // use the `proxy` feature, it gets more dangerous because it can expose
33
- // remote code execution vulnerabilities in backends like Django and Rails.
34
- // So we will disable the host check normally, but enable it if you have
35
- // specified the `proxy` setting. Finally, we let you override it if you
36
- // really know what you're doing with a special environment variable.
37
- // Note: ["localhost", ".localhost"] will support subdomains - but we might
38
- // want to allow setting the allowedHosts manually for more complex setups
39
- allowedHosts: disableFirewall ? 'all' : [allowedHost],
40
- headers: {
41
- 'Access-Control-Allow-Origin': '*',
42
- 'Access-Control-Allow-Methods': '*',
43
- 'Access-Control-Allow-Headers': '*',
44
- },
45
- // Enable gzip compression of generated files.
46
- compress: true,
47
- static: {
48
- // By default WebpackDevServer serves physical files from current directory
49
- // in addition to all the virtual build products that it serves from memory.
50
- // This is confusing because those files won’t automatically be available in
51
- // production build folder unless we copy them. However, copying the whole
52
- // project directory is dangerous because we may expose sensitive files.
53
- // Instead, we establish a convention that only files in `public` directory
54
- // get served. Our build script will copy `public` into the `build` folder.
55
- // In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
56
- // <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
57
- // In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
58
- // Note that we only recommend to use `public` folder as an escape hatch
59
- // for files like `favicon.ico`, `manifest.json`, and libraries that are
60
- // for some reason broken when imported through webpack. If you just want to
61
- // use an image, put it in `src` and `import` it from JavaScript instead.
62
- directory: paths.appPublic,
63
- publicPath: [paths.publicUrlOrPath],
64
- // By default files from `contentBase` will not trigger a page reload.
65
- watch: {
66
- // Reportedly, this avoids CPU overload on some systems.
67
- // https://github.com/facebook/create-react-app/issues/293
68
- // src/node_modules is not ignored to support absolute imports
69
- // https://github.com/facebook/create-react-app/issues/1065
70
- ignored: ignoredFiles(paths.appSrc),
71
- },
72
- },
73
- client: {
74
- webSocketURL: {
75
- // Enable custom sockjs pathname for websocket connection to hot reloading server.
76
- // Enable custom sockjs hostname, pathname and port for websocket connection
77
- // to hot reloading server.
78
- hostname: sockHost,
79
- pathname: sockPath,
80
- port: sockPort,
81
- },
82
- overlay: {
83
- errors: true,
84
- warnings: false,
85
- },
86
- },
87
- devMiddleware: {
88
- // It is important to tell WebpackDevServer to use the same "publicPath" path as
89
- // we specified in the webpack config. When homepage is '.', default to serving
90
- // from the root.
91
- // remove last slash so user can land on `/test` instead of `/test/`
92
- publicPath: paths.publicUrlOrPath.slice(0, -1),
93
- },
94
-
95
- https: getHttpsConfig(),
96
- host,
97
- historyApiFallback: {
98
- // Paths with dots should still use the history fallback.
99
- // See https://github.com/facebook/create-react-app/issues/387.
100
- disableDotRule: true,
101
- index: paths.publicUrlOrPath,
102
- },
103
- // `proxy` is run between `before` and `after` `webpack-dev-server` hooks
104
- proxy,
105
- onBeforeSetupMiddleware(devServer) {
106
- // Keep `evalSourceMapMiddleware`
107
- // middlewares before `redirectServedPath` otherwise will not have any effect
108
- // This lets us fetch source contents from webpack for the error overlay
109
- devServer.app.use(evalSourceMapMiddleware(devServer));
110
-
111
- if (fs.existsSync(paths.proxySetup)) {
112
- // This registers user provided middleware for proxy reasons
113
- require(paths.proxySetup)(devServer.app);
114
- }
115
- },
116
- onAfterSetupMiddleware(devServer) {
117
- // Redirect to `PUBLIC_URL` or `homepage` from `package.json` if url not match
118
- devServer.app.use(redirectServedPath(paths.publicUrlOrPath));
119
-
120
- // This service worker file is effectively a 'no-op' that will reset any
121
- // previous service worker registered for the same host:port combination.
122
- // We do this in development to avoid hitting the production cache if
123
- // it used the same host and port.
124
- // https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
125
- devServer.app.use(noopServiceWorkerMiddleware(paths.publicUrlOrPath));
126
- },
127
- };
128
- };
package/jest.config.js DELETED
@@ -1,18 +0,0 @@
1
- module.exports = {
2
- roots: ['<rootDir>'],
3
- transform: {
4
- '\\.(js|jsx|tsx|ts)?$': 'babel-jest',
5
- },
6
- testMatch: [
7
- '<rootDir>/src/**/?(*.)(spec|test).{js,jsx,ts,tsx,mjs}',
8
- ],
9
- moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'node'],
10
- testPathIgnorePatterns: ['/node_modules/', '/public/'],
11
- setupFilesAfterEnv: [
12
- '@testing-library/jest-dom/extend-expect',
13
- ],
14
- moduleNameMapper: {
15
- '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/config/jest/fileTransform.js',
16
- '.+\\.(css|scss)$': 'identity-obj-proxy',
17
- },
18
- };
package/scripts/start.js DELETED
@@ -1,135 +0,0 @@
1
- /* eslint-disable global-require */
2
- /* eslint-disable import/no-dynamic-require */
3
-
4
- // Do this as the first thing so that any code reading it knows the right env.
5
- process.env.BABEL_ENV = 'development';
6
- process.env.NODE_ENV = 'development';
7
-
8
- // Makes the script crash on unhandled rejections instead of silently
9
- // ignoring them. In the future, promise rejections that are not handled will
10
- // terminate the Node.js process with a non-zero exit code.
11
- process.on('unhandledRejection', (err) => {
12
- throw err;
13
- });
14
-
15
- const fs = require('fs');
16
- const chalk = require('react-dev-utils/chalk');
17
- const webpack = require('webpack');
18
- const WebpackDevServer = require('webpack-dev-server');
19
- const clearConsole = require('react-dev-utils/clearConsole');
20
- const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
21
- const {
22
- choosePort,
23
- createCompiler,
24
- prepareProxy,
25
- prepareUrls,
26
- } = require('react-dev-utils/WebpackDevServerUtils');
27
- const openBrowser = require('react-dev-utils/openBrowser');
28
- const semver = require('semver');
29
- // We require that you explicitly set browsers and do not fall back to
30
- // browserslist defaults.
31
- const { checkBrowsers } = require('react-dev-utils/browsersHelper');
32
- const config = require('../config/webpack.config');
33
- const paths = require('../config/paths');
34
- const createDevServerConfig = require('../config/webpackDevServer.config');
35
-
36
- const react = require(require.resolve('react', { paths: [paths.appPath] }));
37
-
38
- const useYarn = fs.existsSync(paths.yarnLockFile);
39
- const isInteractive = process.stdout.isTTY;
40
-
41
- // Warn and crash if required files are missing
42
- if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
43
- process.exit(1);
44
- }
45
-
46
- // Tools like Cloud9 rely on this.
47
- const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3001;
48
- const HOST = process.env.HOST || '0.0.0.0';
49
-
50
- if (process.env.HOST) {
51
- console.log(chalk.cyan(`Attempting to bind to HOST environment variable: ${chalk.yellow(chalk.bold(process.env.HOST))}`));
52
- console.log('If this was unintentional, check that you haven\'t mistakenly set it in your shell.');
53
- console.log(`Learn more here: ${chalk.yellow('https://cra.link/advanced-config')}`);
54
- console.log();
55
- }
56
-
57
- checkBrowsers(paths.appPath, isInteractive)
58
- .then(() =>
59
- // We attempt to use the default port but if it is busy, we offer the user to
60
- // run on a different port. `choosePort()` Promise resolves to the next free port.
61
- choosePort(HOST, DEFAULT_PORT))
62
- .then((port) => {
63
- if (port == null) {
64
- // We have not found a port.
65
- return;
66
- }
67
-
68
- const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
69
- const appName = require(paths.appPackageJson).name;
70
-
71
- const useTypeScript = fs.existsSync(paths.appTsConfig);
72
- const urls = prepareUrls(
73
- protocol,
74
- HOST,
75
- port,
76
- paths.publicUrlOrPath.slice(0, -1),
77
- );
78
- // Create a webpack compiler that is configured with custom messages.
79
- const compiler = createCompiler({
80
- appName,
81
- config,
82
- urls,
83
- useYarn,
84
- useTypeScript,
85
- webpack,
86
- });
87
- // Load proxy config
88
- const proxySetting = require(paths.appPackageJson).proxy;
89
- const proxyConfig = prepareProxy(
90
- proxySetting,
91
- paths.appPublic,
92
- paths.publicUrlOrPath,
93
- );
94
- // Serve webpack assets generated by the compiler over a web server.
95
- const serverConfig = {
96
- ...createDevServerConfig(proxyConfig, urls.lanUrlForConfig),
97
- host: HOST,
98
- port,
99
- };
100
- const devServer = new WebpackDevServer(serverConfig, compiler);
101
- // Launch WebpackDevServer.
102
- devServer.startCallback(() => {
103
- if (isInteractive) {
104
- clearConsole();
105
- }
106
-
107
- if (semver.lt(react.version, '16.10.0')) {
108
- console.log(chalk.yellow(`Fast Refresh requires React 16.10 or higher. You are using React ${react.version}.`));
109
- }
110
-
111
- console.log(chalk.cyan('Starting the development server...\n'));
112
- openBrowser(urls.localUrlForBrowser);
113
- });
114
-
115
- ['SIGINT', 'SIGTERM'].forEach((sig) => {
116
- process.on(sig, () => {
117
- devServer.close();
118
- process.exit();
119
- });
120
- });
121
-
122
- if (process.env.CI !== 'true') {
123
- // Gracefully exit when stdin ends
124
- process.stdin.on('end', () => {
125
- devServer.close();
126
- process.exit();
127
- });
128
- }
129
- })
130
- .catch((err) => {
131
- if (err && err.message) {
132
- console.log(err.message);
133
- }
134
- process.exit(1);
135
- });
package/tsconfig.json DELETED
@@ -1,33 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "allowJs": true,
4
- "allowSyntheticDefaultImports": true,
5
- "baseUrl": ".",
6
- "declaration": true,
7
- "esModuleInterop": true,
8
- "forceConsistentCasingInFileNames": true,
9
- "isolatedModules": true,
10
- "jsx": "react",
11
- "lib": [
12
- "dom",
13
- "dom.iterable",
14
- "esnext"
15
- ],
16
- "moduleResolution": "node",
17
- "resolveJsonModule": true,
18
- "skipLibCheck": true,
19
- "sourceMap": true,
20
- "strict": true,
21
- "target": "es2018"
22
- },
23
- "exclude": [
24
- "!node_modules/@types",
25
- "node_modules",
26
- "config",
27
- "src/**/*.spec.ts",
28
- "src/**/*.test.ts"
29
- ],
30
- "include": ["src/**/*"],
31
- "typeRoots": ["./node_modules/@types"],
32
- "types": ["node"]
33
- }
package/tsup.config.ts DELETED
@@ -1,10 +0,0 @@
1
- /* eslint-disable no-param-reassign */
2
- /* eslint-disable import/no-extraneous-dependencies */
3
- import { defineConfig } from 'tsup';
4
-
5
- export default defineConfig({
6
- entry: ['src/lib/**/!(*.d|*.spec).ts*'],
7
- external: ['react', 'sass'],
8
- clean: true,
9
- outDir: 'lib',
10
- });