@cedarjs/codemods 3.0.0-canary.13479 → 3.0.0-canary.13482
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.
|
@@ -35,12 +35,19 @@ var import_node_fs = __toESM(require("node:fs"));
|
|
|
35
35
|
var import_node_path = __toESM(require("node:path"));
|
|
36
36
|
var import_jscodeshift = __toESM(require("jscodeshift"));
|
|
37
37
|
var import_project_config = require("@cedarjs/project-config");
|
|
38
|
+
var import_prettify = __toESM(require("../../../lib/prettify"));
|
|
38
39
|
function getParserForFile(filePath) {
|
|
39
40
|
if (filePath.endsWith(".tsx") || filePath.endsWith(".jsx")) {
|
|
40
41
|
return import_jscodeshift.default.withParser("tsx");
|
|
41
42
|
}
|
|
42
43
|
return import_jscodeshift.default.withParser("ts");
|
|
43
44
|
}
|
|
45
|
+
function getPrettierParserForFile(filePath) {
|
|
46
|
+
if (filePath.endsWith(".ts") || filePath.endsWith(".tsx") || filePath.endsWith(".cts") || filePath.endsWith(".mts")) {
|
|
47
|
+
return "typescript";
|
|
48
|
+
}
|
|
49
|
+
return "babel";
|
|
50
|
+
}
|
|
44
51
|
function transformDbFile(file) {
|
|
45
52
|
const parser = getParserForFile(file.path);
|
|
46
53
|
const root = parser(file.source);
|
|
@@ -89,7 +96,12 @@ async function prismaV7Prep() {
|
|
|
89
96
|
if (import_node_fs.default.existsSync(dbFilePath)) {
|
|
90
97
|
const source = import_node_fs.default.readFileSync(dbFilePath, "utf-8");
|
|
91
98
|
const transformed = transformDbFile({ source, path: dbFilePath });
|
|
92
|
-
import_node_fs.default.writeFileSync(
|
|
99
|
+
import_node_fs.default.writeFileSync(
|
|
100
|
+
dbFilePath,
|
|
101
|
+
await (0, import_prettify.default)(transformed, {
|
|
102
|
+
parser: getPrettierParserForFile(dbFilePath)
|
|
103
|
+
})
|
|
104
|
+
);
|
|
93
105
|
}
|
|
94
106
|
const dirsToTransform = [paths.api.src, dataMigrationsPath, paths.scripts];
|
|
95
107
|
for (const dir of dirsToTransform) {
|
|
@@ -102,7 +114,12 @@ async function prismaV7Prep() {
|
|
|
102
114
|
for (const file of files) {
|
|
103
115
|
const source = import_node_fs.default.readFileSync(file, "utf-8");
|
|
104
116
|
const transformed = transformOtherFile({ source, path: file });
|
|
105
|
-
import_node_fs.default.writeFileSync(
|
|
117
|
+
import_node_fs.default.writeFileSync(
|
|
118
|
+
file,
|
|
119
|
+
await (0, import_prettify.default)(transformed, {
|
|
120
|
+
parser: getPrettierParserForFile(file)
|
|
121
|
+
})
|
|
122
|
+
);
|
|
106
123
|
}
|
|
107
124
|
}
|
|
108
125
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/codemods",
|
|
3
|
-
"version": "3.0.0-canary.
|
|
3
|
+
"version": "3.0.0-canary.13482+ea250e347",
|
|
4
4
|
"description": "Codemods to ease upgrading a CedarJS Project",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/plugin-transform-typescript": "^7.26.8",
|
|
31
31
|
"@babel/runtime-corejs3": "7.29.0",
|
|
32
32
|
"@babel/traverse": "7.29.0",
|
|
33
|
-
"@cedarjs/project-config": "3.0.0-canary.
|
|
33
|
+
"@cedarjs/project-config": "3.0.0-canary.13482",
|
|
34
34
|
"@svgr/core": "8.1.0",
|
|
35
35
|
"@svgr/plugin-jsx": "8.1.0",
|
|
36
36
|
"@vscode/ripgrep": "1.17.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"yargs": "17.7.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@cedarjs/framework-tools": "3.0.0-canary.
|
|
52
|
+
"@cedarjs/framework-tools": "3.0.0-canary.13482",
|
|
53
53
|
"@types/babel__core": "7.20.5",
|
|
54
54
|
"@types/jscodeshift": "0.12.0",
|
|
55
55
|
"@types/yargs": "17.0.35",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "ea250e347f4f786189a73ecd93c44ba4bf6bcbc1"
|
|
64
64
|
}
|