Skip to content

Commit 0963dd7

Browse files
committed
warn if ember-cli-deploy-build is in use and not disabled
if a user is using a plugin pack that specifies ember-cli-deploy-build as one of the plugins, deployment will error at the build phase because ember-cli-deploy-build will try to build an ember project, and error when it doesn't find ember-cli-build.js ember-cli-deploy allows a user to disable specific plugins from the ENV object exported in config/deploy.js To do so, export an ENV such that `ENV.pipeline.disabled.build === true`
1 parent 6ae8da1 commit 0963dd7

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

index.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ var DeployPluginBase = require('ember-cli-deploy-plugin');
55
var Promise = require('ember-cli/lib/ext/promise');
66
var exec = require('child_process').exec;
77
var glob = require('glob');
8+
var nodeModulesPath = require('node-modules-path');
9+
var path = require('path');
10+
var fs = require('fs');
11+
12+
var getDisabledPluginsMap = function(context) {
13+
if (context && context.config && context.config.pipeline) {
14+
return context.config.pipeline.disabled;
15+
}
16+
return {};
17+
};
18+
19+
var userHasDisabledBuildPlugin = function(context) {
20+
return getDisabledPluginsMap(context).build;
21+
};
822

923
module.exports = {
1024
name: 'ember-cli-deploy-create-react-app',
@@ -17,6 +31,38 @@ module.exports = {
1731

1832
defaultConfig: {},
1933

34+
configure: function(context) {
35+
this.warnIfBuildPluginNotDisabled(context);
36+
},
37+
38+
warnIfBuildPluginNotDisabled(context) {
39+
if (userHasDisabledBuildPlugin(context)) {
40+
return;
41+
}
42+
43+
var modulesPath = nodeModulesPath(process.cwd());
44+
var buildPluginPath = path.join(modulesPath, 'ember-cli-deploy-build');
45+
if (fs.existsSync(buildPluginPath)) {
46+
this.warn('The ember build plugin must be disabled.');
47+
this.warn('Add the following to your config/deploy.js file:');
48+
this.warn('```', {color: 'red'});
49+
this.logCode('ENV.pipeline = {');
50+
this.logCode(' disabled: {');
51+
this.logCode(' build: true');
52+
this.logCode(' }');
53+
this.logCode('};');
54+
this.warn('```', {color: 'red'});
55+
}
56+
},
57+
58+
warn(message) {
59+
this.log(message, {color: 'red'});
60+
},
61+
62+
logCode(message) {
63+
this.log(message, {color: 'green'});
64+
},
65+
2066
build: function(context) {
2167
var self = this;
2268
var options = {};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
},
2121
"dependencies": {
2222
"ember-cli-babel": "^5.1.7",
23-
"ember-cli-deploy-plugin": "^0.2.9"
23+
"ember-cli-deploy-plugin": "^0.2.9",
24+
"node-modules-path": "^1.0.1"
2425
},
2526
"devDependencies": {
2627
"broccoli-asset-rev": "^2.4.5",

0 commit comments

Comments
 (0)