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.
|
// Always run install to link packages.
|
||||||
if (options.isUsingTsSolutionConfig) {
|
if (options.isUsingTsSolutionConfig) {
|
||||||
tasks.push(() => installPackagesTask(host));
|
tasks.push(() => installPackagesTask(host, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.push(() => {
|
tasks.push(() => {
|
||||||
|
|||||||
@ -136,7 +136,7 @@ export async function reactNativeLibraryGeneratorInternal(
|
|||||||
|
|
||||||
// Always run install to link packages.
|
// Always run install to link packages.
|
||||||
if (options.isUsingTsSolutionConfig) {
|
if (options.isUsingTsSolutionConfig) {
|
||||||
tasks.push(() => installPackagesTask(host));
|
tasks.push(() => installPackagesTask(host, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.push(() => {
|
tasks.push(() => {
|
||||||
|
|||||||
@ -1335,6 +1335,9 @@ describe('app', () => {
|
|||||||
"vite.config.mts",
|
"vite.config.mts",
|
||||||
"vitest.config.ts",
|
"vitest.config.ts",
|
||||||
"vitest.config.mts",
|
"vitest.config.mts",
|
||||||
|
"eslint.config.js",
|
||||||
|
"eslint.config.cjs",
|
||||||
|
"eslint.config.mjs",
|
||||||
],
|
],
|
||||||
"extends": "../tsconfig.base.json",
|
"extends": "../tsconfig.base.json",
|
||||||
"include": [
|
"include": [
|
||||||
|
|||||||
@ -361,11 +361,19 @@ export async function applicationGeneratorInternal(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTsconfigFiles(host, options.appProjectRoot, 'tsconfig.app.json', {
|
updateTsconfigFiles(
|
||||||
jsx: 'react-jsx',
|
host,
|
||||||
module: 'esnext',
|
options.appProjectRoot,
|
||||||
moduleResolution: 'bundler',
|
'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) {
|
if (!options.skipFormat) {
|
||||||
await formatFiles(host);
|
await formatFiles(host);
|
||||||
|
|||||||
@ -286,7 +286,7 @@ export async function libraryGeneratorInternal(host: Tree, schema: Schema) {
|
|||||||
|
|
||||||
// Always run install to link packages.
|
// Always run install to link packages.
|
||||||
if (options.isUsingTsSolutionConfig) {
|
if (options.isUsingTsSolutionConfig) {
|
||||||
tasks.push(() => installPackagesTask(host));
|
tasks.push(() => installPackagesTask(host, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.push(() => {
|
tasks.push(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user