@omnifyjp/ts 1.1.2 → 1.1.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/dist/cli.js CHANGED
@@ -71,7 +71,7 @@ program
71
71
  .option('-c, --config <path>', 'Path to omnify.yaml (default: ./omnify.yaml)')
72
72
  .option('-i, --input <path>', 'Path to schemas.json (overrides config)')
73
73
  .option('-o, --output <path>', 'Output directory for TypeScript (overrides config)')
74
- .option('--force', 'Overwrite user-editable model files', false)
74
+ .option('--force', 'Force regeneration of auto-generated files', false)
75
75
  .action((opts) => {
76
76
  let inputPath;
77
77
  let tsEnabled = true;
@@ -126,7 +126,7 @@ program
126
126
  filePath = join(tsOutput, file.filePath);
127
127
  }
128
128
  mkdirSync(dirname(filePath), { recursive: true });
129
- if (!file.overwrite && existsSync(filePath) && !opts.force) {
129
+ if (!file.overwrite && existsSync(filePath)) {
130
130
  tsSkipped++;
131
131
  continue;
132
132
  }
@@ -157,7 +157,7 @@ program
157
157
  for (const file of phpFiles) {
158
158
  const filePath = resolve(configDir, file.path);
159
159
  mkdirSync(dirname(filePath), { recursive: true });
160
- if (!file.overwrite && existsSync(filePath) && !opts.force) {
160
+ if (!file.overwrite && existsSync(filePath)) {
161
161
  phpSkipped++;
162
162
  continue;
163
163
  }
@@ -38,7 +38,7 @@ export function buildRelation(propName, property, modelNamespace, context) {
38
38
  /** Generate pivot table name matching Go's GeneratePivotTableName logic. */
39
39
  export function generatePivotTableName(sourceTable, targetTable) {
40
40
  const tables = [singularize(sourceTable), singularize(targetTable)].sort();
41
- return tables.join('_');
41
+ return tables.join('_') + '_pivot';
42
42
  }
43
43
  /** Get the return type hint for a relation. */
44
44
  export function getReturnType(relation) {
@@ -14,6 +14,17 @@ export function generateServiceProvider(reader, config) {
14
14
  }
15
15
  morphEntries.sort();
16
16
  const morphMapContent = morphEntries.join('\n');
17
+ // Build package migration loading lines
18
+ const packageMigrationLines = [];
19
+ const packages = reader.getPackages();
20
+ for (const [name, pkg] of Object.entries(packages)) {
21
+ if (pkg.migrationsPath) {
22
+ packageMigrationLines.push(` $this->loadMigrationsFrom(base_path('${pkg.migrationsPath}')); // ${name}`);
23
+ }
24
+ }
25
+ const packageMigrationsBlock = packageMigrationLines.length > 0
26
+ ? `\n // Load package migrations\n${packageMigrationLines.join('\n')}\n`
27
+ : '';
17
28
  const providerNamespace = config.providers.namespace;
18
29
  const content = `<?php
19
30
 
@@ -50,7 +61,7 @@ class OmnifyServiceProvider extends ServiceProvider
50
61
  {
51
62
  // Load Omnify migrations from custom directory
52
63
  $this->loadMigrationsFrom(database_path('migrations/omnify'));
53
-
64
+ ${packageMigrationsBlock}
54
65
  // Register morph map for polymorphic relationships
55
66
  Relation::enforceMorphMap([
56
67
  ${morphMapContent}
package/dist/types.d.ts CHANGED
@@ -27,6 +27,7 @@ export interface SchemasJson {
27
27
  }
28
28
  /** Package metadata in schemas.json (codegen namespace references). */
29
29
  export interface PackageExportInfo {
30
+ readonly migrationsPath?: string;
30
31
  readonly codegen?: PackageCodegenExport;
31
32
  }
32
33
  /** Codegen namespace info from a package. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnifyjp/ts",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "TypeScript model type generator from Omnify schemas.json",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",