mirror of
https://github.com/cursorless-dev/cursorless.git
synced 2024-10-03 20:37:50 +03:00
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:
parent
e1f1b276fa
commit
99969acf18
@ -1,8 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "src",
|
|
||||||
"outDir": "out",
|
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
"lib": ["es5", "es6", "dom"],
|
"lib": ["es5", "es6", "dom"],
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "src",
|
|
||||||
"outDir": "out",
|
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "out",
|
|
||||||
"rootDir": "src"
|
|
||||||
},
|
|
||||||
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
||||||
"references": []
|
"references": []
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "out",
|
|
||||||
"rootDir": "src"
|
|
||||||
},
|
|
||||||
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2020",
|
"target": "es2020"
|
||||||
"outDir": "out",
|
|
||||||
"rootDir": "src"
|
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
||||||
"references": [
|
"references": [
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": ["@tsconfig/docusaurus/tsconfig.json", "../../tsconfig.base.json"],
|
"extends": ["@tsconfig/docusaurus/tsconfig.json", "../../tsconfig.base.json"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": "src",
|
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"emitDeclarationOnly": false,
|
"emitDeclarationOnly": false
|
||||||
"outDir": "out"
|
|
||||||
},
|
},
|
||||||
"references": [],
|
"references": [],
|
||||||
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"]
|
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"]
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"incremental": true,
|
"incremental": true
|
||||||
"rootDir": "src",
|
|
||||||
"outDir": "out"
|
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "out",
|
|
||||||
"rootDir": "src"
|
|
||||||
},
|
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"path": "../common"
|
"path": "../common"
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2020",
|
"target": "es2020"
|
||||||
"outDir": "out",
|
|
||||||
"rootDir": "src"
|
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
||||||
"references": [
|
"references": [
|
||||||
|
@ -5,7 +5,7 @@ import { pathExists } from "path-exists";
|
|||||||
import { PackageJson, TsConfigJson } from "type-fest";
|
import { PackageJson, TsConfigJson } from "type-fest";
|
||||||
import { toPosixPath } from "./toPosixPath";
|
import { toPosixPath } from "./toPosixPath";
|
||||||
import { Context } from "./Context";
|
import { Context } from "./Context";
|
||||||
import { uniq } from "lodash-es";
|
import { cloneDeep, isEqual, uniq } from "lodash-es";
|
||||||
import { readFile } from "fs/promises";
|
import { readFile } from "fs/promises";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,14 +89,18 @@ export async function updateTSConfig(
|
|||||||
references.push({ path: relativePath });
|
references.push({ path: relativePath });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const compilerOptions = {
|
||||||
|
...(cloneDeep(input.compilerOptions) ?? {}),
|
||||||
|
};
|
||||||
|
delete compilerOptions.outDir;
|
||||||
|
delete compilerOptions.rootDir;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...input,
|
...input,
|
||||||
extends: getExtends(pathFromPackageToRoot, input.extends),
|
extends: getExtends(pathFromPackageToRoot, input.extends),
|
||||||
compilerOptions: {
|
|
||||||
...(input.compilerOptions ?? {}),
|
...(isEqual(compilerOptions, {}) ? {} : { compilerOptions }),
|
||||||
rootDir: "src",
|
|
||||||
outDir: "out",
|
|
||||||
},
|
|
||||||
references: references.sort((r1, r2) => r1.path.localeCompare(r2.path)),
|
references: references.sort((r1, r2) => r1.path.localeCompare(r2.path)),
|
||||||
include: [
|
include: [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "out",
|
|
||||||
"rootDir": "src",
|
|
||||||
"target": "es2020",
|
"target": "es2020",
|
||||||
"module": "ES2020",
|
"module": "ES2020",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
|
||||||
"rootDir": "src",
|
|
||||||
"outDir": "out"
|
|
||||||
},
|
|
||||||
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
|
||||||
"rootDir": "src",
|
|
||||||
"outDir": "out"
|
|
||||||
},
|
|
||||||
"references": [],
|
"references": [],
|
||||||
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"]
|
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"]
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
|
||||||
"rootDir": "src",
|
|
||||||
"outDir": "out"
|
|
||||||
},
|
|
||||||
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "out",
|
|
||||||
"rootDir": "src"
|
|
||||||
},
|
|
||||||
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2020",
|
"target": "es2020"
|
||||||
"outDir": "out",
|
|
||||||
"rootDir": "src"
|
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
"include": ["src/**/*.ts", "src/**/*.json", "../../typings/**/*.d.ts"],
|
||||||
"references": [
|
"references": [
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
"composite": true,
|
"composite": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"strict": true
|
"strict": true,
|
||||||
|
"rootDir": "${configDir}/src",
|
||||||
|
"outDir": "${configDir}/out"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user