Skip to content

Commit 15909fa

Browse files
authored
Merge pull request #13 from ijlee2/unify-test-input-files
Unified test input files
2 parents 249d462 + 1063fd4 commit 15909fa

File tree

15 files changed

+211
-484
lines changed

15 files changed

+211
-484
lines changed

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
This codemod will co-locate component JS and HBS as described in the [Component Templates Co-location RFC](https://emberjs.github.io/rfcs/0481-component-templates-co-location.html).
44

5-
### Examples
5+
## Examples
66

77
* [Travis CI](https://github.com/GavinJoyce/travis-web/pull/1)
88
* [Ghost Admin](https://github.com/GavinJoyce/Ghost-Admin/pull/1)
99

10-
### Usage
10+
## Usage
1111

1212
To run the migrator on your app:
1313

@@ -16,6 +16,8 @@ cd your/project/path
1616
npx github:ember-codemods/ember-component-template-colocation-migrator
1717
```
1818

19+
### Flat component structure
20+
1921
By default, the migrator changes the **classic** component structure to the **flat** component structure.
2022

2123
```
@@ -30,6 +32,8 @@ your-project-name
3032
│ ...
3133
```
3234

35+
### Nested component structure
36+
3337
If you want to change from **classic** to **nested**, you can add the `-ns` flag:
3438

3539
```sh
@@ -53,6 +57,12 @@ your-project-name
5357
```
5458

5559

56-
### Running Tests
60+
## Running Tests
61+
62+
The tests were inspired by [ember-module-migrator](https://github.com/ember-codemods/ember-module-migrator/blob/master/test/engines/classic-test.js).
5763

58-
* `npm run test`
64+
If you are contributing to this codemod, please check that all tests pass by running,
65+
66+
```sh
67+
yarn test
68+
```

lib/migrator.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ module.exports = class Migrator {
2727
}
2828

2929
findTemplates() {
30-
const templateFolderPath = path.join(this.projectRoot, 'app/templates');
31-
const templateFilePaths = glob.sync(`${templateFolderPath}/**/*.hbs`);
30+
const componentsFolderPath = path.join(this.projectRoot, 'app/components');
31+
const templatesFolderPath = path.join(this.projectRoot, 'app/templates');
32+
const templateFilePaths = glob.sync(`{${componentsFolderPath},${templatesFolderPath}}/**/*.hbs`);
3233

3334
return templateFilePaths;
3435
}

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
"devDependencies": {
1515
"assert-diff": "^2.0.3",
1616
"fixturify": "^1.0.1",
17-
"mocha": "^6.1.1",
18-
"power-assert": "^1.3.1"
17+
"mocha": "^6.1.1"
1918
},
2019
"dependencies": {
2120
"@babel/core": "^7.7.5",

test/fixtures/classic-to-nested/example-js/input.js

Lines changed: 0 additions & 83 deletions
This file was deleted.

test/fixtures/classic-to-nested/example-ts/input.js

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)