-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #296 from open-genes/develop
release 1.1.1
- Loading branch information
Showing
11 changed files
with
343 additions
and
47,307 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
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,28 @@ | ||
/* eslint-env es6 */ | ||
const fs = require('fs'); | ||
const { exec } = require('child_process'); | ||
const changelogFile = 'CHANGELOG.md'; | ||
|
||
if (process.argv.length < 3) { | ||
console.error('Usage: node generateChangelog.js <tag>'); | ||
process.exit(1); | ||
} | ||
|
||
const tag = process.argv[2]; | ||
|
||
exec(`git log ${tag}..HEAD --pretty=format:"- %s" --no-merges`, (error, stdout, stderr) => { | ||
if (error) { | ||
console.error(`Error: ${error.message}`); | ||
process.exit(1); | ||
} | ||
if (stderr) { | ||
console.error(`Error: ${stderr}`); | ||
process.exit(1); | ||
} | ||
const strippedText = stdout.replace(/#/g, ''); // Remove '#' symbols | ||
const changelogContent = `\n#Release v${tag}\n\n${strippedText}\n`; | ||
|
||
fs.appendFileSync(changelogFile, changelogContent); | ||
|
||
console.log(`Changelog has been updated and saved to ${changelogFile}`); | ||
}); |
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,44 @@ | ||
/* eslint-env es6 */ | ||
const fs = require('fs'); | ||
const { exec } = require('child_process'); | ||
|
||
if (process.argv.length < 3) { | ||
console.error('Usage: node .utils/update-version-and-changelog.js <version>'); | ||
process.exit(1); | ||
} | ||
|
||
const newVersion = process.argv[2]; | ||
|
||
// Read package.json and update the version field | ||
fs.readFile('package.json', 'utf8', (err, data) => { | ||
if (err) { | ||
console.error(`Error reading package.json: ${err}`); | ||
process.exit(1); | ||
} | ||
|
||
const packageJson = JSON.parse(data); | ||
packageJson.version = newVersion; | ||
|
||
// Write the updated package.json back to the file | ||
fs.writeFile('package.json', JSON.stringify(packageJson, null, 2), 'utf8', (err) => { | ||
if (err) { | ||
console.error(`Error writing to package.json: ${err}`); | ||
process.exit(1); | ||
} | ||
|
||
// Run the generate-changelog.js script with the new version | ||
exec(`node .utils/generate-changelog.js ${newVersion}`, (error, stdout, stderr) => { | ||
if (error) { | ||
console.error(`Error running generate-changelog.js: ${error.message}`); | ||
process.exit(1); | ||
} | ||
if (stderr) { | ||
console.error(`Error: ${stderr}`); | ||
process.exit(1); | ||
} | ||
|
||
console.log(stdout); | ||
console.log('Version updated in package.json and changelog generated successfully.'); | ||
}); | ||
}); | ||
}); |
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,59 @@ | ||
/* eslint-env es6 */ | ||
const readline = require('readline'); | ||
const fs = require('fs'); | ||
|
||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout | ||
}); | ||
|
||
rl.question('What type of commit did you stage? (bug fix (B) / feature (F)): ', (answer) => { | ||
const lowerCaseAnswer = answer.toLowerCase(); | ||
if (lowerCaseAnswer === 'b') { | ||
updateVersion('patch'); | ||
} else if (lowerCaseAnswer === 'f') { | ||
updateVersion('minor'); | ||
} else { | ||
console.log('Invalid input. Please provide either "B" or "F".'); | ||
} | ||
|
||
rl.close(); | ||
}); | ||
|
||
function updateVersion(bumpType) { | ||
const packageJsonPath = 'package.json'; | ||
|
||
fs.readFile(packageJsonPath, 'utf8', (err, data) => { | ||
if (err) { | ||
console.error(`Error reading ${packageJsonPath}: ${err}`); | ||
process.exit(1); | ||
} | ||
|
||
const packageJson = JSON.parse(data); | ||
const currentVersion = packageJson.version.split('.').map(Number); | ||
let newVersion; | ||
|
||
// Raise version depending on the type of changes | ||
if (bumpType === 'patch') { | ||
newVersion = [currentVersion[0], currentVersion[1], currentVersion[2] + 1]; | ||
} else if (bumpType === 'minor') { | ||
newVersion = [currentVersion[0], currentVersion[1] + 1, 0]; | ||
} | ||
|
||
if (newVersion[1] === 10) { | ||
newVersion[0]++; | ||
newVersion[1] = 0; | ||
} | ||
|
||
packageJson.version = newVersion.join('.'); | ||
|
||
fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf8', (err) => { | ||
if (err) { | ||
console.error(`Error writing to ${packageJsonPath}: ${err}`); | ||
process.exit(1); | ||
} | ||
|
||
console.log(`Version updated to ${packageJson.version} for ${bumpType} commit.`); | ||
}); | ||
}); | ||
} |
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,8 @@ | ||
#Release v1.1.0 | ||
|
||
- Added a release cycle | ||
- OG-923. Transfer scripts to .utils folder, fix versioning script | ||
- OG-923. Add a tool for incrementing a version. Update CONTRIBUTING.md | ||
- OG-923. Update CONTRIBUTING.md | ||
- OG-923. Rename a script for writing a build number to the env files | ||
- OG-923. Add CONTRIBUTING.md |
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,49 @@ | ||
# Release cycle | ||
|
||
## Before Making a PR | ||
Remember to set an app version and add changes to a changelog after working on a feature branch or fixing a bug. This process is automated. All you need to do is set a tag for the first commit preceding the other commits that should be in the release. | ||
Then run: | ||
|
||
``` | ||
npm run versioning | ||
``` | ||
|
||
You can also use the following tasks to do the same thing manually: | ||
|
||
``` | ||
npm run version-and-changelog 2.0.1 | ||
``` | ||
|
||
to write any version to package.json and update the changelog | ||
|
||
or | ||
|
||
``` | ||
npm run update-changelog 2.0.1 | ||
``` | ||
|
||
to only update the changelog. | ||
|
||
--- | ||
|
||
<small> | ||
Replace examples with your own version. Please specify the version number without any prefix, such as "v". | ||
</small> | ||
|
||
## Version Numbers | ||
|
||
Version numbers follow a pattern known as Semantic Versioning ([SemVer](https://semver.org/)), which consists of three components: `major.minor.patch`. | ||
|
||
- **Major Version**: This number increases when there are significant changes that might introduce backward-incompatible features or major restructuring. New major versions may require you to update your code to accommodate these changes. | ||
|
||
- **Minor Version**: Minor version bumps occur for backward-compatible feature additions or improvements. New features are introduced in a backward-compatible manner, so you can adopt them without breaking your existing code. | ||
|
||
- **Patch Version**: Patch versions are for backward-compatible bug fixes or minor enhancements. These updates typically address issues without altering existing features or introducing new ones. | ||
|
||
**Examples:** | ||
|
||
- Version `1.0.0`: Initial release. | ||
- Version `1.1.0`: Added a new feature without breaking existing functionality. | ||
- Version `1.1.1`: Fixed a bug while maintaining compatibility. | ||
|
||
When you're considering which version to use or upgrade to, consult the release notes and changelog provided in the repository to understand the changes introduced in each version. This information will help you make informed decisions about updating your dependencies and codebase. |
Oops, something went wrong.