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.
Files changed (63) hide show
  1. package/README.md +5 -12
  2. package/dist/bin/ember-codemod-pod-to-octane.js +1 -1
  3. package/dist/src/index.js +4 -8
  4. package/dist/src/migration/{ember-app → app}/index.js +1 -1
  5. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-component-classes.js +1 -1
  6. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-component-stylesheets.js +1 -1
  7. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-component-templates.js +1 -1
  8. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-adapters.js +1 -1
  9. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-controllers.js +1 -1
  10. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-models.js +1 -1
  11. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-routes.js +1 -1
  12. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-serializers.js +1 -1
  13. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-stylesheets.js +1 -1
  14. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-route-templates.js +1 -1
  15. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/map-services.js +1 -1
  16. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/map-components.js +1 -1
  17. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/map-route-controllers.js +1 -1
  18. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/map-route-routes.js +1 -1
  19. package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/map-services.js +1 -1
  20. package/dist/src/migration/index.js +2 -3
  21. package/dist/src/migration/{ember-addon → v1-addon}/index.js +1 -1
  22. package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/addon/index.js +2 -0
  23. package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-services.js +17 -0
  24. package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/index.js +16 -0
  25. package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-route-controllers.js +17 -0
  26. package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-route-routes.js +17 -0
  27. package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-route-templates.js +17 -0
  28. package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-services.js +17 -0
  29. package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/tests/index.js +2 -0
  30. 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
  31. package/package.json +1 -1
  32. package/dist/src/migration/ember-addon/steps/create-file-path-maps/addon/index.js +0 -10
  33. package/dist/src/migration/ember-addon/steps/create-file-path-maps/app/index.js +0 -10
  34. package/dist/src/migration/ember-addon/steps/create-file-path-maps/tests/index.js +0 -4
  35. package/dist/src/migration/ember-engine/index.js +0 -13
  36. package/dist/src/migration/ember-engine/steps/create-file-path-maps/addon/map-component-classes.js +0 -17
  37. package/dist/src/migration/ember-engine/steps/create-file-path-maps/addon/map-component-stylesheets.js +0 -17
  38. package/dist/src/migration/ember-engine/steps/create-file-path-maps/addon/map-component-templates.js +0 -17
  39. package/dist/src/migration/ember-engine/steps/create-file-path-maps/tests/map-components.js +0 -17
  40. package/dist/src/migration/ember-engine/steps/create-file-path-maps.js +0 -8
  41. package/dist/src/migration/ember-engine/steps/create-options.js +0 -8
  42. package/dist/src/migration/ember-engine/steps/index.js +0 -2
  43. /package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/app/index.js +0 -0
  44. /package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps/tests/index.js +0 -0
  45. /package/dist/src/migration/{ember-app → app}/steps/create-file-path-maps.js +0 -0
  46. /package/dist/src/migration/{ember-addon → app}/steps/create-options.js +0 -0
  47. /package/dist/src/migration/{ember-app → app}/steps/index.js +0 -0
  48. /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/addon/map-component-classes.js +0 -0
  49. /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/addon/map-component-stylesheets.js +0 -0
  50. /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/addon/map-component-templates.js +0 -0
  51. /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/addon/map-route-controllers.js +0 -0
  52. /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/addon/map-route-routes.js +0 -0
  53. /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/addon/map-route-stylesheets.js +0 -0
  54. /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/addon/map-route-templates.js +0 -0
  55. /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/app/map-component-classes.js +0 -0
  56. /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/app/map-component-templates.js +0 -0
  57. /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps/tests/map-components.js +0 -0
  58. /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/tests/map-route-controllers.js +0 -0
  59. /package/dist/src/migration/{ember-engine → v1-addon}/steps/create-file-path-maps/tests/map-route-routes.js +0 -0
  60. /package/dist/src/migration/{ember-addon → v1-addon}/steps/create-file-path-maps.js +0 -0
  61. /package/dist/src/migration/{ember-app → v1-addon}/steps/create-options.js +0 -0
  62. /package/dist/src/migration/{ember-addon → v1-addon}/steps/index.js +0 -0
  63. /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
- npx ember-codemod-pod-to-octane --type addon
37
- npx ember-codemod-pod-to-octane --type engine
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 assumes that an addon is used to define components (not models or routes).
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
 
@@ -22,7 +22,7 @@ const argv = yargs(hideBin(process.argv))
22
22
  type: 'boolean',
23
23
  })
24
24
  .option('type', {
25
- choices: ['addon', 'app', 'engine'],
25
+ choices: ['app', 'v1-addon'],
26
26
  demandOption: true,
27
27
  describe: 'Type of your Ember project',
28
28
  type: 'string',
package/dist/src/index.js CHANGED
@@ -1,16 +1,12 @@
1
- import { migrateEmberAddon, migrateEmberApp, migrateEmberEngine, } from './migration/index.js';
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
- migrateEmberApp(codemodOptions);
5
+ migrateApp(codemodOptions);
10
6
  break;
11
7
  }
12
- case 'engine': {
13
- migrateEmberEngine(codemodOptions);
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 migrateEmberApp(codemodOptions) {
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', '**', 'component.{d.ts,js,ts}'), {
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', '**', 'styles.{css,scss}'), {
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', '**', 'template.hbs'), {
6
+ const filePaths = findFiles(join('app', podPath, 'components/**/template.hbs'), {
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 mapRouteAdapters(options) {
5
5
  const { podPath, projectRoot } = options;
6
- const filePaths = findFiles(join('app', podPath, '**', 'adapter.{js,ts}'), {
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, '**', 'controller.{js,ts}'), {
6
+ const filePaths = findFiles(join('app', podPath, '**/controller.{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 mapRouteModels(options) {
5
5
  const { podPath, projectRoot } = options;
6
- const filePaths = findFiles(join('app', podPath, '**', 'model.{js,ts}'), {
6
+ const filePaths = findFiles(join('app', podPath, '**/model.{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 mapRouteRoutes(options) {
5
5
  const { podPath, projectRoot } = options;
6
- const filePaths = findFiles(join('app', podPath, '**', 'route.{js,ts}'), {
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, '**', 'serializer.{js,ts}'), {
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)', '**', 'styles.{css,scss}'), {
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 mapRouteTemplates(options) {
5
5
  const { podPath, projectRoot } = options;
6
- const filePaths = findFiles(join('app', podPath, '!(components)', '**', 'template.hbs'), {
6
+ const filePaths = findFiles(join('app', podPath, '!(components)/**/template.hbs'), {
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 mapServices(options) {
5
5
  const { podPath, projectRoot } = options;
6
- const filePaths = findFiles(join('app', podPath, '**', 'service.{js,ts}'), {
6
+ const filePaths = findFiles(join('app', podPath, '**/service.{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 mapComponents(options) {
5
5
  const { podPath, projectRoot } = options;
6
- const filePaths = findFiles(join('tests/integration', podPath, 'components', '**', 'component-test.{js,ts}'), {
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)', '**', 'controller-test.{js,ts}'), {
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) => {
@@ -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)', '**', 'route-test.{js,ts}'), {
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) => {
@@ -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)', '**', 'service-test.{js,ts}'), {
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 './ember-addon/index.js';
2
- export * from './ember-app/index.js';
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 migrateEmberAddon(codemodOptions) {
3
+ export function migrateV1Addon(codemodOptions) {
4
4
  const options = createOptions(codemodOptions);
5
5
  const filePathMaps = createFilePathMaps(options);
6
6
  if (options.testRun) {
@@ -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
+ }
@@ -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 mapComponentStylesheets(options) {
3
+ export function mapServices(options) {
4
4
  const { projectRoot } = options;
5
- const filePaths = findFiles('app/components/**/styles.js', {
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: 'app/components',
10
+ entityDir: 'tests/unit',
11
11
  replace: (key) => {
12
- return `app/components/${key}`;
12
+ return `tests/unit/services/${key}-test`;
13
13
  },
14
14
  });
15
15
  return [oldFilePath, newFilePath];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-codemod-pod-to-octane",
3
- "version": "2.0.8",
3
+ "version": "3.0.0",
4
4
  "description": "Codemod to un-pod Ember apps, addons, and engines",
5
5
  "keywords": [
6
6
  "codemod",
@@ -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,4 +0,0 @@
1
- import { mapComponents } from './map-components.js';
2
- export function mapTestsFolder(options) {
3
- return new Map([...mapComponents(options)]);
4
- }
@@ -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
- }
@@ -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
- }
@@ -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
- }
@@ -1,8 +0,0 @@
1
- export function createOptions(codemodOptions) {
2
- return {
3
- podPath: codemodOptions.podPath,
4
- projectRoot: codemodOptions.projectRoot,
5
- projectType: codemodOptions.projectType,
6
- testRun: codemodOptions.testRun,
7
- };
8
- }
@@ -1,2 +0,0 @@
1
- export * from './create-file-path-maps.js';
2
- export * from './create-options.js';