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

refactor: rename tsconfig.build files in examples #2201

Merged
merged 2 commits into from
Jan 9, 2019

Conversation

nabdelgadir
Copy link
Contributor

@nabdelgadir nabdelgadir commented Dec 27, 2018

Connect to #2175.

Renamed the tsconfig.build.ts files in the examples to tsconfig.ts because, when using the examples from the lb4 example command, they weren't extending tsconfig.common.json until after the rename. They also now match the rpc-server example.

Checklist

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

Copy link
Contributor

@marioestradarosa marioestradarosa left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Contributor

@jannyHou jannyHou left a comment

Choose a reason for hiding this comment

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

LGTM. Just wondering...why we named them as tsconfig.build.json in the first place?
cc @bajtos @raymondfeng may know the answer, thanks!

@bajtos
Copy link
Member

bajtos commented Jan 4, 2019

I believe this change is going to break "refactor - rename" and "go to definition" commands in VS Code. Let me explain the background. It would be great if you could capture this information in our docs, e.g. DEVELOPING.md.

Right now, our monorepo has two TypeScript setups in place.

  1. Inside VS Code, we want the TypeScript engine to view loopback-next as a single big project. This enables "refactor - rename" command to change all places using the renamed symbol, and also makes "go to definition" jump to .ts files containing the original source code. Otherwise "refactor - rename" works within the same package only and "go to definition" jumps to .d.ts files.

  2. When building the monorepo, we need to build the packages individually, so that one dist directory is created for each package.

That's why we have two sets of tsconfig files:

  • At monorepo root, there is tsconfig.json used by VSCode
  • Inside each package, there is tsconfig.build.json used by npm run build command.

@raymondfeng and I are looking into ways how to leverage TypeScript's Project References to allow us to have the same tsconfig for both build & VSCode, but that's a longer term work. See #1636.

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

As explained in my previous commit, this change is very likely to break VSCode experience inside our monorepo.

I am proposing to use a different approach: when unpacking the example from npm tarball, rename tsconfig.build.json to tsconfig.json. See the following two places in our codebase to get you started:

https://github.com/strongloop/loopback-next/blob/16311c502cf782bb284ba462b5a62c36323898d7/packages/cli/generators/example/index.js#L94-L96

https://github.com/strongloop/loopback-next/blob/16311c502cf782bb284ba462b5a62c36323898d7/packages/cli/generators/example/downloader.js#L13-L15

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

LGTM with one minor comment.

docs/site/DEVELOPING.md Outdated Show resolved Hide resolved
nabdelgadir and others added 2 commits January 9, 2019 13:28
Co-authored-by: Miroslav Bajtoš <mbajtoss@gmail.com>
@nabdelgadir nabdelgadir merged commit ce74b80 into master Jan 9, 2019
@nabdelgadir nabdelgadir deleted the rename-tsconfig-file branch January 9, 2019 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants