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
20 changes: 13 additions & 7 deletions bin/create-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,20 @@
* `--yes` or `-y` is provide by the command, interactive prompts are skipped.
*
* 3. Tidy up the project
* - Remove unused files
* - Rename `tsconfig.json` to `tsconfig.build.json`
* - Improve `package.json`
* - Remove unused files
* - Improve `package.json`
*
* 4. Run `lerna boostrap` on the newly added package to set up dependencies
* 4. Run `lerna bootstrap --scope <full-package-name>` to link its local
* dependencies.
*
* 5. Run `update-ts-project-refs` to update TypeScript project references
*
* 6. Remind to update `CODEOWNERS` and `docs/site/MONOREPO.md`
*/
'use strict';

const build = require('../packages/build');
const {updateReferences} = require('./update-ts-project-refs');
const path = require('path');
const cwd = process.cwd();
const fs = require('fs-extra');
Expand Down Expand Up @@ -101,6 +106,7 @@ async function main() {
await scaffoldProject(project);
await tidyupProject(project);
await bootstrapProject(project);
await updateReferences({dryRun: false});

promptActions(project);
}
Expand Down Expand Up @@ -163,9 +169,6 @@ async function tidyupProject({repoRoot, projectDir}) {
};
fs.writeJsonSync('package.json', pkg);

// Move tsconfig.json to tsconfig.build.json
fs.moveSync('tsconfig.json', 'tsconfig.build.json');

// Remove unused files
build.clean([
'node',
Expand Down Expand Up @@ -197,6 +200,9 @@ async function tidyupProject({repoRoot, projectDir}) {
await waitForProcessExit(copyrightProcess);
}

/**
* Remind follow-up steps
*/
function promptActions({projectDir}) {
console.log();
console.log(
Expand Down
2 changes: 2 additions & 0 deletions bin/update-ts-project-refs.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,5 @@ if (require.main === module) {
process.exit(1);
});
}

exports.updateReferences = updateReferences;
14 changes: 9 additions & 5 deletions docs/site/DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,14 @@ The script does the following steps:
3. Tidy up the project

- Remove unused files
- Rename `tsconfig.json` to `tsconfig.build.json`
- Improve `package.json`

4. Run `lerna boostrap` on the newly added package to set up dependencies
4. Run `lerna bootstrap --scope <full-package-name>` to link its local
dependencies.

5. Run `update-ts-project-refs` to update TypeScript project references

6. Remind to update `CODEOWNERS` and `docs/site/MONOREPO.md`

If you would like to do it manually, follow steps below:

Expand Down Expand Up @@ -756,9 +760,9 @@ In the [`loopback-next`](https://github.com/strongloop/loopback-next) monorepo,

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.
- At monorepo root, there is `tsconfig.json` used by VS Code and
`tsconfig.build.json` used by `eslint`.
- Inside each package, there is `tsconfig.json` used by `npm run build` command.

## Renovate bot

Expand Down