Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Add glimmer-component and glimmer-helper blueprints #30

Merged
merged 4 commits into from
Mar 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Component from '@glimmer/component';

export default class <%= className %> extends Component {
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div></div>
26 changes: 26 additions & 0 deletions blueprints/glimmer-component/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

const stringUtils = require('ember-cli-string-utils');
const validComponentName = require('ember-cli-valid-component-name');
const normalizeEntityName = require('ember-cli-normalize-entity-name');

module.exports = {
description: 'Generates a component. Name must contain a hyphen.',

normalizeEntityName(entityName) {
return validComponentName(normalizeEntityName(entityName));
},

fileMapTokens() {
return {
__name__(options) {
return options.dasherizedModuleName;
},
};
},

locals(options) {
let className = stringUtils.classify(options.entity.name);
return { className };
},
};
2 changes: 2 additions & 0 deletions blueprints/glimmer-helper/files/src/ui/components/__name__.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export default function(params) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't that be in src/ui/helpers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and since components have a class name now, shouldn't helper functions have one too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't that be in src/ui/helpers?

We debated this for a while coming up with module unification, and settled on helpers and components in the same collection of invocable template functions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and since components have a class name now, shouldn't helper functions have one too?

Probably - sorry I was in a rush.

};
24 changes: 24 additions & 0 deletions blueprints/glimmer-helper/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

const stringUtils = require('ember-cli-string-utils');
const normalizeEntityName = require('ember-cli-normalize-entity-name');

module.exports = {
description: 'Generates a helper function.',

normalizeEntityName(entityName) {
return normalizeEntityName(entityName);
},

fileMapTokens() {
return {
__name__(options) {
return options.dasherizedModuleName;
},
};
},

locals(options) {
return { };
},
};
3 changes: 3 additions & 0 deletions ember-cli-addon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
name: 'glimmer-application-pipeline',
};
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
"files": [
"dist"
],
"keywords": [
"glimmer",
"ember-addon"
],
"dependencies": {
"@glimmer/compiler": "^0.23.0-alpha.11",
"@glimmer/di": "^0.2.0",
Expand All @@ -45,6 +49,9 @@
"broccoli-typescript-compiler": "^1.0.1",
"broccoli-uglify-sourcemap": "^1.4.0",
"ember-cli-inject-live-reload": "^1.4.1",
"ember-cli-normalize-entity-name": "^1.0.0",
"ember-cli-string-utils": "^1.1.0",
"ember-cli-valid-component-name": "^1.0.0",
"handlebars": "^4.0.5",
"heimdalljs-logger": "^0.1.8",
"lodash.defaultsdeep": "^4.6.0",
Expand All @@ -59,5 +66,8 @@
"@types/node": "^7.0.7",
"ember-cli": "2.13.0-beta.2",
"typescript": "^2.2.1"
},
"ember-addon": {
"main": "ember-cli-addon.js"
}
}