@3lineas/d1-orm 1.0.9 → 1.0.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/dist/cli/index.cjs +5 -5
- package/dist/cli/index.js +5 -5
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -61,10 +61,10 @@ export class User extends Model {
|
|
|
61
61
|
declare updated_at: string;
|
|
62
62
|
}
|
|
63
63
|
`;
|
|
64
|
-
const userModelPath = path.join(process.cwd(), modelsPath, "User.
|
|
64
|
+
const userModelPath = path.join(process.cwd(), modelsPath, "User.mts");
|
|
65
65
|
if (!fs.existsSync(userModelPath)) {
|
|
66
66
|
fs.writeFileSync(userModelPath, userModelContent);
|
|
67
|
-
p.log.step(`Created model: ${modelsPath}/User.
|
|
67
|
+
p.log.step(`Created model: ${modelsPath}/User.mts`);
|
|
68
68
|
}
|
|
69
69
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").split(".")[0].replace("T", "_");
|
|
70
70
|
const migrationName = `${timestamp}_create_users_table.mts`;
|
|
@@ -93,7 +93,7 @@ export const down = async () => {
|
|
|
93
93
|
fs.writeFileSync(fullMigrationsPath, migrationContent);
|
|
94
94
|
p.log.step(`Created migration: ${migrationsPath}/${migrationName}`);
|
|
95
95
|
}
|
|
96
|
-
const seederContent = `import { User } from '../models/User.
|
|
96
|
+
const seederContent = `import { User } from '../models/User.mts';
|
|
97
97
|
|
|
98
98
|
export const seed = async () => {
|
|
99
99
|
await User.create({
|
|
@@ -227,7 +227,7 @@ async function makeModel(name) {
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
const modelPath = await findModelsPath() || "src/database/models";
|
|
230
|
-
const filename = `${modelName}.
|
|
230
|
+
const filename = `${modelName}.mts`;
|
|
231
231
|
const targetPath = path3.join(process.cwd(), modelPath, filename);
|
|
232
232
|
const template = `import { Model } from '@3lineas/d1-orm';
|
|
233
233
|
|
|
@@ -293,7 +293,7 @@ async function makeSeeder(modelName, modelPath) {
|
|
|
293
293
|
fs3.mkdirSync(seederDir, { recursive: true });
|
|
294
294
|
}
|
|
295
295
|
const relativeModelPath = path3.relative(seederDir, path3.join(process.cwd(), modelPath, modelName)).replace(/\\/g, "/");
|
|
296
|
-
const template = `import { ${modelName} } from '${relativeModelPath}.
|
|
296
|
+
const template = `import { ${modelName} } from '${relativeModelPath}.mts';
|
|
297
297
|
|
|
298
298
|
export const seed = async () => {
|
|
299
299
|
// await ${modelName}.create({ ... });
|
package/dist/cli/index.js
CHANGED
|
@@ -41,10 +41,10 @@ export class User extends Model {
|
|
|
41
41
|
declare updated_at: string;
|
|
42
42
|
}
|
|
43
43
|
`;
|
|
44
|
-
const userModelPath = path.join(process.cwd(), modelsPath, "User.
|
|
44
|
+
const userModelPath = path.join(process.cwd(), modelsPath, "User.mts");
|
|
45
45
|
if (!fs.existsSync(userModelPath)) {
|
|
46
46
|
fs.writeFileSync(userModelPath, userModelContent);
|
|
47
|
-
p.log.step(`Created model: ${modelsPath}/User.
|
|
47
|
+
p.log.step(`Created model: ${modelsPath}/User.mts`);
|
|
48
48
|
}
|
|
49
49
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").split(".")[0].replace("T", "_");
|
|
50
50
|
const migrationName = `${timestamp}_create_users_table.mts`;
|
|
@@ -73,7 +73,7 @@ export const down = async () => {
|
|
|
73
73
|
fs.writeFileSync(fullMigrationsPath, migrationContent);
|
|
74
74
|
p.log.step(`Created migration: ${migrationsPath}/${migrationName}`);
|
|
75
75
|
}
|
|
76
|
-
const seederContent = `import { User } from '../models/User.
|
|
76
|
+
const seederContent = `import { User } from '../models/User.mts';
|
|
77
77
|
|
|
78
78
|
export const seed = async () => {
|
|
79
79
|
await User.create({
|
|
@@ -207,7 +207,7 @@ async function makeModel(name) {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
const modelPath = await findModelsPath() || "src/database/models";
|
|
210
|
-
const filename = `${modelName}.
|
|
210
|
+
const filename = `${modelName}.mts`;
|
|
211
211
|
const targetPath = path3.join(process.cwd(), modelPath, filename);
|
|
212
212
|
const template = `import { Model } from '@3lineas/d1-orm';
|
|
213
213
|
|
|
@@ -273,7 +273,7 @@ async function makeSeeder(modelName, modelPath) {
|
|
|
273
273
|
fs3.mkdirSync(seederDir, { recursive: true });
|
|
274
274
|
}
|
|
275
275
|
const relativeModelPath = path3.relative(seederDir, path3.join(process.cwd(), modelPath, modelName)).replace(/\\/g, "/");
|
|
276
|
-
const template = `import { ${modelName} } from '${relativeModelPath}.
|
|
276
|
+
const template = `import { ${modelName} } from '${relativeModelPath}.mts';
|
|
277
277
|
|
|
278
278
|
export const seed = async () => {
|
|
279
279
|
// await ${modelName}.create({ ... });
|