-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds create-changelog script to recreate entire changelog based on js…
…on files in .changes/ directory. Modified update-changelog script to use markdown syntax rather than HTMl, and changed to use parseInt to convert numeric strings to numbers.
- Loading branch information
Showing
2 changed files
with
52 additions
and
11 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env node | ||
|
||
var fs = require('fs'); | ||
|
||
try { | ||
var changeFiles = fs.readdirSync(process.cwd() + '/.changes'); | ||
} catch (err) { | ||
if (err.code === 'ENOENT') { | ||
err.message += '. Make sure to run from sdk root directory'; | ||
} | ||
throw err; | ||
} | ||
|
||
var updateScript = process.cwd() + '/scripts/update-changelog'; | ||
var changelogFile = process.cwd() + '/CHANGELOG.md'; | ||
|
||
var startContent = '# Changelog for AWS SDK for JavaScript\ | ||
\n<!--LATEST=0.0.0-->\ | ||
\n<!--ENTRYINSERT-->' | ||
|
||
fs.writeFileSync(changelogFile, startContent); | ||
|
||
var fileReg = /^(\d*)\.(\d*)\.(\d*)\.json$/; | ||
|
||
changeFiles | ||
.map(function(file) { return file.match(fileReg); }) | ||
.filter(function(version) { return !!version; }) | ||
.sort(function(v1, v2) { | ||
var diff; | ||
for (var i = 1; i <= 3; i++) { | ||
diff = v1[i] - v2[i]; | ||
if (diff !== 0) { | ||
return diff; | ||
} | ||
} | ||
return 0; | ||
}) | ||
.map(function(version) { return version.slice(1).join('.'); }) | ||
.forEach(function(version) { | ||
process.argv[2] = version; | ||
delete require.cache[updateScript]; | ||
require(updateScript); | ||
}); |
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