@lowxr/shared-config

v1.0.0

Published

🔩 My customized Config of semantic release and commitlint and others.

Readme

Shared config


💾 Installation

npm install --save-dev @lowxr/shared-config
yarn add --save-dev @lowxr/shared-config
pnpm add --save-dev @lowxr/shared-config

🛠 How to use?


📅 changelog-config

[!NOTE] A brief explanation of its use and the most recommended one.

You need to create a changelog file first, changelog.config.js or .changelogrc.js

[!WARNING] These are the only files supported at the moment

1. Default config

// changelog.config.js or .changelogrc.js

// @ts-check
import defineConfig from "@lowxr/shared-config/changelog-config";

/** @type {import("@lowxr/shared-config/changelog-config").Config} */
export default defineConfig();

2. Custom config

[!IMPORTANT] 🔩 If you have no idea of the config

| Key | Type | | --------------------- | --------- | | customCommitTypeMap | object | | customScopeMap | object | | displayCommitTypes | array | | displayScopes | array | | showAuthor | boolean | | showAuthorAvatar | boolean | | showSummary | boolean | | withEmoji | boolean | | reduceHeadingLevel | boolean | | newlineTimestamp | boolean | | addBackToTop | boolean |

// changelog.config.js or .changelogrc.js

// @ts-check
import defineConfig from "@lowxr/shared-config/changelog-config";

/** @type {import("@lowxr/shared-config/changelog-config").Config} */
export default defineConfig({
 showAuthor: true,
 showAuthorAvatar: true,
 showSummary: true,
 withEmoji: true,
 reduceHeadingLevel: true,
 newlineTimestamp: true,
 addBackToTop: true,
});

📨 commitlint-config

[!NOTE] A brief explanation of its use and the most recommended one.

You need to create a commitlint file first, files config

[!IMPORTANT] For best preference, I recommend using commitlint.config.js or .commitlintrc.js

// commitlint.config.js or .commitlintrc.js

// @ts-check
import commitlintConfig from "@lowxr/shared-config/commitlint-config";

/** @type {import('@commitlint/types').UserConfig} */
export default commitlintConfig;

🈹 lefthook-config

[!NOTE] A brief explanation of its use and the most recommended one.

You need to create a lefthook file first, files config

[!IMPORTANT] For best preference, I recommend using lefthook.json or .lefthook.json

// lefthook.json

{
 "$schema": "https://json.schemastore.org/lefthook.json",
 "extends": ["node_modules/@lowxr/shared-config/dist/lefthook-config/base.json"]
}

🔄 release-config

[!NOTE] A brief explanation of its use and the most recommended one.

You need to create a semantic release file first, files config

[!IMPORTANT] For best preference, I recommend using release.config.js or .releaserc.js

1. Default config

// release.config.js or .releaserc.js

// @ts-check
import defineConfig from "@lowxr/shared-config/release-config";

/** @type {import('@lowxr/shared-config/release-config').ReleaseConfigOptions} */
export default defineConfig();

2. Custom config

Define your custom config following the Semantic Release Options

[!IMPORTANT] 🔩 How to configure default and customizable plugins

| Plugin | Type | Doc | | ----------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------- | | commitAnalyzer | object | View Commit Analyzer Docs | | exec | object | View Exec Docs | | releaseNotesGenerator | object | View Release Notes Generator Docs | | changelog | object | View Changelog Docs | | npm | object | View NPM Docs | | git | object | View GIT Docs | | github | object | View Github Docs |

[!NOTE] If you want to add a custom plugin, you can do it by adding the key plugin inside the array you can add as many as you need.

// release.config.js or .releaserc.js

// @ts-check
import defineConfig from "@lowxr/shared-config/release-config";

/** @type {import('@lowxr/shared-config/release-config').ReleaseConfigOptions} */
export default defineConfig({
 branches: [
  "next",
  {
   name: "next",
   channel: "next",
   prerelease: true,
  },
 ],
 plugin: [],
 // Default and customizable plugins
 commitAnalyzer: {
  releaseRules: [
   { breaking: true, release: "major" },
   { type: "feat", release: "minor" },
   { type: "feat", scope: "int-*", release: false },
   { type: "fix", release: "patch" },
  ],
 },
 npm: {
  npmPublish: true,
  tarballDir: "./path/to/you/dir",
  pkgRoot: "./path/to/you/root",
 },
});

📋 License

This repository is distributed under the terms of the MIT License.