ilana-orm 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/cli/ilana.js +11 -11
  2. package/package.json +1 -1
package/cli/ilana.js CHANGED
@@ -131,8 +131,8 @@ function generateModel(name, options = {}) {
131
131
 
132
132
  function getModelTemplate(className, tableName) {
133
133
  if (isTypeScriptProject()) {
134
- return `import Model from 'ilana-orm/orm/Model';
135
- // import { MoneyCast, EncryptedCast } from 'ilana-orm/orm/CustomCasts';
134
+ return `import Model from 'ilana-orm/orm/Model.js';
135
+ // import { MoneyCast, EncryptedCast } from 'ilana-orm/orm/CustomCasts.js';
136
136
 
137
137
  export default class ${className} extends Model {
138
138
  protected static table = '${tableName}';
@@ -223,7 +223,7 @@ module.exports = ${className};
223
223
 
224
224
  function getPivotModelTemplate(className, tableName) {
225
225
  if (isTypeScriptProject()) {
226
- return `import Model from 'ilana-orm/orm/Model';
226
+ return `import Model from 'ilana-orm/orm/Model.js';
227
227
 
228
228
  export default class ${className} extends Model {
229
229
  protected static table = '${tableName}';
@@ -260,8 +260,8 @@ function generateFactory(className) {
260
260
  }
261
261
 
262
262
  const template = isTypeScriptProject() ?
263
- `import { defineFactory } from 'ilana-orm/orm/Factory';
264
- import ${className} from '../../models/${className}';
263
+ `import { defineFactory } from 'ilana-orm/orm/Factory.js';
264
+ import ${className} from '../../models/${className}.js';
265
265
 
266
266
  export default defineFactory(${className}, (faker) => ({
267
267
  // Define your factory attributes here
@@ -298,9 +298,9 @@ function generateSeeder(className) {
298
298
  }
299
299
 
300
300
  const template = isTypeScriptProject() ?
301
- `import Seeder from 'ilana-orm/orm/Seeder';
302
- import ${className} from '../../models/${className}';
303
- import '../factories/${className}Factory';
301
+ `import Seeder from 'ilana-orm/orm/Seeder.js';
302
+ import ${className} from '../../models/${className}.js';
303
+ import '../factories/${className}Factory.js';
304
304
 
305
305
  export default class ${className}Seeder extends Seeder {
306
306
  async run(): Promise<void> {
@@ -357,7 +357,7 @@ const commands = {
357
357
 
358
358
  function getESModuleConfigTemplate() {
359
359
  return `import 'dotenv/config';
360
- import Database from 'ilana-orm/database/connection';
360
+ import Database from 'ilana-orm/database/connection.js';
361
361
 
362
362
  const config = {
363
363
  default: process.env.DB_CONNECTION || 'mysql',
@@ -863,7 +863,7 @@ DB_TIMEZONE=UTC
863
863
  }
864
864
 
865
865
  const template = isTypeScriptProject() ?
866
- `${modelName ? `import ${modelName} from '../models/${modelName}';\n\n` : ''}export default class ${className}Observer {
866
+ `${modelName ? `import ${modelName} from '../models/${modelName}.js';\n\n` : ''}export default class ${className}Observer {
867
867
  async creating(model: ${modelName || 'any'}): Promise<void> {}
868
868
  async created(model: ${modelName || 'any'}): Promise<void> {}
869
869
  async updating(model: ${modelName || 'any'}): Promise<void> {}
@@ -911,7 +911,7 @@ module.exports = ${className}Observer;
911
911
  }
912
912
 
913
913
  const template = isTypeScriptProject() ?
914
- `import { CustomCast } from 'ilana-orm/orm/Model';
914
+ `import { CustomCast } from 'ilana-orm/orm/Model.js';
915
915
 
916
916
  export default class ${className}Cast implements CustomCast {
917
917
  get(value: any): any {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ilana-orm",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A fully-featured, Eloquent-style ORM for Node.js with TypeScript support",
5
5
  "main": "index.js",
6
6
  "bin": {