Skip to content
Merged
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
22 changes: 22 additions & 0 deletions docs/site/DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -510,3 +510,25 @@ configuration, it's important to verify that all usage scenarios keep working.
5. Test integration with supported IDEs:

- [VS Code](./VSCODE.md#how-to-verify-tslint-setup)

### tsconfig files

In the [`loopback-next`](https://github.com/strongloop/loopback-next) monorepo,
`TypeScript` is set up in two places:

1. When using VS Code, the `TypeScript` engine views `loopback-next` as a single
big project.

This enables the "refactor - rename" command to change all places using the
renamed symbol, and also makes "go to definition" command 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.

This is why we have two sets of `tsconfig` files:

- At monorepo root, there is `tsconfig.json` used by VS Code.
- Inside each package, there is `tsconfig.build.json` used by `npm run build`
command.
5 changes: 5 additions & 0 deletions packages/cli/generators/example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const chalk = require('chalk');
const downloadAndExtractExample = require('./downloader');
const path = require('path');
const utils = require('../../lib/utils');
const fs = require('fs-extra');

const EXAMPLES = {
todo: 'Tutorial example on how to build an application with LoopBack 4.',
Expand Down Expand Up @@ -94,6 +95,10 @@ module.exports = class extends BaseGenerator {
const cwd = process.cwd();
const absOutDir = await downloadAndExtractExample(this.exampleName, cwd);
this.outDir = path.relative(cwd, absOutDir);
fs.rename(
`${this.outDir}/tsconfig.build.json`,
`${this.outDir}/tsconfig.json`,
);
}

install() {
Expand Down