Skip to content

Commit bcb2d29

Browse files
committed
Remove the classic component-structure option
The classic file structure is deprecated.
1 parent 0f9b3fc commit bcb2d29

File tree

4 files changed

+13
-127
lines changed

4 files changed

+13
-127
lines changed

blueprints/component-class/index.js

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const path = require('path');
44
const SilentError = require('silent-error');
55
const stringUtil = require('ember-cli-string-utils');
6-
const pathUtil = require('ember-cli-path-utils');
76
const getPathOption = require('ember-cli-get-component-path-option');
87
const normalizeEntityName = require('ember-cli-normalize-entity-name');
98
const { EOL } = require('os');
@@ -44,9 +43,9 @@ module.exports = {
4443
},
4544
{
4645
name: 'component-structure',
47-
type: OCTANE ? ['flat', 'nested', 'classic'] : ['classic'],
48-
default: OCTANE ? 'flat' : 'classic',
49-
aliases: OCTANE ? [{ fs: 'flat' }, { ns: 'nested' }, { cs: 'classic' }] : [{ cs: 'classic' }],
46+
type: ['flat', 'nested'],
47+
default: 'flat',
48+
aliases: [{ fs: 'flat' }, { ns: 'nested' }],
5049
},
5150
],
5251

@@ -71,15 +70,9 @@ module.exports = {
7170
option.default = '@ember/component';
7271
}
7372
} else if (option.name === 'component-structure') {
74-
if (isOctane) {
75-
option.type = ['flat', 'nested', 'classic'];
76-
option.default = 'flat';
77-
option.aliases = [{ fs: 'flat' }, { ns: 'nested' }, { cs: 'classic' }];
78-
} else {
79-
option.type = ['classic'];
80-
option.default = 'classic';
81-
option.aliases = [{ cs: 'classic' }];
82-
}
73+
option.type = ['flat', 'nested'];
74+
option.default = 'flat';
75+
option.aliases = [{ fs: 'flat' }, { ns: 'nested' }];
8376
}
8477
});
8578

@@ -108,10 +101,7 @@ module.exports = {
108101
return 'component';
109102
},
110103
};
111-
} else if (
112-
commandOptions.componentStructure === 'classic' ||
113-
commandOptions.componentStructure === 'flat'
114-
) {
104+
} else if (commandOptions.componentStructure === 'flat') {
115105
return {
116106
__path__() {
117107
return 'components';
@@ -149,11 +139,6 @@ module.exports = {
149139
if (options.project.isEmberCLIAddon() || (options.inRepoAddon && !options.inDummy)) {
150140
if (options.pod) {
151141
templatePath = './template';
152-
} else {
153-
templatePath =
154-
pathUtil.getRelativeParentPath(options.entity.name) +
155-
'templates/components/' +
156-
stringUtil.dasherize(options.entity.name);
157142
}
158143
}
159144

blueprints/component/index.js

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ module.exports = {
4848
},
4949
{
5050
name: 'component-structure',
51-
type: OCTANE ? ['flat', 'nested', 'classic'] : ['classic'],
52-
default: OCTANE ? 'flat' : 'classic',
53-
aliases: OCTANE ? [{ fs: 'flat' }, { ns: 'nested' }, { cs: 'classic' }] : [{ cs: 'classic' }],
51+
type: ['flat', 'nested'],
52+
default: 'flat',
53+
aliases: [{ fs: 'flat' }, { ns: 'nested' }],
5454
},
5555
],
5656

@@ -75,15 +75,9 @@ module.exports = {
7575
option.default = '@ember/component';
7676
}
7777
} else if (option.name === 'component-structure') {
78-
if (isOctane) {
79-
option.type = ['flat', 'nested', 'classic'];
80-
option.default = 'flat';
81-
option.aliases = [{ fs: 'flat' }, { ns: 'nested' }, { cs: 'classic' }];
82-
} else {
83-
option.type = ['classic'];
84-
option.default = 'classic';
85-
option.aliases = [{ cs: 'classic' }];
86-
}
78+
option.type = ['flat', 'nested'];
79+
option.default = 'flat';
80+
option.aliases = [{ fs: 'flat' }, { ns: 'nested' }];
8781
}
8882
});
8983

@@ -107,12 +101,6 @@ module.exports = {
107101
'Usage of --component-class argument to `ember generate component` is only available on canary'
108102
);
109103
}
110-
111-
if (options.componentStructure !== 'classic') {
112-
throw new SilentError(
113-
'Usage of --component-structure argument to `ember generate component` is only available on canary'
114-
);
115-
}
116104
}
117105

118106
return this._super.install.apply(this, arguments);
@@ -161,21 +149,6 @@ module.exports = {
161149
return 'template';
162150
},
163151
};
164-
} else if (
165-
!this.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE ||
166-
commandOptions.componentStructure === 'classic'
167-
) {
168-
return {
169-
__path__() {
170-
return 'components';
171-
},
172-
__templatepath__() {
173-
return 'templates/components';
174-
},
175-
__templatename__() {
176-
return options.dasherizedModuleName;
177-
},
178-
};
179152
} else if (
180153
this.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE &&
181154
commandOptions.componentStructure === 'flat'

node-tests/blueprints/component-class-test.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,6 @@ describe('Blueprint: component-class', function () {
5454
});
5555
});
5656

57-
// classic default
58-
it('component-class foo --component-structure=classic --component-class=@ember/component', function () {
59-
return emberGenerateDestroy(
60-
[
61-
'component-class',
62-
'foo',
63-
'--component-structure',
64-
'classic',
65-
'--component-class',
66-
'@ember/component',
67-
],
68-
(_file) => {
69-
expect(_file('app/components/foo.js')).to.equal(emberComponentContents);
70-
}
71-
);
72-
});
73-
7457
// Octane default
7558
it('component-class foo --component-structure=flat --component-class=@glimmer/component', function () {
7659
return emberGenerateDestroy(
@@ -106,15 +89,6 @@ describe('Blueprint: component-class', function () {
10689
);
10790
});
10891

109-
it('component-class foo --component-structure=classic', function () {
110-
return emberGenerateDestroy(
111-
['component-class', '--component-structure', 'classic', 'foo'],
112-
(_file) => {
113-
expect(_file('app/components/foo.js')).to.equal(glimmerComponentContents);
114-
}
115-
);
116-
});
117-
11892
it('component-class foo --component-class=@ember/component', function () {
11993
return emberGenerateDestroy(
12094
['component-class', '--component-class', '@ember/component', 'foo'],

node-tests/blueprints/component-test.js

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -64,34 +64,6 @@ describe('Blueprint: component', function () {
6464
});
6565
});
6666

67-
// classic default
68-
it('component foo --component-structure=classic --component-class=@ember/component', function () {
69-
return emberGenerateDestroy(
70-
[
71-
'component',
72-
'foo',
73-
'--component-structure',
74-
'classic',
75-
'--component-class',
76-
'@ember/component',
77-
],
78-
(_file) => {
79-
expect(_file('app/components/foo.js')).to.equal(emberComponentContents);
80-
81-
expect(_file('app/templates/components/foo.hbs')).to.equal('{{yield}}');
82-
83-
expect(_file('tests/integration/components/foo-test.js')).to.equal(
84-
fixture('component-test/default-template.js', {
85-
replace: {
86-
component: 'foo',
87-
componentInvocation: 'Foo',
88-
},
89-
})
90-
);
91-
}
92-
);
93-
});
94-
9567
// Octane default
9668
it('component foo --component-structure=flat --component-class=@glimmer/component', function () {
9769
return emberGenerateDestroy(
@@ -156,24 +128,6 @@ describe('Blueprint: component', function () {
156128
);
157129
});
158130

159-
it('component foo --component-structure=classic', function () {
160-
return emberGenerateDestroy(
161-
['component', '--component-structure', 'classic', 'foo'],
162-
(_file) => {
163-
expect(_file('app/templates/components/foo.hbs')).to.equal('{{yield}}');
164-
165-
expect(_file('tests/integration/components/foo-test.js')).to.equal(
166-
fixture('component-test/default-template.js', {
167-
replace: {
168-
component: 'foo',
169-
componentInvocation: 'Foo',
170-
},
171-
})
172-
);
173-
}
174-
);
175-
});
176-
177131
it('component foo --component-class=@ember/component', function () {
178132
return emberGenerateDestroy(
179133
['component', '--component-class', '@ember/component', 'foo'],

0 commit comments

Comments
 (0)