@famgia/omnify 1.0.70 → 1.0.71
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/ai-guides/config-guide.md +199 -68
- package/package.json +9 -9
|
@@ -1,106 +1,176 @@
|
|
|
1
1
|
# Omnify Configuration Guide
|
|
2
2
|
|
|
3
|
+
## Quick Start
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# Create new Laravel project (recommended)
|
|
7
|
+
npx @famgia/omnify create-laravel-project my-app
|
|
8
|
+
cd my-app
|
|
9
|
+
|
|
10
|
+
# Or initialize in existing project
|
|
11
|
+
npx @famgia/omnify init
|
|
12
|
+
```
|
|
13
|
+
|
|
3
14
|
## Configuration File
|
|
4
15
|
|
|
5
16
|
Create `omnify.config.ts` in project root:
|
|
6
17
|
|
|
7
18
|
```typescript
|
|
8
19
|
import { defineConfig } from '@famgia/omnify';
|
|
20
|
+
import laravel from '@famgia/omnify-laravel/plugin';
|
|
21
|
+
import typescript from '@famgia/omnify-typescript/plugin';
|
|
9
22
|
|
|
10
23
|
export default defineConfig({
|
|
11
24
|
schemasDir: './schemas',
|
|
25
|
+
lockFilePath: './.omnify.lock',
|
|
12
26
|
|
|
13
27
|
database: {
|
|
14
|
-
driver: 'mysql',
|
|
28
|
+
driver: 'mysql',
|
|
29
|
+
devUrl: 'mysql://root:password@localhost:3306/dev_db',
|
|
15
30
|
},
|
|
16
31
|
|
|
17
|
-
|
|
18
|
-
laravel
|
|
19
|
-
migrationsPath: '
|
|
20
|
-
modelsPath: '
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
plugins: [
|
|
33
|
+
laravel({
|
|
34
|
+
migrationsPath: 'database/migrations/omnify',
|
|
35
|
+
modelsPath: 'app/Models',
|
|
36
|
+
baseModelsPath: 'app/Models/OmnifyBase',
|
|
37
|
+
providersPath: 'app/Providers',
|
|
38
|
+
localesPath: 'app/Models/OmnifyBase/Locales',
|
|
39
|
+
}),
|
|
40
|
+
typescript({
|
|
41
|
+
path: './resources/ts/types/models',
|
|
42
|
+
generateRules: true,
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
28
45
|
|
|
29
|
-
// Multi-language support (optional)
|
|
30
46
|
locale: {
|
|
31
|
-
locales: ['
|
|
32
|
-
defaultLocale: '
|
|
33
|
-
fallbackLocale: 'en',
|
|
47
|
+
locales: ['ja', 'en'],
|
|
48
|
+
defaultLocale: 'ja',
|
|
34
49
|
},
|
|
35
50
|
});
|
|
36
51
|
```
|
|
37
52
|
|
|
38
53
|
## Configuration Options
|
|
39
54
|
|
|
55
|
+
### Root Options
|
|
56
|
+
|
|
57
|
+
| Option | Type | Required | Description |
|
|
58
|
+
|--------|------|----------|-------------|
|
|
59
|
+
| `schemasDir` | `string` | Yes | Directory containing schema files |
|
|
60
|
+
| `lockFilePath` | `string` | Yes | Path to lock file for change tracking |
|
|
61
|
+
| `database` | `object` | Yes | Database configuration |
|
|
62
|
+
| `plugins` | `Plugin[]` | No | Array of generator plugins |
|
|
63
|
+
| `locale` | `object` | No | Multi-language support configuration |
|
|
64
|
+
|
|
40
65
|
### database (required)
|
|
41
|
-
| Option | Type | Description |
|
|
42
|
-
|--------|------|-------------|
|
|
43
|
-
| `driver` | string | Database driver: mysql, pgsql, sqlite, sqlsrv, mariadb |
|
|
44
|
-
| `devUrl` | string | Development database URL for Atlas diff |
|
|
45
|
-
| `enableFieldComments` | boolean | Enable field comments in migrations (MySQL) |
|
|
46
66
|
|
|
47
|
-
### output.laravel
|
|
48
|
-
| Option | Type | Description |
|
|
49
|
-
|--------|------|-------------|
|
|
50
|
-
| `migrationsPath` | string | Directory for generated migrations |
|
|
51
|
-
| `modelsPath` | string | Directory for generated models |
|
|
52
|
-
| `modelsNamespace` | string | PHP namespace for models |
|
|
53
|
-
| `factoriesPath` | string | Directory for generated factories |
|
|
54
|
-
| `enumsPath` | string | Directory for generated enums |
|
|
55
|
-
| `enumsNamespace` | string | PHP namespace for enums |
|
|
56
|
-
|
|
57
|
-
### output.typescript
|
|
58
67
|
| Option | Type | Description |
|
|
59
68
|
|--------|------|-------------|
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
| `generateRelationships` | boolean | Generate relationship types |
|
|
64
|
-
| `generateRules` | boolean | Generate Ant Design validation rules (default: true) |
|
|
65
|
-
| `validationTemplates` | object | Custom validation message templates |
|
|
69
|
+
| `driver` | `string` | Database driver: `mysql`, `pgsql`, `sqlite`, `sqlsrv`, `mariadb` |
|
|
70
|
+
| `devUrl` | `string` | Development database URL for Atlas diff (required for `generate`) |
|
|
71
|
+
| `enableFieldComments` | `boolean` | Enable field comments in migrations (MySQL) |
|
|
66
72
|
|
|
67
|
-
|
|
73
|
+
### Database URL Format
|
|
68
74
|
|
|
69
|
-
|
|
75
|
+
```
|
|
76
|
+
mysql://user:password@host:port/database
|
|
77
|
+
postgres://user:password@host:port/database
|
|
78
|
+
sqlite://path/to/file.db
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Plugin Configuration
|
|
82
|
+
|
|
83
|
+
### Laravel Plugin
|
|
70
84
|
|
|
71
85
|
```typescript
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
import laravel from '@famgia/omnify-laravel/plugin';
|
|
87
|
+
|
|
88
|
+
laravel({
|
|
89
|
+
migrationsPath: 'database/migrations/omnify', // Migration files
|
|
90
|
+
modelsPath: 'app/Models', // Model classes
|
|
91
|
+
baseModelsPath: 'app/Models/OmnifyBase', // Base model classes (auto-generated)
|
|
92
|
+
providersPath: 'app/Providers', // Service provider (OmnifyServiceProvider)
|
|
93
|
+
localesPath: 'app/Models/OmnifyBase/Locales', // Locale files
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
| Option | Type | Default | Description |
|
|
98
|
+
|--------|------|---------|-------------|
|
|
99
|
+
| `migrationsPath` | `string` | `database/migrations/omnify` | Laravel migrations output |
|
|
100
|
+
| `modelsPath` | `string` | `app/Models` | Model classes output |
|
|
101
|
+
| `baseModelsPath` | `string` | `app/Models/OmnifyBase` | Base model classes output |
|
|
102
|
+
| `providersPath` | `string` | `app/Providers` | Service provider output |
|
|
103
|
+
| `localesPath` | `string` | `app/Models/OmnifyBase/Locales` | Locale files output |
|
|
104
|
+
|
|
105
|
+
### TypeScript Plugin
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import typescript from '@famgia/omnify-typescript/plugin';
|
|
109
|
+
|
|
110
|
+
typescript({
|
|
111
|
+
path: './resources/ts/types/models', // Output directory
|
|
112
|
+
generateRules: true, // Generate Ant Design validation rules
|
|
113
|
+
})
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
| Option | Type | Default | Description |
|
|
117
|
+
|--------|------|---------|-------------|
|
|
118
|
+
| `path` | `string` | `./src/types/model` | Output directory for TypeScript types |
|
|
119
|
+
| `generateRules` | `boolean` | `true` | Generate Ant Design validation rules |
|
|
120
|
+
|
|
121
|
+
### Japan Plugin (Optional)
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
import japan from '@famgia/omnify-japan/plugin';
|
|
125
|
+
|
|
126
|
+
japan({
|
|
127
|
+
// Japan-specific types: JapaneseName, JapaneseAddress, etc.
|
|
128
|
+
})
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Locale Configuration
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
locale: {
|
|
135
|
+
locales: ['ja', 'en', 'vi'], // Supported locale codes
|
|
136
|
+
defaultLocale: 'ja', // Default locale for simple strings
|
|
137
|
+
fallbackLocale: 'en', // Fallback when requested locale not found
|
|
93
138
|
}
|
|
94
139
|
```
|
|
95
140
|
|
|
96
|
-
|
|
141
|
+
## Commands
|
|
97
142
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
143
|
+
```bash
|
|
144
|
+
# Create new Laravel project
|
|
145
|
+
npx @famgia/omnify create-laravel-project my-app
|
|
146
|
+
|
|
147
|
+
# Initialize in existing project
|
|
148
|
+
npx @famgia/omnify init
|
|
149
|
+
|
|
150
|
+
# Validate all schemas
|
|
151
|
+
npx @famgia/omnify validate
|
|
152
|
+
|
|
153
|
+
# Show pending changes
|
|
154
|
+
npx @famgia/omnify diff
|
|
155
|
+
|
|
156
|
+
# Generate code
|
|
157
|
+
npx @famgia/omnify generate
|
|
158
|
+
|
|
159
|
+
# Generate with options
|
|
160
|
+
npx @famgia/omnify generate --force # Force regenerate
|
|
161
|
+
npx @famgia/omnify generate --migrations-only # Only migrations
|
|
162
|
+
npx @famgia/omnify generate --types-only # Only TypeScript
|
|
163
|
+
|
|
164
|
+
# Reset all generated files
|
|
165
|
+
npx @famgia/omnify reset
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Environment Variables
|
|
169
|
+
|
|
170
|
+
| Variable | Description |
|
|
171
|
+
|----------|-------------|
|
|
172
|
+
| `OMNIFY_DEV_URL` | Override database.devUrl from config |
|
|
173
|
+
| `DEBUG` | Set to `omnify:*` for debug output |
|
|
104
174
|
|
|
105
175
|
## Common Mistakes
|
|
106
176
|
|
|
@@ -120,3 +190,64 @@ Built-in templates are available for: ja, en, vi, ko, zh
|
|
|
120
190
|
},
|
|
121
191
|
}
|
|
122
192
|
```
|
|
193
|
+
|
|
194
|
+
**Wrong** - Using old `output` format:
|
|
195
|
+
```typescript
|
|
196
|
+
{
|
|
197
|
+
output: {
|
|
198
|
+
laravel: { ... }, // ERROR: Use plugins instead
|
|
199
|
+
typescript: { ... },
|
|
200
|
+
},
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Correct** - Using plugins:
|
|
205
|
+
```typescript
|
|
206
|
+
{
|
|
207
|
+
plugins: [
|
|
208
|
+
laravel({ ... }),
|
|
209
|
+
typescript({ ... }),
|
|
210
|
+
],
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Full Example
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
import { defineConfig } from '@famgia/omnify';
|
|
218
|
+
import laravel from '@famgia/omnify-laravel/plugin';
|
|
219
|
+
import typescript from '@famgia/omnify-typescript/plugin';
|
|
220
|
+
import japan from '@famgia/omnify-japan/plugin';
|
|
221
|
+
|
|
222
|
+
export default defineConfig({
|
|
223
|
+
schemasDir: './schemas',
|
|
224
|
+
lockFilePath: './.omnify.lock',
|
|
225
|
+
|
|
226
|
+
database: {
|
|
227
|
+
driver: 'mysql',
|
|
228
|
+
devUrl: process.env.OMNIFY_DEV_URL || 'mysql://root:password@localhost:3306/dev_db',
|
|
229
|
+
enableFieldComments: true,
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
plugins: [
|
|
233
|
+
laravel({
|
|
234
|
+
migrationsPath: 'database/migrations/omnify',
|
|
235
|
+
modelsPath: 'app/Models',
|
|
236
|
+
baseModelsPath: 'app/Models/OmnifyBase',
|
|
237
|
+
providersPath: 'app/Providers',
|
|
238
|
+
localesPath: 'app/Models/OmnifyBase/Locales',
|
|
239
|
+
}),
|
|
240
|
+
typescript({
|
|
241
|
+
path: './resources/ts/types/models',
|
|
242
|
+
generateRules: true,
|
|
243
|
+
}),
|
|
244
|
+
japan(), // Japan-specific types
|
|
245
|
+
],
|
|
246
|
+
|
|
247
|
+
locale: {
|
|
248
|
+
locales: ['ja', 'en'],
|
|
249
|
+
defaultLocale: 'ja',
|
|
250
|
+
fallbackLocale: 'ja',
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@famgia/omnify",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.71",
|
|
4
4
|
"description": "Schema-driven database migration system with TypeScript types and Laravel migrations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@famgia/omnify-cli": "0.0.
|
|
29
|
-
"@famgia/omnify-core": "0.0.
|
|
30
|
-
"@famgia/omnify-types": "0.0.
|
|
31
|
-
"@famgia/omnify-laravel": "0.0.
|
|
32
|
-
"@famgia/omnify-typescript": "0.0.
|
|
33
|
-
"@famgia/omnify-atlas": "0.0.
|
|
34
|
-
"@famgia/omnify-mcp": "0.0.
|
|
35
|
-
"@famgia/omnify-japan": "0.0.
|
|
28
|
+
"@famgia/omnify-cli": "0.0.67",
|
|
29
|
+
"@famgia/omnify-core": "0.0.61",
|
|
30
|
+
"@famgia/omnify-types": "0.0.59",
|
|
31
|
+
"@famgia/omnify-laravel": "0.0.70",
|
|
32
|
+
"@famgia/omnify-typescript": "0.0.49",
|
|
33
|
+
"@famgia/omnify-atlas": "0.0.55",
|
|
34
|
+
"@famgia/omnify-mcp": "0.0.47",
|
|
35
|
+
"@famgia/omnify-japan": "0.0.54"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
|
38
38
|
"omnify",
|