45 Commits

Author SHA1 Message Date
Gregor Martynus
6a83cb53e5
fix(deps): bump @semantic-release/npm to ^10.0.0-beta.1 (#2670) 2023-01-14 14:14:04 -08:00
Matt Travi
9eab1adb9d
feat(esm): convert to esm (#2569)
for #2543

BREAKING CHANGE: semantic-release is now ESM-only. since it is used through its own executable, the impact on consuming projects should be minimal

BREAKING CHANGE: references to plugin files in configs need to include the file extension because of executing in an ESM context
2022-11-11 09:24:06 -06:00
Matt Travi
4cd3641dbf
refactor(plugins): switched from require to await import() when loading plugins (#2558) 2022-09-17 14:10:05 -07:00
Gregor Martynus
caa3526caa style: xo 2020-04-08 15:13:33 -07:00
greenkeeper[bot]
f899fa9a7c chore(package): update xo to version 0.28.1
Closes #1488
2020-03-26 23:55:26 -04:00
greenkeeper[bot]
ef1b8a0b91 chore(package): update ava to version 3.1.0 2020-01-27 13:52:59 -05:00
Pierre Vanduynslager
20e7a38cdb style: prettier formatting 2019-11-20 14:16:13 -05:00
Pierre Vanduynslager
d4f28abd47 test: fix parsing of MODULE_NOT_FOUND errors message in unit tests 2019-06-05 17:18:17 -04:00
greenkeeper[bot]
ba00e16f43 chore(package): update ava to version 1.0.1 2018-12-27 15:04:57 -05:00
Pierre Vanduynslager
7b4052470b feat: support multiple branches and distribution channels
- Allow to configure multiple branches to release from
- Allow to define a distribution channel associated with each branch
- Manage the availability on distribution channels based on git merges
- Support regular releases, maintenance releases and pre-releases
- Add the `addChannel` plugin step to make an existing release available on a different distribution channel

BREAKING CHANGE: the `branch` option has been removed in favor of `branches`

The new `branches` option expect either an Array or a single branch definition. To migrate your configuration:
- If you want to publish package from multiple branches, please the configuration documentation
- If you use the default configuration and want to publish only from `master`: nothing to change
- If you use the `branch` configuration and want to publish only from one branch: replace `branch` by `branches` (`"branch": "my-release-branch"` => `"branches": "my-release-branch"`)
2018-11-29 14:13:03 -05:00
Pierre Vanduynslager
90da6a0bc1 feat: add logs about prepare, publish, success and fail plugins skipped in dry-run mode 2018-11-14 11:27:06 -05:00
Pierre Vanduynslager
5180001ae6 feat: support multiple plugins for the analyzeCommits step
In case multiple plugins with a `analyzeCommits` step are configured, all of them will be executed and the highest release type (`major` > `minor`, `patch`) will be used.
2018-11-12 15:06:46 -05:00
Pierre Vanduynslager
ff275a5cd4 fix: use module name in logs for plugins loaded with plugins option 2018-10-09 15:29:04 -04:00
Pierre Vanduynslager
aa9d5c6efe docs: add a Getting started section and clarify config steps 2018-10-08 13:24:51 -04:00
Pierre Vanduynslager
5ba5010c80 feat: add new plugins option 2018-10-08 13:24:51 -04:00
Pierre Vanduynslager
63d422ed5c fix: do not clone stdout/stderr passed to pugins 2018-08-04 20:33:26 -04:00
Pierre Vanduynslager
d8c84a0e0b fix: clarify EPLUGINCONF error message
The message now specify if the step is required and if it allows to configure multiple plugins.
2018-07-29 23:50:17 -04:00
Pierre Vanduynslager
0626d57116 feat: log with signale and allow to customize stdin and stdout 2018-07-29 21:56:21 -04:00
Pierre Vanduynslager
a94e08de9a feat: pass cwd and env context to plugins
- Allow to run semantic-release (via API) from anywhere passing the current working directory.
- Allows to simplify the tests and to run them in parallel in both the core and plugins.
2018-07-17 00:42:04 -04:00
Pierre Vanduynslager
d8e59cce53 fix: set default path to generateNotes object config 2018-07-10 15:50:24 -04:00
Pierre Vanduynslager
24ce560065 refactor: build plugin pipeline parameters at initialization
In addition, factorize the pipeline config function to avoid code duplication.
2018-07-10 13:18:58 -04:00
Pierre Vanduynslager
576eb6027f refactor: simplify plugin validation 2018-07-10 13:18:58 -04:00
Pierre Vanduynslager
ed9c456f5e refactor: always return an Array of results/errors from a plugin pipeline
Always return an `Array` from a pipeline simplify the function utilization as it's more deterministic. Previously, it would return/throw a single value/error when called with a single input and an `Array` of results/errors when called with an `Array` of input.
2018-07-10 13:18:58 -04:00
Pierre Vanduynslager
f93eeb799b fix: do not set path to plugin config defined as a Function or an Array
If a plugin hook was defined as a `Function` or an `Array` the `path` property would be set to the default value.
Even if this bug had no actual negative impact, it should be fixed so the code would perform as intended.
2018-07-10 13:18:58 -04:00
Matt Travi
6a36832398 fix(plugin-load): clarify load message
added quotes around plugin name to set it apart from the message. without the quotes, some consumers
were missunderstanding the successful loading of the `fail` plugin as a load failure and assuming
something was broken

resolves #811
2018-06-05 22:27:05 -07:00
Pierre Vanduynslager
c2beb643fa feat: add the prepare plugin hook
BREAKING CHANGE: Committing or creating files in the `publish` plugin hook is not supported anymore and now must be done in the `prepare` hook

Plugins with a `publish` hook that makes a commit or create a file that can be committed must use the `prepare` hook.
2018-02-19 00:28:50 -05:00
Pierre Vanduynslager
4d0490122c style: lint 2018-02-15 23:19:57 -05:00
Pierre Vanduynslager
49f5e704ba feat: add success and fail notification plugins
- Allow `publish` plugins to return an `Object` with information related to the releases
- Add the `success` plugin hook, called when all `publish` are successful, receiving a list of release
- Add the `fail` plugin hook, called when an error happens at any point, receiving a list of errors
- Add detailed message for each error
2018-02-11 19:53:41 -05:00
Pierre Vanduynslager
9b2f6bfed2 feat: allow plugins to throw an iterable list of errors 2018-02-11 19:53:41 -05:00
Pierre Vanduynslager
faabffb208 fix: log all core verification errors 2018-01-29 00:55:32 -05:00
Pierre Vanduynslager
d0b304e240 feat: get last release with git tags
- Remove the `getLastRelease` plugin type
- Retrieve the last release based on Git tags
- Create the next release Git tag before calling the `publish` plugins

BREAKING CHANGE: Remove the `getLastRelease` plugin type

The `getLastRelease` plugins will not be called anymore.

BREAKING CHANGE: Git repository authentication is now mandatory

The Git authentication is now mandatory and must be set via `GH_TOKEN`, `GITHUB_TOKEN`,  `GL_TOKEN`, `GITLAB_TOKEN` or `GIT_CREDENTIALS` as described in [CI configuration](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/ci-configuration.md#authentication).
2018-01-27 16:50:29 -05:00
Pierre Vanduynslager
cdb98f919f feat: log all verification errors 2018-01-27 13:24:39 -05:00
Pierre Vanduynslager
996305d69c feat: move npm workaround for missing gitHead to the npm plugin 2017-12-30 21:17:04 -05:00
Pierre Vanduynslager
754b420fd6 feat: support sharable configuration
Adds the options `extends`, which can be defined via configuration file or CLI arguments to a single path or an array of paths of shareable configuration.
A shareable configuration is a file or a module that can be loaded with `require`.
Options is defined by merging in the following order of priority:
- CLI/API
- Configuration file
- Shareable configuration (from right to left)

Options set in a shareable configuration can be unset by setting it to `null` or `undefined` in the main configuration file. If a default value applies to this property it will be used.
2017-12-22 14:22:30 -05:00
Pierre Vanduynslager
2fc538b607 test: add test for missing custom plugin modules 2017-12-22 14:22:30 -05:00
Pierre Vanduynslager
f707b1a90a feat: allow to define plugin options globally 2017-12-22 14:22:30 -05:00
Pierre Vanduynslager
8942093c18 test: limit information stored in context
Store only objects set in `beforeEach` used in `test`.
Avoid logging useless info on test failure.
2017-12-14 11:44:24 -05:00
Pierre Vanduynslager
4053d8f7fb fix: log plugin type in addition of path 2017-12-10 04:03:32 -05:00
Pierre Vanduynslager
8371a03da0 test: Verify Error instance type and SemanticReleaseError name 2017-11-29 18:06:14 -05:00
Pierre Vanduynslager
613a646363 fix: Typo in error messages 2017-11-29 18:06:14 -05:00
Pierre Vanduynslager
d7b323dd00 fix: Accept undefined values for the getLastRelease and generateNotes plugins
Adapt tests and default value to the plugin definitions (`definitions.js`)
2017-11-29 18:06:14 -05:00
Pierre Vanduynslager
5bec59b26b feat: Expect plugins to return Promises
BREAKING CHANGE: Each plugin is expected to return an async function or a Promise returning function. The callback parameter is not passed to plugins anymore.
2017-11-24 21:56:15 -05:00
Pierre Vanduynslager
d4c7605f68 fix: Use default plugin if the path property is missing from a single plugin configuration 2017-11-22 19:47:09 -05:00
Pierre Vanduynslager
facdadaddb ci: Lint with XO 2017-11-21 20:55:47 -05:00
Pierre Vanduynslager
d548edcf37 feat: Extract npm and github publish to plugins
- Add a new plugin type: `publish`
- Add support for multi-plugin. A plugin module can now return an object with a property for each plugin type
- Uses by default [npm](https://github.com/semantic-release/npm) and [github](https://github.com/semantic-release/github) in addition of Travis for the verify condition plugin
- Uses by default [npm](https://github.com/semantic-release/npm) and [github](https://github.com/semantic-release/github) for the publish plugin
- `gitTag` if one can be found is passed to `generateNotes` for both `lastRelease` and `nextRelease`
- `semantic-release` now verifies the plugin configuration (in the `release` property of `package.json`) and throws an error if it's invalid
- `semantic-release` now verifies each plugin output and will throw an error if a plugin returns an unexpected value.

BREAKING CHANGE: `githubToken`, `githubUrl` and `githubApiPathPrefix` have to be set at the [github](https://github.com/semantic-release/github) plugin level. They can be set via `GH_TOKEN`, `GH_URL` and `GH_PREFIX` environment variables.

BREAKING CHANGE: the `npm` parameter is not passed to any plugin anymore. Each plugin have to read `.npmrc` if they needs to (with https://github.com/kevva/npm-conf for example).
2017-11-21 16:41:04 -05:00