ember-codemod-pod-to-octane 1.2.8 → 1.2.10
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
|
@@ -32,13 +32,14 @@ Step 3. Update references originating from, as well as pointing to, the moved fi
|
|
|
32
32
|
You must pass `--type` to indicate what type of project you have.
|
|
33
33
|
|
|
34
34
|
```sh
|
|
35
|
-
npx ember-codemod-pod-to-octane --type
|
|
36
|
-
npx ember-codemod-pod-to-octane --type
|
|
37
|
-
npx ember-codemod-pod-to-octane --type
|
|
35
|
+
npx ember-codemod-pod-to-octane --type app
|
|
36
|
+
npx ember-codemod-pod-to-octane --type addon
|
|
37
|
+
npx ember-codemod-pod-to-octane --type engine
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
<details>
|
|
42
|
+
|
|
42
43
|
<summary>Optional: Do a test run</summary>
|
|
43
44
|
|
|
44
45
|
Pass `--test` to preview how the codemod will move files.
|
|
@@ -51,32 +52,34 @@ npx ember-codemod-pod-to-octane --test
|
|
|
51
52
|
|
|
52
53
|
|
|
53
54
|
<details>
|
|
55
|
+
|
|
54
56
|
<summary>Optional: Specify the project root</summary>
|
|
55
57
|
|
|
56
58
|
Pass `--root` to run the codemod on a project somewhere else (i.e. not in the current directory).
|
|
57
59
|
|
|
58
60
|
```sh
|
|
59
|
-
npx ember-codemod-pod-to-octane --root
|
|
61
|
+
npx ember-codemod-pod-to-octane --root <path/to/your/project>
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
Note, you can use `--root` to un-pod the demo app of an Ember addon.
|
|
63
65
|
|
|
64
66
|
```sh
|
|
65
67
|
# If the current directory is the addon root
|
|
66
|
-
npx ember-codemod-pod-to-octane --type
|
|
68
|
+
npx ember-codemod-pod-to-octane --type app --root tests/dummy
|
|
67
69
|
```
|
|
68
70
|
|
|
69
71
|
</details>
|
|
70
72
|
|
|
71
73
|
|
|
72
74
|
<details>
|
|
75
|
+
|
|
73
76
|
<summary>Optional: Specify the pod path</summary>
|
|
74
77
|
|
|
75
78
|
Pass `--pod-path` if `podModulePrefix` has been set in `config/environment.js`. "Subtract" `modulePrefix` from `podModulePrefix` to get the pod path.
|
|
76
79
|
|
|
77
80
|
```sh
|
|
78
81
|
# If modulePrefix is 'my-app' and podModulePrefix is 'my-app/pods'
|
|
79
|
-
npx ember-codemod-pod-to-octane --pod-path
|
|
82
|
+
npx ember-codemod-pod-to-octane --pod-path pods
|
|
80
83
|
```
|
|
81
84
|
|
|
82
85
|
</details>
|
|
@@ -88,6 +91,7 @@ The codemod is designed to cover typical uses of an Ember app, addon, and engine
|
|
|
88
91
|
|
|
89
92
|
|
|
90
93
|
<details>
|
|
94
|
+
|
|
91
95
|
<summary>Apps</summary>
|
|
92
96
|
|
|
93
97
|
To account for a bug (found when Ember CLI is combined with Ember Data), the codemod doesn't consider unit tests for adapters, models, and serializers. You will need to manually move the test files.
|
|
@@ -96,6 +100,7 @@ To account for a bug (found when Ember CLI is combined with Ember Data), the cod
|
|
|
96
100
|
|
|
97
101
|
|
|
98
102
|
<details>
|
|
103
|
+
|
|
99
104
|
<summary>Addons</summary>
|
|
100
105
|
|
|
101
106
|
The codemod assumes that an addon is used to define components (not models or routes).
|
|
@@ -104,6 +109,7 @@ The codemod assumes that an addon is used to define components (not models or ro
|
|
|
104
109
|
|
|
105
110
|
|
|
106
111
|
<details>
|
|
112
|
+
|
|
107
113
|
<summary>Engines</summary>
|
|
108
114
|
|
|
109
115
|
The codemod assumes that an engine is used to define routes and route-specific components.
|
|
@@ -120,7 +126,7 @@ cd <path/to/cloned/repo>
|
|
|
120
126
|
pnpm build
|
|
121
127
|
|
|
122
128
|
# Run codemod
|
|
123
|
-
./dist/bin/ember-codemod-pod-to-octane.js --root
|
|
129
|
+
./dist/bin/ember-codemod-pod-to-octane.js --root <path/to/your/project>
|
|
124
130
|
```
|
|
125
131
|
|
|
126
132
|
|
|
@@ -136,11 +142,6 @@ See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
|
136
142
|
If you have an open-sourced app or addon that I can use as a reference, reach out to me on [Discord](https://discord.gg/emberjs) at `ijlee2`. Please star this project so that I can gauge its importance to you and the Ember community. ⭐
|
|
137
143
|
|
|
138
144
|
|
|
139
|
-
## Credits
|
|
140
|
-
|
|
141
|
-
Thanks goes to FlashRecruit, Imago, and CLARK, who gave me the necessary Ember experience. Some code is based on [`ember-component-template-colocation-migrator`](https://github.com/ember-codemods/ember-component-template-colocation-migrator).
|
|
142
|
-
|
|
143
|
-
|
|
144
145
|
## License
|
|
145
146
|
|
|
146
147
|
This project is licensed under the [MIT License](LICENSE.md).
|
package/dist/src/index.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
export function updatePathsInAppFolder(
|
|
3
|
+
export function updatePathsInAppFolder(filePathMap, options) {
|
|
4
4
|
const { projectRoot } = options;
|
|
5
|
-
|
|
6
|
-
// Read file
|
|
5
|
+
filePathMap.forEach((newFilePath, oldFilePath) => {
|
|
7
6
|
const newAbsolutePath = join(projectRoot, newFilePath);
|
|
8
7
|
const file = readFileSync(newAbsolutePath, 'utf8');
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
.replace(/\.js$/, '');
|
|
13
|
-
const newRelativePath = newFilePath
|
|
14
|
-
.replace(/^app\//, '')
|
|
15
|
-
.replace(/\.js$/, '');
|
|
16
|
-
const newFile = file.replace(new RegExp(oldRelativePath), newRelativePath);
|
|
8
|
+
const text = oldFilePath.replace(/^app\//, '').replace(/\.js$/, '');
|
|
9
|
+
const newText = newFilePath.replace(/^app\//, '').replace(/\.js$/, '');
|
|
10
|
+
const newFile = file.replace(new RegExp(text), newText);
|
|
17
11
|
writeFileSync(newAbsolutePath, newFile, 'utf8');
|
|
18
12
|
});
|
|
19
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-codemod-pod-to-octane",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
4
|
"description": "Codemod to un-pod Ember apps, addons, and engines",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemod",
|
|
@@ -24,31 +24,31 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@codemod-utils/files": "^0.5.
|
|
27
|
+
"@codemod-utils/files": "^0.5.2",
|
|
28
28
|
"yargs": "^17.7.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@babel/core": "^7.22.
|
|
32
|
-
"@codemod-utils/tests": "^0.
|
|
31
|
+
"@babel/core": "^7.22.10",
|
|
32
|
+
"@codemod-utils/tests": "^0.3.0",
|
|
33
33
|
"@sondr3/minitest": "^0.1.1",
|
|
34
34
|
"@tsconfig/esm": "^1.0.4",
|
|
35
35
|
"@tsconfig/node16": "^16.1.0",
|
|
36
36
|
"@tsconfig/strictest": "^2.0.1",
|
|
37
|
-
"@types/node": "^16.
|
|
37
|
+
"@types/node": "^16.18.40",
|
|
38
38
|
"@types/yargs": "^17.0.24",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
40
|
-
"@typescript-eslint/parser": "^
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^6.3.0",
|
|
40
|
+
"@typescript-eslint/parser": "^6.3.0",
|
|
41
41
|
"concurrently": "^8.2.0",
|
|
42
|
-
"eslint": "^8.
|
|
43
|
-
"eslint-config-prettier": "^
|
|
44
|
-
"eslint-import-resolver-typescript": "^3.
|
|
45
|
-
"eslint-plugin-import": "^2.
|
|
42
|
+
"eslint": "^8.47.0",
|
|
43
|
+
"eslint-config-prettier": "^9.0.0",
|
|
44
|
+
"eslint-import-resolver-typescript": "^3.6.0",
|
|
45
|
+
"eslint-plugin-import": "^2.28.0",
|
|
46
46
|
"eslint-plugin-n": "^16.0.1",
|
|
47
|
-
"eslint-plugin-prettier": "^
|
|
47
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
48
48
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
49
49
|
"eslint-plugin-typescript-sort-keys": "^2.3.0",
|
|
50
50
|
"lerna-changelog": "^2.2.0",
|
|
51
|
-
"prettier": "^
|
|
51
|
+
"prettier": "^3.0.1",
|
|
52
52
|
"typescript": "^5.1.6"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|