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

chore: upgrade to typescript 3.0.x and lerna 3.1.x #1626

Merged
merged 2 commits into from
Aug 21, 2018

Conversation

raymondfeng
Copy link
Contributor

@raymondfeng raymondfeng commented Aug 20, 2018

Upgrade to TypeScript 3.0.x and lerna 3.1.x

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

@raymondfeng raymondfeng changed the title chore: upgrade to typescript 3.0.x chore: upgrade to typescript 3.0.x and lerna 3.1.x Aug 20, 2018
@raymondfeng raymondfeng force-pushed the upgrade-to-typescript-3.0.x branch 4 times, most recently from c0bde0b to 466b9fd Compare August 20, 2018 23:53
Copy link
Contributor

@virkt25 virkt25 left a comment

Choose a reason for hiding this comment

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

👏 awesome PR! In a followup PR now we can explore using TS Project Linking to see if it improves build times.

Just have a few questions to help me better understand some of the changes.

/**
* A dummy command to get filtered packages
*/
class NopCommand extends Command {
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this help us get filtered packages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The base command has the default steps to set up filter packages. We execute a no-op command to get such information.

// Load dependencies from `packages/build/package.json`
const buildDeps = require(path.join(rootPath, 'packages/build/package.json'))
.dependencies;
await cmd; // Execute the command
Copy link
Contributor

Choose a reason for hiding this comment

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

just an await executes the command? How?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The constructor returns an instance of the command, which has then() to function as a promise to run it.

@@ -1,6 +0,0 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we getting rid of this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It creates inconsistency against loopback-next root level prettier.

@@ -39,13 +39,7 @@
"lb-clean": "./bin/run-clean.js"
},
"scripts": {
"lint": "npm run prettier:check",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we getting rid of linting in this package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's just redundant as we already have npm run lint at loopback-next level.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh. I thought all packages had those but just double checked and they don't. 👍

scope: scope,
loglevel: 'silent',
});
return cmd.run();
await cmd;
Copy link
Contributor

Choose a reason for hiding this comment

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

How does just awaiting a command trigger it? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please note that cmd is a promise-like object when runs the command itself.

'@commitlint/config-conventional',
'@commitlint/config-lerna-scopes',
],
extends: ['@commitlint/config-conventional', './bin/config-lerna-scopes'],
Copy link
Contributor

Choose a reason for hiding this comment

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

I know the switch to away from @commitlint/config-lerna-scopes is because it doesn't yet support Lerna 3.x BUT they have a PR in progress to add 3.x support ... I don't think we should introduce our own script for the package as it becomes something for us to maintain. We can split this PR to land the TypeScript upgrade and give commitlint some time to upgrade (knowing their history and the current progress of the PR I'd say a week tops) and we won't have to have a custom script to maintain?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha, I didn't see the PR and was trying to submit one. It's actually not too bad to maintain some of the commit rules for loopback-next itself though, IMO.

@raymondfeng raymondfeng force-pushed the upgrade-to-typescript-3.0.x branch 2 times, most recently from e6c2823 to 9afbefb Compare August 21, 2018 05:48
},
"scripts": {
"postinstall": "lerna bootstrap",
"postinstall": "lerna bootstrap --no-ci",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the record, lerna 3.x forces npm ci instead of npm i for CI envs. But npm ci fails as we don't check in package-lock.json files. It's not working to set the ci flag to false in lerna.json as the value is overridden.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation! I had to look at the docs to find the info. Would help other reviewers. Is there an issue regarding the flag in lerna.json not working? Would be good to remove it eventually but not a blocker for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Cross-posting lerna/lerna#1449 (comment)

Next release should fix this for you properly.

AFAICT, the next release has been already published, see https://github.com/lerna/lerna/releases/tag/v3.1.3

Bug Fixes

add: Avoid passing bad scope to pacote
global-options: Move env defaults to command superclass

@raymondfeng Do you have bandwidth to update our scripts and remove --no-ci in favor of settingci: false in lerna.json?

Copy link
Member

Choose a reason for hiding this comment

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

LOL, the follow-up pull request has been already landed, see #1632.

Please ignore my comment above.

@raymondfeng
Copy link
Contributor Author

@virkt25 PTAL

@virkt25
Copy link
Contributor

virkt25 commented Aug 21, 2018

In terms of the changes I don't have any more comments or concerns except I don't think we should be creating our own script for the packages given the PR in progress. It's one less thing for us to maintain.

It's actually not too bad to maintain some of the commit rules for loopback-next itself though, IMO.
We do maintain the rules, the script is a utility to get valid scopes so I don't think we should own this.

Copy link
Contributor

@shimks shimks left a comment

Choose a reason for hiding this comment

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

LGTM as far as I can tell. I wanted to look at some docs behind @lerna/project but lerna doesn't seem to have any...

@raymondfeng
Copy link
Contributor Author

I don't think we should be creating our own script for the packages given the PR in progress. It's one less thing for us to maintain.

Considering the code is tiny and it also gives us flexibility to introduce extra scopes, such as examples, I won't be too worried if we have it in the code base.

We can revert it back to the config-lerna-scopes module once a new version is released instead of waiting if the team feel strongly about it.

@virkt25
Copy link
Contributor

virkt25 commented Aug 21, 2018

Considering the code is tiny and it also gives us flexibility to introduce extra scopes, such as examples, I won't be too worried if we have it in the code base.

Adding additional scopes would go against conventional commits. It should either be a package name or nothing.

We can revert it back to the config-lerna-scopes module once a new version is released instead of waiting if the team feel strongly about it.

That sounds reasonable to me. Can you please add a comment to commitlint.config.js to remind us to the config-lerna-scopes package once it's released with the newest version and the script can be deleted. Or maybe an issue.

@raymondfeng raymondfeng merged commit 12c24a8 into master Aug 21, 2018
@raymondfeng raymondfeng deleted the upgrade-to-typescript-3.0.x branch August 21, 2018 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants