Skip to content

Commit

Permalink
Allow usage of blueprint within a blueprinted project.
Browse files Browse the repository at this point in the history
Prior to these changes running `ember init -b @glimmer/blueprint`
would always download the `latest` release from `npm`'s registry for
`@glimmer/blueprint`. This means that it is impossible to actually
control your upgrading process.

This change makes this package *both* a stand alone blueprint package
*and* an addon. The addon creates a blueprint for `@glimmer/blueprint`
so that now `ember init -b @glimmer/blueprint` will use whatever version
of `@glimmer/blueprint` that you happen to have installed. This mirrors
the way ember-cli upgrades work (where you first update the version of
ember-cli in the project, then you run `ember init` with that version).

Ultimately, this commit should be able to be revertted once the upstream
issue is resolved: ember-cli/ember-cli#6952.
  • Loading branch information
rwjblue committed Apr 11, 2017
1 parent 069abb6 commit 8b95d66
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
26 changes: 26 additions & 0 deletions packages/@glimmer/blueprint/blueprints/@glimmer/blueprint/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';
const path = require('path');
const MainBlueprint = require('../../../index');

/*
Create an "addon blueprint" that simply defers to our
top level entry point as the blueprint.
This is basically just a work around for
https://github.com/ember-cli/ember-cli/issues/6952.
Once that issue is fixed and released we can remove:
* ember-addon keyword in package.json
* ember-addon key in package.json
* ember-addon-main.js file
* blueprints/ folder
*/
module.exports = Object.assign({}, MainBlueprint, {
init() {
this._super.init.apply(this, arguments);

this.path = path.join(__dirname, '..', '..', '..');
this.name = '@glimmer/blueprint';
}
});
19 changes: 19 additions & 0 deletions packages/@glimmer/blueprint/ember-addon-main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

/*
Create an "addon blueprint" that simply defers to our
top level entry point as the blueprint.
This is basically just a work around for
https://github.com/ember-cli/ember-cli/issues/6952.
Once that issue is fixed and released we can remove:
* ember-addon keyword in package.json
* ember-addon key in package.json
* ember-addon-main.js file
* blueprints/ folder
*/
module.exports = {
name: '@glimmer/blueprint'
};
6 changes: 5 additions & 1 deletion packages/@glimmer/blueprint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"url": "git+https://github.com/glimmerjs/glimmer-blueprint.git"
},
"keywords": [
"ember-blueprint"
"ember-blueprint",
"ember-addon"
],
"author": "Tom Dale <tom@tomdale.net>",
"license": "MIT",
Expand All @@ -24,5 +25,8 @@
},
"devDependencies": {
"ember-cli-valid-component-name": "^1.0.0"
},
"ember-addon": {
"main": "ember-addon-main.js"
}
}

0 comments on commit 8b95d66

Please sign in to comment.