ember-codemod-pod-to-octane 0.2.0 → 0.3.2

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 (47) hide show
  1. package/README.md +23 -3
  2. package/bin/ember-codemod-pod-to-octane.js +6 -0
  3. package/package.json +5 -5
  4. package/src/migration/ember-addon/addon/component-classes.js +3 -1
  5. package/src/migration/ember-addon/addon/component-stylesheets.js +16 -2
  6. package/src/migration/ember-addon/addon/component-templates.js +3 -1
  7. package/src/migration/ember-addon/addon/index.js +4 -4
  8. package/src/migration/ember-addon/app/component-classes.js +3 -1
  9. package/src/migration/ember-addon/app/component-stylesheets.js +3 -1
  10. package/src/migration/ember-addon/app/component-templates.js +3 -1
  11. package/src/migration/ember-addon/app/index.js +4 -4
  12. package/src/migration/ember-addon/index.js +8 -24
  13. package/src/migration/ember-addon/tests/components.js +3 -1
  14. package/src/migration/ember-addon/tests/index.js +2 -2
  15. package/src/migration/ember-app/app/component-classes.js +14 -7
  16. package/src/migration/ember-app/app/component-stylesheets.js +24 -5
  17. package/src/migration/ember-app/app/component-templates.js +12 -5
  18. package/src/migration/ember-app/app/index.js +12 -12
  19. package/src/migration/ember-app/app/route-adapters.js +8 -4
  20. package/src/migration/ember-app/app/route-controllers.js +8 -4
  21. package/src/migration/ember-app/app/route-models.js +8 -4
  22. package/src/migration/ember-app/app/route-routes.js +8 -4
  23. package/src/migration/ember-app/app/route-serializers.js +8 -4
  24. package/src/migration/ember-app/app/route-stylesheets.js +24 -5
  25. package/src/migration/ember-app/app/route-templates.js +12 -5
  26. package/src/migration/ember-app/app/services.js +8 -4
  27. package/src/migration/ember-app/index.js +5 -14
  28. package/src/migration/ember-app/tests/components.js +14 -4
  29. package/src/migration/ember-app/tests/index.js +5 -5
  30. package/src/migration/ember-app/tests/route-controllers.js +17 -7
  31. package/src/migration/ember-app/tests/route-routes.js +21 -11
  32. package/src/migration/ember-app/tests/services.js +13 -6
  33. package/src/migration/ember-engine/addon/component-classes.js +3 -1
  34. package/src/migration/ember-engine/addon/component-stylesheets.js +16 -2
  35. package/src/migration/ember-engine/addon/component-templates.js +3 -1
  36. package/src/migration/ember-engine/addon/index.js +8 -8
  37. package/src/migration/ember-engine/addon/route-controllers.js +3 -1
  38. package/src/migration/ember-engine/addon/route-routes.js +3 -1
  39. package/src/migration/ember-engine/addon/route-stylesheets.js +16 -2
  40. package/src/migration/ember-engine/addon/route-templates.js +3 -1
  41. package/src/migration/ember-engine/index.js +5 -14
  42. package/src/migration/ember-engine/tests/components.js +3 -1
  43. package/src/migration/ember-engine/tests/index.js +4 -4
  44. package/src/migration/ember-engine/tests/route-controllers.js +3 -1
  45. package/src/migration/ember-engine/tests/route-routes.js +3 -1
  46. package/src/utils/ember-addon/app/components.js +3 -1
  47. package/src/utils/move-files.js +21 -9
package/README.md CHANGED
@@ -16,7 +16,7 @@ npx ember-codemod-pod-to-octane <arguments>
16
16
 
17
17
  Step 2. Remove `podModulePrefix` from `config/environment.js` and `usePods` from `.ember-cli`.
18
18
 
19
- Step 3. Update relative paths in `import` statements.
19
+ Step 3. Update references originating from, as well as pointing to, the moved files. These can include `import` statement, `composes` property from `ember-css-modules`, etc.
20
20
 
21
21
 
22
22
  ### Arguments
@@ -45,12 +45,32 @@ npx ember-codemod-pod-to-octane --test
45
45
  <details>
46
46
  <summary>Optional: Specify the project root</summary>
47
47
 
48
- Pass `--root` to run the codemod against (1) a project somewhere else or (2) multiple projects (assuming you have an automation script).
48
+ Pass `--root` to run the codemod against a project somewhere else.
49
49
 
50
50
  ```sh
51
51
  npx ember-codemod-pod-to-octane --root=<your/project/path>
52
52
  ```
53
53
 
54
+ Note, you can use `--root` to un-pod the demo app of an Ember addon.
55
+
56
+ ```sh
57
+ # If the current directory is the addon root
58
+ npx ember-codemod-pod-to-octane --type=app --root=tests/dummy
59
+ ```
60
+
61
+ </details>
62
+
63
+
64
+ <details>
65
+ <summary>Optional: Specify the pod path</summary>
66
+
67
+ Pass `--pod-path` if `podModulePrefix` has been set in `config/environment.js`. "Subtract" `modulePrefix` from `podModulePrefix` to get the pod path.
68
+
69
+ ```sh
70
+ # If modulePrefix is 'my-app' and podModulePrefix is 'my-app/pods'
71
+ npx ember-codemod-pod-to-octane --pod-path=pods
72
+ ```
73
+
54
74
  </details>
55
75
 
56
76
 
@@ -109,4 +129,4 @@ Thanks goes to FlashRecruit, Imago, and CLARK, who gave me the necessary Ember e
109
129
 
110
130
  ## License
111
131
 
112
- This project is licensed under the [MIT License](LICENSE.md).
132
+ This project is licensed under the [MIT License](LICENSE.md).
@@ -11,6 +11,11 @@ process.title = 'ember-codemod-pod-to-octane';
11
11
 
12
12
  // Set codemod options
13
13
  const { argv } = yargs(hideBin(process.argv))
14
+ .option('pod-path', {
15
+ default: '',
16
+ describe: 'Namespace used for the pod layout',
17
+ type: 'string',
18
+ })
14
19
  .option('root', {
15
20
  describe: 'Location of your Ember project',
16
21
  type: 'string',
@@ -28,6 +33,7 @@ const { argv } = yargs(hideBin(process.argv))
28
33
  });
29
34
 
30
35
  const options = {
36
+ podPath: argv['pod-path'],
31
37
  projectRoot: argv['root'] ?? process.cwd(),
32
38
  projectType: argv['type'],
33
39
  testRun: argv['test'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-codemod-pod-to-octane",
3
- "version": "0.2.0",
3
+ "version": "0.3.2",
4
4
  "description": "Codemod to un-pod Ember apps, addons, and engines",
5
5
  "keywords": [
6
6
  "ember-codemod",
@@ -28,7 +28,7 @@
28
28
  "lint": "eslint . --cache --ext=.cjs,.js",
29
29
  "lint:fix": "eslint . --fix",
30
30
  "start": "node ./src/index.js",
31
- "test": "node ./node_modules/@sondr3/minitest/bin/mt.mjs tests --quiet"
31
+ "test": "mt tests --quiet"
32
32
  },
33
33
  "changelog": {
34
34
  "labels": {
@@ -41,17 +41,17 @@
41
41
  }
42
42
  },
43
43
  "dependencies": {
44
- "@babel/core": "^7.18.9",
44
+ "@babel/core": "^7.19.0",
45
45
  "@babel/eslint-parser": "^7.18.9",
46
46
  "glob": "^8.0.3",
47
47
  "yargs": "^17.5.1"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@sondr3/minitest": "^0.1.1",
51
- "eslint": "^8.20.0",
51
+ "eslint": "^8.23.0",
52
52
  "eslint-config-prettier": "^8.5.0",
53
53
  "eslint-plugin-prettier": "^4.2.1",
54
- "eslint-plugin-simple-import-sort": "^7.0.0",
54
+ "eslint-plugin-simple-import-sort": "^8.0.0",
55
55
  "fixturify": "^2.1.1",
56
56
  "lerna-changelog": "^2.2.0",
57
57
  "prettier": "^2.7.1"
@@ -2,7 +2,9 @@ import glob from 'glob';
2
2
 
3
3
  import { mapPaths } from '../../../utils/map-paths.js';
4
4
 
5
- export function migrationStrategyForComponentClasses(projectRoot) {
5
+ export function migrationStrategyForComponentClasses(options) {
6
+ const { projectRoot } = options;
7
+
6
8
  const oldPaths = glob.sync('addon/components/**/component.{d.ts,js,ts}', {
7
9
  cwd: projectRoot,
8
10
  });
@@ -2,12 +2,26 @@ import glob from 'glob';
2
2
 
3
3
  import { mapPaths } from '../../../utils/map-paths.js';
4
4
 
5
- export function migrationStrategyForComponentStylesheets(projectRoot) {
6
- const oldPaths = glob.sync('addon/components/**/styles.css', {
5
+ export function migrationStrategyForComponentStylesheets(options) {
6
+ const { projectRoot } = options;
7
+
8
+ const oldPaths = glob.sync('addon/components/**/styles.{css,scss}', {
7
9
  cwd: projectRoot,
8
10
  });
9
11
 
10
12
  return oldPaths.map((oldPath) => {
13
+ if (oldPath.endsWith('.scss')) {
14
+ return mapPaths(oldPath, {
15
+ find: {
16
+ directory: 'addon/components',
17
+ file: 'styles.scss',
18
+ },
19
+ replace(key) {
20
+ return `addon/components/${key}.scss`;
21
+ },
22
+ });
23
+ }
24
+
11
25
  return mapPaths(oldPath, {
12
26
  find: {
13
27
  directory: 'addon/components',
@@ -2,7 +2,9 @@ import glob from 'glob';
2
2
 
3
3
  import { mapPaths } from '../../../utils/map-paths.js';
4
4
 
5
- export function migrationStrategyForComponentTemplates(projectRoot) {
5
+ export function migrationStrategyForComponentTemplates(options) {
6
+ const { projectRoot } = options;
7
+
6
8
  const oldPaths = glob.sync('addon/components/**/template.hbs', {
7
9
  cwd: projectRoot,
8
10
  });
@@ -2,10 +2,10 @@ import { migrationStrategyForComponentClasses } from './component-classes.js';
2
2
  import { migrationStrategyForComponentStylesheets } from './component-stylesheets.js';
3
3
  import { migrationStrategyForComponentTemplates } from './component-templates.js';
4
4
 
5
- export function migrationStrategyForAddonFolder(projectRoot) {
5
+ export function migrationStrategyForAddonFolder(options) {
6
6
  return new Map([
7
- ...migrationStrategyForComponentClasses(projectRoot),
8
- ...migrationStrategyForComponentStylesheets(projectRoot),
9
- ...migrationStrategyForComponentTemplates(projectRoot),
7
+ ...migrationStrategyForComponentClasses(options),
8
+ ...migrationStrategyForComponentStylesheets(options),
9
+ ...migrationStrategyForComponentTemplates(options),
10
10
  ]);
11
11
  }
@@ -2,7 +2,9 @@ import glob from 'glob';
2
2
 
3
3
  import { mapPaths } from '../../../utils/map-paths.js';
4
4
 
5
- export function migrationStrategyForComponentClasses(projectRoot) {
5
+ export function migrationStrategyForComponentClasses(options) {
6
+ const { projectRoot } = options;
7
+
6
8
  const oldPaths = glob.sync('app/components/**/component.js', {
7
9
  cwd: projectRoot,
8
10
  });
@@ -2,7 +2,9 @@ import glob from 'glob';
2
2
 
3
3
  import { mapPaths } from '../../../utils/map-paths.js';
4
4
 
5
- export function migrationStrategyForComponentStylesheets(projectRoot) {
5
+ export function migrationStrategyForComponentStylesheets(options) {
6
+ const { projectRoot } = options;
7
+
6
8
  const oldPaths = glob.sync('app/components/**/styles.js', {
7
9
  cwd: projectRoot,
8
10
  });
@@ -2,7 +2,9 @@ import glob from 'glob';
2
2
 
3
3
  import { mapPaths } from '../../../utils/map-paths.js';
4
4
 
5
- export function migrationStrategyForComponentTemplates(projectRoot) {
5
+ export function migrationStrategyForComponentTemplates(options) {
6
+ const { projectRoot } = options;
7
+
6
8
  const oldPaths = glob.sync('app/components/**/template.js', {
7
9
  cwd: projectRoot,
8
10
  });
@@ -2,10 +2,10 @@ import { migrationStrategyForComponentClasses } from './component-classes.js';
2
2
  import { migrationStrategyForComponentStylesheets } from './component-stylesheets.js';
3
3
  import { migrationStrategyForComponentTemplates } from './component-templates.js';
4
4
 
5
- export function migrationStrategyForAppFolder(projectRoot) {
5
+ export function migrationStrategyForAppFolder(options) {
6
6
  return new Map([
7
- ...migrationStrategyForComponentClasses(projectRoot),
8
- ...migrationStrategyForComponentStylesheets(projectRoot),
9
- ...migrationStrategyForComponentTemplates(projectRoot),
7
+ ...migrationStrategyForComponentClasses(options),
8
+ ...migrationStrategyForComponentStylesheets(options),
9
+ ...migrationStrategyForComponentTemplates(options),
10
10
  ]);
11
11
  }
@@ -5,13 +5,11 @@ import { migrationStrategyForAppFolder } from './app/index.js';
5
5
  import { migrationStrategyForTestsFolder } from './tests/index.js';
6
6
 
7
7
  export function migrateEmberAddon(options) {
8
- const { projectRoot, testRun } = options;
8
+ const migrationStrategyAddon = migrationStrategyForAddonFolder(options);
9
+ const migrationStrategyApp = migrationStrategyForAppFolder(options);
10
+ const migrationStrategyTests = migrationStrategyForTestsFolder(options);
9
11
 
10
- const migrationStrategyAddon = migrationStrategyForAddonFolder(projectRoot);
11
- const migrationStrategyApp = migrationStrategyForAppFolder(projectRoot);
12
- const migrationStrategyTests = migrationStrategyForTestsFolder(projectRoot);
13
-
14
- if (testRun) {
12
+ if (options.testRun) {
15
13
  console.log({
16
14
  migrationStrategyAddon,
17
15
  migrationStrategyApp,
@@ -21,23 +19,9 @@ export function migrateEmberAddon(options) {
21
19
  return;
22
20
  }
23
21
 
24
- moveFiles({
25
- migrationStrategy: migrationStrategyAddon,
26
- projectRoot,
27
- });
28
-
29
- moveFiles({
30
- migrationStrategy: migrationStrategyApp,
31
- projectRoot,
32
- });
33
-
34
- moveFiles({
35
- migrationStrategy: migrationStrategyTests,
36
- projectRoot,
37
- });
22
+ moveFiles(migrationStrategyAddon, options);
23
+ moveFiles(migrationStrategyApp, options);
24
+ moveFiles(migrationStrategyTests, options);
38
25
 
39
- updatePaths({
40
- migrationStrategy: migrationStrategyApp,
41
- projectRoot,
42
- });
26
+ updatePaths(migrationStrategyApp, options);
43
27
  }
@@ -2,7 +2,9 @@ import glob from 'glob';
2
2
 
3
3
  import { mapPaths } from '../../../utils/map-paths.js';
4
4
 
5
- export function migrationStrategyForComponents(projectRoot) {
5
+ export function migrationStrategyForComponents(options) {
6
+ const { projectRoot } = options;
7
+
6
8
  const oldPaths = glob.sync(
7
9
  'tests/integration/components/**/component-test.{js,ts}',
8
10
  {
@@ -1,5 +1,5 @@
1
1
  import { migrationStrategyForComponents } from './components.js';
2
2
 
3
- export function migrationStrategyForTestsFolder(projectRoot) {
4
- return new Map([...migrationStrategyForComponents(projectRoot)]);
3
+ export function migrationStrategyForTestsFolder(options) {
4
+ return new Map([...migrationStrategyForComponents(options)]);
5
5
  }
@@ -1,17 +1,24 @@
1
+ import { join } from 'node:path';
2
+
1
3
  import glob from 'glob';
2
4
 
3
5
  import { mapPaths } from '../../../utils/map-paths.js';
4
6
 
5
- export function migrationStrategyForComponentClasses(projectRoot) {
6
- const oldPaths = glob.sync('app/components/**/component.{d.ts,js,ts}', {
7
- cwd: projectRoot,
8
- });
7
+ export function migrationStrategyForComponentClasses(options) {
8
+ const { podPath, projectRoot } = options;
9
+
10
+ const oldPaths = glob.sync(
11
+ join('app', podPath, 'components', '**', 'component.{d.ts,js,ts}'),
12
+ {
13
+ cwd: projectRoot,
14
+ }
15
+ );
9
16
 
10
17
  return oldPaths.map((oldPath) => {
11
18
  if (oldPath.endsWith('.d.ts')) {
12
19
  return mapPaths(oldPath, {
13
20
  find: {
14
- directory: 'app/components',
21
+ directory: join('app', podPath, 'components'),
15
22
  file: 'component.d.ts',
16
23
  },
17
24
  replace(key) {
@@ -23,7 +30,7 @@ export function migrationStrategyForComponentClasses(projectRoot) {
23
30
  if (oldPath.endsWith('.ts')) {
24
31
  return mapPaths(oldPath, {
25
32
  find: {
26
- directory: 'app/components',
33
+ directory: join('app', podPath, 'components'),
27
34
  file: 'component.ts',
28
35
  },
29
36
  replace(key) {
@@ -34,7 +41,7 @@ export function migrationStrategyForComponentClasses(projectRoot) {
34
41
 
35
42
  return mapPaths(oldPath, {
36
43
  find: {
37
- directory: 'app/components',
44
+ directory: join('app', podPath, 'components'),
38
45
  file: 'component.js',
39
46
  },
40
47
  replace(key) {
@@ -1,16 +1,35 @@
1
+ import { join } from 'node:path';
2
+
1
3
  import glob from 'glob';
2
4
 
3
5
  import { mapPaths } from '../../../utils/map-paths.js';
4
6
 
5
- export function migrationStrategyForComponentStylesheets(projectRoot) {
6
- const oldPaths = glob.sync('app/components/**/styles.css', {
7
- cwd: projectRoot,
8
- });
7
+ export function migrationStrategyForComponentStylesheets(options) {
8
+ const { podPath, projectRoot } = options;
9
+
10
+ const oldPaths = glob.sync(
11
+ join('app', podPath, 'components', '**', 'styles.{css,scss}'),
12
+ {
13
+ cwd: projectRoot,
14
+ }
15
+ );
9
16
 
10
17
  return oldPaths.map((oldPath) => {
18
+ if (oldPath.endsWith('.scss')) {
19
+ return mapPaths(oldPath, {
20
+ find: {
21
+ directory: join('app', podPath, 'components'),
22
+ file: 'styles.scss',
23
+ },
24
+ replace(key) {
25
+ return `app/components/${key}.scss`;
26
+ },
27
+ });
28
+ }
29
+
11
30
  return mapPaths(oldPath, {
12
31
  find: {
13
- directory: 'app/components',
32
+ directory: join('app', podPath, 'components'),
14
33
  file: 'styles.css',
15
34
  },
16
35
  replace(key) {
@@ -1,16 +1,23 @@
1
+ import { join } from 'node:path';
2
+
1
3
  import glob from 'glob';
2
4
 
3
5
  import { mapPaths } from '../../../utils/map-paths.js';
4
6
 
5
- export function migrationStrategyForComponentTemplates(projectRoot) {
6
- const oldPaths = glob.sync('app/components/**/template.hbs', {
7
- cwd: projectRoot,
8
- });
7
+ export function migrationStrategyForComponentTemplates(options) {
8
+ const { podPath, projectRoot } = options;
9
+
10
+ const oldPaths = glob.sync(
11
+ join('app', podPath, 'components', '**', 'template.hbs'),
12
+ {
13
+ cwd: projectRoot,
14
+ }
15
+ );
9
16
 
10
17
  return oldPaths.map((oldPath) => {
11
18
  return mapPaths(oldPath, {
12
19
  find: {
13
- directory: 'app/components',
20
+ directory: join('app', podPath, 'components'),
14
21
  file: 'template.hbs',
15
22
  },
16
23
  replace(key) {
@@ -10,18 +10,18 @@ import { migrationStrategyForRouteStylesheets } from './route-stylesheets.js';
10
10
  import { migrationStrategyForRouteTemplates } from './route-templates.js';
11
11
  import { migrationStrategyForServices } from './services.js';
12
12
 
13
- export function migrationStrategyForAppFolder(projectRoot) {
13
+ export function migrationStrategyForAppFolder(options) {
14
14
  return new Map([
15
- ...migrationStrategyForComponentClasses(projectRoot),
16
- ...migrationStrategyForComponentStylesheets(projectRoot),
17
- ...migrationStrategyForComponentTemplates(projectRoot),
18
- ...migrationStrategyForRouteAdapters(projectRoot),
19
- ...migrationStrategyForRouteControllers(projectRoot),
20
- ...migrationStrategyForRouteModels(projectRoot),
21
- ...migrationStrategyForRouteRoutes(projectRoot),
22
- ...migrationStrategyForRouteSerializers(projectRoot),
23
- ...migrationStrategyForRouteStylesheets(projectRoot),
24
- ...migrationStrategyForRouteTemplates(projectRoot),
25
- ...migrationStrategyForServices(projectRoot),
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
26
  ]);
27
27
  }
@@ -1,9 +1,13 @@
1
+ import { join } from 'node:path';
2
+
1
3
  import glob from 'glob';
2
4
 
3
5
  import { mapPaths } from '../../../utils/map-paths.js';
4
6
 
5
- export function migrationStrategyForRouteAdapters(projectRoot) {
6
- const oldPaths = glob.sync('app/**/adapter.{js,ts}', {
7
+ export function migrationStrategyForRouteAdapters(options) {
8
+ const { podPath, projectRoot } = options;
9
+
10
+ const oldPaths = glob.sync(join('app', podPath, '**', 'adapter.{js,ts}'), {
7
11
  cwd: projectRoot,
8
12
  });
9
13
 
@@ -11,7 +15,7 @@ export function migrationStrategyForRouteAdapters(projectRoot) {
11
15
  if (oldPath.endsWith('.ts')) {
12
16
  return mapPaths(oldPath, {
13
17
  find: {
14
- directory: 'app',
18
+ directory: join('app', podPath),
15
19
  file: 'adapter.ts',
16
20
  },
17
21
  replace(key) {
@@ -22,7 +26,7 @@ export function migrationStrategyForRouteAdapters(projectRoot) {
22
26
 
23
27
  return mapPaths(oldPath, {
24
28
  find: {
25
- directory: 'app',
29
+ directory: join('app', podPath),
26
30
  file: 'adapter.js',
27
31
  },
28
32
  replace(key) {
@@ -1,9 +1,13 @@
1
+ import { join } from 'node:path';
2
+
1
3
  import glob from 'glob';
2
4
 
3
5
  import { mapPaths } from '../../../utils/map-paths.js';
4
6
 
5
- export function migrationStrategyForRouteControllers(projectRoot) {
6
- const oldPaths = glob.sync('app/**/controller.{js,ts}', {
7
+ export function migrationStrategyForRouteControllers(options) {
8
+ const { podPath, projectRoot } = options;
9
+
10
+ const oldPaths = glob.sync(join('app', podPath, '**', 'controller.{js,ts}'), {
7
11
  cwd: projectRoot,
8
12
  });
9
13
 
@@ -11,7 +15,7 @@ export function migrationStrategyForRouteControllers(projectRoot) {
11
15
  if (oldPath.endsWith('.ts')) {
12
16
  return mapPaths(oldPath, {
13
17
  find: {
14
- directory: 'app',
18
+ directory: join('app', podPath),
15
19
  file: 'controller.ts',
16
20
  },
17
21
  replace(key) {
@@ -22,7 +26,7 @@ export function migrationStrategyForRouteControllers(projectRoot) {
22
26
 
23
27
  return mapPaths(oldPath, {
24
28
  find: {
25
- directory: 'app',
29
+ directory: join('app', podPath),
26
30
  file: 'controller.js',
27
31
  },
28
32
  replace(key) {
@@ -1,9 +1,13 @@
1
+ import { join } from 'node:path';
2
+
1
3
  import glob from 'glob';
2
4
 
3
5
  import { mapPaths } from '../../../utils/map-paths.js';
4
6
 
5
- export function migrationStrategyForRouteModels(projectRoot) {
6
- const oldPaths = glob.sync('app/**/model.{js,ts}', {
7
+ export function migrationStrategyForRouteModels(options) {
8
+ const { podPath, projectRoot } = options;
9
+
10
+ const oldPaths = glob.sync(join('app', podPath, '**', 'model.{js,ts}'), {
7
11
  cwd: projectRoot,
8
12
  });
9
13
 
@@ -11,7 +15,7 @@ export function migrationStrategyForRouteModels(projectRoot) {
11
15
  if (oldPath.endsWith('.ts')) {
12
16
  return mapPaths(oldPath, {
13
17
  find: {
14
- directory: 'app',
18
+ directory: join('app', podPath),
15
19
  file: 'model.ts',
16
20
  },
17
21
  replace(key) {
@@ -22,7 +26,7 @@ export function migrationStrategyForRouteModels(projectRoot) {
22
26
 
23
27
  return mapPaths(oldPath, {
24
28
  find: {
25
- directory: 'app',
29
+ directory: join('app', podPath),
26
30
  file: 'model.js',
27
31
  },
28
32
  replace(key) {
@@ -1,9 +1,13 @@
1
+ import { join } from 'node:path';
2
+
1
3
  import glob from 'glob';
2
4
 
3
5
  import { mapPaths } from '../../../utils/map-paths.js';
4
6
 
5
- export function migrationStrategyForRouteRoutes(projectRoot) {
6
- const oldPaths = glob.sync('app/**/route.{js,ts}', {
7
+ export function migrationStrategyForRouteRoutes(options) {
8
+ const { podPath, projectRoot } = options;
9
+
10
+ const oldPaths = glob.sync(join('app', podPath, '**', 'route.{js,ts}'), {
7
11
  cwd: projectRoot,
8
12
  });
9
13
 
@@ -11,7 +15,7 @@ export function migrationStrategyForRouteRoutes(projectRoot) {
11
15
  if (oldPath.endsWith('.ts')) {
12
16
  return mapPaths(oldPath, {
13
17
  find: {
14
- directory: 'app',
18
+ directory: join('app', podPath),
15
19
  file: 'route.ts',
16
20
  },
17
21
  replace(key) {
@@ -22,7 +26,7 @@ export function migrationStrategyForRouteRoutes(projectRoot) {
22
26
 
23
27
  return mapPaths(oldPath, {
24
28
  find: {
25
- directory: 'app',
29
+ directory: join('app', podPath),
26
30
  file: 'route.js',
27
31
  },
28
32
  replace(key) {
@@ -1,9 +1,13 @@
1
+ import { join } from 'node:path';
2
+
1
3
  import glob from 'glob';
2
4
 
3
5
  import { mapPaths } from '../../../utils/map-paths.js';
4
6
 
5
- export function migrationStrategyForRouteSerializers(projectRoot) {
6
- const oldPaths = glob.sync('app/**/serializer.{js,ts}', {
7
+ export function migrationStrategyForRouteSerializers(options) {
8
+ const { podPath, projectRoot } = options;
9
+
10
+ const oldPaths = glob.sync(join('app', podPath, '**', 'serializer.{js,ts}'), {
7
11
  cwd: projectRoot,
8
12
  });
9
13
 
@@ -11,7 +15,7 @@ export function migrationStrategyForRouteSerializers(projectRoot) {
11
15
  if (oldPath.endsWith('.ts')) {
12
16
  return mapPaths(oldPath, {
13
17
  find: {
14
- directory: 'app',
18
+ directory: join('app', podPath),
15
19
  file: 'serializer.ts',
16
20
  },
17
21
  replace(key) {
@@ -22,7 +26,7 @@ export function migrationStrategyForRouteSerializers(projectRoot) {
22
26
 
23
27
  return mapPaths(oldPath, {
24
28
  find: {
25
- directory: 'app',
29
+ directory: join('app', podPath),
26
30
  file: 'serializer.js',
27
31
  },
28
32
  replace(key) {
@@ -1,16 +1,35 @@
1
+ import { join } from 'node:path';
2
+
1
3
  import glob from 'glob';
2
4
 
3
5
  import { mapPaths } from '../../../utils/map-paths.js';
4
6
 
5
- export function migrationStrategyForRouteStylesheets(projectRoot) {
6
- const oldPaths = glob.sync('app/!(components)/**/styles.css', {
7
- cwd: projectRoot,
8
- });
7
+ export function migrationStrategyForRouteStylesheets(options) {
8
+ const { podPath, projectRoot } = options;
9
+
10
+ const oldPaths = glob.sync(
11
+ join('app', podPath, '!(components)', '**', 'styles.{css,scss}'),
12
+ {
13
+ cwd: projectRoot,
14
+ }
15
+ );
9
16
 
10
17
  return oldPaths.map((oldPath) => {
18
+ if (oldPath.endsWith('.scss')) {
19
+ return mapPaths(oldPath, {
20
+ find: {
21
+ directory: join('app', podPath),
22
+ file: 'styles.scss',
23
+ },
24
+ replace(key) {
25
+ return `app/styles/${key}.scss`;
26
+ },
27
+ });
28
+ }
29
+
11
30
  return mapPaths(oldPath, {
12
31
  find: {
13
- directory: 'app',
32
+ directory: join('app', podPath),
14
33
  file: 'styles.css',
15
34
  },
16
35
  replace(key) {