-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release v1
- Loading branch information
Showing
32 changed files
with
1,936 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches-ignore: | ||
- 'master' | ||
- 'alpha' | ||
- 'beta' | ||
pull_request: | ||
jobs: | ||
test: | ||
name: test | ||
runs-on: ubuntu-18.04 | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
@@ -24,10 +31,16 @@ jobs: | |
- name: Build | ||
run: npm run build | ||
- name: Test | ||
run: npm run test | ||
uses: paambaati/[email protected] | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
with: | ||
coverageCommand: npm run test:coverage | ||
debug: true | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-18.04 | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,13 @@ on: | |
push: | ||
branches: | ||
- master | ||
- beta | ||
- alpha | ||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-18.04 | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
@@ -27,7 +30,12 @@ jobs: | |
- name: Build | ||
run: npm run build | ||
- name: Test | ||
run: npm run test | ||
uses: paambaati/[email protected] | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
with: | ||
coverageCommand: npm run test:coverage | ||
debug: true | ||
- name: Lint | ||
run: npm run lint | ||
- name: Release | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
/node_modules | ||
/dist | ||
*.sh | ||
.vscode | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"branches": [ | ||
"+([0-9])?(.{+([0-9]),x}).x", | ||
"master", | ||
{"name": "beta", "prerelease": true}, | ||
{"name": "alpha", "prerelease": true} | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/npm", | ||
"@semantic-release/github", | ||
["@semantic-release/changelog", { | ||
"changelogFile": "CHANGELOG.md" | ||
}], | ||
["@semantic-release/git", { | ||
"assets": ["CHANGELOG.md", "package.json"], | ||
"message": "chore(release): :bookmark: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
}], | ||
"./dist/index.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# [1.0.0-alpha.8](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2020-10-23) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* fix the instanciation of a service ([6638b77](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/commit/6638b7775e6db4aece0c5564667a0b737e04094a)) | ||
|
||
|
||
### Features | ||
|
||
* :sparkles: support configuration ([259bf6b](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/commit/259bf6bcff490720e1f2cd0d6c915567f300e5fe)) | ||
|
||
# [1.0.0-alpha.7](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2020-10-23) | ||
|
||
|
||
### Features | ||
|
||
* implement and test new rules, that can take options ([fec9e9c](https://github.com/ghusse/semantic-release-npm-deprecate-old-versions/commit/fec9e9c4a9452ffb0fb44e35395c93a68384bfd2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,196 @@ | ||
[![Maintainability](https://api.codeclimate.com/v1/badges/29751e470914f5b5dd20/maintainability)](https://codeclimate.com/github/ghusse/semantic-release-npm-deprecate-old-versions/maintainability)[![Test Coverage](https://api.codeclimate.com/v1/badges/29751e470914f5b5dd20/test_coverage)](https://codeclimate.com/github/ghusse/semantic-release-npm-deprecate-old-versions/test_coverage) | ||
Under development, not available yet | ||
|
||
# Development in progress, not functional yet | ||
|
||
**DON'T USE IT** until it's released for real. | ||
|
||
## Installation and usage | ||
|
||
- Install with: `npm install semantic-release-npm-deprecate-old-versions --save-dev` | ||
- Set the environment variable `NPM_TOKEN` (same config than `@semantic-release/npm`) | ||
- Update your `releaserc` configuration file | ||
|
||
### Configuration | ||
|
||
```json | ||
{ | ||
"plugins": [ | ||
"@semantic-release/npm", | ||
"semantic-release-npm-deprecate-old-versions" | ||
] | ||
} | ||
``` | ||
|
||
Equivalent to: | ||
```json | ||
{ | ||
"plugins": [ | ||
"@semantic-release/npm", | ||
["semantic-release-npm-deprecate-old-versions", { | ||
"rules": [ | ||
"supportLatest", | ||
"supportPreReleaseIfNotReleased", | ||
"deprecateAll" | ||
] | ||
}] | ||
] | ||
} | ||
``` | ||
|
||
Equivalent to: | ||
```json | ||
{ | ||
"plugins": [ | ||
"@semantic-release/npm", | ||
["semantic-release-npm-deprecate-old-versions", { | ||
"rules": [ | ||
{ | ||
"rule": "supportLatest", | ||
"options": { | ||
"numberOfMajorReleases": 1, | ||
"numberOfMinorReleases": 1, | ||
"numberOfPatchReleases": 1 | ||
} | ||
}, | ||
{ | ||
"rule": "supportPreReleaseIfNotReleased", | ||
"options": { | ||
"numberOfPreReleases": 1, | ||
} | ||
}, | ||
"deprecateAll" | ||
] | ||
}] | ||
] | ||
} | ||
``` | ||
|
||
## Extend rules | ||
|
||
If you have a javascript configuration file for releases, you can pass a function in the array: | ||
|
||
```js | ||
module.exports = { | ||
"plugins": [ | ||
"@semantic-release/npm", | ||
["semantic-release-npm-deprecate-old-versions", { | ||
"rules": [ | ||
customSupportFunction, | ||
"deprecateAll" | ||
] | ||
}] | ||
] | ||
}; | ||
|
||
/** | ||
* @param {import('semver').SemVer} version | ||
* @param {Array<import('semver').SemVer>} allVersionsSortedLatestFirst | ||
* @returns {import('semantic-release-npm-deprecate-old-versions/rule').RuleResult} | ||
*/ | ||
function customSupportFunction(version, allVersionsSortedLatestFirst){ | ||
if (version.major === 4){ | ||
// This version cannot be deprecated by other rules | ||
return { action: 'support' } | ||
} | ||
|
||
if (version.major === 3){ | ||
// This version will be deprecated, and other rules | ||
// will not be applied | ||
return { | ||
action: 'deprecate', | ||
reason: 'Because the new version is awesome' | ||
} | ||
} | ||
|
||
// Let other rules decide | ||
return { action: 'continue' } | ||
} | ||
``` | ||
|
||
## Supported vs deprecated versions | ||
|
||
This plugin considers that either a version is supported, or it is deprecated. | ||
|
||
Every rule computes a status on each version. Rules are applied in order, they have 3 possible outputs: | ||
|
||
- `continue`: the rule does not enforce the status of the given version, it is left to the next rules to decide the status | ||
- `deprecate`: the rule declares that the given version is deprecated, no further rule will be able to change this status | ||
- `support`: the rule declares that the given version is supported, as a consequence, no further rule will be able to change its status | ||
|
||
## Available rules and options | ||
|
||
### support-latest | ||
|
||
This rule allows to declare a certain number of releases as supported. This rule **does not apply to pre-releases**. | ||
|
||
#### Options | ||
|
||
All these options are optional. If a value is not set, the default value will apply | ||
```json | ||
{ | ||
"numberOfMajorReleases": 1, | ||
"numberOfMinorReleases": 1, | ||
"numberOfPatchReleases": 1 | ||
} | ||
``` | ||
|
||
#### Examples | ||
|
||
options: `numberOfMajorReleases=2` | ||
|
||
| `2.0.1` |`2.0.0` | `1.0.2` | `1.0.1` | `1.0.0` | | ||
| :------------ | :--------: | :--------: | :--------: | ---------: | | ||
| **support** | continue | **support**| continue | continue | | ||
|
||
`continue` means that the status of a version is not fixed by this rule | ||
|
||
### support-prerelease-if-not-released | ||
|
||
This rule allows to declare a certain number of pre-releases as supported. This rule **only applies to pre-releases**. | ||
|
||
#### Options | ||
|
||
```json | ||
{ | ||
"numberOfPreReleases": 1, | ||
} | ||
``` | ||
|
||
#### Examples | ||
|
||
options: `numberOfPreReleases=2` | ||
|
||
| `3.0.0-alpha.2` | `3.0.0-alpha.1` | `3.0.0-alpha.0` | `2.0.0` | `2.0.0-alpha.0` | | ||
| :------------ | :-------------: | :-------------: | :------: | -----------------: | | ||
| **support** | **support** | continue | continue | continue | | ||
|
||
---------------------------------------------------------------------------------------- | ||
|
||
options: `numberOfPreReleases=2` | ||
|
||
| `2.0.0` | `2.0.0-alpha.0` | | ||
| :----- | -----------------: | | ||
| continue | continue | | ||
|
||
`continue` means that the status of a version is not fixed by this rule | ||
|
||
In this example the version `2.0.0-alpha.0` is not marked as supported because the version `2.0.0` has been released. | ||
|
||
### deprecate-all | ||
|
||
This rule deprecate all remaining versions (not previously marked as supported). | ||
|
||
It is meant to be used at the end of rules declaration. | ||
|
||
#### Options | ||
|
||
This rule does not have any option | ||
|
||
#### Examples | ||
|
||
options: `numberOfPreReleases=2` | ||
|
||
| `2.0.0` | `1.0.0` | | ||
| :------------ | ----------------: | | ||
| **deprecate** | **deprecate** | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; |
Oops, something went wrong.