lapeh 2.0.2 → 2.0.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/bin/index.js
CHANGED
|
@@ -37,6 +37,9 @@ async function upgradeProject() {
|
|
|
37
37
|
'.env.example',
|
|
38
38
|
'.vscode',
|
|
39
39
|
'tsconfig.json',
|
|
40
|
+
'README.md',
|
|
41
|
+
'src/redis.ts', // Core framework file
|
|
42
|
+
'src/prisma.ts', // Core framework file
|
|
40
43
|
];
|
|
41
44
|
|
|
42
45
|
// Helper to copy recursive
|
|
@@ -44,15 +47,37 @@ async function upgradeProject() {
|
|
|
44
47
|
if (!fs.existsSync(src)) return;
|
|
45
48
|
const stats = fs.statSync(src);
|
|
46
49
|
if (stats.isDirectory()) {
|
|
47
|
-
if (!fs.existsSync(dest)) fs.mkdirSync(dest);
|
|
50
|
+
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
|
48
51
|
fs.readdirSync(src).forEach(childItemName => {
|
|
49
52
|
copyRecursive(path.join(src, childItemName), path.join(dest, childItemName));
|
|
50
53
|
});
|
|
51
54
|
} else {
|
|
55
|
+
// Ensure destination directory exists
|
|
56
|
+
const destDir = path.dirname(dest);
|
|
57
|
+
if (!fs.existsSync(destDir)) fs.mkdirSync(destDir, { recursive: true });
|
|
52
58
|
fs.copyFileSync(src, dest);
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
|
|
62
|
+
// 1. Migration: Rename .model -> .prisma
|
|
63
|
+
const modelsDir = path.join(currentDir, 'src', 'models');
|
|
64
|
+
if (fs.existsSync(modelsDir)) {
|
|
65
|
+
console.log('🔄 Checking for legacy .model files...');
|
|
66
|
+
const files = fs.readdirSync(modelsDir);
|
|
67
|
+
let renamedCount = 0;
|
|
68
|
+
files.forEach(file => {
|
|
69
|
+
if (file.endsWith('.model')) {
|
|
70
|
+
const oldPath = path.join(modelsDir, file);
|
|
71
|
+
const newPath = path.join(modelsDir, file.replace('.model', '.prisma'));
|
|
72
|
+
fs.renameSync(oldPath, newPath);
|
|
73
|
+
renamedCount++;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
if (renamedCount > 0) {
|
|
77
|
+
console.log(`✅ Migrated ${renamedCount} files from .model to .prisma`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
56
81
|
for (const item of filesToSync) {
|
|
57
82
|
const srcPath = path.join(templateDir, item);
|
|
58
83
|
const destPath = path.join(currentDir, item);
|
package/package.json
CHANGED
|
@@ -14,8 +14,8 @@ if (!fs.existsSync(modelsDir)) {
|
|
|
14
14
|
// Read base schema (datasource & generator)
|
|
15
15
|
let schemaContent = fs.readFileSync(baseFile, 'utf8');
|
|
16
16
|
|
|
17
|
-
// Read all .
|
|
18
|
-
const modelFiles = fs.readdirSync(modelsDir).filter(file => file.endsWith('.
|
|
17
|
+
// Read all .prisma files in src/models
|
|
18
|
+
const modelFiles = fs.readdirSync(modelsDir).filter(file => file.endsWith('.prisma'));
|
|
19
19
|
|
|
20
20
|
modelFiles.forEach(file => {
|
|
21
21
|
const content = fs.readFileSync(path.join(modelsDir, file), 'utf8');
|
package/.vscode/settings.json
DELETED
|
File without changes
|
|
File without changes
|