-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Commit PR notes to draftlogs and add scripts to provide draft release notes (CHANGELOG.md) and empty draftlogs #5780
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a4a2244
start draftlog folder
archmoj 80d614e
add log for merged pull 5779
archmoj 7154fa4
centralize util for making an empty directory
archmoj 4e68725
add script to draft new changelog based on draftlogs
archmoj 7dcb82e
Merge remote-tracking branch 'origin/master' into draft-release-notes
archmoj 9bdd412
Merge remote-tracking branch 'origin/master' into draft-release-notes
archmoj 3a91c0e
create a readme for draft logs - throw an error when skipping bad fil…
archmoj eefab9b
update and improve pull request template
archmoj ec4417f
Update draftlogs/README.md
archmoj d17e77c
Update draftlogs/README.md
archmoj 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- Improve README for ES6 module import [[#5779](https://github.com/plotly/plotly.js/pull/5779)], | ||
with thanks to @andreafonso for the contribution! |
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,22 @@ | ||
## Directory of draft logs to help prepare the upcoming [CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md) | ||
|
||
Every pull request should add at least one markdown file to this directory. | ||
The filename must start with a number, preferably the PR number, followed by one of these: | ||
1. `_fix.md` to propose a bug fix | ||
2. `_add.md` to propose new features | ||
3. `_remove.md` to propose a feature removal | ||
4. `_change.md` to propose a minor/major change | ||
5. `_deprecate.md` to propose a feature be deprecated | ||
|
||
If your PR falls into more than one category - for example adding a new feature and changing an existing feature - you should include each in a separate file. | ||
|
||
### Example filename and content for PR numbered 5546 for adding a new feature | ||
- filename: `5546_add.md` | ||
- content: | ||
``` | ||
- Add `icicle` trace type [[#5546](https://github.com/plotly/plotly.js/pull/5546)] | ||
``` | ||
which would render | ||
- Add `icicle` trace type [[#5546](https://github.com/plotly/plotly.js/pull/5546)] | ||
|
||
> Please start your single-line or multiple lined message with a verb. You could basically use the PR description while providing a link to the PR similar to the above example is appreciated too. |
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 |
---|---|---|
@@ -1,36 +1,13 @@ | ||
var path = require('path'); | ||
var fs = require('fs-extra'); | ||
var common = require('./util/common'); | ||
var constants = require('./util/constants'); | ||
var makeEmptyDirectory = require('./util/make_empty_directory'); | ||
var emptyDir = makeEmptyDirectory.emptyDir; | ||
var makeDir = makeEmptyDirectory.makeDir; | ||
|
||
var dist = constants.pathToDist; // dist | ||
var distTopojson = constants.pathToTopojsonDist; // dist/topojson | ||
|
||
// main | ||
emptyDir(distTopojson); | ||
emptyDir(dist); | ||
makeDir(dist); | ||
makeDir(distTopojson); | ||
|
||
function emptyDir(dir) { | ||
if(common.doesDirExist(dir)) { | ||
console.log('empty ' + dir); | ||
try { | ||
var allFiles = fs.readdirSync(dir); | ||
allFiles.forEach(function(file) { | ||
// remove file | ||
fs.unlinkSync(path.join(dir, file)); | ||
}); | ||
|
||
fs.rmdirSync(dir); | ||
} catch(err) { | ||
console.error(err); | ||
} | ||
} | ||
} | ||
|
||
function makeDir(dir) { | ||
if(!common.doesDirExist(dir)) { | ||
// create folder | ||
fs.mkdirSync(dir); | ||
} | ||
} |
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,18 @@ | ||
var constants = require('./util/constants'); | ||
var makeEmptyDirectory = require('./util/make_empty_directory'); | ||
var emptyDir = makeEmptyDirectory.emptyDir; | ||
var makeDir = makeEmptyDirectory.makeDir; | ||
|
||
var pathToDraftlogs = constants.pathToDraftlogs; | ||
|
||
var chZero = '0'.charCodeAt(0); | ||
var chNine = '9'.charCodeAt(0); | ||
|
||
function startsWithNumber(v) { | ||
var ch = v.charCodeAt(0); | ||
return chZero <= ch && ch <= chNine; | ||
} | ||
|
||
// main | ||
emptyDir(pathToDraftlogs, { filter: startsWithNumber }); | ||
makeDir(pathToDraftlogs); |
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,86 @@ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var constants = require('./util/constants'); | ||
|
||
var pathToDraftlogs = constants.pathToDraftlogs; | ||
var pathToChangelog = constants.pathToChangelog; | ||
|
||
var chZero = '0'.charCodeAt(0); | ||
var chNine = '9'.charCodeAt(0); | ||
|
||
function startsWithNumber(v) { | ||
var ch = v.charCodeAt(0); | ||
return chZero <= ch && ch <= chNine; | ||
} | ||
|
||
var allLogs = fs.readdirSync(pathToDraftlogs).filter(startsWithNumber); | ||
|
||
var len = allLogs.length; | ||
if(!len) return; | ||
|
||
var writeAfterMe = 'where X.Y.Z is the semver of most recent plotly.js release.'; | ||
var changelog = fs.readFileSync(pathToChangelog).toString().split(writeAfterMe); | ||
var head = changelog[0]; | ||
var foot = changelog[1]; | ||
|
||
var all = { | ||
Added: [], | ||
Removed: [], | ||
Deprecated: [], | ||
Changed: [], | ||
Fixed: [] | ||
}; | ||
|
||
var ENTER = '\n'; | ||
|
||
var skippedFiles = []; | ||
for(var i = 0; i < len; i++) { | ||
var filename = allLogs[i]; | ||
var message = fs.readFileSync(path.join(pathToDraftlogs, filename), { encoding: 'utf-8' }).toString(); | ||
// trim empty lines | ||
message = message.split(ENTER).filter(function(e) { return !!e; }).join(ENTER); | ||
|
||
if(filename.endsWith('_add.md')) { | ||
all.Added.push(message); | ||
} else if(filename.endsWith('_remove.md')) { | ||
all.Removed.push(message); | ||
} else if(filename.endsWith('_deprecate.md')) { | ||
all.Deprecated.push(message); | ||
} else if(filename.endsWith('_change.md')) { | ||
all.Changed.push(message); | ||
} else if(filename.endsWith('_fix.md')) { | ||
all.Fixed.push(message); | ||
} else { | ||
skippedFiles.push(filename); | ||
} | ||
} | ||
|
||
var draftNewChangelog = [ | ||
head + writeAfterMe, | ||
'', | ||
'## [X.Y.Z] -- UNRELEASED' | ||
]; | ||
|
||
var append = function(key) { | ||
var newMessages = all[key]; | ||
if(!newMessages.length) return; | ||
draftNewChangelog.push(''); | ||
draftNewChangelog.push('### ' + key); | ||
draftNewChangelog.push(newMessages.join(ENTER)); | ||
}; | ||
|
||
append('Added'); | ||
append('Removed'); | ||
append('Deprecated'); | ||
append('Changed'); | ||
append('Fixed'); | ||
|
||
draftNewChangelog.push(foot); | ||
|
||
fs.writeFileSync(pathToChangelog, draftNewChangelog.join(ENTER), { encoding: 'utf-8' }); | ||
|
||
if(skippedFiles.length) { | ||
throw JSON.stringify({ | ||
'skippedFiles': skippedFiles | ||
}, null, 2); | ||
} |
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,40 @@ | ||
var path = require('path'); | ||
var fs = require('fs-extra'); | ||
var common = require('./common'); | ||
|
||
module.exports = { | ||
emptyDir: emptyDir, | ||
makeDir: makeDir | ||
}; | ||
|
||
function emptyDir(dir, opts) { | ||
if(common.doesDirExist(dir)) { | ||
console.log('empty ' + dir); | ||
try { | ||
var allFiles = fs.readdirSync(dir); | ||
var hasFilter = false; | ||
if(opts && opts.filter) { | ||
hasFilter = true; | ||
allFiles = allFiles.filter(opts.filter); | ||
} | ||
|
||
allFiles.forEach(function(file) { | ||
// remove file | ||
fs.unlinkSync(path.join(dir, file)); | ||
}); | ||
|
||
if(!hasFilter) { | ||
fs.rmdirSync(dir); | ||
} | ||
} catch(err) { | ||
console.error(err); | ||
} | ||
} | ||
} | ||
|
||
function makeDir(dir) { | ||
if(!common.doesDirExist(dir)) { | ||
// create folder | ||
fs.mkdirSync(dir); | ||
} | ||
} |
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.
Else throw an error, logging the filename as having been ignored.
Might want to also loosen the
endsWith
tests - to egfilename.toLowerCase().indexOf('_add') !== -1
so stuff like5678_Added.md
will still be picked up.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 have a test which disallows use of uppercase in filenames.
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 do test for uppercase, but I don't think it'll dig into the
draftlogs
dir. And there's still add vs adds vs added etc. Anyway the main thing is to throw an error if we ignore the file. After adding that if you still want to be strict about names that's ok, it'll just occasionally make more work during release if we get an incorrect name.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 call. Addressed in 3a91c0e.