ember-codemod-pod-to-octane 4.0.6 → 4.1.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 +1 -1
- package/dist/src/migration/app/steps/create-file-path-maps/app/map-component-classes.js +4 -5
- package/dist/src/migration/app/steps/create-file-path-maps/app/map-component-stylesheets.js +4 -5
- package/dist/src/migration/app/steps/create-file-path-maps/app/map-component-templates.js +4 -5
- package/dist/src/migration/app/steps/create-file-path-maps/app/map-route-adapters.js +4 -5
- package/dist/src/migration/app/steps/create-file-path-maps/app/map-route-controllers.js +4 -5
- package/dist/src/migration/app/steps/create-file-path-maps/app/map-route-models.js +4 -5
- package/dist/src/migration/app/steps/create-file-path-maps/app/map-route-routes.js +4 -5
- package/dist/src/migration/app/steps/create-file-path-maps/app/map-route-serializers.js +4 -5
- package/dist/src/migration/app/steps/create-file-path-maps/app/map-route-stylesheets.js +5 -6
- package/dist/src/migration/app/steps/create-file-path-maps/app/map-route-templates.js +5 -6
- package/dist/src/migration/app/steps/create-file-path-maps/app/map-services.js +4 -5
- package/dist/src/migration/app/steps/create-file-path-maps/tests/map-components.js +4 -5
- package/dist/src/migration/app/steps/create-file-path-maps/tests/map-route-controllers.js +8 -9
- package/dist/src/migration/app/steps/create-file-path-maps/tests/map-route-routes.js +8 -9
- package/dist/src/migration/app/steps/create-file-path-maps/tests/map-services.js +5 -6
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-component-classes.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-component-stylesheets.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-component-templates.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-route-controllers.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-route-routes.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-route-stylesheets.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-route-templates.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-services.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-component-classes.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-component-templates.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-route-controllers.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-route-routes.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-route-templates.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-services.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/tests/map-components.js +2 -2
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/tests/map-route-controllers.js +4 -4
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/tests/map-route-routes.js +4 -4
- package/dist/src/migration/v1-addon/steps/create-file-path-maps/tests/map-services.js +2 -2
- package/dist/src/migration/v1-addon/steps/update-paths-in-app-folder.js +7 -7
- package/dist/src/utils/files/index.js +1 -0
- package/dist/src/utils/files/normalized-join.js +4 -0
- package/dist/src/utils/files/rename-pod-path.js +3 -8
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ pnpm build
|
|
|
147
147
|
> export function mapComponentClasses(options: Options): FilePathMapEntries {
|
|
148
148
|
> const { podPath, projectRoot } = options;
|
|
149
149
|
>
|
|
150
|
-
> const podDir =
|
|
150
|
+
> const podDir = normalizedJoin('app', podPath, 'components');
|
|
151
151
|
>
|
|
152
152
|
> - const filePaths = findFiles(`${podDir}/**/component.{d.ts,js,ts}`, {
|
|
153
153
|
> + const filePaths = findFiles(`${podDir}/navigation-menu/**/component.{d.ts,js,ts}`, {
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapComponentClasses(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('app', podPath, 'components');
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/component.{d.ts,js,ts}`, {
|
|
8
7
|
projectRoot,
|
|
9
8
|
});
|
|
10
9
|
return filePaths.map((oldFilePath) => {
|
|
11
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
11
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `app/components/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/components/${dir}`;
|
|
15
14
|
},
|
|
16
15
|
});
|
|
17
16
|
return [oldFilePath, newFilePath];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapComponentStylesheets(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('app', podPath, 'components');
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/styles.{css,scss}`, {
|
|
8
7
|
projectRoot,
|
|
9
8
|
});
|
|
10
9
|
return filePaths.map((oldFilePath) => {
|
|
11
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
11
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `app/components/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/components/${dir}`;
|
|
15
14
|
},
|
|
16
15
|
});
|
|
17
16
|
return [oldFilePath, newFilePath];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapComponentTemplates(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('app', podPath, 'components');
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/template.hbs`, {
|
|
8
7
|
projectRoot,
|
|
9
8
|
});
|
|
10
9
|
return filePaths.map((oldFilePath) => {
|
|
11
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
11
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `app/components/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/components/${dir}`;
|
|
15
14
|
},
|
|
16
15
|
});
|
|
17
16
|
return [oldFilePath, newFilePath];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapRouteAdapters(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('app', podPath);
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/adapter.{js,ts}`, {
|
|
8
7
|
projectRoot,
|
|
9
8
|
});
|
|
10
9
|
return filePaths.map((oldFilePath) => {
|
|
11
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
11
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `app/adapters/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/adapters/${dir}`;
|
|
15
14
|
},
|
|
16
15
|
});
|
|
17
16
|
return [oldFilePath, newFilePath];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapRouteControllers(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('app', podPath);
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/controller.{js,ts}`, {
|
|
8
7
|
projectRoot,
|
|
9
8
|
});
|
|
10
9
|
return filePaths.map((oldFilePath) => {
|
|
11
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
11
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `app/controllers/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/controllers/${dir}`;
|
|
15
14
|
},
|
|
16
15
|
});
|
|
17
16
|
return [oldFilePath, newFilePath];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapRouteModels(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('app', podPath);
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/model.{js,ts}`, {
|
|
8
7
|
projectRoot,
|
|
9
8
|
});
|
|
10
9
|
return filePaths.map((oldFilePath) => {
|
|
11
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
11
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `app/models/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/models/${dir}`;
|
|
15
14
|
},
|
|
16
15
|
});
|
|
17
16
|
return [oldFilePath, newFilePath];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapRouteRoutes(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('app', podPath);
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/route.{js,ts}`, {
|
|
8
7
|
projectRoot,
|
|
9
8
|
});
|
|
10
9
|
return filePaths.map((oldFilePath) => {
|
|
11
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
11
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `app/routes/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/routes/${dir}`;
|
|
15
14
|
},
|
|
16
15
|
});
|
|
17
16
|
return [oldFilePath, newFilePath];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapRouteSerializers(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('app', podPath);
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/serializer.{js,ts}`, {
|
|
8
7
|
projectRoot,
|
|
9
8
|
});
|
|
10
9
|
return filePaths.map((oldFilePath) => {
|
|
11
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
11
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `app/serializers/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/serializers/${dir}`;
|
|
15
14
|
},
|
|
16
15
|
});
|
|
17
16
|
return [oldFilePath, newFilePath];
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapRouteStylesheets(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('app', podPath);
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/styles.{css,scss}`, {
|
|
8
|
-
ignoreList: [
|
|
7
|
+
ignoreList: [normalizedJoin('app', podPath, 'components/**')],
|
|
9
8
|
projectRoot,
|
|
10
9
|
});
|
|
11
10
|
return filePaths.map((oldFilePath) => {
|
|
12
11
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
13
12
|
podDir,
|
|
14
|
-
replace: (
|
|
15
|
-
return `app/styles/${
|
|
13
|
+
replace: (dir) => {
|
|
14
|
+
return `app/styles/${dir}`;
|
|
16
15
|
},
|
|
17
16
|
});
|
|
18
17
|
return [oldFilePath, newFilePath];
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapRouteTemplates(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('app', podPath);
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/template.hbs`, {
|
|
8
|
-
ignoreList: [
|
|
7
|
+
ignoreList: [normalizedJoin('app', podPath, 'components/**')],
|
|
9
8
|
projectRoot,
|
|
10
9
|
});
|
|
11
10
|
return filePaths.map((oldFilePath) => {
|
|
12
11
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
13
12
|
podDir,
|
|
14
|
-
replace: (
|
|
15
|
-
return `app/templates/${
|
|
13
|
+
replace: (dir) => {
|
|
14
|
+
return `app/templates/${dir}`;
|
|
16
15
|
},
|
|
17
16
|
});
|
|
18
17
|
return [oldFilePath, newFilePath];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapServices(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('app', podPath);
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/service.{js,ts}`, {
|
|
8
7
|
projectRoot,
|
|
9
8
|
});
|
|
10
9
|
return filePaths.map((oldFilePath) => {
|
|
11
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
11
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `app/services/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/services/${dir}`;
|
|
15
14
|
},
|
|
16
15
|
});
|
|
17
16
|
return [oldFilePath, newFilePath];
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapComponents(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('tests/integration', podPath, 'components');
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/component-test.{js,ts}`, {
|
|
8
7
|
projectRoot,
|
|
9
8
|
});
|
|
10
9
|
return filePaths.map((oldFilePath) => {
|
|
11
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
11
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `tests/integration/components/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `tests/integration/components/${dir}-test`;
|
|
15
14
|
},
|
|
16
15
|
});
|
|
17
16
|
return [oldFilePath, newFilePath];
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapRouteControllers(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
5
|
/*
|
|
7
6
|
Case 1: Didn't pass the --pod flag, but configured { usePods: true } in .ember-cli
|
|
8
7
|
*/
|
|
9
|
-
const podDir1 =
|
|
8
|
+
const podDir1 = normalizedJoin('tests/unit', podPath);
|
|
10
9
|
const filePaths1 = findFiles(`${podDir1}/**/controller-test.{js,ts}`, {
|
|
11
|
-
ignoreList: [
|
|
10
|
+
ignoreList: [normalizedJoin('tests/unit', podPath, 'controllers/**')],
|
|
12
11
|
projectRoot,
|
|
13
12
|
});
|
|
14
13
|
const filePathMap1 = filePaths1.map((oldFilePath) => {
|
|
15
14
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
16
15
|
podDir: podDir1,
|
|
17
|
-
replace: (
|
|
18
|
-
return `tests/unit/controllers/${
|
|
16
|
+
replace: (dir) => {
|
|
17
|
+
return `tests/unit/controllers/${dir}-test`;
|
|
19
18
|
},
|
|
20
19
|
});
|
|
21
20
|
return [oldFilePath, newFilePath];
|
|
@@ -23,15 +22,15 @@ export function mapRouteControllers(options) {
|
|
|
23
22
|
/*
|
|
24
23
|
Case 2: Passed the --pod flag to Ember CLI
|
|
25
24
|
*/
|
|
26
|
-
const podDir2 =
|
|
25
|
+
const podDir2 = normalizedJoin('tests/unit', podPath, 'controllers');
|
|
27
26
|
const filePaths2 = findFiles(`${podDir2}/**/controller-test.{js,ts}`, {
|
|
28
27
|
projectRoot,
|
|
29
28
|
});
|
|
30
29
|
const filePathMap2 = filePaths2.map((oldFilePath) => {
|
|
31
30
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
32
31
|
podDir: podDir2,
|
|
33
|
-
replace: (
|
|
34
|
-
return `tests/unit/controllers/${
|
|
32
|
+
replace: (dir) => {
|
|
33
|
+
return `tests/unit/controllers/${dir}-test`;
|
|
35
34
|
},
|
|
36
35
|
});
|
|
37
36
|
return [oldFilePath, newFilePath];
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapRouteRoutes(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
5
|
/*
|
|
7
6
|
Case 1: Didn't pass the --pod flag, but configured { usePods: true } in .ember-cli
|
|
8
7
|
*/
|
|
9
|
-
const podDir1 =
|
|
8
|
+
const podDir1 = normalizedJoin('tests/unit', podPath);
|
|
10
9
|
const filePaths1 = findFiles(`${podDir1}/**/route-test.{js,ts}`, {
|
|
11
|
-
ignoreList: [
|
|
10
|
+
ignoreList: [normalizedJoin('tests/unit', podPath, 'routes/**')],
|
|
12
11
|
projectRoot,
|
|
13
12
|
});
|
|
14
13
|
const filePathMap1 = filePaths1.map((oldFilePath) => {
|
|
15
14
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
16
15
|
podDir: podDir1,
|
|
17
|
-
replace: (
|
|
18
|
-
return `tests/unit/routes/${
|
|
16
|
+
replace: (dir) => {
|
|
17
|
+
return `tests/unit/routes/${dir}-test`;
|
|
19
18
|
},
|
|
20
19
|
});
|
|
21
20
|
return [oldFilePath, newFilePath];
|
|
@@ -23,15 +22,15 @@ export function mapRouteRoutes(options) {
|
|
|
23
22
|
/*
|
|
24
23
|
Case 2: Passed the --pod flag to Ember CLI
|
|
25
24
|
*/
|
|
26
|
-
const podDir2 =
|
|
25
|
+
const podDir2 = normalizedJoin('tests/unit', podPath, 'routes');
|
|
27
26
|
const filePaths2 = findFiles(`${podDir2}/**/route-test.{js,ts}`, {
|
|
28
27
|
projectRoot,
|
|
29
28
|
});
|
|
30
29
|
const filePathMap2 = filePaths2.map((oldFilePath) => {
|
|
31
30
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
32
31
|
podDir: podDir2,
|
|
33
|
-
replace: (
|
|
34
|
-
return `tests/unit/routes/${
|
|
32
|
+
replace: (dir) => {
|
|
33
|
+
return `tests/unit/routes/${dir}-test`;
|
|
35
34
|
},
|
|
36
35
|
});
|
|
37
36
|
return [oldFilePath, newFilePath];
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
1
|
import { findFiles } from '@codemod-utils/files';
|
|
3
|
-
import { renamePodPath } from '../../../../../utils/files/index.js';
|
|
2
|
+
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
|
|
4
3
|
export function mapServices(options) {
|
|
5
4
|
const { podPath, projectRoot } = options;
|
|
6
|
-
const podDir =
|
|
5
|
+
const podDir = normalizedJoin('tests/unit', podPath);
|
|
7
6
|
const filePaths = findFiles(`${podDir}/**/service-test.{js,ts}`, {
|
|
8
|
-
ignoreList: [
|
|
7
|
+
ignoreList: [normalizedJoin('tests/unit', podPath, 'services/**')],
|
|
9
8
|
projectRoot,
|
|
10
9
|
});
|
|
11
10
|
return filePaths.map((oldFilePath) => {
|
|
12
11
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
13
12
|
podDir,
|
|
14
|
-
replace: (
|
|
15
|
-
return `tests/unit/services/${
|
|
13
|
+
replace: (dir) => {
|
|
14
|
+
return `tests/unit/services/${dir}-test`;
|
|
16
15
|
},
|
|
17
16
|
});
|
|
18
17
|
return [oldFilePath, newFilePath];
|
package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-component-classes.js
CHANGED
|
@@ -9,8 +9,8 @@ export function mapComponentClasses(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `addon/components/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `addon/components/${dir}`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-component-stylesheets.js
CHANGED
|
@@ -9,8 +9,8 @@ export function mapComponentStylesheets(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `addon/components/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `addon/components/${dir}`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-component-templates.js
CHANGED
|
@@ -9,8 +9,8 @@ export function mapComponentTemplates(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `addon/components/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `addon/components/${dir}`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-route-controllers.js
CHANGED
|
@@ -9,8 +9,8 @@ export function mapRouteControllers(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `addon/controllers/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `addon/controllers/${dir}`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
|
@@ -9,8 +9,8 @@ export function mapRouteRoutes(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `addon/routes/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `addon/routes/${dir}`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-route-stylesheets.js
CHANGED
|
@@ -10,8 +10,8 @@ export function mapRouteStylesheets(options) {
|
|
|
10
10
|
return filePaths.map((oldFilePath) => {
|
|
11
11
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
12
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `addon/styles/${
|
|
13
|
+
replace: (dir) => {
|
|
14
|
+
return `addon/styles/${dir}`;
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
return [oldFilePath, newFilePath];
|
package/dist/src/migration/v1-addon/steps/create-file-path-maps/addon/map-route-templates.js
CHANGED
|
@@ -10,8 +10,8 @@ export function mapRouteTemplates(options) {
|
|
|
10
10
|
return filePaths.map((oldFilePath) => {
|
|
11
11
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
12
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `addon/templates/${
|
|
13
|
+
replace: (dir) => {
|
|
14
|
+
return `addon/templates/${dir}`;
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
return [oldFilePath, newFilePath];
|
|
@@ -9,8 +9,8 @@ export function mapServices(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `addon/services/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `addon/services/${dir}`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-component-classes.js
CHANGED
|
@@ -9,8 +9,8 @@ export function mapComponentClasses(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `app/components/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/components/${dir}`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-component-templates.js
CHANGED
|
@@ -9,8 +9,8 @@ export function mapComponentTemplates(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `app/components/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/components/${dir}`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
package/dist/src/migration/v1-addon/steps/create-file-path-maps/app/map-route-controllers.js
CHANGED
|
@@ -9,8 +9,8 @@ export function mapRouteControllers(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `app/controllers/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/controllers/${dir}`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
|
@@ -9,8 +9,8 @@ export function mapRouteRoutes(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `app/routes/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/routes/${dir}`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
|
@@ -10,8 +10,8 @@ export function mapRouteTemplates(options) {
|
|
|
10
10
|
return filePaths.map((oldFilePath) => {
|
|
11
11
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
12
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `app/templates/${
|
|
13
|
+
replace: (dir) => {
|
|
14
|
+
return `app/templates/${dir}`;
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
return [oldFilePath, newFilePath];
|
|
@@ -9,8 +9,8 @@ export function mapServices(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `app/services/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `app/services/${dir}`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
|
@@ -9,8 +9,8 @@ export function mapComponents(options) {
|
|
|
9
9
|
return filePaths.map((oldFilePath) => {
|
|
10
10
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
11
11
|
podDir,
|
|
12
|
-
replace: (
|
|
13
|
-
return `tests/integration/components/${
|
|
12
|
+
replace: (dir) => {
|
|
13
|
+
return `tests/integration/components/${dir}-test`;
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
return [oldFilePath, newFilePath];
|
package/dist/src/migration/v1-addon/steps/create-file-path-maps/tests/map-route-controllers.js
CHANGED
|
@@ -13,8 +13,8 @@ export function mapRouteControllers(options) {
|
|
|
13
13
|
const filePathMap1 = filePaths1.map((oldFilePath) => {
|
|
14
14
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
15
15
|
podDir: podDir1,
|
|
16
|
-
replace: (
|
|
17
|
-
return `tests/unit/controllers/${
|
|
16
|
+
replace: (dir) => {
|
|
17
|
+
return `tests/unit/controllers/${dir}-test`;
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
20
|
return [oldFilePath, newFilePath];
|
|
@@ -29,8 +29,8 @@ export function mapRouteControllers(options) {
|
|
|
29
29
|
const filePathMap2 = filePaths2.map((oldFilePath) => {
|
|
30
30
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
31
31
|
podDir: podDir2,
|
|
32
|
-
replace: (
|
|
33
|
-
return `tests/unit/controllers/${
|
|
32
|
+
replace: (dir) => {
|
|
33
|
+
return `tests/unit/controllers/${dir}-test`;
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
36
|
return [oldFilePath, newFilePath];
|
|
@@ -13,8 +13,8 @@ export function mapRouteRoutes(options) {
|
|
|
13
13
|
const filePathMap1 = filePaths1.map((oldFilePath) => {
|
|
14
14
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
15
15
|
podDir: podDir1,
|
|
16
|
-
replace: (
|
|
17
|
-
return `tests/unit/routes/${
|
|
16
|
+
replace: (dir) => {
|
|
17
|
+
return `tests/unit/routes/${dir}-test`;
|
|
18
18
|
},
|
|
19
19
|
});
|
|
20
20
|
return [oldFilePath, newFilePath];
|
|
@@ -29,8 +29,8 @@ export function mapRouteRoutes(options) {
|
|
|
29
29
|
const filePathMap2 = filePaths2.map((oldFilePath) => {
|
|
30
30
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
31
31
|
podDir: podDir2,
|
|
32
|
-
replace: (
|
|
33
|
-
return `tests/unit/routes/${
|
|
32
|
+
replace: (dir) => {
|
|
33
|
+
return `tests/unit/routes/${dir}-test`;
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
36
|
return [oldFilePath, newFilePath];
|
|
@@ -10,8 +10,8 @@ export function mapServices(options) {
|
|
|
10
10
|
return filePaths.map((oldFilePath) => {
|
|
11
11
|
const newFilePath = renamePodPath(oldFilePath, {
|
|
12
12
|
podDir,
|
|
13
|
-
replace: (
|
|
14
|
-
return `tests/unit/services/${
|
|
13
|
+
replace: (dir) => {
|
|
14
|
+
return `tests/unit/services/${dir}-test`;
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
17
|
return [oldFilePath, newFilePath];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
2
|
+
import { join, relative, sep } from 'node:path';
|
|
3
|
+
function getReexportPath(filePath) {
|
|
4
|
+
return relative('app', filePath).replace(/\.js$/, '').replaceAll(sep, '/');
|
|
5
|
+
}
|
|
3
6
|
export function updatePathsInAppFolder(filePathMap, options) {
|
|
4
7
|
const { projectRoot } = options;
|
|
5
8
|
filePathMap.forEach((newFilePath, oldFilePath) => {
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const newText = newFilePath.replace(/^app\//, '').replace(/\.js$/, '');
|
|
10
|
-
const newFile = file.replace(new RegExp(text), newText);
|
|
11
|
-
writeFileSync(newAbsolutePath, newFile, 'utf8');
|
|
9
|
+
const oldFile = readFileSync(join(projectRoot, newFilePath), 'utf8');
|
|
10
|
+
const newFile = oldFile.replace(getReexportPath(oldFilePath), getReexportPath(newFilePath));
|
|
11
|
+
writeFileSync(join(projectRoot, newFilePath), newFile, 'utf8');
|
|
12
12
|
});
|
|
13
13
|
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
+
import { normalize, relative } from 'node:path';
|
|
1
2
|
import { parseFilePath } from '@codemod-utils/files';
|
|
2
3
|
export function renamePodPath(filePath, options) {
|
|
3
|
-
const { dir, ext, name } = parseFilePath(filePath);
|
|
4
4
|
const { podDir, replace } = options;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
const key = filePath
|
|
9
|
-
.replace(new RegExp(`^${podDir}/`), '')
|
|
10
|
-
.replace(new RegExp(`/${name}${ext}$`), '');
|
|
11
|
-
return `${replace(key)}${ext}`;
|
|
5
|
+
const { dir, ext } = parseFilePath(relative(podDir, filePath));
|
|
6
|
+
return `${normalize(replace(dir))}${ext}`;
|
|
12
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-codemod-pod-to-octane",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "Codemod to un-pod Ember apps, addons, and engines",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemod",
|
|
@@ -24,30 +24,30 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@codemod-utils/files": "^3.
|
|
27
|
+
"@codemod-utils/files": "^3.2.1",
|
|
28
28
|
"yargs": "^18.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@changesets/cli": "^2.29.
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@ijlee2-frontend-configs/eslint-config-node": "^2.
|
|
35
|
-
"@ijlee2-frontend-configs/prettier": "^2.
|
|
31
|
+
"@changesets/cli": "^2.29.8",
|
|
32
|
+
"@codemod-utils/tests": "^2.2.0",
|
|
33
|
+
"@ijlee2-frontend-configs/changesets": "^1.0.0",
|
|
34
|
+
"@ijlee2-frontend-configs/eslint-config-node": "^2.3.1",
|
|
35
|
+
"@ijlee2-frontend-configs/prettier": "^2.3.1",
|
|
36
36
|
"@sondr3/minitest": "^0.1.2",
|
|
37
37
|
"@tsconfig/node20": "^20.1.8",
|
|
38
38
|
"@tsconfig/strictest": "^2.0.8",
|
|
39
|
-
"@types/node": "^20.19.
|
|
39
|
+
"@types/node": "^20.19.26",
|
|
40
40
|
"@types/yargs": "^17.0.35",
|
|
41
41
|
"concurrently": "^9.2.1",
|
|
42
42
|
"eslint": "^9.39.1",
|
|
43
|
-
"prettier": "^3.
|
|
43
|
+
"prettier": "^3.7.4",
|
|
44
44
|
"typescript": "^5.9.3"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": "20.* || >= 22"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
|
-
"build": "
|
|
50
|
+
"build": "sh build.sh --production",
|
|
51
51
|
"format": "prettier . --cache --write",
|
|
52
52
|
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
|
|
53
53
|
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\" && pnpm format",
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
"lint:types": "tsc --noEmit",
|
|
58
58
|
"release:prepare": "changeset version",
|
|
59
59
|
"release:publish": "pnpm build && changeset publish",
|
|
60
|
-
"test": "
|
|
60
|
+
"test": "sh build.sh --test && mt dist-for-testing --quiet"
|
|
61
61
|
}
|
|
62
62
|
}
|