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

fix(cli): remove project references from examples #5204

Merged
merged 1 commit into from
Apr 23, 2020
Merged

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented Apr 23, 2020

In #5155, we reworked our typescript setup to leverage composite mode and project references. This breaks our example applications when they are checked out standalone, typically via lb4 example.

$ lb4 example todo
(...)
$ cd loopback4-example-todo
$ npm t
(...)
> lb-tsc

error TS6053: File '/private/packages/http-caching-proxy/tsconfig.json' not found.
error TS6053: File '/private/packages/testlab/tsconfig.json' not found.
(...)
Found 10 errors.

This patch fixes the problem by introducing a new step to lb4 example command where we remove references and compilerOptions.composite field from tsconfig.json file.

Implements #2609.

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • 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

👉 Check out how to submit a PR 👈

// was checked out outside of our monorepo.
const tsconfigContent = await fs.readJson(tsconfig);
delete tsconfigContent.references;
delete tsconfigContent.compilerOptions.composite;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let’s set the composite flag to false as it may inherit its value from the base tsconfig.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. LGTY now?

In #5155, we reworked our typescript setup
to leverage composite mode and project references. This breaks our
example applications when they are checked out standalone, typically
via `lb4 example`.

```sh
$ lb4 example todo
(...)
$ cd loopback4-example-todo
$ npm t
(...)
> lb-tsc

error TS6053: File '/private/packages/http-caching-proxy/tsconfig.json' not found.
error TS6053: File '/private/packages/testlab/tsconfig.json' not found.
(...)
Found 10 errors.
```

This commit fixes the problem by introducing a new step to `lb4 example`
command where we remove `references` field from `tsconfig.json` file
and set the field `compilerOptions.composite` to `false`.

Signed-off-by: Miroslav Bajtoš <[email protected]>
@bajtos bajtos merged commit 6359ed6 into master Apr 23, 2020
@bajtos bajtos deleted the fix/examples branch April 23, 2020 14:55
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.

3 participants