Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
7963d78e56
|
|||
| 4c60f62e72 |
@@ -1,4 +1,5 @@
|
||||
const fs = require("fs");
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
const packageFile = fs.readFileSync("./package.json").toString();
|
||||
const newPackageFile = packageFile.replace(
|
||||
@@ -15,3 +16,7 @@ const newIndexFile = indexFile.replace(
|
||||
);
|
||||
|
||||
fs.writeFileSync("./src/index.ts", newIndexFile);
|
||||
|
||||
execSync(
|
||||
`rcz changelog --show-hashes --unreleased-as v${__NEW_VERSION__} > CHANGELOG.md`
|
||||
);
|
||||
|
||||
7
.rczrc.postrelease.js
Normal file
7
.rczrc.postrelease.js
Normal file
@@ -0,0 +1,7 @@
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
execSync(`git push -u origin --tags`);
|
||||
|
||||
execSync(`pnpm run build`);
|
||||
|
||||
execSync(`pnpm publish`);
|
||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -4,6 +4,7 @@
|
||||
"johndoe",
|
||||
"onrelease",
|
||||
"outro",
|
||||
"postrelease",
|
||||
"rczrc",
|
||||
"Resultium"
|
||||
]
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
# Changelog
|
||||
Generation of this changelog is based on commits
|
||||
## v1.9.0
|
||||
### Features
|
||||
- [4c60f62e7] - **config**: add post-release event file
|
||||
## v1.8.0
|
||||
### Features
|
||||
- [1e8bfd04d] - **commands**: add option to change unreleased change title
|
||||
### Fixes
|
||||
- [8e460614f] - **commands**: have unreleased section for changelog
|
||||
### Miscellaneous
|
||||
- [357036d02] - **release**: v1.8.0
|
||||
## v1.7.0
|
||||
### Features
|
||||
- [f4a7a0d2b] - **commands**: add release script customizability (#12)
|
||||
|
||||
@@ -40,6 +40,8 @@ You can create an `.rczrc`, `.rczrc.json` or `rcz.config.json` file in your root
|
||||
}
|
||||
```
|
||||
|
||||
### On-release event
|
||||
|
||||
You are also able to create an onRelease event file, that is going to run before creation of a git tag and a release commit, when `rcz release` is run. The file is to be named `.rczrc.onrelease.js`. A sample can be seen below.
|
||||
|
||||
```js
|
||||
@@ -62,3 +64,7 @@ fs.writeFileSync("./src/index.ts", newIndexFile); // Write to source code index
|
||||
In your onRelease file you are provided with `__NEW_VERSION__` constant string which is the new version submitted in `rcz release` and `__IS_SIGNED__` constant which is a boolean telling whether the release (it's commit and tag) is going to be signed.
|
||||
|
||||
Bear in mind, **this script is going to be executed through `eval()` with no sanitation**, be careful with whatever you write.
|
||||
|
||||
### Post-release event
|
||||
|
||||
Same as for onRelease you can also create a postRelease file which gets run after the tag and commit get created. Same as for onRelease file you are provided with `__NEW_VERSION__` and `__IS_SIGNED__`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@resultium/rcz",
|
||||
"version": "1.8.0",
|
||||
"version": "1.9.0",
|
||||
"description": "Resultium commit standardization library, based on conventional commits",
|
||||
"main": "./dist/index.js",
|
||||
"bin": {
|
||||
|
||||
18
src/index.ts
18
src/index.ts
@@ -45,7 +45,7 @@ const program = new Command();
|
||||
program
|
||||
.name("rcz")
|
||||
.description("Resultium commit standardization command-line interface")
|
||||
.version("1.8.0");
|
||||
.version("1.9.0");
|
||||
|
||||
program
|
||||
.command("commit")
|
||||
@@ -473,6 +473,22 @@ program
|
||||
? [`-s`, `v${version}`, `-m`, `"v${version}"`]
|
||||
: [`-a`, `v${version}`, `-m`, `"v${version}"`]
|
||||
);
|
||||
|
||||
const postReleaseFile = (
|
||||
await fs.promises.readFile(
|
||||
path.join(process.cwd(), ".rczrc.postrelease.js")
|
||||
)
|
||||
).toString();
|
||||
|
||||
if (postReleaseFile) {
|
||||
const postReleaseScript = `
|
||||
const __NEW_VERSION__ = "${version}";
|
||||
const __IS_SIGNED__ = ${sign};
|
||||
|
||||
${postReleaseFile}`;
|
||||
|
||||
eval(postReleaseScript);
|
||||
}
|
||||
});
|
||||
|
||||
program
|
||||
|
||||
Reference in New Issue
Block a user