gov-ui-core 0.2.6-beta.9 → 0.2.6
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/.storybook/main.ts +36 -37
- package/.storybook/preview.tsx +27 -27
- package/@types/custom.d.ts +43 -43
- package/@types/styles.d.ts +3 -86
- package/README.md +46 -46
- package/build/App.d.ts +3 -3
- package/build/Main.d.ts +5 -5
- package/build/components/Button/DropdownButton.d.ts +15 -15
- package/build/components/Button/SwitchButton.d.ts +7 -7
- package/build/components/Button/index.d.ts +11 -11
- package/build/components/Button/styled.d.ts +10 -11
- package/build/components/Calendar/CalendarNavigation.d.ts +9 -9
- package/build/components/Calendar/constants.d.ts +2 -2
- package/build/components/Calendar/index.d.ts +11 -11
- package/build/components/Calendar/styled.d.ts +2 -2
- package/build/components/Carousel/ArrowButton.d.ts +7 -7
- package/build/components/Carousel/index.d.ts +14 -14
- package/build/components/Carousel/styled.d.ts +2 -2
- package/build/components/Directory/index.d.ts +32 -32
- package/build/components/Directory/styled.d.ts +6 -6
- package/build/components/EmptyBox/index.d.ts +8 -8
- package/build/components/EmptyBox/styled.d.ts +4 -4
- package/build/components/Form/Form.d.ts +21 -21
- package/build/components/Form/Group.d.ts +6 -6
- package/build/components/Form/Item.d.ts +22 -22
- package/build/components/Form/index.d.ts +14 -14
- package/build/components/Form/styled.d.ts +7 -7
- package/build/components/Header/ContentHeader.d.ts +15 -15
- package/build/components/Header/styled.d.ts +5 -5
- package/build/components/Icons/index.d.ts +14 -14
- package/build/components/Input/Checkbox.d.ts +19 -19
- package/build/components/Input/ErrorMessage.d.ts +8 -8
- package/build/components/Input/Input.d.ts +23 -23
- package/build/components/Input/InputNumber.d.ts +8 -8
- package/build/components/Input/Radio.d.ts +16 -16
- package/build/components/Input/Search.d.ts +13 -13
- package/build/components/Input/Select.d.ts +39 -40
- package/build/components/Input/TextArea.d.ts +15 -15
- package/build/components/Input/index.d.ts +19 -19
- package/build/components/Input/styled.d.ts +25 -25
- package/build/components/IntlText/index.d.ts +5 -5
- package/build/components/Loading/OverlayLoading.d.ts +10 -10
- package/build/components/Loading/Spinner.d.ts +9 -9
- package/build/components/Loading/styled.d.ts +10 -10
- package/build/components/Styled/mixins.d.ts +13 -13
- package/build/components/Styled/variable.d.ts +6 -6
- package/build/components/Table/AppendTable.d.ts +26 -26
- package/build/components/Table/AutoTooltip.d.ts +8 -8
- package/build/components/Table/TableBase.d.ts +16 -16
- package/build/components/Table/TableLoading.d.ts +9 -9
- package/build/components/Table/components/Pagination.d.ts +18 -18
- package/build/components/Table/components/PaginationItem.d.ts +9 -9
- package/build/components/Table/index.d.ts +27 -27
- package/build/components/Table/styled.d.ts +25 -25
- package/build/components/ThemeProvider.d.ts +16 -16
- package/build/globalStyle.d.ts +5 -5
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/modules.d.ts +23 -24
- package/build/pages/CreateTable.d.ts +20 -20
- package/build/pages/FormSample.d.ts +5 -5
- package/build/pages/Sample.d.ts +5 -5
- package/build/pages/Sample2.d.ts +5 -5
- package/build/pages/Sample3.d.ts +5 -5
- package/build/pages/Sample4.d.ts +5 -5
- package/build/pages/TableSample.d.ts +5 -5
- package/build/pages/sampleData.d.ts +59 -59
- package/build/reportWebVitals.d.ts +3 -3
- package/build/theme.d.ts +45 -3
- package/build/utils/customState.d.ts +28 -28
- package/build/utils/hookUtils.d.ts +16 -16
- package/build/utils/index.d.ts +35 -35
- package/config/env.js +104 -104
- package/config/getHttpsConfig.js +66 -66
- package/config/jest/babelTransform.js +29 -29
- package/config/jest/cssTransform.js +14 -14
- package/config/jest/fileTransform.js +40 -40
- package/config/modules.js +134 -134
- package/config/paths.js +77 -77
- package/config/webpack/persistentCache/createEnvironmentHash.js +9 -9
- package/config/webpack.config.js +756 -756
- package/config/webpack.prod.config.js +91 -91
- package/config/webpackDevServer.config.js +127 -127
- package/doctor-storybook.log +18 -0
- package/migration-storybook.log +98 -0
- package/package.json +215 -247
- package/public/index.html +43 -43
- package/public/manifest.json +25 -25
- package/public/robots.txt +3 -3
- package/scripts/build.js +217 -217
- package/scripts/start.js +154 -154
- package/scripts/test.js +52 -52
- package/tsconfig.json +34 -34
- package/.eslintrc.json +0 -54
- package/.husky/pre-commit +0 -4
- package/.prettierrc +0 -12
- package/.stylelintrc.json +0 -16
- package/build/20d0d451f31ed3b5c15f.woff +0 -1
- package/build/39285e8af490890e2df4.otf +0 -0
- package/build/3965b6176d1ce958b445.woff +0 -1
- package/build/508d69efb37042551458.woff +0 -1
- package/build/72ba455576ce8174ffa8.otf +0 -0
- package/build/a9ba4978d441af03cd27.woff +0 -1
- package/build/components/Button/constants.d.ts +0 -19
- package/build/components/Chip/constants.d.ts +0 -9
- package/build/components/Chip/index.d.ts +0 -12
- package/build/e65c7edcd47e3e9f5c99.otf +0 -0
- package/build/f7a8dce8dfc249d7e12b.otf +0 -0
- package/build/pages/ButtonSample.d.ts +0 -6
- package/build/pages/ChipSample.d.ts +0 -6
- package/build/pages/InputSample.d.ts +0 -6
- package/build/pages/TailwindSample.d.ts +0 -1
- package/postcss.config.js +0 -8
- package/tailwind.config.js +0 -185
package/scripts/start.js
CHANGED
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Do this as the first thing so that any code reading it knows the right env.
|
|
4
|
-
process.env.BABEL_ENV = 'development';
|
|
5
|
-
process.env.NODE_ENV = 'development';
|
|
6
|
-
|
|
7
|
-
// Makes the script crash on unhandled rejections instead of silently
|
|
8
|
-
// ignoring them. In the future, promise rejections that are not handled will
|
|
9
|
-
// terminate the Node.js process with a non-zero exit code.
|
|
10
|
-
process.on('unhandledRejection', err => {
|
|
11
|
-
throw err;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// Ensure environment variables are read.
|
|
15
|
-
require('../config/env');
|
|
16
|
-
|
|
17
|
-
const fs = require('fs');
|
|
18
|
-
const chalk = require('react-dev-utils/chalk');
|
|
19
|
-
const webpack = require('webpack');
|
|
20
|
-
const WebpackDevServer = require('webpack-dev-server');
|
|
21
|
-
const clearConsole = require('react-dev-utils/clearConsole');
|
|
22
|
-
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
|
23
|
-
const {
|
|
24
|
-
choosePort,
|
|
25
|
-
createCompiler,
|
|
26
|
-
prepareProxy,
|
|
27
|
-
prepareUrls,
|
|
28
|
-
} = require('react-dev-utils/WebpackDevServerUtils');
|
|
29
|
-
const openBrowser = require('react-dev-utils/openBrowser');
|
|
30
|
-
const semver = require('semver');
|
|
31
|
-
const paths = require('../config/paths');
|
|
32
|
-
const configFactory = require('../config/webpack.config');
|
|
33
|
-
const createDevServerConfig = require('../config/webpackDevServer.config');
|
|
34
|
-
const getClientEnvironment = require('../config/env');
|
|
35
|
-
const react = require(require.resolve('react', { paths: [paths.appPath] }));
|
|
36
|
-
|
|
37
|
-
const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
|
|
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) || 4000;
|
|
48
|
-
const HOST = process.env.HOST || '0.0.0.0';
|
|
49
|
-
|
|
50
|
-
if (process.env.HOST) {
|
|
51
|
-
console.log(
|
|
52
|
-
chalk.cyan(
|
|
53
|
-
`Attempting to bind to HOST environment variable: ${chalk.yellow(
|
|
54
|
-
chalk.bold(process.env.HOST)
|
|
55
|
-
)}`
|
|
56
|
-
)
|
|
57
|
-
);
|
|
58
|
-
console.log(
|
|
59
|
-
`If this was unintentional, check that you haven't mistakenly set it in your shell.`
|
|
60
|
-
);
|
|
61
|
-
console.log(
|
|
62
|
-
`Learn more here: ${chalk.yellow('https://cra.link/advanced-config')}`
|
|
63
|
-
);
|
|
64
|
-
console.log();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// We require that you explicitly set browsers and do not fall back to
|
|
68
|
-
// browserslist defaults.
|
|
69
|
-
const { checkBrowsers } = require('react-dev-utils/browsersHelper');
|
|
70
|
-
checkBrowsers(paths.appPath, isInteractive)
|
|
71
|
-
.then(() => {
|
|
72
|
-
// We attempt to use the default port but if it is busy, we offer the user to
|
|
73
|
-
// run on a different port. `choosePort()` Promise resolves to the next free port.
|
|
74
|
-
return choosePort(HOST, DEFAULT_PORT);
|
|
75
|
-
})
|
|
76
|
-
.then(port => {
|
|
77
|
-
if (port == null) {
|
|
78
|
-
// We have not found a port.
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const config = configFactory('development');
|
|
83
|
-
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
84
|
-
const appName = require(paths.appPackageJson).name;
|
|
85
|
-
|
|
86
|
-
const useTypeScript = fs.existsSync(paths.appTsConfig);
|
|
87
|
-
const urls = prepareUrls(
|
|
88
|
-
protocol,
|
|
89
|
-
HOST,
|
|
90
|
-
port,
|
|
91
|
-
paths.publicUrlOrPath.slice(0, -1)
|
|
92
|
-
);
|
|
93
|
-
// Create a webpack compiler that is configured with custom messages.
|
|
94
|
-
const compiler = createCompiler({
|
|
95
|
-
appName,
|
|
96
|
-
config,
|
|
97
|
-
urls,
|
|
98
|
-
useYarn,
|
|
99
|
-
useTypeScript,
|
|
100
|
-
webpack,
|
|
101
|
-
});
|
|
102
|
-
// Load proxy config
|
|
103
|
-
const proxySetting = require(paths.appPackageJson).proxy;
|
|
104
|
-
const proxyConfig = prepareProxy(
|
|
105
|
-
proxySetting,
|
|
106
|
-
paths.appPublic,
|
|
107
|
-
paths.publicUrlOrPath
|
|
108
|
-
);
|
|
109
|
-
// Serve webpack assets generated by the compiler over a web server.
|
|
110
|
-
const serverConfig = {
|
|
111
|
-
...createDevServerConfig(proxyConfig, urls.lanUrlForConfig),
|
|
112
|
-
host: HOST,
|
|
113
|
-
port,
|
|
114
|
-
};
|
|
115
|
-
const devServer = new WebpackDevServer(serverConfig, compiler);
|
|
116
|
-
// Launch WebpackDevServer.
|
|
117
|
-
devServer.startCallback(() => {
|
|
118
|
-
if (isInteractive) {
|
|
119
|
-
clearConsole();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (env.raw.FAST_REFRESH && semver.lt(react.version, '16.10.0')) {
|
|
123
|
-
console.log(
|
|
124
|
-
chalk.yellow(
|
|
125
|
-
`Fast Refresh requires React 16.10 or higher. You are using React ${react.version}.`
|
|
126
|
-
)
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
console.log(chalk.cyan('Starting the development server...\n'));
|
|
131
|
-
openBrowser(urls.localUrlForBrowser);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
['SIGINT', 'SIGTERM'].forEach(function (sig) {
|
|
135
|
-
process.on(sig, function () {
|
|
136
|
-
devServer.close();
|
|
137
|
-
process.exit();
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
if (process.env.CI !== 'true') {
|
|
142
|
-
// Gracefully exit when stdin ends
|
|
143
|
-
process.stdin.on('end', function () {
|
|
144
|
-
devServer.close();
|
|
145
|
-
process.exit();
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
.catch(err => {
|
|
150
|
-
if (err && err.message) {
|
|
151
|
-
console.log(err.message);
|
|
152
|
-
}
|
|
153
|
-
process.exit(1);
|
|
154
|
-
});
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Do this as the first thing so that any code reading it knows the right env.
|
|
4
|
+
process.env.BABEL_ENV = 'development';
|
|
5
|
+
process.env.NODE_ENV = 'development';
|
|
6
|
+
|
|
7
|
+
// Makes the script crash on unhandled rejections instead of silently
|
|
8
|
+
// ignoring them. In the future, promise rejections that are not handled will
|
|
9
|
+
// terminate the Node.js process with a non-zero exit code.
|
|
10
|
+
process.on('unhandledRejection', err => {
|
|
11
|
+
throw err;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Ensure environment variables are read.
|
|
15
|
+
require('../config/env');
|
|
16
|
+
|
|
17
|
+
const fs = require('fs');
|
|
18
|
+
const chalk = require('react-dev-utils/chalk');
|
|
19
|
+
const webpack = require('webpack');
|
|
20
|
+
const WebpackDevServer = require('webpack-dev-server');
|
|
21
|
+
const clearConsole = require('react-dev-utils/clearConsole');
|
|
22
|
+
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
|
23
|
+
const {
|
|
24
|
+
choosePort,
|
|
25
|
+
createCompiler,
|
|
26
|
+
prepareProxy,
|
|
27
|
+
prepareUrls,
|
|
28
|
+
} = require('react-dev-utils/WebpackDevServerUtils');
|
|
29
|
+
const openBrowser = require('react-dev-utils/openBrowser');
|
|
30
|
+
const semver = require('semver');
|
|
31
|
+
const paths = require('../config/paths');
|
|
32
|
+
const configFactory = require('../config/webpack.config');
|
|
33
|
+
const createDevServerConfig = require('../config/webpackDevServer.config');
|
|
34
|
+
const getClientEnvironment = require('../config/env');
|
|
35
|
+
const react = require(require.resolve('react', { paths: [paths.appPath] }));
|
|
36
|
+
|
|
37
|
+
const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
|
|
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) || 4000;
|
|
48
|
+
const HOST = process.env.HOST || '0.0.0.0';
|
|
49
|
+
|
|
50
|
+
if (process.env.HOST) {
|
|
51
|
+
console.log(
|
|
52
|
+
chalk.cyan(
|
|
53
|
+
`Attempting to bind to HOST environment variable: ${chalk.yellow(
|
|
54
|
+
chalk.bold(process.env.HOST)
|
|
55
|
+
)}`
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
console.log(
|
|
59
|
+
`If this was unintentional, check that you haven't mistakenly set it in your shell.`
|
|
60
|
+
);
|
|
61
|
+
console.log(
|
|
62
|
+
`Learn more here: ${chalk.yellow('https://cra.link/advanced-config')}`
|
|
63
|
+
);
|
|
64
|
+
console.log();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// We require that you explicitly set browsers and do not fall back to
|
|
68
|
+
// browserslist defaults.
|
|
69
|
+
const { checkBrowsers } = require('react-dev-utils/browsersHelper');
|
|
70
|
+
checkBrowsers(paths.appPath, isInteractive)
|
|
71
|
+
.then(() => {
|
|
72
|
+
// We attempt to use the default port but if it is busy, we offer the user to
|
|
73
|
+
// run on a different port. `choosePort()` Promise resolves to the next free port.
|
|
74
|
+
return choosePort(HOST, DEFAULT_PORT);
|
|
75
|
+
})
|
|
76
|
+
.then(port => {
|
|
77
|
+
if (port == null) {
|
|
78
|
+
// We have not found a port.
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const config = configFactory('development');
|
|
83
|
+
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
84
|
+
const appName = require(paths.appPackageJson).name;
|
|
85
|
+
|
|
86
|
+
const useTypeScript = fs.existsSync(paths.appTsConfig);
|
|
87
|
+
const urls = prepareUrls(
|
|
88
|
+
protocol,
|
|
89
|
+
HOST,
|
|
90
|
+
port,
|
|
91
|
+
paths.publicUrlOrPath.slice(0, -1)
|
|
92
|
+
);
|
|
93
|
+
// Create a webpack compiler that is configured with custom messages.
|
|
94
|
+
const compiler = createCompiler({
|
|
95
|
+
appName,
|
|
96
|
+
config,
|
|
97
|
+
urls,
|
|
98
|
+
useYarn,
|
|
99
|
+
useTypeScript,
|
|
100
|
+
webpack,
|
|
101
|
+
});
|
|
102
|
+
// Load proxy config
|
|
103
|
+
const proxySetting = require(paths.appPackageJson).proxy;
|
|
104
|
+
const proxyConfig = prepareProxy(
|
|
105
|
+
proxySetting,
|
|
106
|
+
paths.appPublic,
|
|
107
|
+
paths.publicUrlOrPath
|
|
108
|
+
);
|
|
109
|
+
// Serve webpack assets generated by the compiler over a web server.
|
|
110
|
+
const serverConfig = {
|
|
111
|
+
...createDevServerConfig(proxyConfig, urls.lanUrlForConfig),
|
|
112
|
+
host: HOST,
|
|
113
|
+
port,
|
|
114
|
+
};
|
|
115
|
+
const devServer = new WebpackDevServer(serverConfig, compiler);
|
|
116
|
+
// Launch WebpackDevServer.
|
|
117
|
+
devServer.startCallback(() => {
|
|
118
|
+
if (isInteractive) {
|
|
119
|
+
clearConsole();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (env.raw.FAST_REFRESH && semver.lt(react.version, '16.10.0')) {
|
|
123
|
+
console.log(
|
|
124
|
+
chalk.yellow(
|
|
125
|
+
`Fast Refresh requires React 16.10 or higher. You are using React ${react.version}.`
|
|
126
|
+
)
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
console.log(chalk.cyan('Starting the development server...\n'));
|
|
131
|
+
openBrowser(urls.localUrlForBrowser);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
['SIGINT', 'SIGTERM'].forEach(function (sig) {
|
|
135
|
+
process.on(sig, function () {
|
|
136
|
+
devServer.close();
|
|
137
|
+
process.exit();
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
if (process.env.CI !== 'true') {
|
|
142
|
+
// Gracefully exit when stdin ends
|
|
143
|
+
process.stdin.on('end', function () {
|
|
144
|
+
devServer.close();
|
|
145
|
+
process.exit();
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
.catch(err => {
|
|
150
|
+
if (err && err.message) {
|
|
151
|
+
console.log(err.message);
|
|
152
|
+
}
|
|
153
|
+
process.exit(1);
|
|
154
|
+
});
|
package/scripts/test.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Do this as the first thing so that any code reading it knows the right env.
|
|
4
|
-
process.env.BABEL_ENV = 'test';
|
|
5
|
-
process.env.NODE_ENV = 'test';
|
|
6
|
-
process.env.PUBLIC_URL = '';
|
|
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
|
-
// Ensure environment variables are read.
|
|
16
|
-
require('../config/env');
|
|
17
|
-
|
|
18
|
-
const jest = require('jest');
|
|
19
|
-
const execSync = require('child_process').execSync;
|
|
20
|
-
let argv = process.argv.slice(2);
|
|
21
|
-
|
|
22
|
-
function isInGitRepository() {
|
|
23
|
-
try {
|
|
24
|
-
execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });
|
|
25
|
-
return true;
|
|
26
|
-
} catch (e) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function isInMercurialRepository() {
|
|
32
|
-
try {
|
|
33
|
-
execSync('hg --cwd . root', { stdio: 'ignore' });
|
|
34
|
-
return true;
|
|
35
|
-
} catch (e) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Watch unless on CI or explicitly running all tests
|
|
41
|
-
if (
|
|
42
|
-
!process.env.CI &&
|
|
43
|
-
argv.indexOf('--watchAll') === -1 &&
|
|
44
|
-
argv.indexOf('--watchAll=false') === -1
|
|
45
|
-
) {
|
|
46
|
-
// https://github.com/facebook/create-react-app/issues/5210
|
|
47
|
-
const hasSourceControl = isInGitRepository() || isInMercurialRepository();
|
|
48
|
-
argv.push(hasSourceControl ? '--watch' : '--watchAll');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
jest.run(argv);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Do this as the first thing so that any code reading it knows the right env.
|
|
4
|
+
process.env.BABEL_ENV = 'test';
|
|
5
|
+
process.env.NODE_ENV = 'test';
|
|
6
|
+
process.env.PUBLIC_URL = '';
|
|
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
|
+
// Ensure environment variables are read.
|
|
16
|
+
require('../config/env');
|
|
17
|
+
|
|
18
|
+
const jest = require('jest');
|
|
19
|
+
const execSync = require('child_process').execSync;
|
|
20
|
+
let argv = process.argv.slice(2);
|
|
21
|
+
|
|
22
|
+
function isInGitRepository() {
|
|
23
|
+
try {
|
|
24
|
+
execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });
|
|
25
|
+
return true;
|
|
26
|
+
} catch (e) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function isInMercurialRepository() {
|
|
32
|
+
try {
|
|
33
|
+
execSync('hg --cwd . root', { stdio: 'ignore' });
|
|
34
|
+
return true;
|
|
35
|
+
} catch (e) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Watch unless on CI or explicitly running all tests
|
|
41
|
+
if (
|
|
42
|
+
!process.env.CI &&
|
|
43
|
+
argv.indexOf('--watchAll') === -1 &&
|
|
44
|
+
argv.indexOf('--watchAll=false') === -1
|
|
45
|
+
) {
|
|
46
|
+
// https://github.com/facebook/create-react-app/issues/5210
|
|
47
|
+
const hasSourceControl = isInGitRepository() || isInMercurialRepository();
|
|
48
|
+
argv.push(hasSourceControl ? '--watch' : '--watchAll');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
jest.run(argv);
|
package/tsconfig.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es5",
|
|
4
|
-
"lib": [
|
|
5
|
-
"dom",
|
|
6
|
-
"dom.iterable",
|
|
7
|
-
"esnext"
|
|
8
|
-
],
|
|
9
|
-
"outDir": "build",
|
|
10
|
-
"allowJs": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"allowSyntheticDefaultImports": true,
|
|
15
|
-
"strict": true,
|
|
16
|
-
"forceConsistentCasingInFileNames": true,
|
|
17
|
-
"noFallthroughCasesInSwitch": true,
|
|
18
|
-
"module": "esnext",
|
|
19
|
-
"moduleResolution": "node",
|
|
20
|
-
"resolveJsonModule": true,
|
|
21
|
-
"isolatedModules": true,
|
|
22
|
-
"noImplicitAny": false,
|
|
23
|
-
"jsx": "react-jsx",
|
|
24
|
-
"baseUrl": ".",
|
|
25
|
-
"paths": {
|
|
26
|
-
"@/*": ["./src/*"]
|
|
27
|
-
},
|
|
28
|
-
"typeRoots": ["./@types", "../node_modules/@types"],
|
|
29
|
-
"types": ["@types/jest"],
|
|
30
|
-
"downlevelIteration": true
|
|
31
|
-
},
|
|
32
|
-
"include": ["@types", "src/modules.ts", "src/index.tsx", "src/react-app-env.d.ts"],
|
|
33
|
-
"exclude": ["node_modules"]
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"outDir": "build",
|
|
10
|
+
"allowJs": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"allowSyntheticDefaultImports": true,
|
|
15
|
+
"strict": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"module": "esnext",
|
|
19
|
+
"moduleResolution": "node",
|
|
20
|
+
"resolveJsonModule": true,
|
|
21
|
+
"isolatedModules": true,
|
|
22
|
+
"noImplicitAny": false,
|
|
23
|
+
"jsx": "react-jsx",
|
|
24
|
+
"baseUrl": ".",
|
|
25
|
+
"paths": {
|
|
26
|
+
"@/*": ["./src/*"]
|
|
27
|
+
},
|
|
28
|
+
"typeRoots": ["./@types", "../node_modules/@types"],
|
|
29
|
+
"types": ["@types/jest"],
|
|
30
|
+
"downlevelIteration": true
|
|
31
|
+
},
|
|
32
|
+
"include": ["@types", "src/modules.ts", "src/index.tsx", "src/react-app-env.d.ts"],
|
|
33
|
+
"exclude": ["node_modules"]
|
|
34
|
+
}
|
package/.eslintrc.json
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"node": true,
|
|
4
|
-
"browser": true,
|
|
5
|
-
"es2021": true
|
|
6
|
-
},
|
|
7
|
-
"extends": [
|
|
8
|
-
"eslint:recommended",
|
|
9
|
-
"plugin:react/recommended",
|
|
10
|
-
"plugin:@typescript-eslint/recommended",
|
|
11
|
-
"prettier"
|
|
12
|
-
],
|
|
13
|
-
"overrides": [
|
|
14
|
-
],
|
|
15
|
-
"parser": "@typescript-eslint/parser",
|
|
16
|
-
"parserOptions": {
|
|
17
|
-
"ecmaFeatures": {
|
|
18
|
-
"jsx": true
|
|
19
|
-
},
|
|
20
|
-
"ecmaVersion": "latest",
|
|
21
|
-
"sourceType": "module",
|
|
22
|
-
"project": "./tsconfig.json"
|
|
23
|
-
},
|
|
24
|
-
"plugins": [
|
|
25
|
-
"react",
|
|
26
|
-
"@typescript-eslint"
|
|
27
|
-
],
|
|
28
|
-
"rules": {
|
|
29
|
-
"quotes": [
|
|
30
|
-
"error",
|
|
31
|
-
"single",
|
|
32
|
-
{
|
|
33
|
-
"avoidEscape": true
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
"jsx-quotes": ["error", "prefer-double"],
|
|
37
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
38
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
39
|
-
"@typescript-eslint/no-empty-function": "off",
|
|
40
|
-
"@typescript-eslint/ban-ts-comment": "off",
|
|
41
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
42
|
-
"react/no-children-prop": "off",
|
|
43
|
-
"no-extra-boolean-cast": "off",
|
|
44
|
-
"no-constant-condition": "off"
|
|
45
|
-
},
|
|
46
|
-
"settings": {
|
|
47
|
-
"react": {
|
|
48
|
-
"version": "detect"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"ignorePatterns": [
|
|
52
|
-
"mock/**/*"
|
|
53
|
-
]
|
|
54
|
-
}
|
package/.husky/pre-commit
DELETED
package/.prettierrc
DELETED
package/.stylelintrc.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["stylelint-config-standard-scss", "stylelint-config-prettier-scss", "prettier"],
|
|
3
|
-
"rules": {
|
|
4
|
-
"at-rule-no-unknown": null,
|
|
5
|
-
"selector-class-pattern": "^([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
|
|
6
|
-
"keyframes-name-pattern": "/^(,[a-z][a-z0-9]*)(-[a-z0-9]+)*$/",
|
|
7
|
-
"no-descending-specificity": null,
|
|
8
|
-
"block-no-empty": null,
|
|
9
|
-
"scss/at-rule-no-unknown": [
|
|
10
|
-
true,
|
|
11
|
-
{
|
|
12
|
-
"ignoreAtRules": ["tailwind"]
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|