gov-ui-core 0.2.6-beta.8 → 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 -39
- 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 -25
- 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 -246
- 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/components/Button/constants.d.ts +0 -19
- package/build/components/TailwindTest/index.d.ts +0 -6
- package/build/pages/ButtonSample.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/config/modules.js
CHANGED
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const paths = require('./paths');
|
|
6
|
-
const chalk = require('react-dev-utils/chalk');
|
|
7
|
-
const resolve = require('resolve');
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Get additional module paths based on the baseUrl of a compilerOptions object.
|
|
11
|
-
*
|
|
12
|
-
* @param {Object} options
|
|
13
|
-
*/
|
|
14
|
-
function getAdditionalModulePaths(options = {}) {
|
|
15
|
-
const baseUrl = options.baseUrl;
|
|
16
|
-
|
|
17
|
-
if (!baseUrl) {
|
|
18
|
-
return '';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
22
|
-
|
|
23
|
-
// We don't need to do anything if `baseUrl` is set to `node_modules`. This is
|
|
24
|
-
// the default behavior.
|
|
25
|
-
if (path.relative(paths.appNodeModules, baseUrlResolved) === '') {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Allow the user set the `baseUrl` to `appSrc`.
|
|
30
|
-
if (path.relative(paths.appSrc, baseUrlResolved) === '') {
|
|
31
|
-
return [paths.appSrc];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// If the path is equal to the root directory we ignore it here.
|
|
35
|
-
// We don't want to allow importing from the root directly as source files are
|
|
36
|
-
// not transpiled outside of `src`. We do allow importing them with the
|
|
37
|
-
// absolute path (e.g. `src/Components/Button.js`) but we set that up with
|
|
38
|
-
// an alias.
|
|
39
|
-
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Otherwise, throw an error.
|
|
44
|
-
throw new Error(
|
|
45
|
-
chalk.red.bold(
|
|
46
|
-
"Your project's `baseUrl` can only be set to `src` or `node_modules`." +
|
|
47
|
-
' Create React App does not support other values at this time.'
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Get webpack aliases based on the baseUrl of a compilerOptions object.
|
|
54
|
-
*
|
|
55
|
-
* @param {*} options
|
|
56
|
-
*/
|
|
57
|
-
function getWebpackAliases(options = {}) {
|
|
58
|
-
const baseUrl = options.baseUrl;
|
|
59
|
-
|
|
60
|
-
if (!baseUrl) {
|
|
61
|
-
return {};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
65
|
-
|
|
66
|
-
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
67
|
-
return {
|
|
68
|
-
src: paths.appSrc,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Get jest aliases based on the baseUrl of a compilerOptions object.
|
|
75
|
-
*
|
|
76
|
-
* @param {*} options
|
|
77
|
-
*/
|
|
78
|
-
function getJestAliases(options = {}) {
|
|
79
|
-
const baseUrl = options.baseUrl;
|
|
80
|
-
|
|
81
|
-
if (!baseUrl) {
|
|
82
|
-
return {};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
86
|
-
|
|
87
|
-
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
88
|
-
return {
|
|
89
|
-
'^src/(.*)$': '<rootDir>/src/$1',
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function getModules() {
|
|
95
|
-
// Check if TypeScript is setup
|
|
96
|
-
const hasTsConfig = fs.existsSync(paths.appTsConfig);
|
|
97
|
-
const hasJsConfig = fs.existsSync(paths.appJsConfig);
|
|
98
|
-
|
|
99
|
-
if (hasTsConfig && hasJsConfig) {
|
|
100
|
-
throw new Error(
|
|
101
|
-
'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.'
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
let config;
|
|
106
|
-
|
|
107
|
-
// If there's a tsconfig.json we assume it's a
|
|
108
|
-
// TypeScript project and set up the config
|
|
109
|
-
// based on tsconfig.json
|
|
110
|
-
if (hasTsConfig) {
|
|
111
|
-
const ts = require(resolve.sync('typescript', {
|
|
112
|
-
basedir: paths.appNodeModules,
|
|
113
|
-
}));
|
|
114
|
-
config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;
|
|
115
|
-
// Otherwise we'll check if there is jsconfig.json
|
|
116
|
-
// for non TS projects.
|
|
117
|
-
} else if (hasJsConfig) {
|
|
118
|
-
config = require(paths.appJsConfig);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
config = config || {};
|
|
122
|
-
const options = config.compilerOptions || {};
|
|
123
|
-
|
|
124
|
-
const additionalModulePaths = getAdditionalModulePaths(options);
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
additionalModulePaths: additionalModulePaths,
|
|
128
|
-
webpackAliases: getWebpackAliases(options),
|
|
129
|
-
jestAliases: getJestAliases(options),
|
|
130
|
-
hasTsConfig,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
module.exports = getModules();
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const paths = require('./paths');
|
|
6
|
+
const chalk = require('react-dev-utils/chalk');
|
|
7
|
+
const resolve = require('resolve');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get additional module paths based on the baseUrl of a compilerOptions object.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} options
|
|
13
|
+
*/
|
|
14
|
+
function getAdditionalModulePaths(options = {}) {
|
|
15
|
+
const baseUrl = options.baseUrl;
|
|
16
|
+
|
|
17
|
+
if (!baseUrl) {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
22
|
+
|
|
23
|
+
// We don't need to do anything if `baseUrl` is set to `node_modules`. This is
|
|
24
|
+
// the default behavior.
|
|
25
|
+
if (path.relative(paths.appNodeModules, baseUrlResolved) === '') {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Allow the user set the `baseUrl` to `appSrc`.
|
|
30
|
+
if (path.relative(paths.appSrc, baseUrlResolved) === '') {
|
|
31
|
+
return [paths.appSrc];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// If the path is equal to the root directory we ignore it here.
|
|
35
|
+
// We don't want to allow importing from the root directly as source files are
|
|
36
|
+
// not transpiled outside of `src`. We do allow importing them with the
|
|
37
|
+
// absolute path (e.g. `src/Components/Button.js`) but we set that up with
|
|
38
|
+
// an alias.
|
|
39
|
+
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Otherwise, throw an error.
|
|
44
|
+
throw new Error(
|
|
45
|
+
chalk.red.bold(
|
|
46
|
+
"Your project's `baseUrl` can only be set to `src` or `node_modules`." +
|
|
47
|
+
' Create React App does not support other values at this time.'
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get webpack aliases based on the baseUrl of a compilerOptions object.
|
|
54
|
+
*
|
|
55
|
+
* @param {*} options
|
|
56
|
+
*/
|
|
57
|
+
function getWebpackAliases(options = {}) {
|
|
58
|
+
const baseUrl = options.baseUrl;
|
|
59
|
+
|
|
60
|
+
if (!baseUrl) {
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
65
|
+
|
|
66
|
+
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
67
|
+
return {
|
|
68
|
+
src: paths.appSrc,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Get jest aliases based on the baseUrl of a compilerOptions object.
|
|
75
|
+
*
|
|
76
|
+
* @param {*} options
|
|
77
|
+
*/
|
|
78
|
+
function getJestAliases(options = {}) {
|
|
79
|
+
const baseUrl = options.baseUrl;
|
|
80
|
+
|
|
81
|
+
if (!baseUrl) {
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
|
|
86
|
+
|
|
87
|
+
if (path.relative(paths.appPath, baseUrlResolved) === '') {
|
|
88
|
+
return {
|
|
89
|
+
'^src/(.*)$': '<rootDir>/src/$1',
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function getModules() {
|
|
95
|
+
// Check if TypeScript is setup
|
|
96
|
+
const hasTsConfig = fs.existsSync(paths.appTsConfig);
|
|
97
|
+
const hasJsConfig = fs.existsSync(paths.appJsConfig);
|
|
98
|
+
|
|
99
|
+
if (hasTsConfig && hasJsConfig) {
|
|
100
|
+
throw new Error(
|
|
101
|
+
'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.'
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let config;
|
|
106
|
+
|
|
107
|
+
// If there's a tsconfig.json we assume it's a
|
|
108
|
+
// TypeScript project and set up the config
|
|
109
|
+
// based on tsconfig.json
|
|
110
|
+
if (hasTsConfig) {
|
|
111
|
+
const ts = require(resolve.sync('typescript', {
|
|
112
|
+
basedir: paths.appNodeModules,
|
|
113
|
+
}));
|
|
114
|
+
config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;
|
|
115
|
+
// Otherwise we'll check if there is jsconfig.json
|
|
116
|
+
// for non TS projects.
|
|
117
|
+
} else if (hasJsConfig) {
|
|
118
|
+
config = require(paths.appJsConfig);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
config = config || {};
|
|
122
|
+
const options = config.compilerOptions || {};
|
|
123
|
+
|
|
124
|
+
const additionalModulePaths = getAdditionalModulePaths(options);
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
additionalModulePaths: additionalModulePaths,
|
|
128
|
+
webpackAliases: getWebpackAliases(options),
|
|
129
|
+
jestAliases: getJestAliases(options),
|
|
130
|
+
hasTsConfig,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
module.exports = getModules();
|
package/config/paths.js
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
|
|
6
|
-
|
|
7
|
-
// Make sure any symlinks in the project folder are resolved:
|
|
8
|
-
// https://github.com/facebook/create-react-app/issues/637
|
|
9
|
-
const appDirectory = fs.realpathSync(process.cwd());
|
|
10
|
-
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
|
|
11
|
-
|
|
12
|
-
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
|
|
13
|
-
// "public path" at which the app is served.
|
|
14
|
-
// webpack needs to know it to put the right <script> hrefs into HTML even in
|
|
15
|
-
// single-page apps that may serve index.html for nested URLs like /todos/42.
|
|
16
|
-
// We can't use a relative path in HTML because we don't want to load something
|
|
17
|
-
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
|
|
18
|
-
const publicUrlOrPath = getPublicUrlOrPath(
|
|
19
|
-
process.env.NODE_ENV === 'development',
|
|
20
|
-
require(resolveApp('package.json')).homepage,
|
|
21
|
-
process.env.PUBLIC_URL
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const buildPath = process.env.BUILD_PATH || 'build';
|
|
25
|
-
|
|
26
|
-
const moduleFileExtensions = [
|
|
27
|
-
'web.mjs',
|
|
28
|
-
'mjs',
|
|
29
|
-
'web.js',
|
|
30
|
-
'js',
|
|
31
|
-
'web.ts',
|
|
32
|
-
'ts',
|
|
33
|
-
'web.tsx',
|
|
34
|
-
'tsx',
|
|
35
|
-
'json',
|
|
36
|
-
'web.jsx',
|
|
37
|
-
'jsx',
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
// Resolve file paths in the same order as webpack
|
|
41
|
-
const resolveModule = (resolveFn, filePath) => {
|
|
42
|
-
const extension = moduleFileExtensions.find(extension =>
|
|
43
|
-
fs.existsSync(resolveFn(`${filePath}.${extension}`))
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
if (extension) {
|
|
47
|
-
return resolveFn(`${filePath}.${extension}`);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return resolveFn(`${filePath}.js`);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// config after eject: we're in ./config/
|
|
54
|
-
module.exports = {
|
|
55
|
-
dotenv: resolveApp('.env'),
|
|
56
|
-
appPath: resolveApp('.'),
|
|
57
|
-
appBuild: resolveApp(buildPath),
|
|
58
|
-
appPublic: resolveApp('public'),
|
|
59
|
-
appHtml: resolveApp('public/index.html'),
|
|
60
|
-
appIndexJs: resolveModule(resolveApp, 'src/index'),
|
|
61
|
-
appPackageJson: resolveApp('package.json'),
|
|
62
|
-
appSrc: resolveApp('src'),
|
|
63
|
-
appTsConfig: resolveApp('tsconfig.json'),
|
|
64
|
-
appJsConfig: resolveApp('jsconfig.json'),
|
|
65
|
-
yarnLockFile: resolveApp('yarn.lock'),
|
|
66
|
-
testsSetup: resolveModule(resolveApp, 'src/setupTests'),
|
|
67
|
-
proxySetup: resolveApp('src/setupProxy.js'),
|
|
68
|
-
appNodeModules: resolveApp('node_modules'),
|
|
69
|
-
appWebpackCache: resolveApp('node_modules/.cache'),
|
|
70
|
-
appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
|
|
71
|
-
swSrc: resolveModule(resolveApp, 'src/service-worker'),
|
|
72
|
-
publicUrlOrPath,
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
module.exports.moduleFileExtensions = moduleFileExtensions;
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
|
|
6
|
+
|
|
7
|
+
// Make sure any symlinks in the project folder are resolved:
|
|
8
|
+
// https://github.com/facebook/create-react-app/issues/637
|
|
9
|
+
const appDirectory = fs.realpathSync(process.cwd());
|
|
10
|
+
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
|
|
11
|
+
|
|
12
|
+
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
|
|
13
|
+
// "public path" at which the app is served.
|
|
14
|
+
// webpack needs to know it to put the right <script> hrefs into HTML even in
|
|
15
|
+
// single-page apps that may serve index.html for nested URLs like /todos/42.
|
|
16
|
+
// We can't use a relative path in HTML because we don't want to load something
|
|
17
|
+
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
|
|
18
|
+
const publicUrlOrPath = getPublicUrlOrPath(
|
|
19
|
+
process.env.NODE_ENV === 'development',
|
|
20
|
+
require(resolveApp('package.json')).homepage,
|
|
21
|
+
process.env.PUBLIC_URL
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const buildPath = process.env.BUILD_PATH || 'build';
|
|
25
|
+
|
|
26
|
+
const moduleFileExtensions = [
|
|
27
|
+
'web.mjs',
|
|
28
|
+
'mjs',
|
|
29
|
+
'web.js',
|
|
30
|
+
'js',
|
|
31
|
+
'web.ts',
|
|
32
|
+
'ts',
|
|
33
|
+
'web.tsx',
|
|
34
|
+
'tsx',
|
|
35
|
+
'json',
|
|
36
|
+
'web.jsx',
|
|
37
|
+
'jsx',
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
// Resolve file paths in the same order as webpack
|
|
41
|
+
const resolveModule = (resolveFn, filePath) => {
|
|
42
|
+
const extension = moduleFileExtensions.find(extension =>
|
|
43
|
+
fs.existsSync(resolveFn(`${filePath}.${extension}`))
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (extension) {
|
|
47
|
+
return resolveFn(`${filePath}.${extension}`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return resolveFn(`${filePath}.js`);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// config after eject: we're in ./config/
|
|
54
|
+
module.exports = {
|
|
55
|
+
dotenv: resolveApp('.env'),
|
|
56
|
+
appPath: resolveApp('.'),
|
|
57
|
+
appBuild: resolveApp(buildPath),
|
|
58
|
+
appPublic: resolveApp('public'),
|
|
59
|
+
appHtml: resolveApp('public/index.html'),
|
|
60
|
+
appIndexJs: resolveModule(resolveApp, 'src/index'),
|
|
61
|
+
appPackageJson: resolveApp('package.json'),
|
|
62
|
+
appSrc: resolveApp('src'),
|
|
63
|
+
appTsConfig: resolveApp('tsconfig.json'),
|
|
64
|
+
appJsConfig: resolveApp('jsconfig.json'),
|
|
65
|
+
yarnLockFile: resolveApp('yarn.lock'),
|
|
66
|
+
testsSetup: resolveModule(resolveApp, 'src/setupTests'),
|
|
67
|
+
proxySetup: resolveApp('src/setupProxy.js'),
|
|
68
|
+
appNodeModules: resolveApp('node_modules'),
|
|
69
|
+
appWebpackCache: resolveApp('node_modules/.cache'),
|
|
70
|
+
appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
|
|
71
|
+
swSrc: resolveModule(resolveApp, 'src/service-worker'),
|
|
72
|
+
publicUrlOrPath,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
module.exports.moduleFileExtensions = moduleFileExtensions;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const { createHash } = require('crypto');
|
|
3
|
-
|
|
4
|
-
module.exports = env => {
|
|
5
|
-
const hash = createHash('md5');
|
|
6
|
-
hash.update(JSON.stringify(env));
|
|
7
|
-
|
|
8
|
-
return hash.digest('hex');
|
|
9
|
-
};
|
|
1
|
+
'use strict';
|
|
2
|
+
const { createHash } = require('crypto');
|
|
3
|
+
|
|
4
|
+
module.exports = env => {
|
|
5
|
+
const hash = createHash('md5');
|
|
6
|
+
hash.update(JSON.stringify(env));
|
|
7
|
+
|
|
8
|
+
return hash.digest('hex');
|
|
9
|
+
};
|