Use new $configDir setting in tsconfig (#2532)

This shipped in Typescript 5.5; see
https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-configdir-template-variable-for-configuration-files

## Checklist

- [-] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [-] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [-] I have not broken the cheatsheet
This commit is contained in:
Pokey Rule 2024-07-18 22:46:24 -07:00 committed by GitHub
parent e1f1b276fa
commit 99969acf18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 18 additions and 56 deletions

View File

@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "out",
"jsx": "react-jsx",
"lib": ["es5", "es6", "dom"],
"allowSyntheticDefaultImports": true,

View File

@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "out",
"jsx": "react-jsx",
"esModuleInterop": true,
"skipLibCheck": true,

View File

@ -1,9 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src"
},
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
"references": []
}

View File

@ -1,9 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src"
},
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
"references": [
{

View File

@ -1,9 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "es2020",
"outDir": "out",
"rootDir": "src"
"target": "es2020"
},
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
"references": [

View File

@ -1,10 +1,8 @@
{
"extends": ["@tsconfig/docusaurus/tsconfig.json", "../../tsconfig.base.json"],
"compilerOptions": {
"rootDir": "src",
"esModuleInterop": true,
"emitDeclarationOnly": false,
"outDir": "out"
"emitDeclarationOnly": false
},
"references": [],
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"]

View File

@ -11,9 +11,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"rootDir": "src",
"outDir": "out"
"incremental": true
},
"include": [
"src/**/*.ts",

View File

@ -1,9 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src"
},
"references": [
{
"path": "../common"

View File

@ -1,9 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "es2020",
"outDir": "out",
"rootDir": "src"
"target": "es2020"
},
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
"references": [

View File

@ -5,7 +5,7 @@ import { pathExists } from "path-exists";
import { PackageJson, TsConfigJson } from "type-fest";
import { toPosixPath } from "./toPosixPath";
import { Context } from "./Context";
import { uniq } from "lodash-es";
import { cloneDeep, isEqual, uniq } from "lodash-es";
import { readFile } from "fs/promises";
/**
@ -89,14 +89,18 @@ export async function updateTSConfig(
references.push({ path: relativePath });
}
const compilerOptions = {
...(cloneDeep(input.compilerOptions) ?? {}),
};
delete compilerOptions.outDir;
delete compilerOptions.rootDir;
return {
...input,
extends: getExtends(pathFromPackageToRoot, input.extends),
compilerOptions: {
...(input.compilerOptions ?? {}),
rootDir: "src",
outDir: "out",
},
...(isEqual(compilerOptions, {}) ? {} : { compilerOptions }),
references: references.sort((r1, r2) => r1.path.localeCompare(r2.path)),
include: [
"src/**/*.ts",

View File

@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src",
"target": "es2020",
"module": "ES2020",
"moduleResolution": "node",

View File

@ -1,9 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "out"
},
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
"references": [
{

View File

@ -1,9 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "out"
},
"references": [],
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"]
}

View File

@ -1,9 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "out"
},
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
"references": [
{

View File

@ -1,9 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "out",
"rootDir": "src"
},
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
"references": [
{

View File

@ -1,9 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "es2020",
"outDir": "out",
"rootDir": "src"
"target": "es2020"
},
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
"references": [

View File

@ -11,6 +11,8 @@
"composite": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"strict": true
"strict": true,
"rootDir": "${configDir}/src",
"outDir": "${configDir}/out"
}
}