fix(react): fix issues with react ts setup (#29312)
Fixes a couple of things: 1. React application should ignore `eslint.config.js`, `eslint.config.cjs`, and `eslint.config.mjs` files since they are not part of the app runtime. 2. React lib generators should always run `npm install`. It currently runs only when `package.json` has changed, but we need to run it to link packages regardless of `package.json` changes.
This commit is contained in:
parent
726c07d324
commit
c2eae0e297
@ -136,7 +136,7 @@ export async function expoLibraryGeneratorInternal(
|
||||
|
||||
// Always run install to link packages.
|
||||
if (options.isUsingTsSolutionConfig) {
|
||||
tasks.push(() => installPackagesTask(host));
|
||||
tasks.push(() => installPackagesTask(host, true));
|
||||
}
|
||||
|
||||
tasks.push(() => {
|
||||
|
||||
@ -136,7 +136,7 @@ export async function reactNativeLibraryGeneratorInternal(
|
||||
|
||||
// Always run install to link packages.
|
||||
if (options.isUsingTsSolutionConfig) {
|
||||
tasks.push(() => installPackagesTask(host));
|
||||
tasks.push(() => installPackagesTask(host, true));
|
||||
}
|
||||
|
||||
tasks.push(() => {
|
||||
|
||||
@ -1335,6 +1335,9 @@ describe('app', () => {
|
||||
"vite.config.mts",
|
||||
"vitest.config.ts",
|
||||
"vitest.config.mts",
|
||||
"eslint.config.js",
|
||||
"eslint.config.cjs",
|
||||
"eslint.config.mjs",
|
||||
],
|
||||
"extends": "../tsconfig.base.json",
|
||||
"include": [
|
||||
|
||||
@ -361,11 +361,19 @@ export async function applicationGeneratorInternal(
|
||||
);
|
||||
}
|
||||
|
||||
updateTsconfigFiles(host, options.appProjectRoot, 'tsconfig.app.json', {
|
||||
jsx: 'react-jsx',
|
||||
module: 'esnext',
|
||||
moduleResolution: 'bundler',
|
||||
});
|
||||
updateTsconfigFiles(
|
||||
host,
|
||||
options.appProjectRoot,
|
||||
'tsconfig.app.json',
|
||||
{
|
||||
jsx: 'react-jsx',
|
||||
module: 'esnext',
|
||||
moduleResolution: 'bundler',
|
||||
},
|
||||
options.linter === 'eslint'
|
||||
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
||||
: undefined
|
||||
);
|
||||
|
||||
if (!options.skipFormat) {
|
||||
await formatFiles(host);
|
||||
|
||||
@ -286,7 +286,7 @@ export async function libraryGeneratorInternal(host: Tree, schema: Schema) {
|
||||
|
||||
// Always run install to link packages.
|
||||
if (options.isUsingTsSolutionConfig) {
|
||||
tasks.push(() => installPackagesTask(host));
|
||||
tasks.push(() => installPackagesTask(host, true));
|
||||
}
|
||||
|
||||
tasks.push(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user