ember-codemod-pod-to-octane 2.0.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -12
- package/dist/bin/ember-codemod-pod-to-octane.js +1 -1
- package/dist/src/index.js +4 -8
- package/dist/src/migration/{ember-app → app}/index.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-component-classes.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-component-stylesheets.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-component-templates.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-adapters.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-controllers.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-models.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-routes.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-serializers.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-stylesheets.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-templates.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-services.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/map-components.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/map-route-controllers.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/map-route-routes.js +1 -1
- package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/map-services.js +1 -1
- package/dist/src/migration/index.js +2 -3
- package/dist/src/migration/{ember-addon → v1-addon}/index.js +1 -1
- package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/addon/index.js +2 -0
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-services.js +17 -0
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/index.js +16 -0
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-route-controllers.js +17 -0
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-route-routes.js +17 -0
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-route-templates.js +17 -0
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-services.js +17 -0
- package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/tests/index.js +2 -0
- package/dist/src/migration/{ember-addon/steps/create-file-path-maps/app/map-component-stylesheets.js → v1-addon/steps/create-file-path-maps/tests/map-services.js} +4 -4
- package/package.json +1 -1
- package/dist/src/migration/ember-addon/steps/create-file-path-maps/addon/index.js +0 -10
- package/dist/src/migration/ember-addon/steps/create-file-path-maps/app/index.js +0 -10
- package/dist/src/migration/ember-addon/steps/create-file-path-maps/tests/index.js +0 -4
- package/dist/src/migration/ember-engine/index.js +0 -13
- package/dist/src/migration/ember-engine/steps/create-file-path-maps/addon/map-component-classes.js +0 -17
- package/dist/src/migration/ember-engine/steps/create-file-path-maps/addon/map-component-stylesheets.js +0 -17
- package/dist/src/migration/ember-engine/steps/create-file-path-maps/addon/map-component-templates.js +0 -17
- package/dist/src/migration/ember-engine/steps/create-file-path-maps/tests/map-components.js +0 -17
- package/dist/src/migration/ember-engine/steps/create-file-path-maps.js +0 -8
- package/dist/src/migration/ember-engine/steps/create-options.js +0 -8
- package/dist/src/migration/ember-engine/steps/index.js +0 -2
- /package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/index.js +0 -0
- /package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/index.js +0 -0
- /package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps.js +0 -0
- /package/dist/src/migration/{ember-addon → app}/steps/create-options.js +0 -0
- /package/dist/src/migration/{ember-app → app}/steps/index.js +0 -0
- /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/addon/map-component-classes.js +0 -0
- /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/addon/map-component-stylesheets.js +0 -0
- /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/addon/map-component-templates.js +0 -0
- /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/addon/map-route-controllers.js +0 -0
- /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/addon/map-route-routes.js +0 -0
- /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/addon/map-route-stylesheets.js +0 -0
- /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/addon/map-route-templates.js +0 -0
- /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/app/map-component-classes.js +0 -0
- /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/app/map-component-templates.js +0 -0
- /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/tests/map-components.js +0 -0
- /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/tests/map-route-controllers.js +0 -0
- /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/tests/map-route-routes.js +0 -0
- /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps.js +0 -0
- /package/dist/src/migration/{ember-app → v1-addon}/steps/create-options.js +0 -0
- /package/dist/src/migration/{ember-addon → v1-addon}/steps/index.js +0 -0
- /package/dist/src/migration/{ember-addon → v1-addon}/steps/update-paths-in-app-folder.js +0 -0
package/README.md
CHANGED
|
@@ -32,9 +32,11 @@ Step 3. Update references originating from, as well as pointing to, the moved fi
|
|
|
32
32
|
You must pass `--type` to indicate what type of project you have.
|
|
33
33
|
|
|
34
34
|
```sh
|
|
35
|
+
# For classic apps
|
|
35
36
|
npx ember-codemod-pod-to-octane --type app
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
# For v1 addons (including engines)
|
|
39
|
+
npx ember-codemod-pod-to-octane --type v1-addon
|
|
38
40
|
```
|
|
39
41
|
|
|
40
42
|
|
|
@@ -103,16 +105,7 @@ To account for a bug (found when Ember CLI is combined with Ember Data), the cod
|
|
|
103
105
|
|
|
104
106
|
<summary>Addons</summary>
|
|
105
107
|
|
|
106
|
-
The codemod
|
|
107
|
-
|
|
108
|
-
</details>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
<details>
|
|
112
|
-
|
|
113
|
-
<summary>Engines</summary>
|
|
114
|
-
|
|
115
|
-
The codemod assumes that an engine is used to define routes and route-specific components.
|
|
108
|
+
The codemod doesn't consider things related to Ember Data (i.e. adapters, models, and serializers).
|
|
116
109
|
|
|
117
110
|
</details>
|
|
118
111
|
|
package/dist/src/index.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { migrateApp, migrateV1Addon } from './migration/index.js';
|
|
2
2
|
export function runCodemod(codemodOptions) {
|
|
3
3
|
switch (codemodOptions.projectType) {
|
|
4
|
-
case 'addon': {
|
|
5
|
-
migrateEmberAddon(codemodOptions);
|
|
6
|
-
break;
|
|
7
|
-
}
|
|
8
4
|
case 'app': {
|
|
9
|
-
|
|
5
|
+
migrateApp(codemodOptions);
|
|
10
6
|
break;
|
|
11
7
|
}
|
|
12
|
-
case '
|
|
13
|
-
|
|
8
|
+
case 'v1-addon': {
|
|
9
|
+
migrateV1Addon(codemodOptions);
|
|
14
10
|
break;
|
|
15
11
|
}
|
|
16
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { moveFiles } from '@codemod-utils/files';
|
|
2
2
|
import { createFilePathMaps, createOptions } from './steps/index.js';
|
|
3
|
-
export function
|
|
3
|
+
export function migrateApp(codemodOptions) {
|
|
4
4
|
const options = createOptions(codemodOptions);
|
|
5
5
|
const filePathMaps = createFilePathMaps(options);
|
|
6
6
|
if (options.testRun) {
|
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapComponentClasses(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('app', podPath, 'components
|
|
6
|
+
const filePaths = findFiles(join('app', podPath, 'components/**/component.{d.ts,js,ts}'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapComponentStylesheets(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('app', podPath, 'components
|
|
6
|
+
const filePaths = findFiles(join('app', podPath, 'components/**/styles.{css,scss}'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapComponentTemplates(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('app', podPath, 'components
|
|
6
|
+
const filePaths = findFiles(join('app', podPath, 'components/**/template.hbs'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-adapters.js
RENAMED
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapRouteAdapters(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('app', podPath, '
|
|
6
|
+
const filePaths = findFiles(join('app', podPath, '**/adapter.{js,ts}'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapRouteControllers(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('app', podPath, '
|
|
6
|
+
const filePaths = findFiles(join('app', podPath, '**/controller.{js,ts}'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-models.js
RENAMED
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapRouteModels(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('app', podPath, '
|
|
6
|
+
const filePaths = findFiles(join('app', podPath, '**/model.{js,ts}'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-routes.js
RENAMED
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapRouteRoutes(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('app', podPath, '
|
|
6
|
+
const filePaths = findFiles(join('app', podPath, '**/route.{js,ts}'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapRouteSerializers(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('app', podPath, '
|
|
6
|
+
const filePaths = findFiles(join('app', podPath, '**/serializer.{js,ts}'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapRouteStylesheets(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('app', podPath, '!(components)
|
|
6
|
+
const filePaths = findFiles(join('app', podPath, '!(components)/**/styles.{css,scss}'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-templates.js
RENAMED
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapRouteTemplates(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('app', podPath, '!(components)
|
|
6
|
+
const filePaths = findFiles(join('app', podPath, '!(components)/**/template.hbs'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-services.js
RENAMED
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapServices(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('app', podPath, '
|
|
6
|
+
const filePaths = findFiles(join('app', podPath, '**/service.{js,ts}'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/map-components.js
RENAMED
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapComponents(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('tests/integration', podPath, 'components
|
|
6
|
+
const filePaths = findFiles(join('tests/integration', podPath, 'components/**/component-test.{js,ts}'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
@@ -6,7 +6,7 @@ export function mapRouteControllers(options) {
|
|
|
6
6
|
/*
|
|
7
7
|
Case 1: Didn't pass the --pod flag, but configured { usePods: true } in .ember-cli
|
|
8
8
|
*/
|
|
9
|
-
const filePaths1 = findFiles(join('tests/unit', podPath, '!(controllers)
|
|
9
|
+
const filePaths1 = findFiles(join('tests/unit', podPath, '!(controllers)/**/controller-test.{js,ts}'), {
|
|
10
10
|
projectRoot,
|
|
11
11
|
});
|
|
12
12
|
const filePathMap1 = filePaths1.map((oldFilePath) => {
|
package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/map-route-routes.js
RENAMED
|
@@ -6,7 +6,7 @@ export function mapRouteRoutes(options) {
|
|
|
6
6
|
/*
|
|
7
7
|
Case 1: Didn't pass the --pod flag, but configured { usePods: true } in .ember-cli
|
|
8
8
|
*/
|
|
9
|
-
const filePaths1 = findFiles(join('tests/unit', podPath, '!(routes)
|
|
9
|
+
const filePaths1 = findFiles(join('tests/unit', podPath, '!(routes)/**/route-test.{js,ts}'), {
|
|
10
10
|
projectRoot,
|
|
11
11
|
});
|
|
12
12
|
const filePathMap1 = filePaths1.map((oldFilePath) => {
|
package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/map-services.js
RENAMED
|
@@ -3,7 +3,7 @@ import { findFiles } from '@codemod-utils/files';
|
|
|
3
3
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
4
4
|
export function mapServices(options) {
|
|
5
5
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const filePaths = findFiles(join('tests/unit', podPath, '!(services)
|
|
6
|
+
const filePaths = findFiles(join('tests/unit', podPath, '!(services)/**/service-test.{js,ts}'), {
|
|
7
7
|
projectRoot,
|
|
8
8
|
});
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './ember-engine/index.js';
|
|
1
|
+
export * from './app/index.js';
|
|
2
|
+
export * from './v1-addon/index.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { moveFiles } from '@codemod-utils/files';
|
|
2
2
|
import { createFilePathMaps, createOptions, updatePathsInAppFolder, } from './steps/index.js';
|
|
3
|
-
export function
|
|
3
|
+
export function migrateV1Addon(codemodOptions) {
|
|
4
4
|
const options = createOptions(codemodOptions);
|
|
5
5
|
const filePathMaps = createFilePathMaps(options);
|
|
6
6
|
if (options.testRun) {
|
package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/addon/index.js
RENAMED
|
@@ -5,6 +5,7 @@ import { mapRouteControllers } from './map-route-controllers.js';
|
|
|
5
5
|
import { mapRouteRoutes } from './map-route-routes.js';
|
|
6
6
|
import { mapRouteStylesheets } from './map-route-stylesheets.js';
|
|
7
7
|
import { mapRouteTemplates } from './map-route-templates.js';
|
|
8
|
+
import { mapServices } from './map-services.js';
|
|
8
9
|
export function mapAddonFolder(options) {
|
|
9
10
|
return new Map([
|
|
10
11
|
...mapComponentClasses(options),
|
|
@@ -14,5 +15,6 @@ export function mapAddonFolder(options) {
|
|
|
14
15
|
...mapRouteRoutes(options),
|
|
15
16
|
...mapRouteStylesheets(options),
|
|
16
17
|
...mapRouteTemplates(options),
|
|
18
|
+
...mapServices(options),
|
|
17
19
|
]);
|
|
18
20
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { findFiles } from '@codemod-utils/files';
|
|
2
|
+
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
3
|
+
export function mapServices(options) {
|
|
4
|
+
const { projectRoot } = options;
|
|
5
|
+
const filePaths = findFiles('addon/**/service.{js,ts}', {
|
|
6
|
+
projectRoot,
|
|
7
|
+
});
|
|
8
|
+
return filePaths.map((oldFilePath) => {
|
|
9
|
+
const newFilePath = renamePodPath(oldFilePath, {
|
|
10
|
+
entityDir: 'addon',
|
|
11
|
+
replace: (key) => {
|
|
12
|
+
return `addon/services/${key}`;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return [oldFilePath, newFilePath];
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { mapComponentClasses } from './map-component-classes.js';
|
|
2
|
+
import { mapComponentTemplates } from './map-component-templates.js';
|
|
3
|
+
import { mapRouteControllers } from './map-route-controllers.js';
|
|
4
|
+
import { mapRouteRoutes } from './map-route-routes.js';
|
|
5
|
+
import { mapRouteTemplates } from './map-route-templates.js';
|
|
6
|
+
import { mapServices } from './map-services.js';
|
|
7
|
+
export function mapAppFolder(options) {
|
|
8
|
+
return new Map([
|
|
9
|
+
...mapComponentClasses(options),
|
|
10
|
+
...mapComponentTemplates(options),
|
|
11
|
+
...mapRouteControllers(options),
|
|
12
|
+
...mapRouteRoutes(options),
|
|
13
|
+
...mapRouteTemplates(options),
|
|
14
|
+
...mapServices(options),
|
|
15
|
+
]);
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { findFiles } from '@codemod-utils/files';
|
|
2
|
+
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
3
|
+
export function mapRouteControllers(options) {
|
|
4
|
+
const { projectRoot } = options;
|
|
5
|
+
const filePaths = findFiles('app/**/controller.js', {
|
|
6
|
+
projectRoot,
|
|
7
|
+
});
|
|
8
|
+
return filePaths.map((oldFilePath) => {
|
|
9
|
+
const newFilePath = renamePodPath(oldFilePath, {
|
|
10
|
+
entityDir: 'app',
|
|
11
|
+
replace: (key) => {
|
|
12
|
+
return `app/controllers/${key}`;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return [oldFilePath, newFilePath];
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { findFiles } from '@codemod-utils/files';
|
|
2
|
+
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
3
|
+
export function mapRouteRoutes(options) {
|
|
4
|
+
const { projectRoot } = options;
|
|
5
|
+
const filePaths = findFiles('app/**/route.js', {
|
|
6
|
+
projectRoot,
|
|
7
|
+
});
|
|
8
|
+
return filePaths.map((oldFilePath) => {
|
|
9
|
+
const newFilePath = renamePodPath(oldFilePath, {
|
|
10
|
+
entityDir: 'app',
|
|
11
|
+
replace: (key) => {
|
|
12
|
+
return `app/routes/${key}`;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return [oldFilePath, newFilePath];
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { findFiles } from '@codemod-utils/files';
|
|
2
|
+
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
3
|
+
export function mapRouteTemplates(options) {
|
|
4
|
+
const { projectRoot } = options;
|
|
5
|
+
const filePaths = findFiles('app/!(components)/**/template.js', {
|
|
6
|
+
projectRoot,
|
|
7
|
+
});
|
|
8
|
+
return filePaths.map((oldFilePath) => {
|
|
9
|
+
const newFilePath = renamePodPath(oldFilePath, {
|
|
10
|
+
entityDir: 'app',
|
|
11
|
+
replace: (key) => {
|
|
12
|
+
return `app/templates/${key}`;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return [oldFilePath, newFilePath];
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { findFiles } from '@codemod-utils/files';
|
|
2
|
+
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
3
|
+
export function mapServices(options) {
|
|
4
|
+
const { projectRoot } = options;
|
|
5
|
+
const filePaths = findFiles('app/**/service.js', {
|
|
6
|
+
projectRoot,
|
|
7
|
+
});
|
|
8
|
+
return filePaths.map((oldFilePath) => {
|
|
9
|
+
const newFilePath = renamePodPath(oldFilePath, {
|
|
10
|
+
entityDir: 'app',
|
|
11
|
+
replace: (key) => {
|
|
12
|
+
return `app/services/${key}`;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return [oldFilePath, newFilePath];
|
|
16
|
+
});
|
|
17
|
+
}
|
package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/tests/index.js
RENAMED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { mapComponents } from './map-components.js';
|
|
2
2
|
import { mapRouteControllers } from './map-route-controllers.js';
|
|
3
3
|
import { mapRouteRoutes } from './map-route-routes.js';
|
|
4
|
+
import { mapServices } from './map-services.js';
|
|
4
5
|
export function mapTestsFolder(options) {
|
|
5
6
|
return new Map([
|
|
6
7
|
...mapComponents(options),
|
|
7
8
|
...mapRouteControllers(options),
|
|
8
9
|
...mapRouteRoutes(options),
|
|
10
|
+
...mapServices(options),
|
|
9
11
|
]);
|
|
10
12
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { findFiles } from '@codemod-utils/files';
|
|
2
2
|
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
3
|
-
export function
|
|
3
|
+
export function mapServices(options) {
|
|
4
4
|
const { projectRoot } = options;
|
|
5
|
-
const filePaths = findFiles('
|
|
5
|
+
const filePaths = findFiles('tests/unit/!(services)/**/service-test.{js,ts}', {
|
|
6
6
|
projectRoot,
|
|
7
7
|
});
|
|
8
8
|
return filePaths.map((oldFilePath) => {
|
|
9
9
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
10
|
-
entityDir: '
|
|
10
|
+
entityDir: 'tests/unit',
|
|
11
11
|
replace: (key) => {
|
|
12
|
-
return `
|
|
12
|
+
return `tests/unit/services/${key}-test`;
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
15
|
return [oldFilePath, newFilePath];
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { mapComponentClasses } from './map-component-classes.js';
|
|
2
|
-
import { mapComponentStylesheets } from './map-component-stylesheets.js';
|
|
3
|
-
import { mapComponentTemplates } from './map-component-templates.js';
|
|
4
|
-
export function mapAddonFolder(options) {
|
|
5
|
-
return new Map([
|
|
6
|
-
...mapComponentClasses(options),
|
|
7
|
-
...mapComponentStylesheets(options),
|
|
8
|
-
...mapComponentTemplates(options),
|
|
9
|
-
]);
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { mapComponentClasses } from './map-component-classes.js';
|
|
2
|
-
import { mapComponentStylesheets } from './map-component-stylesheets.js';
|
|
3
|
-
import { mapComponentTemplates } from './map-component-templates.js';
|
|
4
|
-
export function mapAppFolder(options) {
|
|
5
|
-
return new Map([
|
|
6
|
-
...mapComponentClasses(options),
|
|
7
|
-
...mapComponentStylesheets(options),
|
|
8
|
-
...mapComponentTemplates(options),
|
|
9
|
-
]);
|
|
10
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { moveFiles } from '@codemod-utils/files';
|
|
2
|
-
import { createFilePathMaps, createOptions } from './steps/index.js';
|
|
3
|
-
export function migrateEmberEngine(codemodOptions) {
|
|
4
|
-
const options = createOptions(codemodOptions);
|
|
5
|
-
const filePathMaps = createFilePathMaps(options);
|
|
6
|
-
if (options.testRun) {
|
|
7
|
-
console.log(filePathMaps);
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
// Preserve code
|
|
11
|
-
moveFiles(filePathMaps.addon, options);
|
|
12
|
-
moveFiles(filePathMaps.tests, options);
|
|
13
|
-
}
|
package/dist/src/migration/ember-engine/steps/create-file-path-maps/addon/map-component-classes.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { findFiles } from '@codemod-utils/files';
|
|
2
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
3
|
-
export function mapComponentClasses(options) {
|
|
4
|
-
const { projectRoot } = options;
|
|
5
|
-
const filePaths = findFiles('addon/components/**/component.{d.ts,js,ts}', {
|
|
6
|
-
projectRoot,
|
|
7
|
-
});
|
|
8
|
-
return filePaths.map((oldFilePath) => {
|
|
9
|
-
const newFilePath = renamePodPath(oldFilePath, {
|
|
10
|
-
entityDir: 'addon/components',
|
|
11
|
-
replace: (key) => {
|
|
12
|
-
return `addon/components/${key}`;
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
return [oldFilePath, newFilePath];
|
|
16
|
-
});
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { findFiles } from '@codemod-utils/files';
|
|
2
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
3
|
-
export function mapComponentStylesheets(options) {
|
|
4
|
-
const { projectRoot } = options;
|
|
5
|
-
const filePaths = findFiles('addon/components/**/styles.{css,scss}', {
|
|
6
|
-
projectRoot,
|
|
7
|
-
});
|
|
8
|
-
return filePaths.map((oldFilePath) => {
|
|
9
|
-
const newFilePath = renamePodPath(oldFilePath, {
|
|
10
|
-
entityDir: 'addon/components',
|
|
11
|
-
replace: (key) => {
|
|
12
|
-
return `addon/components/${key}`;
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
return [oldFilePath, newFilePath];
|
|
16
|
-
});
|
|
17
|
-
}
|
package/dist/src/migration/ember-engine/steps/create-file-path-maps/addon/map-component-templates.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { findFiles } from '@codemod-utils/files';
|
|
2
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
3
|
-
export function mapComponentTemplates(options) {
|
|
4
|
-
const { projectRoot } = options;
|
|
5
|
-
const filePaths = findFiles('addon/components/**/template.hbs', {
|
|
6
|
-
projectRoot,
|
|
7
|
-
});
|
|
8
|
-
return filePaths.map((oldFilePath) => {
|
|
9
|
-
const newFilePath = renamePodPath(oldFilePath, {
|
|
10
|
-
entityDir: 'addon/components',
|
|
11
|
-
replace: (key) => {
|
|
12
|
-
return `addon/components/${key}`;
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
return [oldFilePath, newFilePath];
|
|
16
|
-
});
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { findFiles } from '@codemod-utils/files';
|
|
2
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
3
|
-
export function mapComponents(options) {
|
|
4
|
-
const { projectRoot } = options;
|
|
5
|
-
const filePaths = findFiles('tests/integration/components/**/component-test.{js,ts}', {
|
|
6
|
-
projectRoot,
|
|
7
|
-
});
|
|
8
|
-
return filePaths.map((oldFilePath) => {
|
|
9
|
-
const newFilePath = renamePodPath(oldFilePath, {
|
|
10
|
-
entityDir: 'tests/integration/components',
|
|
11
|
-
replace: (key) => {
|
|
12
|
-
return `tests/integration/components/${key}-test`;
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
return [oldFilePath, newFilePath];
|
|
16
|
-
});
|
|
17
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { mapAddonFolder } from './create-file-path-maps/addon/index.js';
|
|
2
|
-
import { mapTestsFolder } from './create-file-path-maps/tests/index.js';
|
|
3
|
-
export function createFilePathMaps(options) {
|
|
4
|
-
return {
|
|
5
|
-
addon: mapAddonFolder(options),
|
|
6
|
-
tests: mapTestsFolder(options),
|
|
7
|
-
};
|
|
8
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|