Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
7963d78e56
|
|||
| 4c60f62e72 |
@@ -1,4 +1,5 @@
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
const { execSync } = require("child_process");
|
||||||
|
|
||||||
const packageFile = fs.readFileSync("./package.json").toString();
|
const packageFile = fs.readFileSync("./package.json").toString();
|
||||||
const newPackageFile = packageFile.replace(
|
const newPackageFile = packageFile.replace(
|
||||||
@@ -15,3 +16,7 @@ const newIndexFile = indexFile.replace(
|
|||||||
);
|
);
|
||||||
|
|
||||||
fs.writeFileSync("./src/index.ts", newIndexFile);
|
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",
|
"johndoe",
|
||||||
"onrelease",
|
"onrelease",
|
||||||
"outro",
|
"outro",
|
||||||
|
"postrelease",
|
||||||
"rczrc",
|
"rczrc",
|
||||||
"Resultium"
|
"Resultium"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
Generation of this changelog is based on commits
|
Generation of this changelog is based on commits
|
||||||
|
## v1.9.0
|
||||||
|
### Features
|
||||||
|
- [4c60f62e7] - **config**: add post-release event file
|
||||||
## v1.8.0
|
## v1.8.0
|
||||||
### Features
|
### Features
|
||||||
- [1e8bfd04d] - **commands**: add option to change unreleased change title
|
- [1e8bfd04d] - **commands**: add option to change unreleased change title
|
||||||
### Fixes
|
### Fixes
|
||||||
- [8e460614f] - **commands**: have unreleased section for changelog
|
- [8e460614f] - **commands**: have unreleased section for changelog
|
||||||
|
### Miscellaneous
|
||||||
|
- [357036d02] - **release**: v1.8.0
|
||||||
## v1.7.0
|
## v1.7.0
|
||||||
### Features
|
### Features
|
||||||
- [f4a7a0d2b] - **commands**: add release script customizability (#12)
|
- [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.
|
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
|
```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.
|
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.
|
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",
|
"name": "@resultium/rcz",
|
||||||
"version": "1.8.0",
|
"version": "1.9.0",
|
||||||
"description": "Resultium commit standardization library, based on conventional commits",
|
"description": "Resultium commit standardization library, based on conventional commits",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
18
src/index.ts
18
src/index.ts
@@ -45,7 +45,7 @@ const program = new Command();
|
|||||||
program
|
program
|
||||||
.name("rcz")
|
.name("rcz")
|
||||||
.description("Resultium commit standardization command-line interface")
|
.description("Resultium commit standardization command-line interface")
|
||||||
.version("1.8.0");
|
.version("1.9.0");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("commit")
|
.command("commit")
|
||||||
@@ -473,6 +473,22 @@ program
|
|||||||
? [`-s`, `v${version}`, `-m`, `"v${version}"`]
|
? [`-s`, `v${version}`, `-m`, `"v${version}"`]
|
||||||
: [`-a`, `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
|
program
|
||||||
|
|||||||
Reference in New Issue
Block a user