Skip to content

Commit 30db3c1

Browse files
authored
Merge branch 'main' into feature/rfc-0931
2 parents 83810af + e1abff5 commit 30db3c1

File tree

6 files changed

+20
-455
lines changed

6 files changed

+20
-455
lines changed

blueprints/component-class/index.js

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
'use strict';
22

3-
const path = require('path');
43
const SilentError = require('silent-error');
54
const stringUtil = require('ember-cli-string-utils');
6-
const pathUtil = require('ember-cli-path-utils');
75
const getPathOption = require('ember-cli-get-component-path-option');
86
const normalizeEntityName = require('ember-cli-normalize-entity-name');
9-
const { EOL } = require('os');
107
const { has } = require('@ember/edition-utils');
118
const { generateComponentSignature } = require('../-utils');
129

@@ -44,9 +41,9 @@ module.exports = {
4441
},
4542
{
4643
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' }],
44+
type: ['flat', 'nested'],
45+
default: 'flat',
46+
aliases: [{ fs: 'flat' }, { ns: 'nested' }],
5047
},
5148
],
5249

@@ -71,15 +68,9 @@ module.exports = {
7168
option.default = '@ember/component';
7269
}
7370
} 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-
}
71+
option.type = ['flat', 'nested'];
72+
option.default = 'flat';
73+
option.aliases = [{ fs: 'flat' }, { ns: 'nested' }];
8374
}
8475
});
8576

@@ -99,19 +90,7 @@ module.exports = {
9990
fileMapTokens(options) {
10091
let commandOptions = this.options;
10192

102-
if (commandOptions.pod) {
103-
return {
104-
__path__() {
105-
return path.join(options.podPath, options.locals.path, options.dasherizedModuleName);
106-
},
107-
__name__() {
108-
return 'component';
109-
},
110-
};
111-
} else if (
112-
commandOptions.componentStructure === 'classic' ||
113-
commandOptions.componentStructure === 'flat'
114-
) {
93+
if (commandOptions.componentStructure === 'flat') {
11594
return {
11695
__path__() {
11796
return 'components';
@@ -139,35 +118,17 @@ module.exports = {
139118
let sanitizedModuleName = options.entity.name.replace(/\//g, '-');
140119
let classifiedModuleName = stringUtil.classify(sanitizedModuleName);
141120

142-
let templatePath = '';
143121
let importComponent = '';
144122
let importTemplate = '';
145123
let defaultExport = '';
146124
let componentSignature = '';
147125

148-
// if we're in an addon, build import statement
149-
if (options.project.isEmberCLIAddon() || (options.inRepoAddon && !options.inDummy)) {
150-
if (options.pod) {
151-
templatePath = './template';
152-
} else {
153-
templatePath =
154-
pathUtil.getRelativeParentPath(options.entity.name) +
155-
'templates/components/' +
156-
stringUtil.dasherize(options.entity.name);
157-
}
158-
}
159-
160126
let componentClass = options.componentClass;
161127

162128
switch (componentClass) {
163129
case '@ember/component':
164130
importComponent = `import Component from '@ember/component';`;
165-
if (templatePath) {
166-
importTemplate = `import layout from '${templatePath}';${EOL}`;
167-
defaultExport = `Component.extend({${EOL} layout${EOL}});`;
168-
} else {
169-
defaultExport = `Component.extend({});`;
170-
}
131+
defaultExport = `Component.extend({});`;
171132
break;
172133
case '@glimmer/component':
173134
importComponent = `import Component from '@glimmer/component';`;

blueprints/component/index.js

Lines changed: 8 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
'use strict';
22

33
const chalk = require('chalk');
4-
const path = require('path');
54
const SilentError = require('silent-error');
65
const stringUtil = require('ember-cli-string-utils');
7-
const pathUtil = require('ember-cli-path-utils');
86
const getPathOption = require('ember-cli-get-component-path-option');
97
const normalizeEntityName = require('ember-cli-normalize-entity-name');
10-
const { EOL } = require('os');
118
const { has } = require('@ember/edition-utils');
129
const { generateComponentSignature } = require('../-utils');
1310

@@ -48,9 +45,9 @@ module.exports = {
4845
},
4946
{
5047
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' }],
48+
type: ['flat', 'nested'],
49+
default: 'flat',
50+
aliases: [{ fs: 'flat' }, { ns: 'nested' }],
5451
},
5552
],
5653

@@ -75,15 +72,9 @@ module.exports = {
7572
option.default = '@ember/component';
7673
}
7774
} 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-
}
75+
option.type = ['flat', 'nested'];
76+
option.default = 'flat';
77+
option.aliases = [{ fs: 'flat' }, { ns: 'nested' }];
8778
}
8879
});
8980

@@ -107,12 +98,6 @@ module.exports = {
10798
'Usage of --component-class argument to `ember generate component` is only available on canary'
10899
);
109100
}
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-
}
116101
}
117102

118103
return this._super.install.apply(this, arguments);
@@ -149,37 +134,7 @@ module.exports = {
149134
fileMapTokens(options) {
150135
let commandOptions = this.options;
151136

152-
if (commandOptions.pod) {
153-
return {
154-
__path__() {
155-
return path.join(options.podPath, options.locals.path, options.dasherizedModuleName);
156-
},
157-
__templatepath__() {
158-
return path.join(options.podPath, options.locals.path, options.dasherizedModuleName);
159-
},
160-
__templatename__() {
161-
return 'template';
162-
},
163-
};
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-
};
179-
} else if (
180-
this.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE &&
181-
commandOptions.componentStructure === 'flat'
182-
) {
137+
if (this.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE && commandOptions.componentStructure === 'flat') {
183138
return {
184139
__path__() {
185140
return 'components';
@@ -236,19 +191,6 @@ module.exports = {
236191
},
237192

238193
locals(options) {
239-
// if we're in an addon, build import statement
240-
let templatePath = '';
241-
if (options.project.isEmberCLIAddon() || (options.inRepoAddon && !options.inDummy)) {
242-
if (options.pod) {
243-
templatePath = './template';
244-
} else {
245-
templatePath =
246-
pathUtil.getRelativeParentPath(options.entity.name) +
247-
'templates/components/' +
248-
stringUtil.dasherize(options.entity.name);
249-
}
250-
}
251-
252194
let componentClass = this.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE
253195
? options.componentClass
254196
: '@ember/component';
@@ -264,12 +206,7 @@ module.exports = {
264206
switch (componentClass) {
265207
case '@ember/component':
266208
importComponent = `import Component from '@ember/component';`;
267-
if (templatePath) {
268-
importTemplate = `import layout from '${templatePath}';${EOL}`;
269-
defaultExport = `Component.extend({${EOL} layout${EOL}});`;
270-
} else {
271-
defaultExport = `Component.extend({});`;
272-
}
209+
defaultExport = `Component.extend({});`;
273210
break;
274211
case '@glimmer/component':
275212
importComponent = `import Component from '@glimmer/component';`;

lib/browsers.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = [
33
'Edge >= 110',
44
'Firefox >= 102',
55
'iOS >= 12',
6-
'Safari >= 12',
6+
'Safari >= 15.6',
77
'ChromeAndroid >= 112',
88
'FirefoxAndroid >= 110',
99
];
@@ -60,16 +60,4 @@ module.exports = [
6060
safari 16.1
6161
safari 16.0
6262
safari 15.6
63-
safari 15.5
64-
safari 15.4
65-
safari 15.2-15.3
66-
safari 15.1
67-
safari 15
68-
safari 14.1
69-
safari 14
70-
safari 13.1
71-
safari 13
72-
safari 12.1
73-
safari 12
74-
7563
*/

0 commit comments

Comments
 (0)