@@ -9,6 +9,7 @@ const isDefaultBlueprint = require('./is-default-blueprint');
99const emberInstallAddon = require ( './ember-install-addon' ) ;
1010const overwriteBlueprintFiles = require ( './overwrite-blueprint-files' ) ;
1111const debug = require ( 'debug' ) ( 'ember-cli-update' ) ;
12+ const npm = require ( 'boilerplate-update/src/npm' ) ;
1213
1314const nodeModulesIgnore = `
1415
@@ -37,7 +38,10 @@ module.exports = function getStartAndEndCommands({
3738 } else if ( ! endBlueprint . isBaseBlueprint && isDefaultBlueprint ( baseBlueprint ) ) {
3839 startRange = endRange = baseBlueprint . version ;
3940 } else {
40- startRange = endRange = '' ;
41+ // first version that supports blueprints with versions
42+ 43+ // https://github.com/ember-cli/ember-cli/pull/8571
44+ startRange = endRange = '>=3.11.0-beta.1' ;
4145 }
4246
4347 return {
@@ -63,13 +67,18 @@ module.exports = function getStartAndEndCommands({
6367 } ;
6468} ;
6569
66- function isDefaultAddonBlueprint ( blueprint ) {
70+ async function isDefaultAddonBlueprint ( blueprint ) {
6771 let isCustomBlueprint = ! isDefaultBlueprint ( blueprint ) ;
6872
6973 let isDefaultAddonBlueprint ;
7074
7175 if ( isCustomBlueprint ) {
72- let { keywords } = utils . require ( path . join ( blueprint . path , 'package' ) ) ;
76+ let keywords ;
77+ if ( blueprint . path ) {
78+ keywords = utils . require ( path . join ( blueprint . path , 'package' ) ) . keywords ;
79+ } else {
80+ keywords = await npm . json ( `v ${ blueprint . packageName } keywords` ) ;
81+ }
7382
7483 isDefaultAddonBlueprint = ! ( keywords && keywords . includes ( 'ember-blueprint' ) ) ;
7584 }
@@ -88,14 +97,16 @@ function getArgs(projectName, blueprint) {
8897 args . push ( 'init' ) ;
8998 }
9099
91- let isCustomBlueprint = ! isDefaultBlueprint ( blueprint ) ;
92-
93100 let _blueprint ;
94- if ( isCustomBlueprint ) {
101+ if ( blueprint . path ) {
102+ // Only use path when necessary, because `npm install <folder>`
103+ // symlinks instead of actually installing, so any peerDeps won't
104+ // work. Example https://github.com/salsify/ember-cli-dependency-lint/blob/v1.0.3/lib/commands/dependency-lint.js#L5
95105 _blueprint = blueprint . path ;
96- } else {
97- // Can we use the above path all the time, even if it is default?
106+ } else if ( isDefaultBlueprint ( blueprint ) ) {
98107 _blueprint = blueprint . name ;
108+ } else {
109+ _blueprint = `${ blueprint . packageName } @${ blueprint . version } ` ;
99110 }
100111
101112 return [
@@ -186,7 +197,7 @@ function createProject(runEmber) {
186197 }
187198
188199 if ( options . blueprint ) {
189- if ( isDefaultAddonBlueprint ( options . blueprint ) ) {
200+ if ( await isDefaultAddonBlueprint ( options . blueprint ) ) {
190201 await module . exports . installAddonBlueprint ( {
191202 cwd,
192203 projectName : options . projectName ,
@@ -227,8 +238,9 @@ module.exports.installAddonBlueprint = async function installAddonBlueprint({
227238
228239 let { ps } = await emberInstallAddon ( {
229240 cwd : projectRoot ,
230- addonName : blueprint . path ,
231- blueprintPackageName : blueprint . packageName ,
241+ packageName : blueprint . packageName ,
242+ version : blueprint . version ,
243+ blueprintPath : blueprint . path ,
232244 stdin : 'pipe'
233245 } ) ;
234246
0 commit comments