Skip to content

Commit 777712e

Browse files
committed
Renamed the class field newComponentStructure to structure
1 parent 4c2ffb6 commit 777712e

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

bin/ember-component-template-colocation-migrator

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,17 @@ const { argv } = require('yargs');
2020
const changeToFlatStructure = argv.f && argv.s;
2121
const changeToNestedStructure = argv.n && argv.s;
2222

23-
let newComponentStructure = 'flat';
23+
let structure = 'flat';
2424

2525
if (changeToFlatStructure) {
26-
newComponentStructure = 'flat';
26+
structure = 'flat';
2727

2828
} else if (changeToNestedStructure) {
29-
newComponentStructure = 'nested';
29+
structure = 'nested';
3030

3131
}
3232

33-
let migrator = new Migrator({
34-
projectRoot,
35-
newComponentStructure
36-
});
33+
let migrator = new Migrator({ projectRoot, structure });
3734

3835
migrator.execute().then(function() {
3936
console.log('Codemod finished successfully!');

lib/migrator.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const { moveFile, removeDirs } = require('./utils/file')
66

77
module.exports = class Migrator {
88
constructor(options) {
9-
const { projectRoot, newComponentStructure } = options;
9+
const { projectRoot, structure } = options;
1010

1111
this.projectRoot = projectRoot;
12-
this.newComponentStructure = newComponentStructure;
12+
this.structure = structure;
1313
}
1414

1515
findClassicComponentTemplates() {
@@ -149,10 +149,10 @@ module.exports = class Migrator {
149149
templateFilePaths = this.skipTemplatesUsedAsLayoutName(templateFilePaths);
150150
templateFilePaths = this.skipTemplatesUsedAsPartial(templateFilePaths);
151151

152-
if (this.newComponentStructure === 'flat') {
152+
if (this.structure === 'flat') {
153153
this.changeComponentStructureToFlat(templateFilePaths);
154154

155-
} else if (this.newComponentStructure === 'nested') {
155+
} else if (this.structure === 'nested') {
156156
this.changeComponentStructureToNested(templateFilePaths);
157157

158158
}

test/migrator-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var Migrator = require('../lib/migrator');
1010
assertDiff.options.strict = true;
1111

1212
describe("Migrator", function() {
13-
describe('newComponentStructure = flat', function() {
13+
describe('structure = flat', function() {
1414
var tmpPath = "tmp/process-files";
1515
var fixturesPath = path.resolve(__dirname, "fixtures/classic-to-flat");
1616

@@ -41,7 +41,7 @@ describe("Migrator", function() {
4141
var migratorOptions = Object.assign(
4242
{
4343
projectRoot: tmpPath,
44-
newComponentStructure: 'flat'
44+
structure: 'flat'
4545
},
4646
migratorConfig
4747
);
@@ -59,7 +59,7 @@ describe("Migrator", function() {
5959
});
6060

6161

62-
describe('newComponentStructure = nested', function() {
62+
describe('structure = nested', function() {
6363
var tmpPath = "tmp/process-files";
6464
var fixturesPath = path.resolve(__dirname, "fixtures/classic-to-nested");
6565

@@ -90,7 +90,7 @@ describe("Migrator", function() {
9090
var migratorOptions = Object.assign(
9191
{
9292
projectRoot: tmpPath,
93-
newComponentStructure: 'nested'
93+
structure: 'nested'
9494
},
9595
migratorConfig
9696
);

0 commit comments

Comments
 (0)