Skip to content

Commit 881d1f7

Browse files
authored
Merge branch 'master' into update-tsconfig-when-in-repo-addons-are-generated
2 parents f818740 + cea46c3 commit 881d1f7

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
99
### Added
1010

1111
* Blueprint (and tests) to generate in-repo addons configured for TypeScript
12+
* @ts-ignore component template import.
1213

1314
### Changed
1415

1516
* Improve instructions for setting up [Linked Addons](README.md#linking-addons) and [In-repo Addons](README.md#in-repo-addons).
1617

18+
### Fixed
19+
20+
* Addon components need to manually set their layout property to the imported compiled template.
21+
1722
## [1.1.6] - 2018-02-23
1823

1924
### Fixed

blueprints/component/files/__root__/__path__/__name__.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import Component from '@ember/component';
22
<%= importTemplate %>
33
export default class <%= classifiedModuleName %> extends Component.extend({
44
// anything which *must* be merged to prototype here
5-
}) {
5+
}) {<%= contents %>
66
// normal class body definition here
77
};

blueprints/component/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ module.exports = {
6262
templatePath = pathUtil.getRelativeParentPath(options.entity.name) +
6363
'templates/components/' + stringUtil.dasherize(options.entity.name);
6464
}
65-
importTemplate = 'import layout from \'' + templatePath + '\';\n';
66-
contents = '\n layout';
65+
importTemplate = '// @ts-ignore: Ignore import of compiled template\nimport layout from \'' + templatePath + '\';\n';
66+
contents = '\n layout = layout;';
6767
}
6868

6969
return {

node-tests/blueprints/component-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,16 @@ describe('Acceptance: ember generate and destroy component', function() {
1919
expect(file('app/components/foo-bar.ts')).to.contain('export default class FooBar extends Component.extend');
2020
}));
2121
});
22+
23+
it('addon component foo-bar', function() {
24+
let args = ['component', 'foo-bar'];
25+
26+
return emberNew({ target: 'addon' })
27+
.then(() => emberGenerateDestroy(args, (file) => {
28+
expect(file('addon/components/foo-bar.ts'))
29+
.to.contain('// @ts-ignore: Ignore import of compiled template\nimport layout from \'../templates/components/foo-bar\';\n');
30+
expect(file('addon/components/foo-bar.ts'))
31+
.to.contain('layout = layout;');
32+
}));
33+
});
2234
});

0 commit comments

Comments
 (0)