ember-codemod-pod-to-octane 0.1.0 → 0.3.1
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 +25 -5
- package/bin/ember-codemod-pod-to-octane.js +6 -0
- package/package.json +5 -5
- package/src/migration/ember-addon/addon/component-classes.js +3 -1
- package/src/migration/ember-addon/addon/component-stylesheets.js +16 -2
- package/src/migration/ember-addon/addon/component-templates.js +3 -1
- package/src/migration/ember-addon/addon/index.js +4 -4
- package/src/migration/ember-addon/app/component-classes.js +3 -1
- package/src/migration/ember-addon/app/component-stylesheets.js +3 -1
- package/src/migration/ember-addon/app/component-templates.js +3 -1
- package/src/migration/ember-addon/app/index.js +4 -4
- package/src/migration/ember-addon/index.js +8 -24
- package/src/migration/ember-addon/tests/components.js +3 -1
- package/src/migration/ember-addon/tests/index.js +2 -2
- package/src/migration/ember-app/app/component-classes.js +13 -7
- package/src/migration/ember-app/app/component-stylesheets.js +23 -5
- package/src/migration/ember-app/app/component-templates.js +11 -5
- package/src/migration/ember-app/app/index.js +13 -11
- package/src/migration/ember-app/app/route-adapters.js +7 -4
- package/src/migration/ember-app/app/route-controllers.js +7 -4
- package/src/migration/ember-app/app/route-models.js +7 -4
- package/src/migration/ember-app/app/route-routes.js +7 -4
- package/src/migration/ember-app/app/route-serializers.js +7 -4
- package/src/migration/ember-app/app/route-stylesheets.js +23 -5
- package/src/migration/ember-app/app/route-templates.js +11 -5
- package/src/migration/ember-app/app/services.js +36 -0
- package/src/migration/ember-app/index.js +5 -14
- package/src/migration/ember-app/tests/components.js +13 -4
- package/src/migration/ember-app/tests/index.js +6 -4
- package/src/migration/ember-app/tests/route-controllers.js +16 -7
- package/src/migration/ember-app/tests/route-routes.js +20 -11
- package/src/migration/ember-app/tests/services.js +39 -0
- package/src/migration/ember-engine/addon/component-classes.js +3 -1
- package/src/migration/ember-engine/addon/component-stylesheets.js +16 -2
- package/src/migration/ember-engine/addon/component-templates.js +3 -1
- package/src/migration/ember-engine/addon/index.js +8 -8
- package/src/migration/ember-engine/addon/route-controllers.js +3 -1
- package/src/migration/ember-engine/addon/route-routes.js +3 -1
- package/src/migration/ember-engine/addon/route-stylesheets.js +16 -2
- package/src/migration/ember-engine/addon/route-templates.js +3 -1
- package/src/migration/ember-engine/index.js +5 -14
- package/src/migration/ember-engine/tests/components.js +3 -1
- package/src/migration/ember-engine/tests/index.js +4 -4
- package/src/migration/ember-engine/tests/route-controllers.js +3 -1
- package/src/migration/ember-engine/tests/route-routes.js +3 -1
- package/src/utils/ember-addon/app/components.js +3 -1
- package/src/utils/move-files.js +21 -9
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@ cd <your/project/path>
|
|
|
14
14
|
npx ember-codemod-pod-to-octane <arguments>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Step 2. Remove `podModulePrefix` from `
|
|
17
|
+
Step 2. Remove `podModulePrefix` from `config/environment.js` and `usePods` from `.ember-cli`.
|
|
18
18
|
|
|
19
|
-
Step 3. Update
|
|
19
|
+
Step 3. Update references to the moved files (e.g. `import` statement, `composes` property from `ember-css-modules`).
|
|
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
|
|
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 --root=tests/dummy/app --type=app
|
|
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
|
|
|
@@ -87,7 +107,7 @@ To better meet your needs, consider forking the repo and running the codemod loc
|
|
|
87
107
|
|
|
88
108
|
```sh
|
|
89
109
|
cd <your/forked/repo>
|
|
90
|
-
./bin/ember-codemod-pod-to-octane <arguments>
|
|
110
|
+
./bin/ember-codemod-pod-to-octane.js <arguments>
|
|
91
111
|
```
|
|
92
112
|
|
|
93
113
|
|
|
@@ -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.1
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Codemod to un-pod Ember apps, addons, and engines",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-codemod",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/ijlee2/ember-codemod-
|
|
12
|
+
"url": "https://github.com/ijlee2/ember-codemod-pod-to-octane.git"
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"author": "Isaac J. Lee",
|
|
@@ -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": "
|
|
31
|
+
"test": "mt tests --quiet"
|
|
32
32
|
},
|
|
33
33
|
"changelog": {
|
|
34
34
|
"labels": {
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@babel/core": "^7.18.
|
|
44
|
+
"@babel/core": "^7.18.13",
|
|
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.
|
|
51
|
+
"eslint": "^8.22.0",
|
|
52
52
|
"eslint-config-prettier": "^8.5.0",
|
|
53
53
|
"eslint-plugin-prettier": "^4.2.1",
|
|
54
54
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
@@ -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(
|
|
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(
|
|
6
|
-
const
|
|
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(
|
|
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(
|
|
5
|
+
export function migrationStrategyForAddonFolder(options) {
|
|
6
6
|
return new Map([
|
|
7
|
-
...migrationStrategyForComponentClasses(
|
|
8
|
-
...migrationStrategyForComponentStylesheets(
|
|
9
|
-
...migrationStrategyForComponentTemplates(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
5
|
+
export function migrationStrategyForAppFolder(options) {
|
|
6
6
|
return new Map([
|
|
7
|
-
...migrationStrategyForComponentClasses(
|
|
8
|
-
...migrationStrategyForComponentStylesheets(
|
|
9
|
-
...migrationStrategyForComponentTemplates(
|
|
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
|
|
8
|
+
const migrationStrategyAddon = migrationStrategyForAddonFolder(options);
|
|
9
|
+
const migrationStrategyApp = migrationStrategyForAppFolder(options);
|
|
10
|
+
const migrationStrategyTests = migrationStrategyForTestsFolder(options);
|
|
9
11
|
|
|
10
|
-
|
|
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
|
-
|
|
26
|
-
|
|
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(
|
|
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(
|
|
4
|
-
return new Map([...migrationStrategyForComponents(
|
|
3
|
+
export function migrationStrategyForTestsFolder(options) {
|
|
4
|
+
return new Map([...migrationStrategyForComponents(options)]);
|
|
5
5
|
}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import glob from 'glob';
|
|
2
|
+
import { join } from 'node:path';
|
|
2
3
|
|
|
3
4
|
import { mapPaths } from '../../../utils/map-paths.js';
|
|
4
5
|
|
|
5
|
-
export function migrationStrategyForComponentClasses(
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export function migrationStrategyForComponentClasses(options) {
|
|
7
|
+
const { podPath, projectRoot } = options;
|
|
8
|
+
|
|
9
|
+
const oldPaths = glob.sync(
|
|
10
|
+
join('app', podPath, 'components', '**', 'component.{d.ts,js,ts}'),
|
|
11
|
+
{
|
|
12
|
+
cwd: projectRoot,
|
|
13
|
+
}
|
|
14
|
+
);
|
|
9
15
|
|
|
10
16
|
return oldPaths.map((oldPath) => {
|
|
11
17
|
if (oldPath.endsWith('.d.ts')) {
|
|
12
18
|
return mapPaths(oldPath, {
|
|
13
19
|
find: {
|
|
14
|
-
directory: 'app
|
|
20
|
+
directory: join('app', podPath, 'components'),
|
|
15
21
|
file: 'component.d.ts',
|
|
16
22
|
},
|
|
17
23
|
replace(key) {
|
|
@@ -23,7 +29,7 @@ export function migrationStrategyForComponentClasses(projectRoot) {
|
|
|
23
29
|
if (oldPath.endsWith('.ts')) {
|
|
24
30
|
return mapPaths(oldPath, {
|
|
25
31
|
find: {
|
|
26
|
-
directory: 'app
|
|
32
|
+
directory: join('app', podPath, 'components'),
|
|
27
33
|
file: 'component.ts',
|
|
28
34
|
},
|
|
29
35
|
replace(key) {
|
|
@@ -34,7 +40,7 @@ export function migrationStrategyForComponentClasses(projectRoot) {
|
|
|
34
40
|
|
|
35
41
|
return mapPaths(oldPath, {
|
|
36
42
|
find: {
|
|
37
|
-
directory: 'app
|
|
43
|
+
directory: join('app', podPath, 'components'),
|
|
38
44
|
file: 'component.js',
|
|
39
45
|
},
|
|
40
46
|
replace(key) {
|
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
import glob from 'glob';
|
|
2
|
+
import { join } from 'node:path';
|
|
2
3
|
|
|
3
4
|
import { mapPaths } from '../../../utils/map-paths.js';
|
|
4
5
|
|
|
5
|
-
export function migrationStrategyForComponentStylesheets(
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export function migrationStrategyForComponentStylesheets(options) {
|
|
7
|
+
const { podPath, projectRoot } = options;
|
|
8
|
+
|
|
9
|
+
const oldPaths = glob.sync(
|
|
10
|
+
join('app', podPath, 'components', '**', 'styles.{css,scss}'),
|
|
11
|
+
{
|
|
12
|
+
cwd: projectRoot,
|
|
13
|
+
}
|
|
14
|
+
);
|
|
9
15
|
|
|
10
16
|
return oldPaths.map((oldPath) => {
|
|
17
|
+
if (oldPath.endsWith('.scss')) {
|
|
18
|
+
return mapPaths(oldPath, {
|
|
19
|
+
find: {
|
|
20
|
+
directory: join('app', podPath, 'components'),
|
|
21
|
+
file: 'styles.scss',
|
|
22
|
+
},
|
|
23
|
+
replace(key) {
|
|
24
|
+
return `app/components/${key}.scss`;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
11
29
|
return mapPaths(oldPath, {
|
|
12
30
|
find: {
|
|
13
|
-
directory: 'app
|
|
31
|
+
directory: join('app', podPath, 'components'),
|
|
14
32
|
file: 'styles.css',
|
|
15
33
|
},
|
|
16
34
|
replace(key) {
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import glob from 'glob';
|
|
2
|
+
import { join } from 'node:path';
|
|
2
3
|
|
|
3
4
|
import { mapPaths } from '../../../utils/map-paths.js';
|
|
4
5
|
|
|
5
|
-
export function migrationStrategyForComponentTemplates(
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export function migrationStrategyForComponentTemplates(options) {
|
|
7
|
+
const { podPath, projectRoot } = options;
|
|
8
|
+
|
|
9
|
+
const oldPaths = glob.sync(
|
|
10
|
+
join('app', podPath, 'components', '**', 'template.hbs'),
|
|
11
|
+
{
|
|
12
|
+
cwd: projectRoot,
|
|
13
|
+
}
|
|
14
|
+
);
|
|
9
15
|
|
|
10
16
|
return oldPaths.map((oldPath) => {
|
|
11
17
|
return mapPaths(oldPath, {
|
|
12
18
|
find: {
|
|
13
|
-
directory: 'app
|
|
19
|
+
directory: join('app', podPath, 'components'),
|
|
14
20
|
file: 'template.hbs',
|
|
15
21
|
},
|
|
16
22
|
replace(key) {
|
|
@@ -8,18 +8,20 @@ import { migrationStrategyForRouteRoutes } from './route-routes.js';
|
|
|
8
8
|
import { migrationStrategyForRouteSerializers } from './route-serializers.js';
|
|
9
9
|
import { migrationStrategyForRouteStylesheets } from './route-stylesheets.js';
|
|
10
10
|
import { migrationStrategyForRouteTemplates } from './route-templates.js';
|
|
11
|
+
import { migrationStrategyForServices } from './services.js';
|
|
11
12
|
|
|
12
|
-
export function migrationStrategyForAppFolder(
|
|
13
|
+
export function migrationStrategyForAppFolder(options) {
|
|
13
14
|
return new Map([
|
|
14
|
-
...migrationStrategyForComponentClasses(
|
|
15
|
-
...migrationStrategyForComponentStylesheets(
|
|
16
|
-
...migrationStrategyForComponentTemplates(
|
|
17
|
-
...migrationStrategyForRouteAdapters(
|
|
18
|
-
...migrationStrategyForRouteControllers(
|
|
19
|
-
...migrationStrategyForRouteModels(
|
|
20
|
-
...migrationStrategyForRouteRoutes(
|
|
21
|
-
...migrationStrategyForRouteSerializers(
|
|
22
|
-
...migrationStrategyForRouteStylesheets(
|
|
23
|
-
...migrationStrategyForRouteTemplates(
|
|
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),
|
|
24
26
|
]);
|
|
25
27
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import glob from 'glob';
|
|
2
|
+
import { join } from 'node:path';
|
|
2
3
|
|
|
3
4
|
import { mapPaths } from '../../../utils/map-paths.js';
|
|
4
5
|
|
|
5
|
-
export function migrationStrategyForRouteAdapters(
|
|
6
|
-
const
|
|
6
|
+
export function migrationStrategyForRouteAdapters(options) {
|
|
7
|
+
const { podPath, projectRoot } = options;
|
|
8
|
+
|
|
9
|
+
const oldPaths = glob.sync(join('app', podPath, '**', 'adapter.{js,ts}'), {
|
|
7
10
|
cwd: projectRoot,
|
|
8
11
|
});
|
|
9
12
|
|
|
@@ -11,7 +14,7 @@ export function migrationStrategyForRouteAdapters(projectRoot) {
|
|
|
11
14
|
if (oldPath.endsWith('.ts')) {
|
|
12
15
|
return mapPaths(oldPath, {
|
|
13
16
|
find: {
|
|
14
|
-
directory: 'app',
|
|
17
|
+
directory: join('app', podPath),
|
|
15
18
|
file: 'adapter.ts',
|
|
16
19
|
},
|
|
17
20
|
replace(key) {
|
|
@@ -22,7 +25,7 @@ export function migrationStrategyForRouteAdapters(projectRoot) {
|
|
|
22
25
|
|
|
23
26
|
return mapPaths(oldPath, {
|
|
24
27
|
find: {
|
|
25
|
-
directory: 'app',
|
|
28
|
+
directory: join('app', podPath),
|
|
26
29
|
file: 'adapter.js',
|
|
27
30
|
},
|
|
28
31
|
replace(key) {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import glob from 'glob';
|
|
2
|
+
import { join } from 'node:path';
|
|
2
3
|
|
|
3
4
|
import { mapPaths } from '../../../utils/map-paths.js';
|
|
4
5
|
|
|
5
|
-
export function migrationStrategyForRouteControllers(
|
|
6
|
-
const
|
|
6
|
+
export function migrationStrategyForRouteControllers(options) {
|
|
7
|
+
const { podPath, projectRoot } = options;
|
|
8
|
+
|
|
9
|
+
const oldPaths = glob.sync(join('app', podPath, '**', 'controller.{js,ts}'), {
|
|
7
10
|
cwd: projectRoot,
|
|
8
11
|
});
|
|
9
12
|
|
|
@@ -11,7 +14,7 @@ export function migrationStrategyForRouteControllers(projectRoot) {
|
|
|
11
14
|
if (oldPath.endsWith('.ts')) {
|
|
12
15
|
return mapPaths(oldPath, {
|
|
13
16
|
find: {
|
|
14
|
-
directory: 'app',
|
|
17
|
+
directory: join('app', podPath),
|
|
15
18
|
file: 'controller.ts',
|
|
16
19
|
},
|
|
17
20
|
replace(key) {
|
|
@@ -22,7 +25,7 @@ export function migrationStrategyForRouteControllers(projectRoot) {
|
|
|
22
25
|
|
|
23
26
|
return mapPaths(oldPath, {
|
|
24
27
|
find: {
|
|
25
|
-
directory: 'app',
|
|
28
|
+
directory: join('app', podPath),
|
|
26
29
|
file: 'controller.js',
|
|
27
30
|
},
|
|
28
31
|
replace(key) {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import glob from 'glob';
|
|
2
|
+
import { join } from 'node:path';
|
|
2
3
|
|
|
3
4
|
import { mapPaths } from '../../../utils/map-paths.js';
|
|
4
5
|
|
|
5
|
-
export function migrationStrategyForRouteModels(
|
|
6
|
-
const
|
|
6
|
+
export function migrationStrategyForRouteModels(options) {
|
|
7
|
+
const { podPath, projectRoot } = options;
|
|
8
|
+
|
|
9
|
+
const oldPaths = glob.sync(join('app', podPath, '**', 'model.{js,ts}'), {
|
|
7
10
|
cwd: projectRoot,
|
|
8
11
|
});
|
|
9
12
|
|
|
@@ -11,7 +14,7 @@ export function migrationStrategyForRouteModels(projectRoot) {
|
|
|
11
14
|
if (oldPath.endsWith('.ts')) {
|
|
12
15
|
return mapPaths(oldPath, {
|
|
13
16
|
find: {
|
|
14
|
-
directory: 'app',
|
|
17
|
+
directory: join('app', podPath),
|
|
15
18
|
file: 'model.ts',
|
|
16
19
|
},
|
|
17
20
|
replace(key) {
|
|
@@ -22,7 +25,7 @@ export function migrationStrategyForRouteModels(projectRoot) {
|
|
|
22
25
|
|
|
23
26
|
return mapPaths(oldPath, {
|
|
24
27
|
find: {
|
|
25
|
-
directory: 'app',
|
|
28
|
+
directory: join('app', podPath),
|
|
26
29
|
file: 'model.js',
|
|
27
30
|
},
|
|
28
31
|
replace(key) {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import glob from 'glob';
|
|
2
|
+
import { join } from 'node:path';
|
|
2
3
|
|
|
3
4
|
import { mapPaths } from '../../../utils/map-paths.js';
|
|
4
5
|
|
|
5
|
-
export function migrationStrategyForRouteRoutes(
|
|
6
|
-
const
|
|
6
|
+
export function migrationStrategyForRouteRoutes(options) {
|
|
7
|
+
const { podPath, projectRoot } = options;
|
|
8
|
+
|
|
9
|
+
const oldPaths = glob.sync(join('app', podPath, '**', 'route.{js,ts}'), {
|
|
7
10
|
cwd: projectRoot,
|
|
8
11
|
});
|
|
9
12
|
|
|
@@ -11,7 +14,7 @@ export function migrationStrategyForRouteRoutes(projectRoot) {
|
|
|
11
14
|
if (oldPath.endsWith('.ts')) {
|
|
12
15
|
return mapPaths(oldPath, {
|
|
13
16
|
find: {
|
|
14
|
-
directory: 'app',
|
|
17
|
+
directory: join('app', podPath),
|
|
15
18
|
file: 'route.ts',
|
|
16
19
|
},
|
|
17
20
|
replace(key) {
|
|
@@ -22,7 +25,7 @@ export function migrationStrategyForRouteRoutes(projectRoot) {
|
|
|
22
25
|
|
|
23
26
|
return mapPaths(oldPath, {
|
|
24
27
|
find: {
|
|
25
|
-
directory: 'app',
|
|
28
|
+
directory: join('app', podPath),
|
|
26
29
|
file: 'route.js',
|
|
27
30
|
},
|
|
28
31
|
replace(key) {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import glob from 'glob';
|
|
2
|
+
import { join } from 'node:path';
|
|
2
3
|
|
|
3
4
|
import { mapPaths } from '../../../utils/map-paths.js';
|
|
4
5
|
|
|
5
|
-
export function migrationStrategyForRouteSerializers(
|
|
6
|
-
const
|
|
6
|
+
export function migrationStrategyForRouteSerializers(options) {
|
|
7
|
+
const { podPath, projectRoot } = options;
|
|
8
|
+
|
|
9
|
+
const oldPaths = glob.sync(join('app', podPath, '**', 'serializer.{js,ts}'), {
|
|
7
10
|
cwd: projectRoot,
|
|
8
11
|
});
|
|
9
12
|
|
|
@@ -11,7 +14,7 @@ export function migrationStrategyForRouteSerializers(projectRoot) {
|
|
|
11
14
|
if (oldPath.endsWith('.ts')) {
|
|
12
15
|
return mapPaths(oldPath, {
|
|
13
16
|
find: {
|
|
14
|
-
directory: 'app',
|
|
17
|
+
directory: join('app', podPath),
|
|
15
18
|
file: 'serializer.ts',
|
|
16
19
|
},
|
|
17
20
|
replace(key) {
|
|
@@ -22,7 +25,7 @@ export function migrationStrategyForRouteSerializers(projectRoot) {
|
|
|
22
25
|
|
|
23
26
|
return mapPaths(oldPath, {
|
|
24
27
|
find: {
|
|
25
|
-
directory: 'app',
|
|
28
|
+
directory: join('app', podPath),
|
|
26
29
|
file: 'serializer.js',
|
|
27
30
|
},
|
|
28
31
|
replace(key) {
|