microsoft / microsoft/TypeScript

Allow for dropping tsconfig.json in arbitrary folder and specifying the source root with tsc command

Aperta
#27,386 5 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

Search Terms

  1. tsconfig.json
  2. TS18003
  3. project root

Suggestion

I have been deving an automation publish tool, with typescript inside. Nice work for you!

Since the tsconfig.json file need to be put in a center config folder other than project/source code root. amd i have tried to use tsc --watch --project path-to-tsconfig.json to make this future, which is not working for now.

I got TS18003 error, and i know why this happen: tsc just want to remind us we may have a wrong include or exclude config. 😄 I cannot find any tsc command should i use to conject with --project option to specify the project root.

I find in the tsc sourcecode that the compiler.parseJsonConfigFileContent(_, _, basePath); function could let us specify the project basePath when parsing tsconfig.json, so, i want to ask if we can expose a command option to let use the same function as basePath, maybe --configFileBasePath or --configContext?

Please let me know if there already is a solution for my use case.

Thank you for your works!

Examples

tsc --project path-to-tsconfig.json --configContext path-to-source-code-root

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript / JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. new expression-level syntax)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dalla gestione di tsc --project e dalla chiamata a compiler.parseJsonConfigFileContent menzionata nell’issue. Traccia il modo in cui i percorsi di tsconfig.json determinano il percorso di base del progetto e come viene prodotto TS18003. Il lavoro è completato quando un’opzione di comando documentata può specificare una radice dei sorgenti separata per una configurazione in una cartella arbitraria, con test che coprono l’invocazione di esempio.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
build-system, cli
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.