microsoft / microsoft/TypeScript

Build mode ignores inherited --pretty flag when run through lerna

Ouverte
#39,178 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Bug Domain: tsc -b
Langage dominant
Go
Étoiles
111k
Forks
14.3k
Merge moyen
2 j 4 h
PR mergées (30 j)
132

Description

TypeScript Version: 39.4

Search Terms: build pretty

"Code"
I am currently in the process of converting a project to a monorepo. Here I noticed that tsc -b seems to ignore the --pretty flag defined in a parent tsconfig when its run through lerna (with the stream flag set to true).
The project is set up as follows
tsconfig.json: pretty => true
tsconfig.build.json: extends from tsconfig.json
package/package-name/tsconfig.build.json: extends from ../../tsconfig.build.json
package/package-name/package.json defines the npm scripts

"scripts": {
  "prebuild": "gulp prebuild",
  "build": "tsc -b tsconfig.build.json",
}

The pretty flag only works sometimes:
If I manually execute npm run build in the package dir, the tsc output is pretty.
If I execute lerna run build --scope=package-name, the tsc output is NOT pretty.
If I execute lerna exec --scope=package-name -- npm run build, the tsc output is pretty.
If I manually add the --pretty flag to the npm script ("tsc -b tsconfig.build.json --watch --pretty"), the tsc output is pretty in all the cases.

Although this might be caused by lerna, I suspect this is actually a bug in TypeScript, because the prebuild output from gulp is colored (pretty) in all the cases I mentioned and manually adding the flag also works.

Expected behavior:
CLI output is "pretty"

Actual behavior:
It is not

Playground Link: not applicable

Related Issues: https://github.com/microsoft/TypeScript/issues/30282

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire les trois formes de commande : npm run build dans le répertoire du package, lerna run build --scope=package-name et lerna exec --scope=package-name -- npm run build. Examinez comment tsc -b lit les fichiers tsconfig.json chaînés et gère --pretty lorsqu’il est invoqué via lerna. C’est terminé lorsque le paramètre pretty hérité produit une sortie CLI cohérente, ou lorsque le problème est attribué à lerna.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
typescript
Domaine
build-system, cli
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.