From 3a254a14f2d8a083ee76559533b8be02f2258921 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Thu, 11 Jun 2015 07:16:50 -0600 Subject: [PATCH] [added] Deprecation warning for individual file use in the Bower release Preparatory step for #693 --- src/utils/deprecationWarning.js | 2 +- tools/amd/build.js | 5 ++++- tools/buildBabel.js | 8 +++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/utils/deprecationWarning.js b/src/utils/deprecationWarning.js index 2272c141fe..802158410f 100644 --- a/src/utils/deprecationWarning.js +++ b/src/utils/deprecationWarning.js @@ -8,7 +8,7 @@ export default function deprecationWarning(oldname, newname, link) { console.warn(message); if (link) { - console.warn(`You can read more about it here ${link}`); + console.warn(`You can read more about it at ${link}`); } } } diff --git a/tools/amd/build.js b/tools/amd/build.js index d52aedf7e5..ae47031c22 100644 --- a/tools/amd/build.js +++ b/tools/amd/build.js @@ -14,7 +14,10 @@ const bowerJson = path.join(bowerRoot, 'bower.json'); const readme = path.join(__dirname, 'README.md'); const license = path.join(repoRoot, 'LICENSE'); -const babelOptions = {modules: 'amd'}; +const babelOptions = { + __reactBootstrapDeprecationWarning: true, + modules: 'amd' +}; const libDestination = path.join(bowerRoot, 'lib'); const factoriesDestination = path.join(libDestination, 'factories'); diff --git a/tools/buildBabel.js b/tools/buildBabel.js index e2ef5c66e2..7811d21bb4 100644 --- a/tools/buildBabel.js +++ b/tools/buildBabel.js @@ -12,7 +12,13 @@ export function buildContent(content, filename, destination, babelOptions={}) { } export function buildFile(filename, destination, babelOptions={}) { - const content = fs.readFileSync(filename, {encoding: 'utf8'}); + let content = fs.readFileSync(filename, {encoding: 'utf8'}); + if (babelOptions.__reactBootstrapDeprecationWarning) { + content = `console.warn('This file is deprecated, and will be removed in v0.24.0. Use react-bootstrap.js or react-bootstrap.min.js instead.'); +console.warn('You can read more about it at https://github.com/react-bootstrap/react-bootstrap/issues/693'); +${content}`; + } + if(babelUtil.canCompile(filename)) { // Get file basename without the extension (in case not .js) let outputName = path.basename(filename, path.extname(filename));