ember-codemod-pod-to-octane 1.1.5 → 1.2.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 (156) hide show
  1. package/dist/bin/ember-codemod-pod-to-octane.d.ts +1 -0
  2. package/{bin → dist/bin}/ember-codemod-pod-to-octane.js +14 -20
  3. package/dist/src/index.d.ts +2 -0
  4. package/dist/src/index.js +20 -0
  5. package/dist/src/migration/ember-addon/addon/component-classes.d.ts +2 -0
  6. package/dist/src/migration/ember-addon/addon/component-classes.js +19 -0
  7. package/dist/src/migration/ember-addon/addon/component-stylesheets.d.ts +2 -0
  8. package/dist/src/migration/ember-addon/addon/component-stylesheets.js +19 -0
  9. package/dist/src/migration/ember-addon/addon/component-templates.d.ts +2 -0
  10. package/dist/src/migration/ember-addon/addon/component-templates.js +19 -0
  11. package/dist/src/migration/ember-addon/addon/index.d.ts +2 -0
  12. package/{src → dist/src}/migration/ember-addon/addon/index.js +5 -6
  13. package/dist/src/migration/ember-addon/app/component-classes.d.ts +2 -0
  14. package/dist/src/migration/ember-addon/app/component-classes.js +19 -0
  15. package/dist/src/migration/ember-addon/app/component-stylesheets.d.ts +2 -0
  16. package/dist/src/migration/ember-addon/app/component-stylesheets.js +19 -0
  17. package/dist/src/migration/ember-addon/app/component-templates.d.ts +2 -0
  18. package/dist/src/migration/ember-addon/app/component-templates.js +19 -0
  19. package/dist/src/migration/ember-addon/app/index.d.ts +2 -0
  20. package/{src → dist/src}/migration/ember-addon/app/index.js +5 -6
  21. package/dist/src/migration/ember-addon/index.d.ts +2 -0
  22. package/dist/src/migration/ember-addon/index.js +24 -0
  23. package/dist/src/migration/ember-addon/steps/create-options.d.ts +2 -0
  24. package/dist/src/migration/ember-addon/steps/create-options.js +15 -0
  25. package/dist/src/migration/ember-addon/tests/components.d.ts +2 -0
  26. package/dist/src/migration/ember-addon/tests/components.js +19 -0
  27. package/dist/src/migration/ember-addon/tests/index.d.ts +2 -0
  28. package/{src → dist/src}/migration/ember-addon/tests/index.js +1 -2
  29. package/dist/src/migration/ember-app/app/component-classes.d.ts +2 -0
  30. package/dist/src/migration/ember-app/app/component-classes.js +20 -0
  31. package/dist/src/migration/ember-app/app/component-stylesheets.d.ts +2 -0
  32. package/dist/src/migration/ember-app/app/component-stylesheets.js +20 -0
  33. package/dist/src/migration/ember-app/app/component-templates.d.ts +2 -0
  34. package/dist/src/migration/ember-app/app/component-templates.js +20 -0
  35. package/dist/src/migration/ember-app/app/index.d.ts +2 -0
  36. package/{src → dist/src}/migration/ember-app/app/index.js +13 -14
  37. package/dist/src/migration/ember-app/app/route-adapters.d.ts +2 -0
  38. package/dist/src/migration/ember-app/app/route-adapters.js +20 -0
  39. package/dist/src/migration/ember-app/app/route-controllers.d.ts +2 -0
  40. package/dist/src/migration/ember-app/app/route-controllers.js +20 -0
  41. package/dist/src/migration/ember-app/app/route-models.d.ts +2 -0
  42. package/dist/src/migration/ember-app/app/route-models.js +20 -0
  43. package/dist/src/migration/ember-app/app/route-routes.d.ts +2 -0
  44. package/dist/src/migration/ember-app/app/route-routes.js +20 -0
  45. package/dist/src/migration/ember-app/app/route-serializers.d.ts +2 -0
  46. package/dist/src/migration/ember-app/app/route-serializers.js +20 -0
  47. package/dist/src/migration/ember-app/app/route-stylesheets.d.ts +2 -0
  48. package/dist/src/migration/ember-app/app/route-stylesheets.js +20 -0
  49. package/dist/src/migration/ember-app/app/route-templates.d.ts +2 -0
  50. package/dist/src/migration/ember-app/app/route-templates.js +20 -0
  51. package/dist/src/migration/ember-app/app/services.d.ts +2 -0
  52. package/dist/src/migration/ember-app/app/services.js +20 -0
  53. package/dist/src/migration/ember-app/index.d.ts +2 -0
  54. package/dist/src/migration/ember-app/index.js +18 -0
  55. package/dist/src/migration/ember-app/steps/create-options.d.ts +2 -0
  56. package/dist/src/migration/ember-app/steps/create-options.js +15 -0
  57. package/dist/src/migration/ember-app/steps/index.d.ts +1 -0
  58. package/dist/src/migration/ember-app/steps/index.js +1 -0
  59. package/dist/src/migration/ember-app/tests/components.d.ts +2 -0
  60. package/dist/src/migration/ember-app/tests/components.js +20 -0
  61. package/dist/src/migration/ember-app/tests/index.d.ts +2 -0
  62. package/{src → dist/src}/migration/ember-app/tests/index.js +6 -7
  63. package/dist/src/migration/ember-app/tests/route-controllers.d.ts +2 -0
  64. package/dist/src/migration/ember-app/tests/route-controllers.js +42 -0
  65. package/dist/src/migration/ember-app/tests/route-routes.d.ts +2 -0
  66. package/dist/src/migration/ember-app/tests/route-routes.js +42 -0
  67. package/dist/src/migration/ember-app/tests/services.d.ts +2 -0
  68. package/dist/src/migration/ember-app/tests/services.js +20 -0
  69. package/dist/src/migration/ember-engine/addon/component-classes.d.ts +2 -0
  70. package/dist/src/migration/ember-engine/addon/component-classes.js +19 -0
  71. package/dist/src/migration/ember-engine/addon/component-stylesheets.d.ts +2 -0
  72. package/dist/src/migration/ember-engine/addon/component-stylesheets.js +19 -0
  73. package/dist/src/migration/ember-engine/addon/component-templates.d.ts +2 -0
  74. package/dist/src/migration/ember-engine/addon/component-templates.js +19 -0
  75. package/dist/src/migration/ember-engine/addon/index.d.ts +2 -0
  76. package/{src → dist/src}/migration/ember-engine/addon/index.js +9 -10
  77. package/dist/src/migration/ember-engine/addon/route-controllers.d.ts +2 -0
  78. package/dist/src/migration/ember-engine/addon/route-controllers.js +19 -0
  79. package/dist/src/migration/ember-engine/addon/route-routes.d.ts +2 -0
  80. package/dist/src/migration/ember-engine/addon/route-routes.js +19 -0
  81. package/dist/src/migration/ember-engine/addon/route-stylesheets.d.ts +2 -0
  82. package/dist/src/migration/ember-engine/addon/route-stylesheets.js +19 -0
  83. package/dist/src/migration/ember-engine/addon/route-templates.d.ts +2 -0
  84. package/dist/src/migration/ember-engine/addon/route-templates.js +19 -0
  85. package/dist/src/migration/ember-engine/index.d.ts +2 -0
  86. package/dist/src/migration/ember-engine/index.js +25 -0
  87. package/dist/src/migration/ember-engine/steps/create-options.d.ts +2 -0
  88. package/dist/src/migration/ember-engine/steps/create-options.js +16 -0
  89. package/dist/src/migration/ember-engine/steps/index.js +4 -0
  90. package/dist/src/migration/ember-engine/steps/update-absolute-paths.d.ts +2 -0
  91. package/dist/src/migration/ember-engine/steps/update-absolute-paths.js +73 -0
  92. package/dist/src/migration/ember-engine/steps/use-absolute-paths.d.ts +2 -0
  93. package/dist/src/migration/ember-engine/steps/use-absolute-paths.js +41 -0
  94. package/dist/src/migration/ember-engine/steps/use-relative-paths.d.ts +2 -0
  95. package/dist/src/migration/ember-engine/steps/use-relative-paths.js +85 -0
  96. package/dist/src/migration/ember-engine/tests/components.d.ts +2 -0
  97. package/dist/src/migration/ember-engine/tests/components.js +19 -0
  98. package/dist/src/migration/ember-engine/tests/index.d.ts +2 -0
  99. package/{src → dist/src}/migration/ember-engine/tests/index.js +5 -6
  100. package/dist/src/migration/ember-engine/tests/route-controllers.d.ts +2 -0
  101. package/dist/src/migration/ember-engine/tests/route-controllers.js +41 -0
  102. package/dist/src/migration/ember-engine/tests/route-routes.d.ts +2 -0
  103. package/dist/src/migration/ember-engine/tests/route-routes.js +41 -0
  104. package/dist/src/migration/index.js +3 -0
  105. package/dist/src/types/index.d.ts +19 -0
  106. package/dist/src/types/index.js +1 -0
  107. package/dist/src/utils/ember-addon/app/components.d.ts +2 -0
  108. package/dist/src/utils/ember-addon/app/components.js +19 -0
  109. package/package.json +37 -15
  110. package/src/index.js +0 -28
  111. package/src/migration/ember-addon/addon/component-classes.js +0 -23
  112. package/src/migration/ember-addon/addon/component-stylesheets.js +0 -23
  113. package/src/migration/ember-addon/addon/component-templates.js +0 -23
  114. package/src/migration/ember-addon/app/component-classes.js +0 -23
  115. package/src/migration/ember-addon/app/component-stylesheets.js +0 -23
  116. package/src/migration/ember-addon/app/component-templates.js +0 -23
  117. package/src/migration/ember-addon/index.js +0 -31
  118. package/src/migration/ember-addon/steps/create-options.js +0 -19
  119. package/src/migration/ember-addon/tests/components.js +0 -26
  120. package/src/migration/ember-app/app/component-classes.js +0 -28
  121. package/src/migration/ember-app/app/component-stylesheets.js +0 -28
  122. package/src/migration/ember-app/app/component-templates.js +0 -28
  123. package/src/migration/ember-app/app/route-adapters.js +0 -25
  124. package/src/migration/ember-app/app/route-controllers.js +0 -28
  125. package/src/migration/ember-app/app/route-models.js +0 -25
  126. package/src/migration/ember-app/app/route-routes.js +0 -25
  127. package/src/migration/ember-app/app/route-serializers.js +0 -28
  128. package/src/migration/ember-app/app/route-stylesheets.js +0 -28
  129. package/src/migration/ember-app/app/route-templates.js +0 -28
  130. package/src/migration/ember-app/app/services.js +0 -25
  131. package/src/migration/ember-app/index.js +0 -24
  132. package/src/migration/ember-app/steps/create-options.js +0 -19
  133. package/src/migration/ember-app/tests/components.js +0 -34
  134. package/src/migration/ember-app/tests/route-controllers.js +0 -63
  135. package/src/migration/ember-app/tests/route-routes.js +0 -57
  136. package/src/migration/ember-app/tests/services.js +0 -28
  137. package/src/migration/ember-engine/addon/component-classes.js +0 -23
  138. package/src/migration/ember-engine/addon/component-stylesheets.js +0 -23
  139. package/src/migration/ember-engine/addon/component-templates.js +0 -23
  140. package/src/migration/ember-engine/addon/route-controllers.js +0 -23
  141. package/src/migration/ember-engine/addon/route-routes.js +0 -23
  142. package/src/migration/ember-engine/addon/route-stylesheets.js +0 -23
  143. package/src/migration/ember-engine/addon/route-templates.js +0 -23
  144. package/src/migration/ember-engine/index.js +0 -39
  145. package/src/migration/ember-engine/steps/create-options.js +0 -21
  146. package/src/migration/ember-engine/steps/update-absolute-paths.js +0 -102
  147. package/src/migration/ember-engine/steps/use-absolute-paths.js +0 -58
  148. package/src/migration/ember-engine/steps/use-relative-paths.js +0 -110
  149. package/src/migration/ember-engine/tests/components.js +0 -26
  150. package/src/migration/ember-engine/tests/route-controllers.js +0 -55
  151. package/src/migration/ember-engine/tests/route-routes.js +0 -49
  152. package/src/utils/ember-addon/app/components.js +0 -24
  153. /package/{src/migration/ember-addon/steps/index.js → dist/src/migration/ember-addon/steps/index.d.ts} +0 -0
  154. /package/{src/migration/ember-app → dist/src/migration/ember-addon}/steps/index.js +0 -0
  155. /package/{src/migration/ember-engine/steps/index.js → dist/src/migration/ember-engine/steps/index.d.ts} +0 -0
  156. /package/{src/migration/index.js → dist/src/migration/index.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -1,42 +1,36 @@
1
- #!/usr/bin/env node
2
1
  'use strict';
3
-
4
2
  import yargs from 'yargs';
5
3
  import { hideBin } from 'yargs/helpers';
6
-
7
4
  import { runCodemod } from '../src/index.js';
8
-
9
5
  // Provide a title to the process in `ps`
10
6
  process.title = 'ember-codemod-pod-to-octane';
11
-
12
7
  // Set codemod options
13
- const { argv } = yargs(hideBin(process.argv))
14
- .option('pod-path', {
8
+ const argv = yargs(hideBin(process.argv))
9
+ .option('pod-path', {
15
10
  default: '',
16
11
  describe: 'Namespace used for the pod layout',
17
12
  type: 'string',
18
- })
19
- .option('root', {
13
+ })
14
+ .option('root', {
20
15
  describe: 'Location of your Ember project',
21
16
  type: 'string',
22
- })
23
- .option('test', {
17
+ })
18
+ .option('test', {
24
19
  default: false,
25
20
  describe: 'Do a test run?',
26
21
  type: 'boolean',
27
- })
28
- .option('type', {
22
+ })
23
+ .option('type', {
29
24
  choices: ['addon', 'app', 'engine'],
30
25
  demandOption: true,
31
26
  describe: 'Type of your Ember project',
32
27
  type: 'string',
33
- });
34
-
28
+ })
29
+ .parseSync();
35
30
  const codemodOptions = {
36
- podPath: argv['pod-path'],
37
- projectRoot: argv['root'] ?? process.cwd(),
38
- projectType: argv['type'],
39
- testRun: argv['test'],
31
+ podPath: argv['pod-path'],
32
+ projectRoot: argv['root'] ?? process.cwd(),
33
+ projectType: argv['type'],
34
+ testRun: argv['test'],
40
35
  };
41
-
42
36
  runCodemod(codemodOptions);
@@ -0,0 +1,2 @@
1
+ import type { CodemodOptions } from './types/index.js';
2
+ export declare function runCodemod(codemodOptions: CodemodOptions): void;
@@ -0,0 +1,20 @@
1
+ import { migrateEmberAddon, migrateEmberApp, migrateEmberEngine, } from './migration/index.js';
2
+ export function runCodemod(codemodOptions) {
3
+ switch (codemodOptions.projectType) {
4
+ case 'addon': {
5
+ migrateEmberAddon(codemodOptions);
6
+ break;
7
+ }
8
+ case 'app': {
9
+ migrateEmberApp(codemodOptions);
10
+ break;
11
+ }
12
+ case 'engine': {
13
+ migrateEmberEngine(codemodOptions);
14
+ break;
15
+ }
16
+ default: {
17
+ console.error(`Unknown project type: ${codemodOptions.projectType}`);
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForComponentClasses(options: Options): FilePathMapEntries;
@@ -0,0 +1,19 @@
1
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
2
+ export function migrationStrategyForComponentClasses(options) {
3
+ const { projectRoot } = options;
4
+ const filePaths = findFiles('addon/components/**/component.{d.ts,js,ts}', {
5
+ projectRoot,
6
+ });
7
+ return filePaths.map((oldFilePath) => {
8
+ const newFilePath = renamePathByFile(oldFilePath, {
9
+ find: {
10
+ directory: 'addon/components',
11
+ file: 'component',
12
+ },
13
+ replace: (key) => {
14
+ return `addon/components/${key}`;
15
+ },
16
+ });
17
+ return [oldFilePath, newFilePath];
18
+ });
19
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForComponentStylesheets(options: Options): FilePathMapEntries;
@@ -0,0 +1,19 @@
1
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
2
+ export function migrationStrategyForComponentStylesheets(options) {
3
+ const { projectRoot } = options;
4
+ const filePaths = findFiles('addon/components/**/styles.{css,scss}', {
5
+ projectRoot,
6
+ });
7
+ return filePaths.map((oldFilePath) => {
8
+ const newFilePath = renamePathByFile(oldFilePath, {
9
+ find: {
10
+ directory: 'addon/components',
11
+ file: 'styles',
12
+ },
13
+ replace: (key) => {
14
+ return `addon/components/${key}`;
15
+ },
16
+ });
17
+ return [oldFilePath, newFilePath];
18
+ });
19
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForComponentTemplates(options: Options): FilePathMapEntries;
@@ -0,0 +1,19 @@
1
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
2
+ export function migrationStrategyForComponentTemplates(options) {
3
+ const { projectRoot } = options;
4
+ const filePaths = findFiles('addon/components/**/template.hbs', {
5
+ projectRoot,
6
+ });
7
+ return filePaths.map((oldFilePath) => {
8
+ const newFilePath = renamePathByFile(oldFilePath, {
9
+ find: {
10
+ directory: 'addon/components',
11
+ file: 'template',
12
+ },
13
+ replace: (key) => {
14
+ return `addon/components/${key}`;
15
+ },
16
+ });
17
+ return [oldFilePath, newFilePath];
18
+ });
19
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMap, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForAddonFolder(options: Options): FilePathMap;
@@ -1,11 +1,10 @@
1
1
  import { migrationStrategyForComponentClasses } from './component-classes.js';
2
2
  import { migrationStrategyForComponentStylesheets } from './component-stylesheets.js';
3
3
  import { migrationStrategyForComponentTemplates } from './component-templates.js';
4
-
5
4
  export function migrationStrategyForAddonFolder(options) {
6
- return new Map([
7
- ...migrationStrategyForComponentClasses(options),
8
- ...migrationStrategyForComponentStylesheets(options),
9
- ...migrationStrategyForComponentTemplates(options),
10
- ]);
5
+ return new Map([
6
+ ...migrationStrategyForComponentClasses(options),
7
+ ...migrationStrategyForComponentStylesheets(options),
8
+ ...migrationStrategyForComponentTemplates(options),
9
+ ]);
11
10
  }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForComponentClasses(options: Options): FilePathMapEntries;
@@ -0,0 +1,19 @@
1
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
2
+ export function migrationStrategyForComponentClasses(options) {
3
+ const { projectRoot } = options;
4
+ const filePaths = findFiles('app/components/**/component.js', {
5
+ projectRoot,
6
+ });
7
+ return filePaths.map((oldFilePath) => {
8
+ const newFilePath = renamePathByFile(oldFilePath, {
9
+ find: {
10
+ directory: 'app/components',
11
+ file: 'component',
12
+ },
13
+ replace: (key) => {
14
+ return `app/components/${key}`;
15
+ },
16
+ });
17
+ return [oldFilePath, newFilePath];
18
+ });
19
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForComponentStylesheets(options: Options): FilePathMapEntries;
@@ -0,0 +1,19 @@
1
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
2
+ export function migrationStrategyForComponentStylesheets(options) {
3
+ const { projectRoot } = options;
4
+ const filePaths = findFiles('app/components/**/styles.js', {
5
+ projectRoot,
6
+ });
7
+ return filePaths.map((oldFilePath) => {
8
+ const newFilePath = renamePathByFile(oldFilePath, {
9
+ find: {
10
+ directory: 'app/components',
11
+ file: 'styles',
12
+ },
13
+ replace: (key) => {
14
+ return `app/components/${key}`;
15
+ },
16
+ });
17
+ return [oldFilePath, newFilePath];
18
+ });
19
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForComponentTemplates(options: Options): FilePathMapEntries;
@@ -0,0 +1,19 @@
1
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
2
+ export function migrationStrategyForComponentTemplates(options) {
3
+ const { projectRoot } = options;
4
+ const filePaths = findFiles('app/components/**/template.js', {
5
+ projectRoot,
6
+ });
7
+ return filePaths.map((oldFilePath) => {
8
+ const newFilePath = renamePathByFile(oldFilePath, {
9
+ find: {
10
+ directory: 'app/components',
11
+ file: 'template',
12
+ },
13
+ replace: (key) => {
14
+ return `app/components/${key}`;
15
+ },
16
+ });
17
+ return [oldFilePath, newFilePath];
18
+ });
19
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMap, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForAppFolder(options: Options): FilePathMap;
@@ -1,11 +1,10 @@
1
1
  import { migrationStrategyForComponentClasses } from './component-classes.js';
2
2
  import { migrationStrategyForComponentStylesheets } from './component-stylesheets.js';
3
3
  import { migrationStrategyForComponentTemplates } from './component-templates.js';
4
-
5
4
  export function migrationStrategyForAppFolder(options) {
6
- return new Map([
7
- ...migrationStrategyForComponentClasses(options),
8
- ...migrationStrategyForComponentStylesheets(options),
9
- ...migrationStrategyForComponentTemplates(options),
10
- ]);
5
+ return new Map([
6
+ ...migrationStrategyForComponentClasses(options),
7
+ ...migrationStrategyForComponentStylesheets(options),
8
+ ...migrationStrategyForComponentTemplates(options),
9
+ ]);
11
10
  }
@@ -0,0 +1,2 @@
1
+ import type { CodemodOptions } from '../../types/index.js';
2
+ export declare function migrateEmberAddon(codemodOptions: CodemodOptions): void;
@@ -0,0 +1,24 @@
1
+ import { moveFiles } from '@codemod-utils/files';
2
+ import { updatePathsInAppFolder } from '../../utils/ember-addon/app/components.js';
3
+ import { migrationStrategyForAddonFolder } from './addon/index.js';
4
+ import { migrationStrategyForAppFolder } from './app/index.js';
5
+ import { createOptions } from './steps/index.js';
6
+ import { migrationStrategyForTestsFolder } from './tests/index.js';
7
+ export function migrateEmberAddon(codemodOptions) {
8
+ const options = createOptions(codemodOptions);
9
+ const migrationStrategyAddon = migrationStrategyForAddonFolder(options);
10
+ const migrationStrategyApp = migrationStrategyForAppFolder(options);
11
+ const migrationStrategyTests = migrationStrategyForTestsFolder(options);
12
+ if (options.testRun) {
13
+ console.log({
14
+ migrationStrategyAddon,
15
+ migrationStrategyApp,
16
+ migrationStrategyTests,
17
+ });
18
+ return;
19
+ }
20
+ moveFiles(migrationStrategyAddon, options);
21
+ moveFiles(migrationStrategyApp, options);
22
+ moveFiles(migrationStrategyTests, options);
23
+ updatePathsInAppFolder(migrationStrategyApp, options);
24
+ }
@@ -0,0 +1,2 @@
1
+ import type { CodemodOptions, Options } from '../../../types/index.js';
2
+ export declare function createOptions(codemodOptions: CodemodOptions): Options;
@@ -0,0 +1,15 @@
1
+ import { readPackageJson } from '@codemod-utils/json';
2
+ function analyzePackageJson(codemodOptions) {
3
+ const packageJson = readPackageJson(codemodOptions);
4
+ return packageJson.name;
5
+ }
6
+ export function createOptions(codemodOptions) {
7
+ const projectName = analyzePackageJson(codemodOptions);
8
+ return {
9
+ podPath: codemodOptions.podPath,
10
+ projectName,
11
+ projectRoot: codemodOptions.projectRoot,
12
+ projectType: codemodOptions.projectType,
13
+ testRun: codemodOptions.testRun,
14
+ };
15
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForComponents(options: Options): FilePathMapEntries;
@@ -0,0 +1,19 @@
1
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
2
+ export function migrationStrategyForComponents(options) {
3
+ const { projectRoot } = options;
4
+ const filePaths = findFiles('tests/integration/components/**/component-test.{js,ts}', {
5
+ projectRoot,
6
+ });
7
+ return filePaths.map((oldFilePath) => {
8
+ const newFilePath = renamePathByFile(oldFilePath, {
9
+ find: {
10
+ directory: 'tests/integration/components',
11
+ file: 'component-test',
12
+ },
13
+ replace: (key) => {
14
+ return `tests/integration/components/${key}-test`;
15
+ },
16
+ });
17
+ return [oldFilePath, newFilePath];
18
+ });
19
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMap, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForTestsFolder(options: Options): FilePathMap;
@@ -1,5 +1,4 @@
1
1
  import { migrationStrategyForComponents } from './components.js';
2
-
3
2
  export function migrationStrategyForTestsFolder(options) {
4
- return new Map([...migrationStrategyForComponents(options)]);
3
+ return new Map([...migrationStrategyForComponents(options)]);
5
4
  }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForComponentClasses(options: Options): FilePathMapEntries;
@@ -0,0 +1,20 @@
1
+ import { join } from 'node:path';
2
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
3
+ export function migrationStrategyForComponentClasses(options) {
4
+ const { podPath, projectRoot } = options;
5
+ const filePaths = findFiles(join('app', podPath, 'components', '**', 'component.{d.ts,js,ts}'), {
6
+ projectRoot,
7
+ });
8
+ return filePaths.map((oldFilePath) => {
9
+ const newFilePath = renamePathByFile(oldFilePath, {
10
+ find: {
11
+ directory: join('app', podPath, 'components'),
12
+ file: 'component',
13
+ },
14
+ replace: (key) => {
15
+ return `app/components/${key}`;
16
+ },
17
+ });
18
+ return [oldFilePath, newFilePath];
19
+ });
20
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForComponentStylesheets(options: Options): FilePathMapEntries;
@@ -0,0 +1,20 @@
1
+ import { join } from 'node:path';
2
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
3
+ export function migrationStrategyForComponentStylesheets(options) {
4
+ const { podPath, projectRoot } = options;
5
+ const filePaths = findFiles(join('app', podPath, 'components', '**', 'styles.{css,scss}'), {
6
+ projectRoot,
7
+ });
8
+ return filePaths.map((oldFilePath) => {
9
+ const newFilePath = renamePathByFile(oldFilePath, {
10
+ find: {
11
+ directory: join('app', podPath, 'components'),
12
+ file: 'styles',
13
+ },
14
+ replace: (key) => {
15
+ return `app/components/${key}`;
16
+ },
17
+ });
18
+ return [oldFilePath, newFilePath];
19
+ });
20
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForComponentTemplates(options: Options): FilePathMapEntries;
@@ -0,0 +1,20 @@
1
+ import { join } from 'node:path';
2
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
3
+ export function migrationStrategyForComponentTemplates(options) {
4
+ const { podPath, projectRoot } = options;
5
+ const filePaths = findFiles(join('app', podPath, 'components', '**', 'template.hbs'), {
6
+ projectRoot,
7
+ });
8
+ return filePaths.map((oldFilePath) => {
9
+ const newFilePath = renamePathByFile(oldFilePath, {
10
+ find: {
11
+ directory: join('app', podPath, 'components'),
12
+ file: 'template',
13
+ },
14
+ replace: (key) => {
15
+ return `app/components/${key}`;
16
+ },
17
+ });
18
+ return [oldFilePath, newFilePath];
19
+ });
20
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMap, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForAppFolder(options: Options): FilePathMap;
@@ -9,19 +9,18 @@ import { migrationStrategyForRouteSerializers } from './route-serializers.js';
9
9
  import { migrationStrategyForRouteStylesheets } from './route-stylesheets.js';
10
10
  import { migrationStrategyForRouteTemplates } from './route-templates.js';
11
11
  import { migrationStrategyForServices } from './services.js';
12
-
13
12
  export function migrationStrategyForAppFolder(options) {
14
- return new Map([
15
- ...migrationStrategyForComponentClasses(options),
16
- ...migrationStrategyForComponentStylesheets(options),
17
- ...migrationStrategyForComponentTemplates(options),
18
- ...migrationStrategyForRouteAdapters(options),
19
- ...migrationStrategyForRouteControllers(options),
20
- ...migrationStrategyForRouteModels(options),
21
- ...migrationStrategyForRouteRoutes(options),
22
- ...migrationStrategyForRouteSerializers(options),
23
- ...migrationStrategyForRouteStylesheets(options),
24
- ...migrationStrategyForRouteTemplates(options),
25
- ...migrationStrategyForServices(options),
26
- ]);
13
+ return new Map([
14
+ ...migrationStrategyForComponentClasses(options),
15
+ ...migrationStrategyForComponentStylesheets(options),
16
+ ...migrationStrategyForComponentTemplates(options),
17
+ ...migrationStrategyForRouteAdapters(options),
18
+ ...migrationStrategyForRouteControllers(options),
19
+ ...migrationStrategyForRouteModels(options),
20
+ ...migrationStrategyForRouteRoutes(options),
21
+ ...migrationStrategyForRouteSerializers(options),
22
+ ...migrationStrategyForRouteStylesheets(options),
23
+ ...migrationStrategyForRouteTemplates(options),
24
+ ...migrationStrategyForServices(options),
25
+ ]);
27
26
  }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForRouteAdapters(options: Options): FilePathMapEntries;
@@ -0,0 +1,20 @@
1
+ import { join } from 'node:path';
2
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
3
+ export function migrationStrategyForRouteAdapters(options) {
4
+ const { podPath, projectRoot } = options;
5
+ const filePaths = findFiles(join('app', podPath, '**', 'adapter.{js,ts}'), {
6
+ projectRoot,
7
+ });
8
+ return filePaths.map((oldFilePath) => {
9
+ const newFilePath = renamePathByFile(oldFilePath, {
10
+ find: {
11
+ directory: join('app', podPath),
12
+ file: 'adapter',
13
+ },
14
+ replace: (key) => {
15
+ return `app/adapters/${key}`;
16
+ },
17
+ });
18
+ return [oldFilePath, newFilePath];
19
+ });
20
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForRouteControllers(options: Options): FilePathMapEntries;
@@ -0,0 +1,20 @@
1
+ import { join } from 'node:path';
2
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
3
+ export function migrationStrategyForRouteControllers(options) {
4
+ const { podPath, projectRoot } = options;
5
+ const filePaths = findFiles(join('app', podPath, '**', 'controller.{js,ts}'), {
6
+ projectRoot,
7
+ });
8
+ return filePaths.map((oldFilePath) => {
9
+ const newFilePath = renamePathByFile(oldFilePath, {
10
+ find: {
11
+ directory: join('app', podPath),
12
+ file: 'controller',
13
+ },
14
+ replace: (key) => {
15
+ return `app/controllers/${key}`;
16
+ },
17
+ });
18
+ return [oldFilePath, newFilePath];
19
+ });
20
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForRouteModels(options: Options): FilePathMapEntries;
@@ -0,0 +1,20 @@
1
+ import { join } from 'node:path';
2
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
3
+ export function migrationStrategyForRouteModels(options) {
4
+ const { podPath, projectRoot } = options;
5
+ const filePaths = findFiles(join('app', podPath, '**', 'model.{js,ts}'), {
6
+ projectRoot,
7
+ });
8
+ return filePaths.map((oldFilePath) => {
9
+ const newFilePath = renamePathByFile(oldFilePath, {
10
+ find: {
11
+ directory: join('app', podPath),
12
+ file: 'model',
13
+ },
14
+ replace: (key) => {
15
+ return `app/models/${key}`;
16
+ },
17
+ });
18
+ return [oldFilePath, newFilePath];
19
+ });
20
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForRouteRoutes(options: Options): FilePathMapEntries;
@@ -0,0 +1,20 @@
1
+ import { join } from 'node:path';
2
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
3
+ export function migrationStrategyForRouteRoutes(options) {
4
+ const { podPath, projectRoot } = options;
5
+ const filePaths = findFiles(join('app', podPath, '**', 'route.{js,ts}'), {
6
+ projectRoot,
7
+ });
8
+ return filePaths.map((oldFilePath) => {
9
+ const newFilePath = renamePathByFile(oldFilePath, {
10
+ find: {
11
+ directory: join('app', podPath),
12
+ file: 'route',
13
+ },
14
+ replace: (key) => {
15
+ return `app/routes/${key}`;
16
+ },
17
+ });
18
+ return [oldFilePath, newFilePath];
19
+ });
20
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForRouteSerializers(options: Options): FilePathMapEntries;
@@ -0,0 +1,20 @@
1
+ import { join } from 'node:path';
2
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
3
+ export function migrationStrategyForRouteSerializers(options) {
4
+ const { podPath, projectRoot } = options;
5
+ const filePaths = findFiles(join('app', podPath, '**', 'serializer.{js,ts}'), {
6
+ projectRoot,
7
+ });
8
+ return filePaths.map((oldFilePath) => {
9
+ const newFilePath = renamePathByFile(oldFilePath, {
10
+ find: {
11
+ directory: join('app', podPath),
12
+ file: 'serializer',
13
+ },
14
+ replace: (key) => {
15
+ return `app/serializers/${key}`;
16
+ },
17
+ });
18
+ return [oldFilePath, newFilePath];
19
+ });
20
+ }
@@ -0,0 +1,2 @@
1
+ import type { FilePathMapEntries, Options } from '../../../types/index.js';
2
+ export declare function migrationStrategyForRouteStylesheets(options: Options): FilePathMapEntries;
@@ -0,0 +1,20 @@
1
+ import { join } from 'node:path';
2
+ import { findFiles, renamePathByFile } from '@codemod-utils/files';
3
+ export function migrationStrategyForRouteStylesheets(options) {
4
+ const { podPath, projectRoot } = options;
5
+ const filePaths = findFiles(join('app', podPath, '!(components)', '**', 'styles.{css,scss}'), {
6
+ projectRoot,
7
+ });
8
+ return filePaths.map((oldFilePath) => {
9
+ const newFilePath = renamePathByFile(oldFilePath, {
10
+ find: {
11
+ directory: join('app', podPath),
12
+ file: 'styles',
13
+ },
14
+ replace: (key) => {
15
+ return `app/styles/${key}`;
16
+ },
17
+ });
18
+ return [oldFilePath, newFilePath];
19
+ });
20
+ }