diff --git a/packages/react-scripts/config/paths.js b/packages/react-scripts/config/paths.js index 11d81b7f5a76b37922c107025d6144d7aa8cc436..c3a3dffdb8d6829a0aefd46a50a475aa742b7e4a 100644 --- a/packages/react-scripts/config/paths.js +++ b/packages/react-scripts/config/paths.js @@ -15,7 +15,7 @@ const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath'); // Make sure any symlinks in the project folder are resolved: // https://github.com/facebook/create-react-app/issues/637 const appDirectory = fs.realpathSync(process.cwd()); -const resolveApp = relativePath => path.resolve(appDirectory, relativePath); +const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath); // We use `PUBLIC_URL` environment variable or "homepage" field to infer // "public path" at which the app is served. @@ -45,7 +45,7 @@ const moduleFileExtensions = [ // Resolve file paths in the same order as webpack const resolveModule = (resolveFn, filePath) => { - const extension = moduleFileExtensions.find(extension => + const extension = moduleFileExtensions.find((extension) => fs.existsSync(resolveFn(`${filePath}.${extension}`)) ); @@ -63,7 +63,7 @@ module.exports = { appBuild: resolveApp('build'), appPublic: resolveApp('public'), appHtml: resolveApp('public/index.html'), - appIndexJs: resolveModule(resolveApp, 'src/index'), + appIndexJs: resolveModule(resolveApp, process.env.APP_ENTRY || 'src/index'), appPackageJson: resolveApp('package.json'), appSrc: resolveApp('src'), appTsConfig: resolveApp('tsconfig.json'), @@ -76,7 +76,8 @@ module.exports = { }; // @remove-on-eject-begin -const resolveOwn = relativePath => path.resolve(__dirname, '..', relativePath); +const resolveOwn = (relativePath) => + path.resolve(__dirname, '..', relativePath); // config before eject: we're in ./node_modules/react-scripts/config/ module.exports = { @@ -85,7 +86,7 @@ module.exports = { appBuild: resolveApp('build'), appPublic: resolveApp('public'), appHtml: resolveApp('public/index.html'), - appIndexJs: resolveModule(resolveApp, 'src/index'), + appIndexJs: resolveModule(resolveApp, process.env.APP_ENTRY || 'src/index'), appPackageJson: resolveApp('package.json'), appSrc: resolveApp('src'), appTsConfig: resolveApp('tsconfig.json'), @@ -120,7 +121,10 @@ if ( appBuild: resolveOwn('../../build'), appPublic: resolveOwn(`${templatePath}/public`), appHtml: resolveOwn(`${templatePath}/public/index.html`), - appIndexJs: resolveModule(resolveOwn, `${templatePath}/src/index`), + appIndexJs: resolveModule( + resolveOwn, + process.env.APP_ENTRY || `${templatePath}/src/index` + ), appPackageJson: resolveOwn('package.json'), appSrc: resolveOwn(`${templatePath}/src`), appTsConfig: resolveOwn(`${templatePath}/tsconfig.json`), diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 63e7faf390ca6d507e75ad8df958ded71c4b99b1..27fb469e8164c29b125cbd4359b8cb34932e7b7a 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -1,10 +1,10 @@ { - "name": "react-scripts", + "name": "@normurod72/react-scripts", "version": "3.4.1", "description": "Configuration and scripts for Create React App.", "repository": { "type": "git", - "url": "https://github.com/facebook/create-react-app.git", + "url": "https://github.com/@normurod72/create-react-app.git", "directory": "packages/react-scripts" }, "license": "MIT", @@ -12,7 +12,7 @@ "node": ">=8.10" }, "bugs": { - "url": "https://github.com/facebook/create-react-app/issues" + "url": "https://github.com/@normurod72/create-react-app/issues" }, "files": [ "bin", diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index 2568ab36db18d4e733ef8f578f3b242f1c0c9987..62d932b7370aece4961d9d47d74dc1cff64ff10f 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -15,7 +15,7 @@ process.env.NODE_ENV = 'development'; // Makes the script crash on unhandled rejections instead of silently // ignoring them. In the future, promise rejections that are not handled will // terminate the Node.js process with a non-zero exit code. -process.on('unhandledRejection', err => { +process.on('unhandledRejection', (err) => { throw err; }); @@ -86,7 +86,7 @@ checkBrowsers(paths.appPath, isInteractive) // run on a different port. `choosePort()` Promise resolves to the next free port. return choosePort(HOST, DEFAULT_PORT); }) - .then(port => { + .then((port) => { if (port == null) { // We have not found a port. return; @@ -104,9 +104,9 @@ checkBrowsers(paths.appPath, isInteractive) paths.publicUrlOrPath.slice(0, -1) ); const devSocket = { - warnings: warnings => + warnings: (warnings) => devServer.sockWrite(devServer.sockets, 'warnings', warnings), - errors: errors => + errors: (errors) => devServer.sockWrite(devServer.sockets, 'errors', errors), }; // Create a webpack compiler that is configured with custom messages. @@ -134,7 +134,7 @@ checkBrowsers(paths.appPath, isInteractive) ); const devServer = new WebpackDevServer(compiler, serverConfig); // Launch WebpackDevServer. - devServer.listen(port, HOST, err => { + devServer.listen(port, HOST, (err) => { if (err) { return console.log(err); } @@ -158,8 +158,8 @@ checkBrowsers(paths.appPath, isInteractive) openBrowser(urls.localUrlForBrowser); }); - ['SIGINT', 'SIGTERM'].forEach(function(sig) { - process.on(sig, function() { + ['SIGINT', 'SIGTERM'].forEach(function (sig) { + process.on(sig, function () { devServer.close(); process.exit(); }); @@ -167,14 +167,14 @@ checkBrowsers(paths.appPath, isInteractive) if (isInteractive || process.env.CI !== 'true') { // Gracefully exit when stdin ends - process.stdin.on('end', function() { + process.stdin.on('end', function () { devServer.close(); process.exit(); }); process.stdin.resume(); } }) - .catch(err => { + .catch((err) => { if (err && err.message) { console.log(err.message); }