mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-07 07:46:32 +02:00
Ensure no deprecate exists in slate-core development (#1991)
* Throw error in test mode * Ensure process * Allow deprecate with user config * Style fix * fix grammer typo
This commit is contained in:
committed by
Ian Storm Taylor
parent
8deecc4461
commit
c64c2ff025
@@ -98,7 +98,7 @@
|
|||||||
"release": "yarn build:production && yarn test && yarn lint && lerna publish && yarn gh-pages",
|
"release": "yarn build:production && yarn test && yarn lint && lerna publish && yarn gh-pages",
|
||||||
"server": "webpack-dev-server --config ./support/webpack/config.js",
|
"server": "webpack-dev-server --config ./support/webpack/config.js",
|
||||||
"start": "npm-run-all --parallel --print-label watch server",
|
"start": "npm-run-all --parallel --print-label watch server",
|
||||||
"test": "cross-env BABEL_ENV=test mocha --require babel-core/register ./packages/*/test/index.js",
|
"test": "cross-env BABEL_ENV=test FORBID_DEPRECATIONS=true mocha --require babel-core/register ./packages/*/test/index.js",
|
||||||
"watch": "rollup --config ./support/rollup/config.js --watch"
|
"watch": "rollup --config ./support/rollup/config.js --watch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,12 @@
|
|||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is deprecate interface forbidden?
|
||||||
|
*/
|
||||||
|
|
||||||
|
const FORBID_DEPRECATE =
|
||||||
|
process && process.env && process.env.FORBID_DEPRECATIONS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is in development?
|
* Is in development?
|
||||||
*
|
*
|
||||||
@@ -75,6 +82,10 @@ function warn(message, ...args) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function deprecate(version, message, ...args) {
|
function deprecate(version, message, ...args) {
|
||||||
|
if (FORBID_DEPRECATE) {
|
||||||
|
throw new Error(`Deprecation (${version}): ${message}`)
|
||||||
|
}
|
||||||
|
|
||||||
log('warn', `Deprecation (${version}): ${message}`, ...args)
|
log('warn', `Deprecation (${version}): ${message}`, ...args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user