From 4660ba659f21c8293fc0b05a4d0ae07c4325f9db Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Tue, 12 Dec 2023 23:27:49 +0200 Subject: [PATCH] chore: cleanups --- CHANGELOG.md | 59 ---------------------------------------------- release.config.cjs | 21 +++++++++++------ src/help.ts | 4 ++-- src/sample.ts | 2 +- src/style.ts | 3 ++- 5 files changed, 19 insertions(+), 70 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index dbef0ad..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,59 +0,0 @@ -# Change Log - -# [2.0.0-pre.6](https://github.com/chenasraf/massarg/compare/v2.0.0-pre.5...v2.0.0-pre.6) (2023-12-12) - - -### Bug Fixes - -* let help flag ignore requirements ([119f201](https://github.com/chenasraf/massarg/commit/119f20156b35adbc6213f79adc6fed3a8c537af3)) - -# [2.0.0-pre.5](https://github.com/chenasraf/massarg/compare/v2.0.0-pre.4...v2.0.0-pre.5) (2023-12-12) - - -### Bug Fixes - -* default options & default values ([eacb0dd](https://github.com/chenasraf/massarg/commit/eacb0dd7ab8712d276280a891067cfffaafbca3a)) - -# [2.0.0-pre.4](https://github.com/chenasraf/massarg/compare/v2.0.0-pre.3...v2.0.0-pre.4) (2023-12-11) - - -### Bug Fixes - -* bugfixes, build updates ([fa29138](https://github.com/chenasraf/massarg/commit/fa29138fd1bb4ac0b574086caf5dd721c17e676b)) -* detect the correct flag syntax in all cases ([291ff0f](https://github.com/chenasraf/massarg/commit/291ff0fe0ef2c33cfa5d0fae3939ce9290397f29)) -* flag negation ([a42a854](https://github.com/chenasraf/massarg/commit/a42a8547195f1c7c932081584af501f8bb05ef19)) -* required options ([0f17d33](https://github.com/chenasraf/massarg/commit/0f17d336fb41f7c39e8dc3f536861d9bd8ab6601)) - - -### Features - -* global column width ([637f91d](https://github.com/chenasraf/massarg/commit/637f91d8ba777e6e1d98b3a65e4cc4b8a2722661)) - -# [2.0.0-pre.3](https://github.com/chenasraf/massarg/compare/v1.0.6...v2.0.0-pre.3) (2023-12-02) - -### Features - -* array & typed options ([73c1ad9](https://github.com/chenasraf/massarg/commit/73c1ad95913ab3cba5ca304e2759a9fd76212ccc)) -* built-in help command + flag ([d26114d](https://github.com/chenasraf/massarg/commit/d26114dd321362c9987045878fb94fc63eb91f7e)) -* example lines, help style updates ([ecd7ced](https://github.com/chenasraf/massarg/commit/ecd7ced3e8ed1f9f771d4e7522d4a8a6c76ae320)) -* help generator ([b0d20bf](https://github.com/chenasraf/massarg/commit/b0d20bf48a2c37aedab6f12b078417706b0d3e89)) -* improve help config, update styles, fixes ([b11cdd3](https://github.com/chenasraf/massarg/commit/b11cdd35a8ac0ac2c61148ddb4487dce4c0f5fca)) -* pass main instance to run fn ([29d6973](https://github.com/chenasraf/massarg/commit/29d6973eecbaa2d86e496387fe946a53c9662466)) -* transform output name for options ([c414365](https://github.com/chenasraf/massarg/commit/c414365fbe602419a19f5522055e5b3c2fed761a)) -* v2 poc ([7d5d302](https://github.com/chenasraf/massarg/commit/7d5d3025c6c65ee2d858aaf1beed50d847f423b4)) -* different opt output name (default camelCase) ([48b9602](https://github.com/chenasraf/massarg/commit/48b96022e42c6de1776485be1d829247f50cb6ad)) - -### Bug Fixes - -* exported types fixes ([a0aa8ec](https://github.com/chenasraf/massarg/commit/a0aa8ecbb7c112033842f080caaea666a75b88b1)) -* help output formatting/text ([fed6f60](https://github.com/chenasraf/massarg/commit/fed6f602c5e682a2b585fed68ed05d95ed2a0a7e)) -* support help option with early quit ([742b597](https://github.com/chenasraf/massarg/commit/742b597f1ec9392f09b6af181d9c9cee7f680ba6)) - -### Continuous Integration - -* update release config ([4b111ab](https://github.com/chenasraf/massarg/commit/4b111ab6f69666a1f5540b08fc932bcf2ac03ee4)) - - -### BREAKING CHANGES - -* recreated massarg package diff --git a/release.config.cjs b/release.config.cjs index 1756694..fb89ca2 100644 --- a/release.config.cjs +++ b/release.config.cjs @@ -1,3 +1,6 @@ +const ref = process.env.GITHUB_REF || '' +const branch = ref.split('/').pop() + /** * @type {import('semantic-release').GlobalConfig} */ @@ -34,13 +37,6 @@ module.exports = { assets: ['*.tgz'], }, ], - [ - '@semantic-release/changelog', - { - changelogFile: 'CHANGELOG.md', - changelogTitle: '# Change Log', - }, - ], [ '@semantic-release/git', { @@ -56,3 +52,14 @@ module.exports = { // ], ], } + +if (branch === 'master') { + const gitIdx = module.exports.plugins.findIndex((plugin) => plugin[0] === '@semantic-release/git') + module.exports.plugins.splice(gitIdx, 0, [ + '@semantic-release/changelog', + { + changelogFile: 'CHANGELOG.md', + changelogTitle: '# Change Log', + }, + ]) +} diff --git a/src/help.ts b/src/help.ts index df54312..f207f8b 100644 --- a/src/help.ts +++ b/src/help.ts @@ -98,7 +98,7 @@ export const HelpConfig = z.object({ /** Prefix for the example input (default: `$`) */ inputPrefix: z.string().default('$').optional(), /** Prefix for the example output (default: `>`) */ - outputPrefix: z.string().default('>').optional(), + outputPrefix: z.string().default('➜').optional(), }) .optional(), /** Text to display at the very top, describing CLI usage */ @@ -148,7 +148,7 @@ export const defaultHelpConfig: DeepRequired = { color: 'brightWhite', }, inputPrefix: '$', - outputPrefix: '>', + outputPrefix: '➜', }, bindCommand: false, bindOption: false, diff --git a/src/sample.ts b/src/sample.ts index 5e083ed..fb32f95 100644 --- a/src/sample.ts +++ b/src/sample.ts @@ -104,7 +104,7 @@ const main = massarg({ .example({ description: 'Example main command', input: 'my-cli --bool --number 123', - output: 'Main command - printing all opts\n{ bool: true, number: 123 }\n', + output: 'Main command - printing all opts\n { bool: true, number: 123 }\n', }) .example({ description: 'Example add command', diff --git a/src/style.ts b/src/style.ts index 5943209..aa9d75d 100644 --- a/src/style.ts +++ b/src/style.ts @@ -1,5 +1,6 @@ import z from 'zod' -import { zodEnumFromObjKeys } from './utils' +import { zodEnumFromObjKeys, strConcat } from './utils' +export { strConcat } export const ansiStyles = { reset: '\x1b[0m',