-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6330c3a
feat(packages/sui-mono): improve performance
f14e2c7
feat(packages/sui-mono): publish parallelization
df6d0ba
feat(packages/sui-mono): update parallel mono
fabea43
feat(packages/sui-mono): update cwd
55702cc
feat(packages/sui-mono): update version
8b8afe3
feat(packages/sui-mono): update changelog creation
380a520
feat(packages/sui-mono): update broken import
d31d061
feat(packages/sui-mono): update mono tag prefix
fc67f20
feat(packages/sui-mono): update version place
f631ea4
feat(packages/sui-mono): update folder matching
c184056
feat(packages/sui-mono): update read file sync
adfcd76
feat(packages/sui-mono): update deps
5485065
feat(packages/sui-mono): use preset
d5a872b
feat(packages/sui-mono): minor fixes
b6e14d7
feat(packages/sui-mono): add atomic git push
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"issue": "issue", | ||
"commit": "commits", | ||
"referenceActions": [ | ||
"close", | ||
"closes", | ||
"closed", | ||
"closing", | ||
"fix", | ||
"fixes", | ||
"fixed", | ||
"fixing", | ||
"resolve", | ||
"resolves", | ||
"resolved", | ||
"resolving" | ||
], | ||
"issuePrefixes": ["#"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"issue": "issues", | ||
"commit": "commit", | ||
"referenceActions": ["close", "closes", "closed", "fix", "fixes", "fixed", "resolve", "resolves", "resolved"], | ||
"issuePrefixes": ["#", "gh-"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"issue": "issues", | ||
"commit": "commit", | ||
"referenceActions": ["close", "closes", "closed", "closing", "fix", "fixes", "fixed", "fixing"], | ||
"issuePrefixes": ["#"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,26 @@ | |
"dependencies": { | ||
"@s-ui/helpers": "1", | ||
"commander": "8.3.0", | ||
"conventional-changelog": "3.1.25", | ||
"enquirer": "2.3.6", | ||
"git-url-parse": "13.1.0", | ||
"glob": "8.0.3", | ||
"word-wrap": "1.2.4" | ||
"word-wrap": "1.2.4", | ||
"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" | ||
Comment on lines
+17
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. I will leave it as it was in the dependency for now 🙏🏻 |
||
}, | ||
"repository": { | ||
"type": "git", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
'use strict' | ||
|
||
const addStream = require('add-stream') | ||
const gitRawCommits = require('git-raw-commits') | ||
const conventionalCommitsParser = require('conventional-commits-parser') | ||
const conventionalChangelogWriter = require('conventional-changelog-writer') | ||
const _ = require('lodash') | ||
const stream = require('stream') | ||
const through = require('through2') | ||
const execFileSync = require('child_process').execFileSync | ||
|
||
const mergeConfig = require('./merge-config.js') | ||
function conventionalChangelog(options, context, gitRawCommitsOpts, parserOpts, writerOpts, gitRawExecOpts) { | ||
writerOpts = writerOpts || {} | ||
|
||
const readable = new stream.Readable({ | ||
objectMode: writerOpts.includeDetails | ||
}) | ||
readable._read = function () {} | ||
|
||
let commitsErrorThrown = false | ||
|
||
let commitsStream = new stream.Readable({ | ||
objectMode: true | ||
}) | ||
commitsStream._read = function () {} | ||
|
||
function commitsRange(from, to) { | ||
return gitRawCommits( | ||
_.merge({}, gitRawCommitsOpts, { | ||
from, | ||
to | ||
}) | ||
).on('error', function (err) { | ||
if (!commitsErrorThrown) { | ||
setImmediate(commitsStream.emit.bind(commitsStream), 'error', err) | ||
commitsErrorThrown = true | ||
} | ||
}) | ||
} | ||
|
||
mergeConfig(options, context, gitRawCommitsOpts, parserOpts, writerOpts, gitRawExecOpts) | ||
.then(function (data) { | ||
options = data.options | ||
context = data.context | ||
gitRawCommitsOpts = data.gitRawCommitsOpts | ||
parserOpts = data.parserOpts | ||
writerOpts = data.writerOpts | ||
gitRawExecOpts = data.gitRawExecOpts | ||
|
||
try { | ||
execFileSync('git', ['rev-parse', '--verify', 'HEAD'], { | ||
stdio: 'ignore' | ||
}) | ||
let reverseTags = context.gitSemverTags.slice(0).reverse() | ||
reverseTags.push('HEAD') | ||
|
||
if (gitRawCommitsOpts.from) { | ||
if (reverseTags.indexOf(gitRawCommitsOpts.from) !== -1) { | ||
reverseTags = reverseTags.slice(reverseTags.indexOf(gitRawCommitsOpts.from)) | ||
} else { | ||
reverseTags = [gitRawCommitsOpts.from, 'HEAD'] | ||
} | ||
} | ||
|
||
let streams = reverseTags.map((to, i) => { | ||
const from = i > 0 ? reverseTags[i - 1] : '' | ||
return commitsRange(from, to) | ||
}) | ||
|
||
if (gitRawCommitsOpts.from) { | ||
streams = streams.splice(1) | ||
} | ||
|
||
if (gitRawCommitsOpts.reverse) { | ||
streams.reverse() | ||
} | ||
|
||
streams | ||
.reduce((prev, next) => next.pipe(addStream(prev))) | ||
.on('data', function (data) { | ||
setImmediate(commitsStream.emit.bind(commitsStream), 'data', data) | ||
}) | ||
.on('end', function () { | ||
setImmediate(commitsStream.emit.bind(commitsStream), 'end') | ||
}) | ||
} catch (_e) { | ||
commitsStream = gitRawCommits(gitRawCommitsOpts, gitRawExecOpts) | ||
} | ||
|
||
commitsStream | ||
.on('error', function (err) { | ||
err.message = 'Error in git-raw-commits: ' + err.message | ||
setImmediate(readable.emit.bind(readable), 'error', err) | ||
}) | ||
.pipe(conventionalCommitsParser(parserOpts)) | ||
.on('error', function (err) { | ||
err.message = 'Error in conventional-commits-parser: ' + err.message | ||
setImmediate(readable.emit.bind(readable), 'error', err) | ||
}) | ||
// it would be better if `gitRawCommits` could spit out better formatted data | ||
// so we don't need to transform here | ||
.pipe( | ||
through.obj(function (chunk, enc, cb) { | ||
try { | ||
options.transform.call(this, chunk, cb) | ||
} catch (err) { | ||
cb(err) | ||
} | ||
}) | ||
) | ||
.on('error', function (err) { | ||
err.message = 'Error in options.transform: ' + err.message | ||
setImmediate(readable.emit.bind(readable), 'error', err) | ||
}) | ||
.pipe(conventionalChangelogWriter(context, writerOpts)) | ||
.on('error', function (err) { | ||
err.message = 'Error in conventional-changelog-writer: ' + err.message | ||
setImmediate(readable.emit.bind(readable), 'error', err) | ||
}) | ||
.pipe( | ||
through( | ||
{ | ||
objectMode: writerOpts.includeDetails | ||
}, | ||
function (chunk, enc, cb) { | ||
try { | ||
readable.push(chunk) | ||
} catch (err) { | ||
setImmediate(function () { | ||
throw err | ||
}) | ||
} | ||
|
||
cb() | ||
}, | ||
function (cb) { | ||
readable.push(null) | ||
|
||
cb() | ||
} | ||
) | ||
) | ||
}) | ||
.catch(function (err) { | ||
setImmediate(readable.emit.bind(readable), 'error', err) | ||
}) | ||
|
||
return readable | ||
} | ||
|
||
module.exports = conventionalChangelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict' | ||
|
||
const conventionalChangelogPresetLoader = require('conventional-changelog-preset-loader') | ||
|
||
const conventionalChangelogCore = require('./conventional-changelog-core.js') | ||
|
||
function conventionalChangelog(options, context, gitRawCommitsOpts, parserOpts, writerOpts) { | ||
options.warn = options.warn || function () {} | ||
|
||
if (options.preset) { | ||
try { | ||
options.config = conventionalChangelogPresetLoader(options.preset) | ||
} catch (err) { | ||
if (typeof options.preset === 'object') { | ||
options.warn(`Preset: "${options.preset.name}" ${err.message}`) | ||
} else if (typeof options.preset === 'string') { | ||
options.warn(`Preset: "${options.preset}" ${err.message}`) | ||
} else { | ||
options.warn(`Preset: ${err.message}`) | ||
} | ||
} | ||
} | ||
|
||
return conventionalChangelogCore(options, context, gitRawCommitsOpts, parserOpts, writerOpts) | ||
} | ||
|
||
module.exports = conventionalChangelog |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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