-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: Add build scripts as a separate package #682
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
Conversation
9e902f9 to
934bb73
Compare
488e2df to
363d398
Compare
363d398 to
3a2a542
Compare
bajtos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice start!
I am not sure how much value there is in sharing our build scripts that are specific to monorepo structure, but then I don't mind that too much.
In addition to my comments below, please take a look at monorepo-level tslint.* config files, they are still around after your changes:
Most importantly, make sure that the tslint extension for VSCode is picking up the right lint config.
Similarly, there are tsconfig.* files at root level that are used by the VSCode TS intellisense, they must be updated to refer to the shared config from the new build package.
packages/authentication/package.json
Outdated
| "LoopBack", | ||
| "Authentication" | ||
| ], | ||
| "keywords": ["LoopBack", "Authentication"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, we are not (or should not be) applying prettier formatting to package.json, because npm will reformat the file back to JSON.stringify format whenever we change it, typically via npm install. Could you please revert these white-space only changes?
I am not sure if package.json is listed in .prettierignore, feel free to add it there if it isn't. Here is what we did in loopback4-extension-starter (the trick works well with VS Code prettier plugin):
*.json
| @@ -0,0 +1,6 @@ | |||
| { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be using top-level .prettierrc from the monorepo, not per-package configs. Please remove this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intentional as I want to make sure the scripts are formatted with es5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, makes sense 👍
packages/build/CODEOWNERS
Outdated
| @@ -0,0 +1,7 @@ | |||
| # Lines starting with '#' are comments. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto, CODEOWNERS file does not make sense inside a package. Please move this entry to top-level CODEOWNERS file at monorepo's root level and use a path specifier to limit the codeowners to this package only.
| @@ -0,0 +1,6 @@ | |||
| { | |||
| "include": ["packages/example-codehub/src/**", "packages/*/dist*/*"], | |||
| "exclude": ["packages/core/*/promisify.*"], | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This configuration is specific to loopback-next (include packages/example-codehub, exclude promisify.* from core), it does not belong to a shared/common config.
packages/context/package.json
Outdated
| "unit": | ||
| "lb-dist mocha --opts ../../test/mocha.opts 'DIST/test/unit/**/*.js'", | ||
| "verify": | ||
| "npm pack && tar xf loopback-context*.tgz && tree package && npm run clean" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment applies here - please revert whitespace changes, npm is going to revert them anyways.
Please do the same in all package.json files modified by this PR.
|
The CI build is failing on all platforms (Travis, AppVeyor + Node.js 6.x, 8.x), please check. |
| "build:dist": "lb-tsc es2017", | ||
| "build:dist6": "lb-tsc es2015", | ||
| "build:apidocs": "lb-apidocs", | ||
| "tslint": "lb-tslint", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool if the project uses the same tslint config as we do. However, if the project wants to customize their tslint settings, how can they do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See README
| "build:apidocs": "lb-apidocs", | ||
| "tslint": "lb-tslint", | ||
| "tslint:fix": "npm run tslint -- --fix", | ||
| "prettier:cli": "lb-prettier \"**/*.ts\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool if the project uses the same prettier config as we do. However, if the project wants to customize their settings, how can they do that? Could you please explain that in README?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See README
a7e2066 to
bfec8ae
Compare
The |
|
@bajtos PTAL. |
bfec8ae to
5d6bfec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although this PR is a bit big to review, I don't really have any concerns. I like how the package is composed of many (mainly independent) build scripts so that people can pick and choose what they want out of it.
| "packages/*/node_modules/**", | ||
| "**/*.d.ts" | ||
| ] | ||
| "extends": "./packages/build/config/tsconfig.common.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the following line here as well?
"$schema": "http://json.schemastore.org/tsconfig"
| const path = require('path'); | ||
| const fs = require('fs'); | ||
|
|
||
| const utils = require('../../bin/utils'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't really use utils in this test case. Can we test its exported functions here as well as the scripts in /bin? You can test them in separate files or describe blocks, but I leave the organization up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Fixed.
b42e96f to
08fdb9d
Compare
packages/build/bin/lint-commits.sh
Outdated
| @@ -0,0 +1,45 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file doesn't need to be moved as we don't expose it in build and loopback-next still seems to be using the one from /bin.
185a4ab to
c6f7599
Compare
78ccf5f to
a96a680
Compare
|
@bajtos PTAL |
6fc98e1 to
9d36527
Compare
9d36527 to
2efb764
Compare
kjdelisle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm mostly happy about the scripts no longer containing tons of ../../../../../
bajtos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid I don't have enough time to review these changes in all details and I don't want to block progress. The changes LGTM at high level now.
My only concern is about mono-repo's top-level tsconfig.build.json which seems to mostly duplicate the content in packages/build/config/tslint.build.json.
| @@ -0,0 +1,6 @@ | |||
| { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, makes sense 👍
Description
The PR adds
buildpackage to the monorepo. It will be published as@loopback/build. The module exposes a set of build related scripts.Other modules will use
@loopback/buildas a dev dependency and use the cli commands for the build.Related issues
Checklist
guide