Skip to content

Commit

Permalink
Merge pull request #20704 from bertdeblock/remove-component-suffix
Browse files Browse the repository at this point in the history
Remove `Component` suffix from blueprints
  • Loading branch information
kategengler authored Jun 11, 2024
2 parents 8369337 + 26b35a0 commit 438ff67
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions blueprints/component-class/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ module.exports = {
importComponent = `import Component from '@glimmer/component';`;
if (this._isUsingTS) {
componentSignature = generateComponentSignature(classifiedModuleName);
defaultExport = `class ${classifiedModuleName}Component extends Component<${classifiedModuleName}Signature> {}`;
defaultExport = `class ${classifiedModuleName} extends Component<${classifiedModuleName}Signature> {}`;
} else {
defaultExport = `class ${classifiedModuleName}Component extends Component {}`;
defaultExport = `class ${classifiedModuleName} extends Component {}`;
}
break;
case '@ember/component/template-only':
Expand Down
4 changes: 2 additions & 2 deletions blueprints/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ module.exports = {
importComponent = `import Component from '@glimmer/component';`;
if (this._isUsingTS) {
componentSignature = generateComponentSignature(classifiedModuleName);
defaultExport = `class ${classifiedModuleName}Component extends Component<${classifiedModuleName}Signature> {}`;
defaultExport = `class ${classifiedModuleName} extends Component<${classifiedModuleName}Signature> {}`;
} else {
defaultExport = `class ${classifiedModuleName}Component extends Component {}`;
defaultExport = `class ${classifiedModuleName} extends Component {}`;
}
break;
case '@ember/component/template-only':
Expand Down
20 changes: 10 additions & 10 deletions node-tests/blueprints/component-class-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const enableOctane = setupTestEnvironment.enableOctane;

const glimmerComponentContents = `import Component from '@glimmer/component';
export default class FooComponent extends Component {}
export default class Foo extends Component {}
`;

const emberComponentContents = `import Component from '@ember/component';
Expand Down Expand Up @@ -145,7 +145,7 @@ describe('Blueprint: component-class', function () {
it('component-class x-foo', function () {
return emberGenerateDestroy(['component-class', 'x-foo'], (_file) => {
expect(_file('app/components/x-foo.js')).to.equal(
glimmerComponentContents.replace('FooComponent', 'XFooComponent')
glimmerComponentContents.replace('Foo', 'XFoo')
);
});
});
Expand All @@ -154,15 +154,15 @@ describe('Blueprint: component-class', function () {
return emberGenerateDestroy(['component-class', 'x-foo.js'], (_file) => {
expect(_file('app/components/x-foo.js.js')).to.not.exist;
expect(_file('app/components/x-foo.js')).to.equal(
glimmerComponentContents.replace('FooComponent', 'XFooComponent')
glimmerComponentContents.replace('Foo', 'XFoo')
);
});
});

it('component-class foo/x-foo', function () {
return emberGenerateDestroy(['component-class', 'foo/x-foo'], (_file) => {
expect(_file('app/components/foo/x-foo.js')).to.equal(
glimmerComponentContents.replace('FooComponent', 'FooXFooComponent')
glimmerComponentContents.replace('Foo', 'FooXFoo')
);
});
});
Expand All @@ -172,7 +172,7 @@ describe('Blueprint: component-class', function () {
['component-class', 'foo/x-foo', '--component-class', '@glimmer/component'],
(_file) => {
expect(_file('app/components/foo/x-foo.js')).to.equal(
glimmerComponentContents.replace('FooComponent', 'FooXFooComponent')
glimmerComponentContents.replace('Foo', 'FooXFoo')
);
}
);
Expand Down Expand Up @@ -298,7 +298,7 @@ describe('Blueprint: component-class', function () {
it('component-class x-foo', function () {
return emberGenerateDestroy(['component-class', 'x-foo'], (_file) => {
expect(_file('addon/components/x-foo.js')).to.equal(
glimmerComponentContents.replace('FooComponent', 'XFooComponent')
glimmerComponentContents.replace('Foo', 'XFoo')
);
expect(_file('app/components/x-foo.js')).to.contain(
"export { default } from 'my-addon/components/x-foo';"
Expand All @@ -309,7 +309,7 @@ describe('Blueprint: component-class', function () {
it('component-class foo/x-foo', function () {
return emberGenerateDestroy(['component-class', 'foo/x-foo'], (_file) => {
expect(_file('addon/components/foo/x-foo.js')).to.equal(
glimmerComponentContents.replace('FooComponent', 'FooXFooComponent')
glimmerComponentContents.replace('Foo', 'FooXFoo')
);
expect(_file('app/components/foo/x-foo.js')).to.contain(
"export { default } from 'my-addon/components/foo/x-foo';"
Expand All @@ -320,7 +320,7 @@ describe('Blueprint: component-class', function () {
it('component-class x-foo --dummy', function () {
return emberGenerateDestroy(['component-class', 'x-foo', '--dummy'], (_file) => {
expect(_file('tests/dummy/app/components/x-foo.js')).equal(
glimmerComponentContents.replace('FooComponent', 'XFooComponent')
glimmerComponentContents.replace('Foo', 'XFoo')
);
expect(_file('app/components/x-foo.js')).to.not.exist;
});
Expand All @@ -329,7 +329,7 @@ describe('Blueprint: component-class', function () {
it('component-class foo/x-foo --dummy', function () {
return emberGenerateDestroy(['component-class', 'foo/x-foo', '--dummy'], (_file) => {
expect(_file('tests/dummy/app/components/foo/x-foo.js')).to.equal(
glimmerComponentContents.replace('FooComponent', 'FooXFooComponent')
glimmerComponentContents.replace('Foo', 'FooXFoo')
);
expect(_file('app/components/foo/x-foo.hbs')).to.not.exist;
});
Expand Down Expand Up @@ -367,7 +367,7 @@ describe('Blueprint: component-class', function () {
['component-class', 'x-foo', '--in-repo-addon=my-addon'],
(_file) => {
expect(_file('lib/my-addon/addon/components/x-foo.js')).to.equal(
glimmerComponentContents.replace('FooComponent', 'XFooComponent')
glimmerComponentContents.replace('Foo', 'XFoo')
);
expect(_file('lib/my-addon/app/components/x-foo.js')).to.contain(
"export { default } from 'my-addon/components/x-foo';"
Expand Down
4 changes: 2 additions & 2 deletions node-tests/blueprints/component-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const enableOctane = setupTestEnvironment.enableOctane;

const glimmerComponentContents = `import Component from '@glimmer/component';
export default class FooComponent extends Component {}
export default class Foo extends Component {}
`;

const emberComponentContents = `import Component from '@ember/component';
Expand Down Expand Up @@ -308,7 +308,7 @@ describe('Blueprint: component', function () {
['component', 'foo/x-foo', '--component-class', '@glimmer/component'],
(_file) => {
expect(_file('app/components/foo/x-foo.js')).to.equal(
glimmerComponentContents.replace('FooComponent', 'FooXFooComponent')
glimmerComponentContents.replace('Foo', 'FooXFoo')
);
expect(_file('app/components/foo/x-foo.hbs')).to.equal('{{yield}}');

Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component/component-dash.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import Component from '@glimmer/component';

export default class XFooComponent extends Component {}
export default class XFoo extends Component {}
2 changes: 1 addition & 1 deletion node-tests/fixtures/component/component-nested.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import Component from '@glimmer/component';

export default class FooXFooComponent extends Component {}
export default class FooXFoo extends Component {}
2 changes: 1 addition & 1 deletion node-tests/fixtures/component/component.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import Component from '@glimmer/component';

export default class FooComponent extends Component {}
export default class Foo extends Component {}

0 comments on commit 438ff67

Please sign in to comment.