From 5f26de21c6e9e3f1a8a887551b01f8c9e9b9a59e Mon Sep 17 00:00:00 2001 From: Cyrille David Date: Wed, 29 May 2019 11:25:20 +0200 Subject: [PATCH] ember-auto-import: Warn when it is a dependency In that case, user may consume pretender without the need of a ember-cli-pretender. --- index.js | 23 +++++++++++++++++++++++ package.json | 1 + yarn.lock | 9 +++++++++ 3 files changed, 33 insertions(+) diff --git a/index.js b/index.js index 5d1a238..3dcec29 100644 --- a/index.js +++ b/index.js @@ -17,6 +17,29 @@ module.exports = { } }, + _autoimportInfo() { + let chalk = require("chalk"); + let info = chalk.yellow(` + INFORMATION (ember-cli-pretender) + ${chalk.inverse( + "ember-auto-import" + )} seems to be in your package dependencies. + As a result, you don't need pretender to be wrapped anymore. + You can install ${chalk.bold("pretender")} and remove ${chalk.bold( + "ember-cli-pretender" + )}. + `); + // eslint-disable-next-line no-console + console.log(info); + }, + + init() { + this._super.init && this._super.init.apply(this, arguments); + if (this.parent.dependencies()["ember-auto-import"]) { + this._autoimportInfo(); + } + }, + treeForVendor: function(tree) { this._findPretenderPaths(); diff --git a/package.json b/package.json index b9814a8..2fd109e 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "abortcontroller-polyfill": "^1.1.9", "broccoli-funnel": "^2.0.1", "broccoli-merge-trees": "^3.0.0", + "chalk": "^2.4.2", "ember-cli-babel": "^6.6.0", "fake-xml-http-request": "^2.0.0", "pretender": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index bf08311..bf15622 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1449,6 +1449,15 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4 escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + chardet@^0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"