Skip to content

Commit

Permalink
fix(remix): tsconfigs were being incorrectly generated causing errors #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 authored Jan 29, 2024
1 parent 911f8d6 commit 1ea09ad
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,6 @@ function expectTargetsToBeCorrect(tree: Tree, projectRoot: string) {
expect(targets.start.command).toEqual('remix-serve build/index.js');
expect(targets.start.options.cwd).toEqual(projectRoot);
expect(targets.typecheck).toBeTruthy();
expect(targets.typecheck.command).toEqual('tsc');
expect(targets.typecheck.command).toEqual('tsc --project tsconfig.app.json');
expect(targets.typecheck.options.cwd).toEqual(projectRoot);
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default async function (tree: Tree, _options: NxRemixGeneratorSchema) {
},
},
typecheck: {
command: `tsc`,
command: `tsc --project tsconfig.app.json`,
options: {
cwd: options.projectRoot,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "./tsconfig.json",
"include": [
"remix.env.d.ts",
"app/**/*.ts",
"app/**/*.tsx",
"app/**/*.js",
"app/**/*.jsx"
],
"exclude": [
"tests/**/*.spec.ts",
"tests/**/*.test.ts",
"tests/**/*.spec.tsx",
"tests/**/*.test.tsx",
"tests/**/*.spec.js",
"tests/**/*.test.js",
"tests/**/*.spec.jsx",
"tests/**/*.test.jsx"
]
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"extends": "<%= offsetFromRoot %>tsconfig.base.json",
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2019"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"moduleResolution": "node",
"resolveJsonModule": true,
"target": "ES2019",
"strict": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
// Remix takes care of building everything in `remix build`.
"noEmit": true
}
"lib": ["DOM", "DOM.Iterable", "ES2019"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"moduleResolution": "node",
"resolveJsonModule": true,
"target": "ES2019",
"strict": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
// Remix takes care of building everything in `remix build`.
"noEmit": true
},
"include": [],
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
joinPathFragments,
stripIndents,
type Tree,
updateJson,
workspaceRoot,
} from '@nx/devkit';
import {
Expand Down Expand Up @@ -56,6 +57,32 @@ export function updateUnitTestConfig(
);
}

const pathToTsConfigSpec = joinPathFragments(
pathToRoot,
`tsconfig.spec.json`
);

updateJson(tree, pathToTsConfigSpec, (json) => {
json.includes = [
'vite.config.ts',
'vitest.config.ts',
'app/**/*.ts',
'app/**/*.tsx',
'app/**/*.js',
'app/**/*.jsx',
'tests/**/*.spec.ts',
'tests/**/*.test.ts',
'tests/**/*.spec.tsx',
'tests/**/*.test.tsx',
'tests/**/*.spec.js',
'tests/**/*.test.js',
'tests/**/*.spec.jsx',
'tests/**/*.test.jsx',
];

return json;
});

return addDependenciesToPackageJson(
tree,
{},
Expand Down

1 comment on commit 1ea09ad

@vercel
Copy link

@vercel vercel bot commented on 1ea09ad Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.