2 Commits

Author SHA1 Message Date
7963d78e56 chore(release): v1.9.0 2023-12-16 18:32:53 +02:00
4c60f62e72 feat(config): add post-release event file 2023-12-16 18:32:29 +02:00
7 changed files with 42 additions and 2 deletions

View File

@@ -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
View File

@@ -0,0 +1,7 @@
const { execSync } = require("child_process");
execSync(`git push -u origin --tags`);
execSync(`pnpm run build`);
execSync(`pnpm publish`);

View File

@@ -4,6 +4,7 @@
"johndoe",
"onrelease",
"outro",
"postrelease",
"rczrc",
"Resultium"
]

View File

@@ -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)

View File

@@ -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__`

View File

@@ -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": {

View File

@@ -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