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

feat(packages/sui-mono): improve performance #1682

Merged
merged 15 commits into from
Feb 5, 2024

Conversation

andresz1
Copy link
Member

@andresz1 andresz1 commented Dec 18, 2023

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

const execFileSync = require('child_process').execFileSync

const mergeConfig = require('./merge-config.js')
function conventionalChangelog(options, context, gitRawCommitsOpts, parserOpts, writerOpts, gitRawExecOpts) {
Copy link
Member Author

@andresz1 andresz1 Dec 28, 2023

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)

Comment on lines 18 to 30
"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"
Copy link
Member Author

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

Copy link
Collaborator

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,
Copy link
Member Author

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

Comment on lines 61 to 66
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()
Copy link
Member Author

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)))
Copy link
Member Author

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')
Copy link
Member Author

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}-`)) {
Copy link
Member Author

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

Copy link
Collaborator

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?

Comment on lines +17 to +32
"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"
Copy link
Member

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?

Copy link
Member Author

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 🙏🏻

@andresz1 andresz1 merged commit e036c5c into master Feb 5, 2024
1 check passed
@andresz1 andresz1 deleted the feat/improve-mono-release-performance branch February 5, 2024 07:58
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.

8 participants