public

Public data repository of Resultium. Includes OSS and branding materials.

@resultium/rcz (1.15.0)

Published 2024-05-18 23:51:22 +00:00 by CTO in public/rcz

Installation

@resultium:registry=
npm install @resultium/rcz@1.15.0
"@resultium/rcz": "1.15.0"

About this package

rcz

Resultium commit standardization library. Supported by NodeJS v14 and above

Installation

  1. Set up @resultium registry in an .npmrc file in your home directory with following content:
    @resultium:registry=https://git.resultium.net/api/packages/public/npm/
    
  2. Install the package using npm
    npm install -g @resultium/rcz
    

Getting started

  1. Make changes to your git initialized project
  2. Run rcz commit in the root directory
    • if you wish to sign your commit use --sign option
  3. Answer all the questions
  4. Push to remote

Configuration

You can create an .rczrc, .rczrc.json or rcz.config.json file in your root directory and specify available scopes and commit types

{
  "scopes": ["forms"],
  "types": [
    {
      "label": "chore",
      "value": "chore",
      "hint": "a routine action"
    }
  ],
  "autoSignCommits": false,
  "autoSignReleases": true
}

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.

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.

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__

Dependencies

Dependencies

ID Version
@clack/prompts ^0.7.0
commander 10.0.1
semver ^7.5.4
simple-git ^3.21.0

Development Dependencies

ID Version
@types/node ^20.10.4
@types/semver ^7.5.6
typescript ^5.3.3

Keywords

conventional commits
Details
npm
2024-05-18 23:51:22 +00:00
9
Resultium
GPL-3.0-or-later
latest
20 KiB
Assets (1)
Versions (10) View all
1.15.0 2024-05-18
1.14.0 2024-05-04
1.13.1 2024-05-04
1.13.0 2024-03-08
1.13.0-rc.0 2024-03-06