Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mdn- and Node.js 8 deprecation warnings for 1.1 release #6777

Merged
merged 10 commits into from
Oct 2, 2020
Merged
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
**Warning:** This package is soon to be renamed. Use [`@mdn/browser-compat-data`](https://www.npmjs.com/package/@mdn/browser-compat-data) instead. If you're already using `mdn-browser-compat-data`, read [the upgrade guide](https://github.com/mdn/browser-compat-data/blob/v1.1.0/UPGRADE-2.0.md).

# mdn-browser-compat-data

[https://github.com/mdn/browser-compat-data](https://github.com/mdn/browser-compat-data)
Expand Down
30 changes: 30 additions & 0 deletions UPGRADE-2.0.x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Upgrading from `mdn-browser-compat-data` 1.1 to `@mdn/browser-compat-data` 2.0.x

`mdn-browser-compat-data` has been renamed to `@mdn/browser-compat-data` (note the `@mdn` scope). Follow these instructions to upgrade to the new package name.

## Before you start

This upgrade causes two breaking changes:

- The old package name no longer works, which means you'll have to update `require()` calls and your `package.json` dependencies.
- Node.js 8 is no longer supported, which means you'll have to upgrade to Node.js 10 or later.

The schema, public API, and other details of the package remain the same since `1.1.x`.

## Upgrade

1. If you have not done so already, upgrade to Node.js 10 or later. Visit the [Node.js site](https://nodejs.org/) for downloads and changelogs.

2. Remove `mdn-browser-compat-data` from your package dependencies.

In the same directory as your `package.json` file, run `npm uninstall mdn-browser-compat-data`.

3. Add `@mdn/browser-compat-data` to your package dependencies.

In the same directory as your `package.json` file, run `npm install @mdn/browser-compat-data`.

4. In your code, replace any `require("mdn-browser-compat-data")` calls with `require("@mdn/browser-compat-data")`.

If possible, run your test suite to make sure this worked.

If you encountered any undocumented [breaking changes](#Before-you-start) as a result of this upgrade, please [open an issue](https://github.com/mdn/browser-compat-data/issues/new).
29 changes: 29 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,35 @@ const fs = require('fs');
const path = require('path');
const extend = require('extend');

function warnPackageName() {
if (!warnPackageName.emitted) {
warnPackageName.emitted = true;
process.emitWarning(
'mdn-browser-compat-data is deprecated. Upgrade to @mdn/browser-compat-data. Learn more: https://github.com/mdn/browser-compat-data/blob/v1.1.0/UPGRADE-2.0.x.md',
{
type: 'DeprecationWarning',
},
);
}
}

function warnNode8Deprecation() {
if (!warnNode8Deprecation.emitted) {
warnNode8Deprecation.emitted = true;
if (process.version.split('.')[0] === 'v8') {
process.emitWarning(
'mdn-browser-compat-data: @mdn/browser-compat-data ends support for Node.js 8. Upgrade to Node.js 10 or later.',
{
type: 'DeprecationWarning',
},
);
}
}
}

warnPackageName();
warnNode8Deprecation();

function load() {
// Recursively load one or more directories passed as arguments.
let dir,
Expand Down