@famgia/omnify-laravel 0.0.1 → 0.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.
- package/README.md +87 -0
- package/package.json +5 -4
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# @famgia/omnify-laravel
|
|
2
|
+
|
|
3
|
+
Laravel migration and TypeScript type generator for Omnify schemas.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @famgia/omnify-laravel
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import {
|
|
15
|
+
generateMigration,
|
|
16
|
+
generateTypeScript,
|
|
17
|
+
MigrationGenerator,
|
|
18
|
+
TypeScriptGenerator
|
|
19
|
+
} from '@famgia/omnify-laravel';
|
|
20
|
+
|
|
21
|
+
// Generate Laravel migration
|
|
22
|
+
const migration = generateMigration(schema, {
|
|
23
|
+
tableName: 'users',
|
|
24
|
+
timestamp: '2024_01_01_000000',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Generate TypeScript interface
|
|
28
|
+
const typescript = generateTypeScript(schemas);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- Laravel migration generation
|
|
34
|
+
- TypeScript interface generation
|
|
35
|
+
- Support for all Laravel column types
|
|
36
|
+
- Relationship handling (belongsTo, hasMany, etc.)
|
|
37
|
+
- Index and constraint generation
|
|
38
|
+
- Enum type support
|
|
39
|
+
|
|
40
|
+
## Generated Output
|
|
41
|
+
|
|
42
|
+
### Laravel Migration
|
|
43
|
+
|
|
44
|
+
```php
|
|
45
|
+
<?php
|
|
46
|
+
|
|
47
|
+
use Illuminate\Database\Migrations\Migration;
|
|
48
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
49
|
+
use Illuminate\Support\Facades\Schema;
|
|
50
|
+
|
|
51
|
+
return new class extends Migration
|
|
52
|
+
{
|
|
53
|
+
public function up(): void
|
|
54
|
+
{
|
|
55
|
+
Schema::create('users', function (Blueprint $table) {
|
|
56
|
+
$table->id();
|
|
57
|
+
$table->string('email')->unique();
|
|
58
|
+
$table->string('name');
|
|
59
|
+
$table->timestamps();
|
|
60
|
+
$table->softDeletes();
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### TypeScript Types
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
export interface User {
|
|
70
|
+
id: number;
|
|
71
|
+
email: string;
|
|
72
|
+
name: string;
|
|
73
|
+
created_at: string;
|
|
74
|
+
updated_at: string;
|
|
75
|
+
deleted_at: string | null;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Related Packages
|
|
80
|
+
|
|
81
|
+
- [@famgia/omnify-core](https://www.npmjs.com/package/@famgia/omnify-core) - Core engine
|
|
82
|
+
- [@famgia/omnify-cli](https://www.npmjs.com/package/@famgia/omnify-cli) - CLI tool
|
|
83
|
+
- [@famgia/omnify-atlas](https://www.npmjs.com/package/@famgia/omnify-atlas) - Atlas adapter
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@famgia/omnify-laravel",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Laravel migration and TypeScript type generator for omnify-schema",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"dist"
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
18
19
|
],
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@famgia/omnify-types": "0.0.
|
|
21
|
-
"@famgia/omnify-core": "0.0.
|
|
21
|
+
"@famgia/omnify-types": "0.0.3",
|
|
22
|
+
"@famgia/omnify-core": "0.0.3"
|
|
22
23
|
},
|
|
23
24
|
"scripts": {
|
|
24
25
|
"build": "tsup",
|