bigbite / build-tools

MIT License
6 stars 1 forks source link

Version increment command for selected targets. #88

Open ampersarnie opened 1 year ago

ampersarnie commented 1 year ago

Having a command that allows for incrementing the version of a specific plugin would help with how we define and perform semver increments.

Example Command Usage

Patch

build-tools version patch
# 1.2.2 → 1.2.3

Minor

build-tools version minor
# 1.2.3 → 1.3.0

Major

build-tools version major
# 1.3.0 → 2.0.0

Beta

build-tools version major:beta
# 2.0.0 → 3.0.0-beta.1

build-tools version beta
# 3.0.0-beta.1 → 3.0.0-beta.2

Increment Multiple

build-tools version minor my-plugin,my-theme
# my-plugin: 2.0.0 → 2.1.0
# my-theme: 3.4.0 → 3.5.0
jordanharris-6 commented 4 months ago

@ampersarnie Should this have the same functionality as NPM-VERSION i.e | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git] ?

I noticed npm version is only compatible with package.json files so couldn't even wrap this in it as it wouldn't work with PHP files.

ampersarnie commented 4 months ago

Yeah they should, however, some of the naming between what was listed in the description and npm doesn't match word for word but are the same. i.e. premajor = major:beta

You can ignore the from-git version. To help with that comparison, here's what you can use:

NPM/semver Build Tools Example Result (x\ y)
major major x.0.0
minor minor 1.x.0
patch patch 1.0.x
premajor major:beta x.0.0-beta.y
preminor minor:beta 1.x.0-beta.y
prepatch patch:beta 1.0.x-beta.y

If you're unsure on what these versions mean, take a look at our internal RFC on Semantic Versioning.