Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4411bede02 |
20
.gitea/issue_template/bug-template.md
Normal file
20
.gitea/issue_template/bug-template.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: "Bug Report"
|
||||||
|
about: Report a reproducible bug or regression
|
||||||
|
title: "Bug: "
|
||||||
|
---
|
||||||
|
|
||||||
|
## Steps To Reproduce
|
||||||
|
|
||||||
|
<!-- Simple, clear, laconical, reproducible steps how to cause this bug in a development environment -->
|
||||||
|
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
|
||||||
|
## The current behavior
|
||||||
|
|
||||||
|
<!-- It is recommended to provide an image or a video, if that is not possible a very concise text would suffice -->
|
||||||
|
|
||||||
|
## The expected behavior
|
||||||
|
|
||||||
|
<!-- Describe the expected behavior -->
|
||||||
29
.gitea/issue_template/feature-request.md
Normal file
29
.gitea/issue_template/feature-request.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
name: "Feature Request"
|
||||||
|
about: Standard feature request template.
|
||||||
|
title: "Feature: "
|
||||||
|
---
|
||||||
|
|
||||||
|
## Feature summary
|
||||||
|
|
||||||
|
<!-- e.g. -->
|
||||||
|
|
||||||
|
Add legal page to the website
|
||||||
|
|
||||||
|
## The expected behavior
|
||||||
|
|
||||||
|
<!-- e.g. -->
|
||||||
|
|
||||||
|
- Ability to select a language for legal page
|
||||||
|
- Presence of a legal page in sitemap
|
||||||
|
- Ability to add different legal documents in a .md format
|
||||||
|
|
||||||
|
## Helpful resources
|
||||||
|
|
||||||
|
<!-- e.g. -->
|
||||||
|
|
||||||
|
- [Svelte Markdown on NPM](https://www.npmjs.com/package/svelte-markdown)
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
First two documents are going to be Privacy Policy and Terms of Service
|
||||||
9
.gitea/issue_template/task.md
Normal file
9
.gitea/issue_template/task.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
name: "Task"
|
||||||
|
about: "Staff task template "
|
||||||
|
title: "Task: "
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Describe the task here, e.g. -->
|
||||||
|
|
||||||
|
Change pricing to medium standard
|
||||||
@@ -1,3 +1,9 @@
|
|||||||
{
|
{
|
||||||
"scopes": ["commands", "changelog", "readme", "release", "config"]
|
"scopes": [
|
||||||
|
"commands",
|
||||||
|
"changelog",
|
||||||
|
"readme",
|
||||||
|
"release",
|
||||||
|
"config"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
const fs = require("fs");
|
|
||||||
|
|
||||||
const packageFile = fs.readFileSync("./package.json").toString();
|
|
||||||
const newPackageFile = packageFile.replace(
|
|
||||||
/"version": "[0-9]+.[0-9]+.[0-9]+"/,
|
|
||||||
`"version": "${__NEW_VERSION__}"`
|
|
||||||
);
|
|
||||||
|
|
||||||
fs.writeFileSync("./package.json", newPackageFile);
|
|
||||||
|
|
||||||
const indexFile = fs.readFileSync("./src/index.ts").toString();
|
|
||||||
const newIndexFile = indexFile.replace(
|
|
||||||
/version\("[0-9]+\.[0-9]+\.[0-9]+"\)/,
|
|
||||||
`version("${__NEW_VERSION__}")`
|
|
||||||
);
|
|
||||||
|
|
||||||
fs.writeFileSync("./src/index.ts", newIndexFile);
|
|
||||||
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"cSpell.words": [
|
|
||||||
"Acked",
|
|
||||||
"johndoe",
|
|
||||||
"onrelease",
|
|
||||||
"outro",
|
|
||||||
"rczrc",
|
|
||||||
"Resultium"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
24
CHANGELOG.md
24
CHANGELOG.md
@@ -2,30 +2,6 @@
|
|||||||
|
|
||||||
Generation of this changelog is based on commits
|
Generation of this changelog is based on commits
|
||||||
|
|
||||||
## v1.7.0
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
- [f4a7a0d2b] - **commands**: add release script customizability (#12)
|
|
||||||
- [c80d76325] - **config**: add auto-signing options
|
|
||||||
- [498c830e3] - change tag message schema (#11)
|
|
||||||
|
|
||||||
## v1.6.0
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
- [a5626dbc5] - improve default 'stage all changes' behavior
|
|
||||||
|
|
||||||
### Miscellaneous
|
|
||||||
|
|
||||||
- [4c892e8b1] - **changelog**: generate for v1.5.2
|
|
||||||
|
|
||||||
## v1.5.2
|
|
||||||
|
|
||||||
### Fixes
|
|
||||||
|
|
||||||
- [8cb67f2cf] - **commands**: incorrect regex generation with specified scopes
|
|
||||||
|
|
||||||
## v1.5.1
|
## v1.5.1
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|||||||
27
README.md
27
README.md
@@ -34,31 +34,6 @@ You can create an `.rczrc`, `.rczrc.json` or `rcz.config.json` file in your root
|
|||||||
"value": "chore",
|
"value": "chore",
|
||||||
"hint": "a routine action"
|
"hint": "a routine action"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"autoSignCommits": false,
|
|
||||||
"autoSignReleases": true
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
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
|
|
||||||
const fs = require("fs"); // Require fileSystem
|
|
||||||
|
|
||||||
const packageFile = fs.readFileSync("./package.json").toString(); // Get package.json contents from the current working directory
|
|
||||||
const newPackageFile = packageFile.replace(
|
|
||||||
/"version": "[0-9]+.[0-9]+.[0-9]+"/,
|
|
||||||
`"version": "${__NEW_VERSION__}"`
|
|
||||||
); // Use RegExp to replace package.json version
|
|
||||||
|
|
||||||
fs.writeFileSync("./package.json", newPackageFile); // Write to package.json file its new content
|
|
||||||
|
|
||||||
const indexFile = fs.readFileSync("./src/index.ts").toString(); // Get index.ts file from source code directory
|
|
||||||
const newIndexFile = indexFile.replace(/version\("[0-9]+\.[0-9]+\.[0-9]+"\)/); // Replace class function call content with the new version
|
|
||||||
|
|
||||||
fs.writeFileSync("./src/index.ts", newIndexFile); // Write to source code index file
|
|
||||||
```
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|||||||
14
cspell.json
Normal file
14
cspell.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2",
|
||||||
|
"ignorePaths": [],
|
||||||
|
"dictionaryDefinitions": [],
|
||||||
|
"dictionaries": [],
|
||||||
|
"words": [
|
||||||
|
"Acked",
|
||||||
|
"johndoe",
|
||||||
|
"outro",
|
||||||
|
"rczrc"
|
||||||
|
],
|
||||||
|
"ignoreWords": [],
|
||||||
|
"import": []
|
||||||
|
}
|
||||||
76
package.json
76
package.json
@@ -1,39 +1,39 @@
|
|||||||
{
|
{
|
||||||
"name": "@resultium/rcz",
|
"name": "@resultium/rcz",
|
||||||
"version": "1.7.0",
|
"version": "1.5.1",
|
||||||
"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": {
|
||||||
"rcz": "./dist/index.js"
|
"rcz": "./dist/index.js"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.resultium.net/technology/rcz.git"
|
"url": "https://git.resultium.net/technology/rcz.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"conventional",
|
"conventional",
|
||||||
"commits"
|
"commits"
|
||||||
],
|
],
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Resultium",
|
"name": "Resultium",
|
||||||
"email": "contact@resultium.io",
|
"email": "contact@resultium.io",
|
||||||
"url": "https://www.resultium.io"
|
"url": "https://www.resultium.io"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@clack/prompts": "^0.7.0",
|
"@clack/prompts": "^0.7.0",
|
||||||
"commander": "^11.0.0",
|
"commander": "^11.0.0",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"simple-git": "^3.19.1"
|
"simple-git": "^3.19.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.5.1",
|
"@types/node": "^20.5.1",
|
||||||
"@types/semver": "^7.5.0",
|
"@types/semver": "^7.5.0",
|
||||||
"typescript": "^5.1.6"
|
"typescript": "^5.1.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
65
src/index.ts
65
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.7.0");
|
.version("1.4.0");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("commit")
|
.command("commit")
|
||||||
@@ -53,11 +53,11 @@ program
|
|||||||
.option("-S, --sign", "sign the commit")
|
.option("-S, --sign", "sign the commit")
|
||||||
.option("--amend", "amend commit message to the last commit")
|
.option("--amend", "amend commit message to the last commit")
|
||||||
.action(async (options) => {
|
.action(async (options) => {
|
||||||
const config = await GetConfig();
|
const sign = options.sign ? true : false;
|
||||||
|
|
||||||
const sign = config?.autoSignCommits || options.sign ? true : false;
|
|
||||||
const amend = options.amend ? true : false;
|
const amend = options.amend ? true : false;
|
||||||
|
|
||||||
|
const config = await GetConfig();
|
||||||
|
|
||||||
intro("Creating a conventional commit");
|
intro("Creating a conventional commit");
|
||||||
|
|
||||||
if (!fs.existsSync(path.join(process.cwd(), ".git"))) {
|
if (!fs.existsSync(path.join(process.cwd(), ".git"))) {
|
||||||
@@ -69,9 +69,7 @@ program
|
|||||||
? null
|
? null
|
||||||
: await confirm({
|
: await confirm({
|
||||||
message: "Stage all changes?",
|
message: "Stage all changes?",
|
||||||
initialValue: (await simpleGit().diff(["--cached"])).toString()
|
initialValue: true,
|
||||||
? false
|
|
||||||
: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isCancel(stageAll)) {
|
if (isCancel(stageAll)) {
|
||||||
@@ -421,50 +419,31 @@ program
|
|||||||
.argument("<version>", "new version formatted in SemVer")
|
.argument("<version>", "new version formatted in SemVer")
|
||||||
.option("-S, --sign", "sign the release commit and tag")
|
.option("-S, --sign", "sign the release commit and tag")
|
||||||
.action(async (string: string, options) => {
|
.action(async (string: string, options) => {
|
||||||
const config = await GetConfig();
|
const sign = options.sign ? true : false;
|
||||||
|
|
||||||
const sign = config?.autoSignReleases || options.sign ? true : false;
|
|
||||||
const version = string.replace("v", "");
|
const version = string.replace("v", "");
|
||||||
|
const packageFile = JSON.parse(
|
||||||
|
(
|
||||||
|
await fs.promises.readFile(path.join(process.cwd(), "package.json"))
|
||||||
|
).toString()
|
||||||
|
);
|
||||||
|
|
||||||
const onReleaseFile = (
|
if (!packageFile) {
|
||||||
await fs.promises.readFile(
|
console.log("[rcz]: this directory does not have a package.json file");
|
||||||
path.join(process.cwd(), ".rczrc.onrelease.js")
|
|
||||||
)
|
|
||||||
).toString();
|
|
||||||
|
|
||||||
if (onReleaseFile) {
|
|
||||||
const releaseScript = `
|
|
||||||
const __NEW_VERSION__ = "${version}";
|
|
||||||
const __IS_SIGNED__ = ${sign};
|
|
||||||
|
|
||||||
${onReleaseFile}`;
|
|
||||||
|
|
||||||
eval(releaseScript);
|
|
||||||
} else {
|
|
||||||
const packageFile = JSON.parse(
|
|
||||||
(
|
|
||||||
await fs.promises.readFile(path.join(process.cwd(), "package.json"))
|
|
||||||
).toString()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!packageFile) {
|
|
||||||
console.log("[rcz]: this directory does not have a package.json file");
|
|
||||||
}
|
|
||||||
|
|
||||||
packageFile.version = version;
|
|
||||||
await fs.promises.writeFile(
|
|
||||||
path.join(process.cwd(), "package.json"),
|
|
||||||
JSON.stringify(packageFile, null, 4)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
packageFile.version = version;
|
||||||
|
await fs.promises.writeFile(
|
||||||
|
path.join(process.cwd(), "package.json"),
|
||||||
|
JSON.stringify(packageFile, null, 4)
|
||||||
|
);
|
||||||
|
|
||||||
await simpleGit()
|
await simpleGit()
|
||||||
.add(".")
|
.add(".")
|
||||||
.commit(`chore(release): v${version}`, sign ? ["-S"] : [])
|
.commit(`chore(release): v${version}`, sign ? ["-S"] : [])
|
||||||
.tag(
|
.tag(
|
||||||
sign
|
sign
|
||||||
? [`-s`, `v${version}`, `-m`, `"v${version}"`]
|
? [`-s`, `v${version}`, `-m`, `"Version ${version}"`]
|
||||||
: [`-a`, `v${version}`, `-m`, `"v${version}"`]
|
: [`-a`, `v${version}`, `-m`, `"Version ${version}"`]
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -488,7 +467,7 @@ program
|
|||||||
config?.types?.map((type) => type.value).join("|") ||
|
config?.types?.map((type) => type.value).join("|") ||
|
||||||
"feat|fix|build|ci|docs|perf|refactor|chore"
|
"feat|fix|build|ci|docs|perf|refactor|chore"
|
||||||
})(\\((${
|
})(\\((${
|
||||||
config?.scopes ? [...config?.scopes, "release"].join("|") : "..*"
|
config?.scopes ? [...config?.scopes, "release"] : "..*"
|
||||||
})\\))?!?: .* ?(\\(..*\\))?((\n\n..*)?(\n\n..*)?)?`,
|
})\\))?!?: .* ?(\\(..*\\))?((\n\n..*)?(\n\n..*)?)?`,
|
||||||
"gm"
|
"gm"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import { DefaultLogFields, ListLogLine } from "simple-git";
|
|||||||
export interface Config {
|
export interface Config {
|
||||||
types?: Array<Type>;
|
types?: Array<Type>;
|
||||||
scopes?: Array<string>;
|
scopes?: Array<string>;
|
||||||
autoSignCommits?: boolean;
|
|
||||||
autoSignReleases?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Type {
|
export interface Type {
|
||||||
|
|||||||
Reference in New Issue
Block a user