https://github.com/ember-cli/semver-deprecate
Semver aware deprecate function
https://github.com/ember-cli/semver-deprecate
Last synced: about 2 months ago
JSON representation
Semver aware deprecate function
- Host: GitHub
- URL: https://github.com/ember-cli/semver-deprecate
- Owner: ember-cli
- Created: 2024-12-31T17:34:40.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-07T21:56:52.000Z (7 months ago)
- Last Synced: 2025-12-23T07:44:59.886Z (3 months ago)
- Language: JavaScript
- Size: 264 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# semver-deprecate
This is a tiny micro-library that extracts the "Ember way" of doing deprecations into a re-usable library. The philosophy of this library is that if you have marked something to be deprecated "until" a certain major version that deprecation call should throw an error once the library's version has exceeded that major version. This allows you to remove code in minor PRs after a major release has been cut because any code-path that used to hit this deprecation is now throwing and thus no longer supported.
## Usage
```js
import { makeDeprecate } from 'semver-deprecate';
import pkg from './package.json' with { type: 'json' };
const deprecate = makeDeprecate(pkg.name, pkg.version);
deprecate('The `foo` method is deprecated.', false, {
for: 'your-lib',
id: 'your-lib.foo-method', // a unique ID for the deprecation
since: {
available: '4.1.0',
enabled: '4.2.0',
},
until: '5.0.0',
url: 'https://example.com',
});
```