diff --git a/blueprints/component/index.js b/blueprints/component/index.js index 4110185f17e..66bd7d76cbd 100644 --- a/blueprints/component/index.js +++ b/blueprints/component/index.js @@ -1,13 +1,10 @@ 'use strict'; const chalk = require('chalk'); -const path = require('path'); const SilentError = require('silent-error'); const stringUtil = require('ember-cli-string-utils'); -const pathUtil = require('ember-cli-path-utils'); const getPathOption = require('ember-cli-get-component-path-option'); const normalizeEntityName = require('ember-cli-normalize-entity-name'); -const { EOL } = require('os'); const { has } = require('@ember/edition-utils'); const { generateComponentSignature } = require('../-utils'); @@ -137,22 +134,7 @@ module.exports = { fileMapTokens(options) { let commandOptions = this.options; - if (commandOptions.pod) { - return { - __path__() { - return path.join(options.podPath, options.locals.path, options.dasherizedModuleName); - }, - __templatepath__() { - return path.join(options.podPath, options.locals.path, options.dasherizedModuleName); - }, - __templatename__() { - return 'template'; - }, - }; - } else if ( - this.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE && - commandOptions.componentStructure === 'flat' - ) { + if (this.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE && commandOptions.componentStructure === 'flat') { return { __path__() { return 'components'; @@ -209,19 +191,6 @@ module.exports = { }, locals(options) { - // if we're in an addon, build import statement - let templatePath = ''; - if (options.project.isEmberCLIAddon() || (options.inRepoAddon && !options.inDummy)) { - if (options.pod) { - templatePath = './template'; - } else { - templatePath = - pathUtil.getRelativeParentPath(options.entity.name) + - 'templates/components/' + - stringUtil.dasherize(options.entity.name); - } - } - let componentClass = this.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE ? options.componentClass : '@ember/component'; @@ -237,12 +206,7 @@ module.exports = { switch (componentClass) { case '@ember/component': importComponent = `import Component from '@ember/component';`; - if (templatePath) { - importTemplate = `import layout from '${templatePath}';${EOL}`; - defaultExport = `Component.extend({${EOL} layout${EOL}});`; - } else { - defaultExport = `Component.extend({});`; - } + defaultExport = `Component.extend({});`; break; case '@glimmer/component': importComponent = `import Component from '@glimmer/component';`; diff --git a/node-tests/blueprints/component-test.js b/node-tests/blueprints/component-test.js index ec05f865c28..d1824ffd727 100644 --- a/node-tests/blueprints/component-test.js +++ b/node-tests/blueprints/component-test.js @@ -4,7 +4,6 @@ const blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); const setupTestHooks = blueprintHelpers.setupTestHooks; const emberNew = blueprintHelpers.emberNew; const emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; -const setupPodConfig = blueprintHelpers.setupPodConfig; const modifyPackages = blueprintHelpers.modifyPackages; const chai = require('ember-cli-blueprint-test-helpers/chai'); @@ -277,159 +276,6 @@ describe('Blueprint: component', function () { } ); }); - - describe('with podModulePrefix', function () { - beforeEach(function () { - setupPodConfig({ podModulePrefix: true }); - }); - - it('component foo --pod', function () { - return emberGenerateDestroy(['component', 'foo', '--pod'], (_file) => { - expect(_file('app/pods/components/foo/template.hbs')).to.equal('{{yield}}'); - - expect(_file('tests/integration/pods/components/foo/component-test.js')).to.equal( - fixture('component-test/default-template.js', { - replace: { - component: 'foo', - componentInvocation: 'Foo', - }, - }) - ); - }); - }); - - it('component x-foo --pod', function () { - return emberGenerateDestroy(['component', 'x-foo', '--pod'], (_file) => { - expect(_file('app/pods/components/x-foo/template.hbs')).to.equal('{{yield}}'); - - expect(_file('tests/integration/pods/components/x-foo/component-test.js')).to.equal( - fixture('component-test/default-template.js', { - replace: { - component: 'x-foo', - componentInvocation: 'XFoo', - }, - }) - ); - }); - }); - - it('component foo/x-foo --pod', function () { - return emberGenerateDestroy(['component', 'foo/x-foo', '--pod'], (_file) => { - expect(_file('app/pods/components/foo/x-foo/template.hbs')).to.equal('{{yield}}'); - - expect(_file('tests/integration/pods/components/foo/x-foo/component-test.js')).to.equal( - fixture('component-test/default-template.js', { - replace: { - component: 'foo/x-foo', - componentInvocation: 'Foo::XFoo', - }, - }) - ); - }); - }); - - it('component x-foo --pod --path foo', function () { - return emberGenerateDestroy(['component', 'x-foo', '--pod', '--path', 'foo'], (_file) => { - expect(_file('app/pods/foo/x-foo/template.hbs')).to.equal('{{yield}}'); - - expect(_file('tests/integration/pods/foo/x-foo/component-test.js')).to.equal( - fixture('component-test/default-template.js', { - replace: { - component: 'x-foo', - componentInvocation: 'XFoo', - path: 'foo/', - }, - }) - ); - }); - }); - - it('component foo/x-foo --pod --path bar', function () { - return emberGenerateDestroy( - ['component', 'foo/x-foo', '--pod', '--path', 'bar'], - (_file) => { - expect(_file('app/pods/bar/foo/x-foo/template.hbs')).to.equal('{{yield}}'); - - expect(_file('tests/integration/pods/bar/foo/x-foo/component-test.js')).to.equal( - fixture('component-test/default-template.js', { - replace: { - component: 'foo/x-foo', - componentInvocation: 'Foo::XFoo', - path: 'bar/', - }, - }) - ); - } - ); - }); - - it('component x-foo --pod --path bar/foo', function () { - return emberGenerateDestroy( - ['component', 'x-foo', '--pod', '--path', 'bar/foo'], - (_file) => { - expect(_file('app/pods/bar/foo/x-foo/template.hbs')).to.equal('{{yield}}'); - expect(_file('tests/integration/pods/bar/foo/x-foo/component-test.js')).to.equal( - fixture('component-test/default-template.js', { - replace: { - component: 'x-foo', - componentInvocation: 'XFoo', - path: 'bar/foo/', - }, - }) - ); - } - ); - }); - - it('component foo/x-foo --pod --path bar/baz', function () { - return emberGenerateDestroy( - ['component', 'foo/x-foo', '--pod', '--path', 'bar/baz'], - (_file) => { - expect(_file('app/pods/bar/baz/foo/x-foo/template.hbs')).to.equal('{{yield}}'); - - expect(_file('tests/integration/pods/bar/baz/foo/x-foo/component-test.js')).to.equal( - fixture('component-test/default-template.js', { - replace: { - component: 'foo/x-foo', - componentInvocation: 'Foo::XFoo', - path: 'bar/baz/', - }, - }) - ); - } - ); - }); - - it('component x-foo --pod -no-path', function () { - return emberGenerateDestroy(['component', 'x-foo', '--pod', '-no-path'], (_file) => { - expect(_file('app/pods/x-foo/template.hbs')).to.equal('{{yield}}'); - - expect(_file('tests/integration/pods/x-foo/component-test.js')).to.equal( - fixture('component-test/default-template.js', { - replace: { - component: 'x-foo', - componentInvocation: 'XFoo', - }, - }) - ); - }); - }); - - it('component foo/x-foo --pod -no-path', function () { - return emberGenerateDestroy(['component', 'foo/x-foo', '--pod', '-no-path'], (_file) => { - expect(_file('app/pods/foo/x-foo/template.hbs')).to.equal('{{yield}}'); - - expect(_file('tests/integration/pods/foo/x-foo/component-test.js')).to.equal( - fixture('component-test/default-template.js', { - replace: { - component: 'foo/x-foo', - componentInvocation: 'Foo::XFoo', - }, - }) - ); - }); - }); - }); }); describe('in addon - octane', function () {