Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add shareable tsconfig support #1397

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"typescript-json-schema": "^0.53.0"
},
"dependencies": {
"@gitbeaker/node": "^21.3.0",
"@octokit/rest": "^18.12.0",
"async-retry": "1.2.3",
"chalk": "^2.3.0",
Expand All @@ -150,7 +151,7 @@
"debug": "^4.1.1",
"fast-json-patch": "^3.0.0-1",
"get-stdin": "^6.0.0",
"@gitbeaker/node": "^21.3.0",
"get-tsconfig": "^4.6.2",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1",
"hyperlinker": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions source/ambient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ declare module "cli-interact"
declare module "hyperlinker"
declare module "supports-hyperlinks"

declare module "get-tsconfig"

// declare module "require-from-string" {
// export interface RequireOptions {
// /** List of paths, that will be appended to module paths. Useful, when you want
Expand Down
4 changes: 2 additions & 2 deletions source/runner/runners/utils/transpiler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from "fs"
import * as path from "path"
import JSON5 from "json5"
import { parseTsconfig } from "get-tsconfig"
import { debug } from "../../../debug"

const enum BabelPackagePrefix {
Expand Down Expand Up @@ -126,7 +126,7 @@ export const typescriptify = (content: string, dir: string): string => {
let compilerOptions: any
const tsConfigPath = lookupTSConfig(dir)
if (tsConfigPath) {
compilerOptions = JSON5.parse(fs.readFileSync(tsConfigPath, "utf8"))
compilerOptions = parseTsconfig(tsConfigPath)
Copy link
Member

Choose a reason for hiding this comment

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

This project already depends on TypeScript (see line 123), so it’s not helpful for us to pull in a 3rd-party package whose purpose is to parseTsconfig without a dependency on TypeScript!

Instead, I’d accept a PR that usests.parseConfig or a similar API that supports extends from the official dependency — that we’re already pulling in.

} else {
compilerOptions = ts.getDefaultCompilerOptions()
}
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4566,6 +4566,13 @@ get-stream@^6.0.0:
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==

get-tsconfig@^4.6.2:
version "4.6.2"
resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.6.2.tgz#831879a5e6c2aa24fe79b60340e2233a1e0f472e"
integrity sha512-E5XrT4CbbXcXWy+1jChlZmrmCwd5KGx502kDCXJJ7y898TtWW9FwoG5HfOLVRKmlmDGkWN2HM9Ho+/Y8F0sJDg==
dependencies:
resolve-pkg-maps "^1.0.0"

get-value@^2.0.3, get-value@^2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28"
Expand Down Expand Up @@ -8340,6 +8347,11 @@ resolve-from@^5.0.0:
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69"
integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==

resolve-pkg-maps@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f"
integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==

resolve-url@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
Expand Down