ember-codemod-pod-to-octane 0.1.0 → 0.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.
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ 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
19
|
Step 3. Update relative paths in `import` statements.
|
|
20
20
|
|
|
@@ -87,7 +87,7 @@ To better meet your needs, consider forking the repo and running the codemod loc
|
|
|
87
87
|
|
|
88
88
|
```sh
|
|
89
89
|
cd <your/forked/repo>
|
|
90
|
-
./bin/ember-codemod-pod-to-octane <arguments>
|
|
90
|
+
./bin/ember-codemod-pod-to-octane.js <arguments>
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-codemod-pod-to-octane",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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",
|
|
@@ -8,6 +8,7 @@ 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
13
|
export function migrationStrategyForAppFolder(projectRoot) {
|
|
13
14
|
return new Map([
|
|
@@ -21,5 +22,6 @@ export function migrationStrategyForAppFolder(projectRoot) {
|
|
|
21
22
|
...migrationStrategyForRouteSerializers(projectRoot),
|
|
22
23
|
...migrationStrategyForRouteStylesheets(projectRoot),
|
|
23
24
|
...migrationStrategyForRouteTemplates(projectRoot),
|
|
25
|
+
...migrationStrategyForServices(projectRoot),
|
|
24
26
|
]);
|
|
25
27
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import glob from 'glob';
|
|
2
|
+
|
|
3
|
+
import { mapPaths } from '../../../utils/map-paths.js';
|
|
4
|
+
|
|
5
|
+
export function migrationStrategyForServices(projectRoot) {
|
|
6
|
+
const oldPaths = glob.sync('app/**/service.{js,ts}', {
|
|
7
|
+
cwd: projectRoot,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
return oldPaths.map((oldPath) => {
|
|
11
|
+
if (oldPath.endsWith('.ts')) {
|
|
12
|
+
return mapPaths(oldPath, {
|
|
13
|
+
find: {
|
|
14
|
+
directory: 'app',
|
|
15
|
+
file: 'service.ts',
|
|
16
|
+
},
|
|
17
|
+
replace(key) {
|
|
18
|
+
return `app/services/${key}.ts`;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return mapPaths(oldPath, {
|
|
24
|
+
find: {
|
|
25
|
+
directory: 'app',
|
|
26
|
+
file: 'service.js',
|
|
27
|
+
},
|
|
28
|
+
replace(key) {
|
|
29
|
+
return `app/services/${key}.js`;
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { migrationStrategyForComponents } from './components.js';
|
|
2
2
|
import { migrationStrategyForRouteControllers } from './route-controllers.js';
|
|
3
3
|
import { migrationStrategyForRouteRoutes } from './route-routes.js';
|
|
4
|
+
import { migrationStrategyForServices } from './services.js';
|
|
4
5
|
|
|
5
6
|
export function migrationStrategyForTestsFolder(projectRoot) {
|
|
6
7
|
return new Map([
|
|
7
8
|
...migrationStrategyForComponents(projectRoot),
|
|
8
9
|
...migrationStrategyForRouteControllers(projectRoot),
|
|
9
10
|
...migrationStrategyForRouteRoutes(projectRoot),
|
|
11
|
+
...migrationStrategyForServices(projectRoot),
|
|
10
12
|
]);
|
|
11
13
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import glob from 'glob';
|
|
2
|
+
|
|
3
|
+
import { mapPaths } from '../../../utils/map-paths.js';
|
|
4
|
+
|
|
5
|
+
export function migrationStrategyForServices(projectRoot) {
|
|
6
|
+
const oldPaths = glob.sync('tests/unit/!(services)/**/service-test.{js,ts}', {
|
|
7
|
+
cwd: projectRoot,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
return oldPaths.map((oldPath) => {
|
|
11
|
+
if (oldPath.endsWith('.ts')) {
|
|
12
|
+
return mapPaths(oldPath, {
|
|
13
|
+
find: {
|
|
14
|
+
directory: 'tests/unit',
|
|
15
|
+
file: 'service-test.ts',
|
|
16
|
+
},
|
|
17
|
+
replace(key) {
|
|
18
|
+
return `tests/unit/services/${key}-test.ts`;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return mapPaths(oldPath, {
|
|
24
|
+
find: {
|
|
25
|
+
directory: 'tests/unit',
|
|
26
|
+
file: 'service-test.js',
|
|
27
|
+
},
|
|
28
|
+
replace(key) {
|
|
29
|
+
return `tests/unit/services/${key}-test.js`;
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|