ember-codemod-pod-to-octane 1.1.2 → 1.1.4
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/package.json +14 -13
- package/src/migration/ember-addon/addon/component-classes.js +10 -34
- package/src/migration/ember-addon/addon/component-stylesheets.js +10 -22
- package/src/migration/ember-addon/addon/component-templates.js +10 -10
- package/src/migration/ember-addon/app/component-classes.js +10 -10
- package/src/migration/ember-addon/app/component-stylesheets.js +10 -10
- package/src/migration/ember-addon/app/component-templates.js +10 -10
- package/src/migration/ember-addon/steps/create-options.js +3 -36
- package/src/migration/ember-addon/tests/components.js +10 -22
- package/src/migration/ember-app/app/component-classes.js +10 -34
- package/src/migration/ember-app/app/component-stylesheets.js +10 -22
- package/src/migration/ember-app/app/component-templates.js +10 -10
- package/src/migration/ember-app/app/route-adapters.js +10 -22
- package/src/migration/ember-app/app/route-controllers.js +14 -23
- package/src/migration/ember-app/app/route-models.js +10 -22
- package/src/migration/ember-app/app/route-routes.js +10 -22
- package/src/migration/ember-app/app/route-serializers.js +14 -23
- package/src/migration/ember-app/app/route-stylesheets.js +10 -22
- package/src/migration/ember-app/app/route-templates.js +10 -10
- package/src/migration/ember-app/app/services.js +10 -22
- package/src/migration/ember-app/steps/create-options.js +3 -36
- package/src/migration/ember-app/tests/components.js +10 -22
- package/src/migration/ember-app/tests/route-controllers.js +20 -42
- package/src/migration/ember-app/tests/route-routes.js +20 -42
- package/src/migration/ember-app/tests/services.js +10 -22
- package/src/migration/ember-engine/addon/component-classes.js +10 -34
- package/src/migration/ember-engine/addon/component-stylesheets.js +10 -22
- package/src/migration/ember-engine/addon/component-templates.js +10 -10
- package/src/migration/ember-engine/addon/route-controllers.js +10 -22
- package/src/migration/ember-engine/addon/route-routes.js +10 -22
- package/src/migration/ember-engine/addon/route-stylesheets.js +10 -22
- package/src/migration/ember-engine/addon/route-templates.js +10 -10
- package/src/migration/ember-engine/steps/create-options.js +3 -36
- package/src/migration/ember-engine/steps/update-absolute-paths.js +1 -1
- package/src/migration/ember-engine/steps/use-absolute-paths.js +1 -1
- package/src/migration/ember-engine/steps/use-relative-paths.js +3 -3
- package/src/migration/ember-engine/tests/components.js +10 -22
- package/src/migration/ember-engine/tests/route-controllers.js +20 -42
- package/src/migration/ember-engine/tests/route-routes.js +20 -42
- package/src/utils/ember-addon/app/components.js +9 -4
- package/src/utils/files/map-file-path.js +0 -17
- package/src/utils/files.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-codemod-pod-to-octane",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Codemod to un-pod Ember apps, addons, and engines",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemod",
|
|
@@ -24,16 +24,23 @@
|
|
|
24
24
|
"bin/",
|
|
25
25
|
"src/"
|
|
26
26
|
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"changelog": "lerna-changelog",
|
|
29
|
+
"lint": "eslint . --cache",
|
|
30
|
+
"lint:fix": "eslint . --fix",
|
|
31
|
+
"test": "mt tests --quiet"
|
|
32
|
+
},
|
|
27
33
|
"dependencies": {
|
|
28
|
-
"@codemod-utils/files": "^0.1
|
|
34
|
+
"@codemod-utils/files": "^0.3.1",
|
|
35
|
+
"@codemod-utils/json": "^0.1.2",
|
|
29
36
|
"yargs": "^17.7.2"
|
|
30
37
|
},
|
|
31
38
|
"devDependencies": {
|
|
32
|
-
"@babel/core": "^7.
|
|
33
|
-
"@babel/eslint-parser": "^7.
|
|
34
|
-
"@codemod-utils/tests": "^0.1.
|
|
39
|
+
"@babel/core": "^7.22.5",
|
|
40
|
+
"@babel/eslint-parser": "^7.22.5",
|
|
41
|
+
"@codemod-utils/tests": "^0.1.2",
|
|
35
42
|
"@sondr3/minitest": "^0.1.1",
|
|
36
|
-
"eslint": "^8.
|
|
43
|
+
"eslint": "^8.42.0",
|
|
37
44
|
"eslint-config-prettier": "^8.8.0",
|
|
38
45
|
"eslint-plugin-import": "^2.27.5",
|
|
39
46
|
"eslint-plugin-n": "^16.0.0",
|
|
@@ -54,11 +61,5 @@
|
|
|
54
61
|
"enhance: documentation": "Documentation",
|
|
55
62
|
"user feedback": "User Feedback"
|
|
56
63
|
}
|
|
57
|
-
},
|
|
58
|
-
"scripts": {
|
|
59
|
-
"changelog": "lerna-changelog",
|
|
60
|
-
"lint": "eslint . --cache",
|
|
61
|
-
"lint:fix": "eslint . --fix",
|
|
62
|
-
"test": "mt tests --quiet"
|
|
63
64
|
}
|
|
64
|
-
}
|
|
65
|
+
}
|
|
@@ -1,47 +1,23 @@
|
|
|
1
|
-
import { findFiles } from '@codemod-utils/files';
|
|
2
|
-
|
|
3
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
1
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
4
2
|
|
|
5
3
|
export function migrationStrategyForComponentClasses(options) {
|
|
6
4
|
const { projectRoot } = options;
|
|
7
5
|
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
const filePaths = findFiles('addon/components/**/component.{d.ts,js,ts}', {
|
|
7
|
+
projectRoot,
|
|
10
8
|
});
|
|
11
9
|
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
return mapFilePath(oldPath, {
|
|
15
|
-
find: {
|
|
16
|
-
directory: 'addon/components',
|
|
17
|
-
file: 'component.d.ts',
|
|
18
|
-
},
|
|
19
|
-
replace(key) {
|
|
20
|
-
return `addon/components/${key}.d.ts`;
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (oldPath.endsWith('.ts')) {
|
|
26
|
-
return mapFilePath(oldPath, {
|
|
27
|
-
find: {
|
|
28
|
-
directory: 'addon/components',
|
|
29
|
-
file: 'component.ts',
|
|
30
|
-
},
|
|
31
|
-
replace(key) {
|
|
32
|
-
return `addon/components/${key}.ts`;
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return mapFilePath(oldPath, {
|
|
10
|
+
return filePaths.map((oldFilePath) => {
|
|
11
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
38
12
|
find: {
|
|
39
13
|
directory: 'addon/components',
|
|
40
|
-
file: 'component
|
|
14
|
+
file: 'component',
|
|
41
15
|
},
|
|
42
|
-
replace(key) {
|
|
43
|
-
return `addon/components/${key}
|
|
16
|
+
replace: (key) => {
|
|
17
|
+
return `addon/components/${key}`;
|
|
44
18
|
},
|
|
45
19
|
});
|
|
20
|
+
|
|
21
|
+
return [oldFilePath, newFilePath];
|
|
46
22
|
});
|
|
47
23
|
}
|
|
@@ -1,35 +1,23 @@
|
|
|
1
|
-
import { findFiles } from '@codemod-utils/files';
|
|
2
|
-
|
|
3
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
1
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
4
2
|
|
|
5
3
|
export function migrationStrategyForComponentStylesheets(options) {
|
|
6
4
|
const { projectRoot } = options;
|
|
7
5
|
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
const filePaths = findFiles('addon/components/**/styles.{css,scss}', {
|
|
7
|
+
projectRoot,
|
|
10
8
|
});
|
|
11
9
|
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
return mapFilePath(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
|
-
|
|
25
|
-
return mapFilePath(oldPath, {
|
|
10
|
+
return filePaths.map((oldFilePath) => {
|
|
11
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
26
12
|
find: {
|
|
27
13
|
directory: 'addon/components',
|
|
28
|
-
file: 'styles
|
|
14
|
+
file: 'styles',
|
|
29
15
|
},
|
|
30
|
-
replace(key) {
|
|
31
|
-
return `addon/components/${key}
|
|
16
|
+
replace: (key) => {
|
|
17
|
+
return `addon/components/${key}`;
|
|
32
18
|
},
|
|
33
19
|
});
|
|
20
|
+
|
|
21
|
+
return [oldFilePath, newFilePath];
|
|
34
22
|
});
|
|
35
23
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { findFiles } from '@codemod-utils/files';
|
|
2
|
-
|
|
3
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
1
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
4
2
|
|
|
5
3
|
export function migrationStrategyForComponentTemplates(options) {
|
|
6
4
|
const { projectRoot } = options;
|
|
7
5
|
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
const filePaths = findFiles('addon/components/**/template.hbs', {
|
|
7
|
+
projectRoot,
|
|
10
8
|
});
|
|
11
9
|
|
|
12
|
-
return
|
|
13
|
-
|
|
10
|
+
return filePaths.map((oldFilePath) => {
|
|
11
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
14
12
|
find: {
|
|
15
13
|
directory: 'addon/components',
|
|
16
|
-
file: 'template
|
|
14
|
+
file: 'template',
|
|
17
15
|
},
|
|
18
|
-
replace(key) {
|
|
19
|
-
return `addon/components/${key}
|
|
16
|
+
replace: (key) => {
|
|
17
|
+
return `addon/components/${key}`;
|
|
20
18
|
},
|
|
21
19
|
});
|
|
20
|
+
|
|
21
|
+
return [oldFilePath, newFilePath];
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { findFiles } from '@codemod-utils/files';
|
|
2
|
-
|
|
3
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
1
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
4
2
|
|
|
5
3
|
export function migrationStrategyForComponentClasses(options) {
|
|
6
4
|
const { projectRoot } = options;
|
|
7
5
|
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
const filePaths = findFiles('app/components/**/component.js', {
|
|
7
|
+
projectRoot,
|
|
10
8
|
});
|
|
11
9
|
|
|
12
|
-
return
|
|
13
|
-
|
|
10
|
+
return filePaths.map((oldFilePath) => {
|
|
11
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
14
12
|
find: {
|
|
15
13
|
directory: 'app/components',
|
|
16
|
-
file: 'component
|
|
14
|
+
file: 'component',
|
|
17
15
|
},
|
|
18
|
-
replace(key) {
|
|
19
|
-
return `app/components/${key}
|
|
16
|
+
replace: (key) => {
|
|
17
|
+
return `app/components/${key}`;
|
|
20
18
|
},
|
|
21
19
|
});
|
|
20
|
+
|
|
21
|
+
return [oldFilePath, newFilePath];
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { findFiles } from '@codemod-utils/files';
|
|
2
|
-
|
|
3
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
1
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
4
2
|
|
|
5
3
|
export function migrationStrategyForComponentStylesheets(options) {
|
|
6
4
|
const { projectRoot } = options;
|
|
7
5
|
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
const filePaths = findFiles('app/components/**/styles.js', {
|
|
7
|
+
projectRoot,
|
|
10
8
|
});
|
|
11
9
|
|
|
12
|
-
return
|
|
13
|
-
|
|
10
|
+
return filePaths.map((oldFilePath) => {
|
|
11
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
14
12
|
find: {
|
|
15
13
|
directory: 'app/components',
|
|
16
|
-
file: 'styles
|
|
14
|
+
file: 'styles',
|
|
17
15
|
},
|
|
18
|
-
replace(key) {
|
|
19
|
-
return `app/components/${key}
|
|
16
|
+
replace: (key) => {
|
|
17
|
+
return `app/components/${key}`;
|
|
20
18
|
},
|
|
21
19
|
});
|
|
20
|
+
|
|
21
|
+
return [oldFilePath, newFilePath];
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { findFiles } from '@codemod-utils/files';
|
|
2
|
-
|
|
3
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
1
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
4
2
|
|
|
5
3
|
export function migrationStrategyForComponentTemplates(options) {
|
|
6
4
|
const { projectRoot } = options;
|
|
7
5
|
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
const filePaths = findFiles('app/components/**/template.js', {
|
|
7
|
+
projectRoot,
|
|
10
8
|
});
|
|
11
9
|
|
|
12
|
-
return
|
|
13
|
-
|
|
10
|
+
return filePaths.map((oldFilePath) => {
|
|
11
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
14
12
|
find: {
|
|
15
13
|
directory: 'app/components',
|
|
16
|
-
file: 'template
|
|
14
|
+
file: 'template',
|
|
17
15
|
},
|
|
18
|
-
replace(key) {
|
|
19
|
-
return `app/components/${key}
|
|
16
|
+
replace: (key) => {
|
|
17
|
+
return `app/components/${key}`;
|
|
20
18
|
},
|
|
21
19
|
});
|
|
20
|
+
|
|
21
|
+
return [oldFilePath, newFilePath];
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -1,44 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
function analyzePackageJson(codemodOptions) {
|
|
5
|
-
const { projectRoot } = codemodOptions;
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
const packageJsonFile = readFileSync(
|
|
9
|
-
join(projectRoot, 'package.json'),
|
|
10
|
-
'utf8',
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
const { name } = JSON.parse(packageJsonFile);
|
|
14
|
-
|
|
15
|
-
if (!name) {
|
|
16
|
-
throw new SyntaxError('Package name is missing.');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (name.includes('/')) {
|
|
20
|
-
// eslint-disable-next-line no-unused-vars
|
|
21
|
-
const [scope, packageName] = name.split('/');
|
|
22
|
-
|
|
23
|
-
if (!packageName) {
|
|
24
|
-
throw new SyntaxError('Package name is missing.');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return name;
|
|
29
|
-
} catch (e) {
|
|
30
|
-
throw new SyntaxError(
|
|
31
|
-
`ERROR: package.json is missing or is not valid. (${e.message})\n`,
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
import { readPackageJson } from '@codemod-utils/json';
|
|
35
2
|
|
|
36
3
|
export function createOptions(codemodOptions) {
|
|
37
|
-
const
|
|
4
|
+
const { name } = readPackageJson(codemodOptions);
|
|
38
5
|
|
|
39
6
|
return {
|
|
40
7
|
podPath: codemodOptions.podPath,
|
|
41
|
-
projectName,
|
|
8
|
+
projectName: name,
|
|
42
9
|
projectRoot: codemodOptions.projectRoot,
|
|
43
10
|
projectType: codemodOptions.projectType,
|
|
44
11
|
testRun: codemodOptions.testRun,
|
|
@@ -1,38 +1,26 @@
|
|
|
1
|
-
import { findFiles } from '@codemod-utils/files';
|
|
2
|
-
|
|
3
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
1
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
4
2
|
|
|
5
3
|
export function migrationStrategyForComponents(options) {
|
|
6
4
|
const { projectRoot } = options;
|
|
7
5
|
|
|
8
|
-
const
|
|
6
|
+
const filePaths = findFiles(
|
|
9
7
|
'tests/integration/components/**/component-test.{js,ts}',
|
|
10
8
|
{
|
|
11
|
-
|
|
9
|
+
projectRoot,
|
|
12
10
|
},
|
|
13
11
|
);
|
|
14
12
|
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
return mapFilePath(oldPath, {
|
|
18
|
-
find: {
|
|
19
|
-
directory: 'tests/integration/components',
|
|
20
|
-
file: 'component-test.ts',
|
|
21
|
-
},
|
|
22
|
-
replace(key) {
|
|
23
|
-
return `tests/integration/components/${key}-test.ts`;
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return mapFilePath(oldPath, {
|
|
13
|
+
return filePaths.map((oldFilePath) => {
|
|
14
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
29
15
|
find: {
|
|
30
16
|
directory: 'tests/integration/components',
|
|
31
|
-
file: 'component-test
|
|
17
|
+
file: 'component-test',
|
|
32
18
|
},
|
|
33
|
-
replace(key) {
|
|
34
|
-
return `tests/integration/components/${key}-test
|
|
19
|
+
replace: (key) => {
|
|
20
|
+
return `tests/integration/components/${key}-test`;
|
|
35
21
|
},
|
|
36
22
|
});
|
|
23
|
+
|
|
24
|
+
return [oldFilePath, newFilePath];
|
|
37
25
|
});
|
|
38
26
|
}
|
|
@@ -1,52 +1,28 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
|
|
3
|
-
import { findFiles } from '@codemod-utils/files';
|
|
4
|
-
|
|
5
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
3
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
6
4
|
|
|
7
5
|
export function migrationStrategyForComponentClasses(options) {
|
|
8
6
|
const { podPath, projectRoot } = options;
|
|
9
7
|
|
|
10
|
-
const
|
|
8
|
+
const filePaths = findFiles(
|
|
11
9
|
join('app', podPath, 'components', '**', 'component.{d.ts,js,ts}'),
|
|
12
10
|
{
|
|
13
|
-
|
|
11
|
+
projectRoot,
|
|
14
12
|
},
|
|
15
13
|
);
|
|
16
14
|
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
return mapFilePath(oldPath, {
|
|
20
|
-
find: {
|
|
21
|
-
directory: join('app', podPath, 'components'),
|
|
22
|
-
file: 'component.d.ts',
|
|
23
|
-
},
|
|
24
|
-
replace(key) {
|
|
25
|
-
return `app/components/${key}.d.ts`;
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (oldPath.endsWith('.ts')) {
|
|
31
|
-
return mapFilePath(oldPath, {
|
|
32
|
-
find: {
|
|
33
|
-
directory: join('app', podPath, 'components'),
|
|
34
|
-
file: 'component.ts',
|
|
35
|
-
},
|
|
36
|
-
replace(key) {
|
|
37
|
-
return `app/components/${key}.ts`;
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return mapFilePath(oldPath, {
|
|
15
|
+
return filePaths.map((oldFilePath) => {
|
|
16
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
43
17
|
find: {
|
|
44
18
|
directory: join('app', podPath, 'components'),
|
|
45
|
-
file: 'component
|
|
19
|
+
file: 'component',
|
|
46
20
|
},
|
|
47
|
-
replace(key) {
|
|
48
|
-
return `app/components/${key}
|
|
21
|
+
replace: (key) => {
|
|
22
|
+
return `app/components/${key}`;
|
|
49
23
|
},
|
|
50
24
|
});
|
|
25
|
+
|
|
26
|
+
return [oldFilePath, newFilePath];
|
|
51
27
|
});
|
|
52
28
|
}
|
|
@@ -1,40 +1,28 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
|
|
3
|
-
import { findFiles } from '@codemod-utils/files';
|
|
4
|
-
|
|
5
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
3
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
6
4
|
|
|
7
5
|
export function migrationStrategyForComponentStylesheets(options) {
|
|
8
6
|
const { podPath, projectRoot } = options;
|
|
9
7
|
|
|
10
|
-
const
|
|
8
|
+
const filePaths = findFiles(
|
|
11
9
|
join('app', podPath, 'components', '**', 'styles.{css,scss}'),
|
|
12
10
|
{
|
|
13
|
-
|
|
11
|
+
projectRoot,
|
|
14
12
|
},
|
|
15
13
|
);
|
|
16
14
|
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
return mapFilePath(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
|
-
|
|
30
|
-
return mapFilePath(oldPath, {
|
|
15
|
+
return filePaths.map((oldFilePath) => {
|
|
16
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
31
17
|
find: {
|
|
32
18
|
directory: join('app', podPath, 'components'),
|
|
33
|
-
file: 'styles
|
|
19
|
+
file: 'styles',
|
|
34
20
|
},
|
|
35
|
-
replace(key) {
|
|
36
|
-
return `app/components/${key}
|
|
21
|
+
replace: (key) => {
|
|
22
|
+
return `app/components/${key}`;
|
|
37
23
|
},
|
|
38
24
|
});
|
|
25
|
+
|
|
26
|
+
return [oldFilePath, newFilePath];
|
|
39
27
|
});
|
|
40
28
|
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
|
|
3
|
-
import { findFiles } from '@codemod-utils/files';
|
|
4
|
-
|
|
5
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
3
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
6
4
|
|
|
7
5
|
export function migrationStrategyForComponentTemplates(options) {
|
|
8
6
|
const { podPath, projectRoot } = options;
|
|
9
7
|
|
|
10
|
-
const
|
|
8
|
+
const filePaths = findFiles(
|
|
11
9
|
join('app', podPath, 'components', '**', 'template.hbs'),
|
|
12
10
|
{
|
|
13
|
-
|
|
11
|
+
projectRoot,
|
|
14
12
|
},
|
|
15
13
|
);
|
|
16
14
|
|
|
17
|
-
return
|
|
18
|
-
|
|
15
|
+
return filePaths.map((oldFilePath) => {
|
|
16
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
19
17
|
find: {
|
|
20
18
|
directory: join('app', podPath, 'components'),
|
|
21
|
-
file: 'template
|
|
19
|
+
file: 'template',
|
|
22
20
|
},
|
|
23
|
-
replace(key) {
|
|
24
|
-
return `app/components/${key}
|
|
21
|
+
replace: (key) => {
|
|
22
|
+
return `app/components/${key}`;
|
|
25
23
|
},
|
|
26
24
|
});
|
|
25
|
+
|
|
26
|
+
return [oldFilePath, newFilePath];
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
|
|
3
|
-
import { findFiles } from '@codemod-utils/files';
|
|
4
|
-
|
|
5
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
3
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
6
4
|
|
|
7
5
|
export function migrationStrategyForRouteAdapters(options) {
|
|
8
6
|
const { podPath, projectRoot } = options;
|
|
9
7
|
|
|
10
|
-
const
|
|
11
|
-
|
|
8
|
+
const filePaths = findFiles(join('app', podPath, '**', 'adapter.{js,ts}'), {
|
|
9
|
+
projectRoot,
|
|
12
10
|
});
|
|
13
11
|
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
return mapFilePath(oldPath, {
|
|
17
|
-
find: {
|
|
18
|
-
directory: join('app', podPath),
|
|
19
|
-
file: 'adapter.ts',
|
|
20
|
-
},
|
|
21
|
-
replace(key) {
|
|
22
|
-
return `app/adapters/${key}.ts`;
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return mapFilePath(oldPath, {
|
|
12
|
+
return filePaths.map((oldFilePath) => {
|
|
13
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
28
14
|
find: {
|
|
29
15
|
directory: join('app', podPath),
|
|
30
|
-
file: 'adapter
|
|
16
|
+
file: 'adapter',
|
|
31
17
|
},
|
|
32
|
-
replace(key) {
|
|
33
|
-
return `app/adapters/${key}
|
|
18
|
+
replace: (key) => {
|
|
19
|
+
return `app/adapters/${key}`;
|
|
34
20
|
},
|
|
35
21
|
});
|
|
22
|
+
|
|
23
|
+
return [oldFilePath, newFilePath];
|
|
36
24
|
});
|
|
37
25
|
}
|
|
@@ -1,37 +1,28 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
|
|
3
|
-
import { findFiles } from '@codemod-utils/files';
|
|
4
|
-
|
|
5
|
-
import { mapFilePath } from '../../../utils/files.js';
|
|
3
|
+
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
6
4
|
|
|
7
5
|
export function migrationStrategyForRouteControllers(options) {
|
|
8
6
|
const { podPath, projectRoot } = options;
|
|
9
7
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return mapFilePath(oldPath, {
|
|
17
|
-
find: {
|
|
18
|
-
directory: join('app', podPath),
|
|
19
|
-
file: 'controller.ts',
|
|
20
|
-
},
|
|
21
|
-
replace(key) {
|
|
22
|
-
return `app/controllers/${key}.ts`;
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
}
|
|
8
|
+
const filePaths = findFiles(
|
|
9
|
+
join('app', podPath, '**', 'controller.{js,ts}'),
|
|
10
|
+
{
|
|
11
|
+
projectRoot,
|
|
12
|
+
},
|
|
13
|
+
);
|
|
26
14
|
|
|
27
|
-
|
|
15
|
+
return filePaths.map((oldFilePath) => {
|
|
16
|
+
const newFilePath = renamePathByFile(oldFilePath, {
|
|
28
17
|
find: {
|
|
29
18
|
directory: join('app', podPath),
|
|
30
|
-
file: 'controller
|
|
19
|
+
file: 'controller',
|
|
31
20
|
},
|
|
32
|
-
replace(key) {
|
|
33
|
-
return `app/controllers/${key}
|
|
21
|
+
replace: (key) => {
|
|
22
|
+
return `app/controllers/${key}`;
|
|
34
23
|
},
|
|
35
24
|
});
|
|
25
|
+
|
|
26
|
+
return [oldFilePath, newFilePath];
|
|
36
27
|
});
|
|
37
28
|
}
|