@evadata/react-scripts 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present, Evadata
4
+ Copyright (c) 2013-present, Facebook, Inc.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # @evadata/react-scripts
2
+
3
+ Evadata fork from the following:
4
+
5
+ This package includes scripts and configuration used by [Create React App](https://github.com/facebook/create-react-app).<br>
6
+ Please refer to its documentation:
7
+
8
+ - [Getting Started](https://facebook.github.io/create-react-app/docs/getting-started) – How to create a new app.
9
+ - [User Guide](https://facebook.github.io/create-react-app/) – How to develop apps bootstrapped with Create React App.
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Copyright (c) 2015-present, Facebook, Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ 'use strict';
10
+
11
+ // Makes the script crash on unhandled rejections instead of silently
12
+ // ignoring them. In the future, promise rejections that are not handled will
13
+ // terminate the Node.js process with a non-zero exit code.
14
+ process.on('unhandledRejection', err => {
15
+ throw err;
16
+ });
17
+
18
+ const spawn = require('react-dev-utils/crossSpawn');
19
+ const args = process.argv.slice(2);
20
+
21
+ const scriptIndex = args.findIndex(
22
+ x => x === 'build' || x === 'eject' || x === 'start' || x === 'test'
23
+ );
24
+ const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
25
+ const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
26
+
27
+ if (['build', 'eject', 'start', 'test'].includes(script)) {
28
+ const result = spawn.sync(
29
+ process.execPath,
30
+ nodeArgs
31
+ .concat(require.resolve('../scripts/' + script))
32
+ .concat(args.slice(scriptIndex + 1)),
33
+ { stdio: 'inherit' }
34
+ );
35
+ if (result.signal) {
36
+ if (result.signal === 'SIGKILL') {
37
+ console.log(
38
+ 'The build failed because the process exited too early. ' +
39
+ 'This probably means the system ran out of memory or someone called ' +
40
+ '`kill -9` on the process.'
41
+ );
42
+ } else if (result.signal === 'SIGTERM') {
43
+ console.log(
44
+ 'The build failed because the process exited too early. ' +
45
+ 'Someone might have called `kill` or `killall`, or the system could ' +
46
+ 'be shutting down.'
47
+ );
48
+ }
49
+ process.exit(1);
50
+ }
51
+ process.exit(result.status);
52
+ } else {
53
+ console.log('Unknown script "' + script + '".');
54
+ console.log('Perhaps you need to update react-scripts?');
55
+ console.log(
56
+ 'See: https://facebook.github.io/create-react-app/docs/updating-to-new-releases'
57
+ );
58
+ }
package/config/env.js ADDED
@@ -0,0 +1,112 @@
1
+ // @remove-on-eject-begin
2
+ /**
3
+ * Copyright (c) 2015-present, Facebook, Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ // @remove-on-eject-end
9
+ 'use strict';
10
+
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+ const paths = require('./paths');
14
+
15
+ // Make sure that including paths.js after env.js will read .env variables.
16
+ delete require.cache[require.resolve('./paths')];
17
+
18
+ const NODE_ENV = process.env.NODE_ENV;
19
+ if (!NODE_ENV) {
20
+ throw new Error(
21
+ 'The NODE_ENV environment variable is required but was not specified.'
22
+ );
23
+ }
24
+
25
+ // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
26
+ const dotenvFiles = [
27
+ `${paths.dotenv}.${NODE_ENV}.local`,
28
+ // Don't include `.env.local` for `test` environment
29
+ // since normally you expect tests to produce the same
30
+ // results for everyone
31
+ NODE_ENV !== 'test' && `${paths.dotenv}.local`,
32
+ `${paths.dotenv}.${NODE_ENV}`,
33
+ paths.dotenv
34
+ ].filter(Boolean);
35
+
36
+ // Load environment variables from .env* files. Suppress warnings using silent
37
+ // if this file is missing. dotenv will never modify any environment variables
38
+ // that have already been set. Variable expansion is supported in .env files.
39
+ // https://github.com/motdotla/dotenv
40
+ // https://github.com/motdotla/dotenv-expand
41
+ dotenvFiles.forEach(dotenvFile => {
42
+ if (fs.existsSync(dotenvFile)) {
43
+ require('dotenv-expand')(
44
+ require('dotenv').config({
45
+ path: dotenvFile
46
+ })
47
+ );
48
+ }
49
+ });
50
+
51
+ // We support resolving modules according to `NODE_PATH`.
52
+ // This lets you use absolute paths in imports inside large monorepos:
53
+ // https://github.com/facebook/create-react-app/issues/253.
54
+ // It works similar to `NODE_PATH` in Node itself:
55
+ // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
56
+ // Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
57
+ // Otherwise, we risk importing Node.js core modules into an app instead of webpack shims.
58
+ // https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
59
+ // We also resolve them to make sure all tools using them work consistently.
60
+ const appDirectory = fs.realpathSync(process.cwd());
61
+ process.env.NODE_PATH = (process.env.NODE_PATH || '')
62
+ .split(path.delimiter)
63
+ .filter(folder => folder && !path.isAbsolute(folder))
64
+ .map(folder => path.resolve(appDirectory, folder))
65
+ .join(path.delimiter);
66
+
67
+ // Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
68
+ // injected into the application via DefinePlugin in webpack configuration.
69
+ const REACT_APP = /^REACT_APP_/i;
70
+
71
+ function getClientEnvironment(publicUrl) {
72
+ const raw = Object.keys(process.env)
73
+ .filter(key => REACT_APP.test(key))
74
+ .reduce(
75
+ (env, key) => {
76
+ env[key] = process.env[key];
77
+ return env;
78
+ },
79
+ {
80
+ // Useful for determining whether we’re running in production mode.
81
+ // Most importantly, it switches React into the correct mode.
82
+ NODE_ENV: process.env.NODE_ENV || 'development',
83
+ // Useful for resolving the correct path to static assets in `public`.
84
+ // For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
85
+ // This should only be used as an escape hatch. Normally you would put
86
+ // images into the `src` and `import` them in code to get their paths.
87
+ PUBLIC_URL: publicUrl,
88
+ // We support configuring the sockjs pathname during development.
89
+ // These settings let a developer run multiple simultaneous projects.
90
+ // They are used as the connection `hostname`, `pathname` and `port`
91
+ // in webpackHotDevClient. They are used as the `sockHost`, `sockPath`
92
+ // and `sockPort` options in webpack-dev-server.
93
+ WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST,
94
+ WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH,
95
+ WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT,
96
+ // Whether or not react-refresh is enabled.
97
+ // It is defined here so it is available in the webpackHotDevClient.
98
+ FAST_REFRESH: process.env.FAST_REFRESH !== 'false'
99
+ }
100
+ );
101
+ // Stringify all values so we can feed into webpack DefinePlugin
102
+ const stringified = {
103
+ 'process.env': Object.keys(raw).reduce((env, key) => {
104
+ env[key] = JSON.stringify(raw[key]);
105
+ return env;
106
+ }, {})
107
+ };
108
+
109
+ return { raw, stringified };
110
+ }
111
+
112
+ module.exports = getClientEnvironment;
@@ -0,0 +1,74 @@
1
+ // @remove-on-eject-begin
2
+ /**
3
+ * Copyright (c) 2015-present, Facebook, Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ // @remove-on-eject-end
9
+ 'use strict';
10
+
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+ const crypto = require('crypto');
14
+ const chalk = require('react-dev-utils/chalk');
15
+ const paths = require('./paths');
16
+
17
+ // Ensure the certificate and key provided are valid and if not
18
+ // throw an easy to debug error
19
+ function validateKeyAndCerts({ cert, key, keyFile, crtFile }) {
20
+ let encrypted;
21
+ try {
22
+ // publicEncrypt will throw an error with an invalid cert
23
+ encrypted = crypto.publicEncrypt(cert, Buffer.from('test'));
24
+ } catch (err) {
25
+ throw new Error(
26
+ `The certificate "${chalk.yellow(crtFile)}" is invalid.\n${err.message}`
27
+ );
28
+ }
29
+
30
+ try {
31
+ // privateDecrypt will throw an error with an invalid key
32
+ crypto.privateDecrypt(key, encrypted);
33
+ } catch (err) {
34
+ throw new Error(
35
+ `The certificate key "${chalk.yellow(keyFile)}" is invalid.\n${
36
+ err.message
37
+ }`
38
+ );
39
+ }
40
+ }
41
+
42
+ // Read file and throw an error if it doesn't exist
43
+ function readEnvFile(file, type) {
44
+ if (!fs.existsSync(file)) {
45
+ throw new Error(
46
+ `You specified ${chalk.cyan(
47
+ type
48
+ )} in your env, but the file "${chalk.yellow(file)}" can't be found.`
49
+ );
50
+ }
51
+ return fs.readFileSync(file);
52
+ }
53
+
54
+ // Get the https config
55
+ // Return cert files if provided in env, otherwise just true or false
56
+ function getHttpsConfig() {
57
+ const { SSL_CRT_FILE, SSL_KEY_FILE, HTTPS } = process.env;
58
+ const isHttps = HTTPS === 'true';
59
+
60
+ if (isHttps && SSL_CRT_FILE && SSL_KEY_FILE) {
61
+ const crtFile = path.resolve(paths.appPath, SSL_CRT_FILE);
62
+ const keyFile = path.resolve(paths.appPath, SSL_KEY_FILE);
63
+ const config = {
64
+ cert: readEnvFile(crtFile, 'SSL_CRT_FILE'),
65
+ key: readEnvFile(keyFile, 'SSL_KEY_FILE')
66
+ };
67
+
68
+ validateKeyAndCerts({ ...config, keyFile, crtFile });
69
+ return config;
70
+ }
71
+ return isHttps;
72
+ }
73
+
74
+ module.exports = getHttpsConfig;
@@ -0,0 +1,37 @@
1
+ // @remove-on-eject-begin
2
+ /**
3
+ * Copyright (c) 2014-present, Facebook, Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ // @remove-on-eject-end
9
+ 'use strict';
10
+
11
+ const babelJest = require('babel-jest').default;
12
+
13
+ const hasJsxRuntime = (() => {
14
+ if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
15
+ return false;
16
+ }
17
+
18
+ try {
19
+ require.resolve('react/jsx-runtime');
20
+ return true;
21
+ } catch (e) {
22
+ return false;
23
+ }
24
+ })();
25
+
26
+ module.exports = babelJest.createTransformer({
27
+ presets: [
28
+ [
29
+ require.resolve('babel-preset-react-app'),
30
+ {
31
+ runtime: hasJsxRuntime ? 'automatic' : 'classic'
32
+ }
33
+ ]
34
+ ],
35
+ babelrc: false,
36
+ configFile: false
37
+ });
@@ -0,0 +1,22 @@
1
+ // @remove-on-eject-begin
2
+ /**
3
+ * Copyright (c) 2014-present, Facebook, Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ // @remove-on-eject-end
9
+ 'use strict';
10
+
11
+ // This is a custom Jest transformer turning style imports into empty objects.
12
+ // http://facebook.github.io/jest/docs/en/webpack.html
13
+
14
+ module.exports = {
15
+ process() {
16
+ return 'module.exports = {};';
17
+ },
18
+ getCacheKey() {
19
+ // The output is always the same.
20
+ return 'cssTransform';
21
+ }
22
+ };
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const camelcase = require('camelcase');
5
+
6
+ // This is a custom Jest transformer turning file imports into filenames.
7
+ // http://facebook.github.io/jest/docs/en/webpack.html
8
+
9
+ module.exports = {
10
+ process(src, filename) {
11
+ const assetFilename = JSON.stringify(path.basename(filename));
12
+
13
+ if (filename.match(/\.svg$/)) {
14
+ // Based on how SVGR generates a component name:
15
+ // https://github.com/smooth-code/svgr/blob/01b194cf967347d43d4cbe6b434404731b87cf27/packages/core/src/state.js#L6
16
+ const pascalCaseFilename = camelcase(path.parse(filename).name, {
17
+ pascalCase: true
18
+ });
19
+ const componentName = `Svg${pascalCaseFilename}`;
20
+ return `const React = require('react');
21
+ module.exports = {
22
+ __esModule: true,
23
+ default: ${assetFilename},
24
+ ReactComponent: React.forwardRef(function ${componentName}(props, ref) {
25
+ return {
26
+ $$typeof: Symbol.for('react.element'),
27
+ type: 'svg',
28
+ ref: ref,
29
+ key: null,
30
+ props: Object.assign({}, props, {
31
+ children: ${assetFilename}
32
+ })
33
+ };
34
+ }),
35
+ };`;
36
+ }
37
+
38
+ return `module.exports = ${assetFilename};`;
39
+ }
40
+ };
@@ -0,0 +1,142 @@
1
+ // @remove-on-eject-begin
2
+ /**
3
+ * Copyright (c) 2015-present, Facebook, Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ // @remove-on-eject-end
9
+ 'use strict';
10
+
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+ const paths = require('./paths');
14
+ const chalk = require('react-dev-utils/chalk');
15
+ const resolve = require('resolve');
16
+
17
+ /**
18
+ * Get additional module paths based on the baseUrl of a compilerOptions object.
19
+ *
20
+ * @param {Object} options
21
+ */
22
+ function getAdditionalModulePaths(options = {}) {
23
+ const baseUrl = options.baseUrl;
24
+
25
+ if (!baseUrl) {
26
+ return '';
27
+ }
28
+
29
+ const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
30
+
31
+ // We don't need to do anything if `baseUrl` is set to `node_modules`. This is
32
+ // the default behavior.
33
+ if (path.relative(paths.appNodeModules, baseUrlResolved) === '') {
34
+ return null;
35
+ }
36
+
37
+ // Allow the user set the `baseUrl` to `appSrc`.
38
+ if (path.relative(paths.appSrc, baseUrlResolved) === '') {
39
+ return [paths.appSrc];
40
+ }
41
+
42
+ // If the path is equal to the root directory we ignore it here.
43
+ // We don't want to allow importing from the root directly as source files are
44
+ // not transpiled outside of `src`. We do allow importing them with the
45
+ // absolute path (e.g. `src/Components/Button.js`) but we set that up with
46
+ // an alias.
47
+ if (path.relative(paths.appPath, baseUrlResolved) === '') {
48
+ return null;
49
+ }
50
+
51
+ // Otherwise, throw an error.
52
+ throw new Error(
53
+ chalk.red.bold(
54
+ "Your project's `baseUrl` can only be set to `src` or `node_modules`." +
55
+ ' Create React App does not support other values at this time.'
56
+ )
57
+ );
58
+ }
59
+
60
+ /**
61
+ * Get webpack aliases based on the baseUrl of a compilerOptions object.
62
+ *
63
+ * @param {*} options
64
+ */
65
+ function getWebpackAliases(options = {}) {
66
+ const baseUrl = options.baseUrl;
67
+
68
+ if (!baseUrl) {
69
+ return {};
70
+ }
71
+
72
+ const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
73
+
74
+ if (path.relative(paths.appPath, baseUrlResolved) === '') {
75
+ return {
76
+ src: paths.appSrc
77
+ };
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Get jest aliases based on the baseUrl of a compilerOptions object.
83
+ *
84
+ * @param {*} options
85
+ */
86
+ function getJestAliases(options = {}) {
87
+ const baseUrl = options.baseUrl;
88
+
89
+ if (!baseUrl) {
90
+ return {};
91
+ }
92
+
93
+ const baseUrlResolved = path.resolve(paths.appPath, baseUrl);
94
+
95
+ if (path.relative(paths.appPath, baseUrlResolved) === '') {
96
+ return {
97
+ '^src/(.*)$': '<rootDir>/src/$1'
98
+ };
99
+ }
100
+ }
101
+
102
+ function getModules() {
103
+ // Check if TypeScript is setup
104
+ const hasTsConfig = fs.existsSync(paths.appTsConfig);
105
+ const hasJsConfig = fs.existsSync(paths.appJsConfig);
106
+
107
+ if (hasTsConfig && hasJsConfig) {
108
+ throw new Error(
109
+ 'You have both a tsconfig.json and a jsconfig.json. If you are using TypeScript please remove your jsconfig.json file.'
110
+ );
111
+ }
112
+
113
+ let config;
114
+
115
+ // If there's a tsconfig.json we assume it's a
116
+ // TypeScript project and set up the config
117
+ // based on tsconfig.json
118
+ if (hasTsConfig) {
119
+ const ts = require(resolve.sync('typescript', {
120
+ basedir: paths.appNodeModules
121
+ }));
122
+ config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;
123
+ // Otherwise we'll check if there is jsconfig.json
124
+ // for non TS projects.
125
+ } else if (hasJsConfig) {
126
+ config = require(paths.appJsConfig);
127
+ }
128
+
129
+ config = config || {};
130
+ const options = config.compilerOptions || {};
131
+
132
+ const additionalModulePaths = getAdditionalModulePaths(options);
133
+
134
+ return {
135
+ additionalModulePaths: additionalModulePaths,
136
+ webpackAliases: getWebpackAliases(options),
137
+ jestAliases: getJestAliases(options),
138
+ hasTsConfig
139
+ };
140
+ }
141
+
142
+ module.exports = getModules();
@@ -0,0 +1,153 @@
1
+ // @remove-on-eject-begin
2
+ /**
3
+ * Copyright (c) 2015-present, Facebook, Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ // @remove-on-eject-end
9
+ 'use strict';
10
+
11
+ const path = require('path');
12
+ const fs = require('fs');
13
+ const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
14
+
15
+ // Make sure any symlinks in the project folder are resolved:
16
+ // https://github.com/facebook/create-react-app/issues/637
17
+ const appDirectory = fs.realpathSync(process.cwd());
18
+ const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
19
+
20
+ // We use `PUBLIC_URL` environment variable or "homepage" field to infer
21
+ // "public path" at which the app is served.
22
+ // webpack needs to know it to put the right <script> hrefs into HTML even in
23
+ // single-page apps that may serve index.html for nested URLs like /todos/42.
24
+ // We can't use a relative path in HTML because we don't want to load something
25
+ // like /todos/42/static/js/bundle.7289d.js. We have to know the root.
26
+ const publicUrlOrPath = getPublicUrlOrPath(
27
+ process.env.NODE_ENV === 'development',
28
+ require(resolveApp('package.json')).homepage,
29
+ process.env.PUBLIC_URL
30
+ );
31
+
32
+ const buildPath = process.env.BUILD_PATH || 'build';
33
+
34
+ const moduleFileExtensions = [
35
+ 'web.mjs',
36
+ 'mjs',
37
+ 'web.js',
38
+ 'js',
39
+ 'web.ts',
40
+ 'ts',
41
+ 'web.tsx',
42
+ 'tsx',
43
+ 'json',
44
+ 'web.jsx',
45
+ 'jsx'
46
+ ];
47
+
48
+ // Resolve file paths in the same order as webpack
49
+ const resolveModule = (resolveFn, filePath) => {
50
+ const extension = moduleFileExtensions.find(extension =>
51
+ fs.existsSync(resolveFn(`${filePath}.${extension}`))
52
+ );
53
+
54
+ if (extension) {
55
+ return resolveFn(`${filePath}.${extension}`);
56
+ }
57
+
58
+ return resolveFn(`${filePath}.js`);
59
+ };
60
+
61
+ // config after eject: we're in ./config/
62
+ module.exports = {
63
+ dotenv: resolveApp('.env'),
64
+ appPath: resolveApp('.'),
65
+ appBuild: resolveApp(buildPath),
66
+ appPublic: resolveApp('public'),
67
+ appHtml: resolveApp('public/index.html'),
68
+ appIndexJs: resolveModule(resolveApp, 'src/index'),
69
+ appPackageJson: resolveApp('package.json'),
70
+ appSrc: resolveApp('src'),
71
+ appTsConfig: resolveApp('tsconfig.json'),
72
+ appJsConfig: resolveApp('jsconfig.json'),
73
+ yarnLockFile: resolveApp('yarn.lock'),
74
+ testsSetup: resolveModule(resolveApp, 'src/setupTests'),
75
+ proxySetup: resolveApp('src/setupProxy.js'),
76
+ appNodeModules: resolveApp('node_modules'),
77
+ appWebpackCache: resolveApp('node_modules/.cache'),
78
+ appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
79
+ swSrc: resolveModule(resolveApp, 'src/service-worker'),
80
+ publicUrlOrPath
81
+ };
82
+
83
+ // @remove-on-eject-begin
84
+ const resolveOwn = relativePath => path.resolve(__dirname, '..', relativePath);
85
+
86
+ // config before eject: we're in ./node_modules/react-scripts/config/
87
+ module.exports = {
88
+ dotenv: resolveApp('.env'),
89
+ appPath: resolveApp('.'),
90
+ appBuild: resolveApp(buildPath),
91
+ appPublic: resolveApp('public'),
92
+ appHtml: resolveApp('public/index.html'),
93
+ appIndexJs: resolveModule(resolveApp, 'src/index'),
94
+ appPackageJson: resolveApp('package.json'),
95
+ appSrc: resolveApp('src'),
96
+ appTsConfig: resolveApp('tsconfig.json'),
97
+ appJsConfig: resolveApp('jsconfig.json'),
98
+ yarnLockFile: resolveApp('yarn.lock'),
99
+ testsSetup: resolveModule(resolveApp, 'src/setupTests'),
100
+ proxySetup: resolveApp('src/setupProxy.js'),
101
+ appNodeModules: resolveApp('node_modules'),
102
+ appWebpackCache: resolveApp('node_modules/.cache'),
103
+ appTsBuildInfoFile: resolveApp('node_modules/.cache/tsconfig.tsbuildinfo'),
104
+ swSrc: resolveModule(resolveApp, 'src/service-worker'),
105
+ publicUrlOrPath,
106
+ // These properties only exist before ejecting:
107
+ ownPath: resolveOwn('.'),
108
+ ownNodeModules: resolveOwn('node_modules'), // This is empty on npm 3
109
+ appTypeDeclarations: resolveApp('src/react-app-env.d.ts'),
110
+ ownTypeDeclarations: resolveOwn('lib/react-app.d.ts')
111
+ };
112
+
113
+ const ownPackageJson = require('../package.json');
114
+ const reactScriptsPath = resolveApp(`node_modules/${ownPackageJson.name}`);
115
+ const reactScriptsLinked =
116
+ fs.existsSync(reactScriptsPath) &&
117
+ fs.lstatSync(reactScriptsPath).isSymbolicLink();
118
+
119
+ // config before publish: we're in ./packages/react-scripts/config/
120
+ if (
121
+ !reactScriptsLinked &&
122
+ __dirname.indexOf(path.join('packages', 'react-scripts', 'config')) !== -1
123
+ ) {
124
+ const templatePath = '../cra-template/template';
125
+ module.exports = {
126
+ dotenv: resolveOwn(`${templatePath}/.env`),
127
+ appPath: resolveApp('.'),
128
+ appBuild: resolveOwn(path.join('../..', buildPath)),
129
+ appPublic: resolveOwn(`${templatePath}/public`),
130
+ appHtml: resolveOwn(`${templatePath}/public/index.html`),
131
+ appIndexJs: resolveModule(resolveOwn, `${templatePath}/src/index`),
132
+ appPackageJson: resolveOwn('package.json'),
133
+ appSrc: resolveOwn(`${templatePath}/src`),
134
+ appTsConfig: resolveOwn(`${templatePath}/tsconfig.json`),
135
+ appJsConfig: resolveOwn(`${templatePath}/jsconfig.json`),
136
+ yarnLockFile: resolveOwn(`${templatePath}/yarn.lock`),
137
+ testsSetup: resolveModule(resolveOwn, `${templatePath}/src/setupTests`),
138
+ proxySetup: resolveOwn(`${templatePath}/src/setupProxy.js`),
139
+ appNodeModules: resolveOwn('node_modules'),
140
+ appWebpackCache: resolveOwn('node_modules/.cache'),
141
+ appTsBuildInfoFile: resolveOwn('node_modules/.cache/tsconfig.tsbuildinfo'),
142
+ swSrc: resolveModule(resolveOwn, `${templatePath}/src/service-worker`),
143
+ publicUrlOrPath,
144
+ // These properties only exist before ejecting:
145
+ ownPath: resolveOwn('.'),
146
+ ownNodeModules: resolveOwn('node_modules'),
147
+ appTypeDeclarations: resolveOwn(`${templatePath}/src/react-app-env.d.ts`),
148
+ ownTypeDeclarations: resolveOwn('lib/react-app.d.ts')
149
+ };
150
+ }
151
+ // @remove-on-eject-end
152
+
153
+ module.exports.moduleFileExtensions = moduleFileExtensions;
@@ -0,0 +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
+ };