Skip to content

Commit 53a6d06

Browse files
committed
feat: remove typescript flag and NODE_PATH support
1 parent 3771237 commit 53a6d06

File tree

5 files changed

+6
-88
lines changed

5 files changed

+6
-88
lines changed

docusaurus/docs/advanced-configuration.md

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ You can adjust various development and production settings by setting environmen
2222
| REACT_EDITOR | ✅ Used | 🚫 Ignored | When an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You can [send a pull request to detect your editor of choice](https://github.com/facebook/create-react-app/issues/2636). Setting this environment variable overrides the automatic detection. If you do it, make sure your systems [PATH](<https://en.wikipedia.org/wiki/PATH_(variable)>) environment variable points to your editor’s bin folder. You can also set it to `none` to disable it completely. |
2323
| CHOKIDAR_USEPOLLING | ✅ Used | 🚫 Ignored | When set to `true`, the watcher runs in polling mode, as necessary inside a VM. Use this option if `npm start` isn't detecting changes. |
2424
| GENERATE_SOURCEMAP | 🚫 Ignored | ✅ Used | When set to `false`, source maps are not generated for a production build. This solves out of memory (OOM) issues on some smaller machines. |
25-
| NODE_PATH | ✅ Used | ✅ Used | Same as [`NODE_PATH` in Node.js](https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders), but only relative folders are allowed. Can be handy for emulating a monorepo setup by setting `NODE_PATH=src`. |
2625
| INLINE_RUNTIME_CHUNK | 🚫 Ignored | ✅ Used | By default, Create React App will embed the runtime script into `index.html` during the production build. When set to `false`, the script will not be embedded and will be imported as usual. This is normally required when dealing with CSP. |
2726
| IMAGE_INLINE_SIZE_LIMIT | 🚫 Ignored | ✅ Used | By default, images smaller than 10,000 bytes are encoded as a data URI in base64 and inlined in the CSS or JS build artifact. Set this to control the size limit in bytes. Setting it to 0 will disable the inlining of images. |
2827
| EXTEND_ESLINT | ✅ Used | ✅ Used | When set to `true`, user provided ESLint configs will be used by `eslint-loader`. Note that any rules set to `"error"` will stop the application from building. |

packages/create-react-app/createReactApp.js

+4-54
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ const program = new commander.Command(packageJson.name)
7474
)
7575
.option('--use-npm')
7676
.option('--use-pnp')
77-
// TODO: Remove this in next major release.
78-
.option(
79-
'--typescript',
80-
'(this option will be removed in favour of templates in the next major release of create-react-app)'
81-
)
8277
.allowUnknownOption()
8378
.on('--help', () => {
8479
console.log(` Only ${chalk.green('<project-directory>')} is required.`);
@@ -114,7 +109,7 @@ const program = new commander.Command(packageJson.name)
114109
console.log();
115110
console.log(` A custom ${chalk.cyan('--template')} can be one of:`);
116111
console.log(
117-
` - a custom fork published on npm: ${chalk.green(
112+
` - a custom template published on npm: ${chalk.green(
118113
'cra-template-typescript'
119114
)}`
120115
);
@@ -190,29 +185,12 @@ createApp(
190185
program.scriptsVersion,
191186
program.template,
192187
program.useNpm,
193-
program.usePnp,
194-
program.typescript
188+
program.usePnp
195189
);
196190

197-
function createApp(
198-
name,
199-
verbose,
200-
version,
201-
template,
202-
useNpm,
203-
usePnp,
204-
useTypeScript
205-
) {
191+
function createApp(name, verbose, version, template, useNpm, usePnp) {
206192
const unsupportedNodeVersion = !semver.satisfies(process.version, '>=8.10.0');
207-
if (unsupportedNodeVersion && useTypeScript) {
208-
console.error(
209-
chalk.red(
210-
`You are using Node ${process.version} with the TypeScript template. Node 8.10 or higher is required to use TypeScript.\n`
211-
)
212-
);
213-
214-
process.exit(1);
215-
} else if (unsupportedNodeVersion) {
193+
if (unsupportedNodeVersion) {
216194
console.log(
217195
chalk.yellow(
218196
`You are using Node ${process.version} so the project will be bootstrapped with an old unsupported version of tools.\n\n` +
@@ -283,23 +261,6 @@ function createApp(
283261
}
284262
}
285263

286-
if (useTypeScript) {
287-
console.log(
288-
chalk.yellow(
289-
'The --typescript option has been deprecated and will be removed in a future release.'
290-
)
291-
);
292-
console.log(
293-
chalk.yellow(
294-
`In future, please use ${chalk.cyan('--template typescript')}.`
295-
)
296-
);
297-
console.log();
298-
if (!template) {
299-
template = 'typescript';
300-
}
301-
}
302-
303264
if (useYarn) {
304265
let yarnUsesDefaultRegistry = true;
305266
try {
@@ -457,17 +418,6 @@ function run(
457418
console.log('');
458419
}
459420

460-
// TODO: Remove with next major release.
461-
if (!supportsTemplates && (template || '').includes('typescript')) {
462-
allDependencies.push(
463-
'@types/node',
464-
'@types/react',
465-
'@types/react-dom',
466-
'@types/jest',
467-
'typescript'
468-
);
469-
}
470-
471421
console.log(
472422
`Installing ${chalk.cyan('react')}, ${chalk.cyan(
473423
'react-dom'

packages/react-scripts/config/modules.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,8 @@ const resolve = require('resolve');
2222
function getAdditionalModulePaths(options = {}) {
2323
const baseUrl = options.baseUrl;
2424

25-
// We need to explicitly check for null and undefined (and not a falsy value) because
26-
// TypeScript treats an empty string as `.`.
27-
if (baseUrl == null) {
28-
// If there's no baseUrl set we respect NODE_PATH
29-
// Note that NODE_PATH is deprecated and will be removed
30-
// in the next major release of create-react-app.
31-
32-
const nodePath = process.env.NODE_PATH || '';
33-
return nodePath.split(path.delimiter).filter(Boolean);
25+
if (!baseUrl) {
26+
return '';
3427
}
3528

3629
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);

packages/react-scripts/scripts/build.js

-12
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,6 @@ checkBrowsers(paths.appPath, isInteractive)
146146

147147
// Create the production build and print the deployment instructions.
148148
function build(previousFileSizes) {
149-
// We used to support resolving modules according to `NODE_PATH`.
150-
// This now has been deprecated in favor of jsconfig/tsconfig.json
151-
// This lets you use absolute paths in imports inside large monorepos:
152-
if (process.env.NODE_PATH) {
153-
console.log(
154-
chalk.yellow(
155-
'Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.'
156-
)
157-
);
158-
console.log();
159-
}
160-
161149
console.log('Creating an optimized production build...');
162150

163151
const compiler = webpack(config);

packages/react-scripts/scripts/start.js

-12
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,6 @@ checkBrowsers(paths.appPath, isInteractive)
142142
clearConsole();
143143
}
144144

145-
// We used to support resolving modules according to `NODE_PATH`.
146-
// This now has been deprecated in favor of jsconfig/tsconfig.json
147-
// This lets you use absolute paths in imports inside large monorepos:
148-
if (process.env.NODE_PATH) {
149-
console.log(
150-
chalk.yellow(
151-
'Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app.'
152-
)
153-
);
154-
console.log();
155-
}
156-
157145
console.log(chalk.cyan('Starting the development server...\n'));
158146
openBrowser(urls.localUrlForBrowser);
159147
});

0 commit comments

Comments
 (0)