From a0229962ceac2c9eb05499373c153c7b3dced382 Mon Sep 17 00:00:00 2001 From: Pierre Vanduynslager Date: Wed, 8 May 2019 16:11:37 -0400 Subject: [PATCH] fix: fix maintenance branch regex --- docs/developer-guide/js-api.md | 2 +- docs/recipes/distribution-channels.md | 2 +- docs/recipes/maintenance-releases.md | 2 +- docs/recipes/pre-releases.md | 2 +- docs/usage/configuration.md | 2 +- docs/usage/workflow-configuration.md | 2 +- lib/get-config.js | 2 +- test/branches/expand.test.js | 8 ++++---- test/get-config.test.js | 6 +++--- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/developer-guide/js-api.md b/docs/developer-guide/js-api.md index cbce7512..4d08625e 100644 --- a/docs/developer-guide/js-api.md +++ b/docs/developer-guide/js-api.md @@ -13,7 +13,7 @@ try { const result = await semanticRelease({ // Core options branches: [ - '+([1-9])?(.{+([1-9]),x}).x', + '+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', diff --git a/docs/recipes/distribution-channels.md b/docs/recipes/distribution-channels.md index 0d9abafa..db55e680 100644 --- a/docs/recipes/distribution-channels.md +++ b/docs/recipes/distribution-channels.md @@ -3,7 +3,7 @@ This recipe will walk you through a simple example that uses distribution channels to make releases available only to a subset of users, in order to collect feedbacks before distributing the release to all users. This example uses the **semantic-release** default configuration: -- [branches](../usage/configuration.md#branches): `['+([1-9])?(.{+([1-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` +- [branches](../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` - [plugins](../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']` ## Initial release diff --git a/docs/recipes/maintenance-releases.md b/docs/recipes/maintenance-releases.md index 0eb93ee2..01d46fb0 100644 --- a/docs/recipes/maintenance-releases.md +++ b/docs/recipes/maintenance-releases.md @@ -3,7 +3,7 @@ This recipe will walk you through a simple example that uses Git branches and distribution channels to publish fixes and features for old versions of a package. This example uses the **semantic-release** default configuration: -- [branches](../usage/configuration.md#branches): `['+([1-9])?(.{+([1-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` +- [branches](../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` - [plugins](../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']` ## Initial release diff --git a/docs/recipes/pre-releases.md b/docs/recipes/pre-releases.md index 1f789185..7bfb1ff4 100644 --- a/docs/recipes/pre-releases.md +++ b/docs/recipes/pre-releases.md @@ -3,7 +3,7 @@ This recipe will walk you through a simple example that uses pre-releases to publish beta versions while working on a future major release and then make only one release on the default distribution. This example uses the **semantic-release** default configuration: -- [branches](../usage/configuration.md#branches): `['+([1-9])?(.{+([1-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` +- [branches](../usage/configuration.md#branches): `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]` - [plugins](../usage/configuration.md#plugins): `['@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', '@semantic-release/npm', '@semantic-release/github']` ## Initial release diff --git a/docs/usage/configuration.md b/docs/usage/configuration.md index 0c67e698..235c7aaf 100644 --- a/docs/usage/configuration.md +++ b/docs/usage/configuration.md @@ -70,7 +70,7 @@ List of modules or file paths containing a [shareable configuration](shareable-c ### branches Type: `Array`, `String`, `Object`
-Default: `['+([1-9])?(.{+([1-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
+Default: `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', {name: 'beta', prerelease: true}, {name: 'alpha', prerelease: true}]`
CLI arguments: `--branches` The branches on which releases should happen. By default **semantic-release** will release: diff --git a/docs/usage/workflow-configuration.md b/docs/usage/workflow-configuration.md index eef0a826..aee88c61 100644 --- a/docs/usage/workflow-configuration.md +++ b/docs/usage/workflow-configuration.md @@ -34,7 +34,7 @@ It can be defined as a [glob](https://github.com/micromatch/micromatch#matching- If `name` doesn't match to any branch existing in the repository, the definition will be ignored. For example the default configuration includes the definition `next` and `next-major` which will become active only when the branches `next` and/or `next-major` are created in the repository. This allow to define your workflow once with all potential branches you might use and have the effective configuration evolving as you create new branches. -For example the configuration `['+([1-9])?(.{+([1-9]),x}).x', 'master', 'next']` will be expanded as: +For example the configuration `['+([0-9])?(.{+([0-9]),x}).x', 'master', 'next']` will be expanded as: ```js { branches: [ diff --git a/lib/get-config.js b/lib/get-config.js index e4812088..ba0a8f25 100644 --- a/lib/get-config.js +++ b/lib/get-config.js @@ -67,7 +67,7 @@ module.exports = async (context, opts) => { // Set default options values if not defined yet options = { branches: [ - '+([1-9])?(.{+([1-9]),x}).x', + '+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', diff --git a/test/branches/expand.test.js b/test/branches/expand.test.js index 889ac6ed..285aaac0 100644 --- a/test/branches/expand.test.js +++ b/test/branches/expand.test.js @@ -6,9 +6,9 @@ test('Expand branches defined with globs', async t => { const {cwd, repositoryUrl} = await gitRepo(true); await gitCommits(['First'], {cwd}); await gitPush(repositoryUrl, 'master', {cwd}); - await gitCheckout('1.1.x', true, {cwd}); + await gitCheckout('1.0.x', true, {cwd}); await gitCommits(['Second'], {cwd}); - await gitPush(repositoryUrl, '1.1.x', {cwd}); + await gitPush(repositoryUrl, '1.0.x', {cwd}); await gitCheckout('1.x.x', true, {cwd}); await gitCommits(['Third'], {cwd}); await gitPush(repositoryUrl, '1.x.x', {cwd}); @@ -30,7 +30,7 @@ test('Expand branches defined with globs', async t => { const branches = [ // Should match all maintenance type branches - {name: '+([1-9])?(.{+([1-9]),x}).x'}, + {name: '+([0-9])?(.{+([0-9]),x}).x'}, {name: 'master', channel: 'latest'}, {name: 'next'}, {name: 'pre/{foo,bar}', channel: `\${name.replace(/^pre\\//g, '')}`, prerelease: true}, @@ -42,7 +42,7 @@ test('Expand branches defined with globs', async t => { ]; t.deepEqual(await expand({cwd}, branches), [ - {name: '1.1.x'}, + {name: '1.0.x'}, {name: '1.x.x'}, {name: '2.x'}, {name: 'master', channel: 'latest'}, diff --git a/test/get-config.test.js b/test/get-config.test.js index 32866464..c243c91b 100644 --- a/test/get-config.test.js +++ b/test/get-config.test.js @@ -36,7 +36,7 @@ test('Default values, reading repositoryUrl from package.json', async t => { // Verify the default options are set t.deepEqual(result.branches, [ - '+([1-9])?(.{+([1-9]),x}).x', + '+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', @@ -57,7 +57,7 @@ test('Default values, reading repositoryUrl from repo if not set in package.json // Verify the default options are set t.deepEqual(result.branches, [ - '+([1-9])?(.{+([1-9]),x}).x', + '+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major', @@ -79,7 +79,7 @@ test('Default values, reading repositoryUrl (http url) from package.json if not // Verify the default options are set t.deepEqual(result.branches, [ - '+([1-9])?(.{+([1-9]),x}).x', + '+([0-9])?(.{+([0-9]),x}).x', 'master', 'next', 'next-major',