-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat(packages/sui-mono): improve performance #1682
Conversation
const execFileSync = require('child_process').execFileSync | ||
|
||
const mergeConfig = require('./merge-config.js') | ||
function conventionalChangelog(options, context, gitRawCommitsOpts, parserOpts, writerOpts, gitRawExecOpts) { |
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 needed to "fork" conventional-changelog-core library for now since there is a bug that doesn't take into consideration custom tags parameter. We need this because we have custom tag names for our packages (we don't use lerna standard)
packages/sui-mono/package.json
Outdated
"conventional-changelog-writer": "^5.0.0", | ||
"conventional-commits-parser": "^3.2.0", | ||
"dateformat": "^3.0.0", | ||
"get-pkg-repo": "^4.0.0", | ||
"git-raw-commits": "^2.0.8", | ||
"git-remote-origin-url": "^2.0.0", | ||
"git-semver-tags": "^4.1.1", | ||
"lodash": "^4.17.15", | ||
"normalize-package-data": "^3.0.0", | ||
"q": "^1.5.1", | ||
"read-pkg": "^3.0.0", | ||
"read-pkg-up": "^3.0.0", | ||
"through2": "^4.0.0" |
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.
The conventional-changelog-core
dependencies
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 want to have fixed versions?
@@ -28,7 +30,7 @@ const folders = program.args.length ? program.args : getWorkspaces() | |||
const changelogOptions = { | |||
preset: 'angular', | |||
append: false, | |||
releaseCount: 0, | |||
releaseCount: 1, |
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.
Instead of generating all the changelog let's generate only the part for the last release
const title = '# CHANGELOG' | ||
const content = fs.readFileSync(outputFile, 'utf8') | ||
const output = fs.createWriteStream(outputFile) | ||
|
||
const name = getWorkspaces().find(path => folder.includes(path)) | ||
const promise = name ? fetchTags(name) : Promise.resolve() |
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.
To avoid a breaking change we need to keep latests changes at the top. Here would be nice to check if somehow we can use always use streams
} | ||
|
||
await Promise.all(packagesToRelease.map(pkg => publish(pkg))) |
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.
Publish all packages in parallel
@@ -0,0 +1,374 @@ | |||
'use strict' | |||
|
|||
const dateFormat = require('dateformat') |
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 is also part of conventional-changelog-core library
const {exec} = require('child_process') | ||
|
||
function checkSUITag(tag, pkg) { | ||
if (pkg && !tag.startsWith(`${pkg}-`)) { |
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.
Here we filter sui package tags
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 should add the comments in the code, what do you think?
"add-stream": "^1.0.0", | ||
"conventional-changelog-writer": "^5.0.0", | ||
"conventional-commits-parser": "^3.2.0", | ||
"conventional-changelog-preset-loader": "^2.3.4", | ||
"conventional-changelog-angular": "^5.0.12", | ||
"dateformat": "^3.0.0", | ||
"get-pkg-repo": "^4.0.0", | ||
"git-raw-commits": "^2.0.8", | ||
"git-remote-origin-url": "^2.0.0", | ||
"git-semver-tags": "^4.1.1", | ||
"lodash": "^4.17.15", | ||
"normalize-package-data": "^3.0.0", | ||
"q": "^1.5.1", | ||
"read-pkg": "^3.0.0", | ||
"read-pkg-up": "^3.0.0", | ||
"through2": "^4.0.0" |
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.
Can you define fixed versions the these external dependencies?
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 will leave it as it was in the dependency for now 🙏🏻
Description
This pull request accelerates the release process of the packages
@s-ui/mono release
by parallelizing the package bump and publication, which are the two steps that consume the most time in the entire process.Related Issue
None
Example
None