@famgia/omnify-laravel 0.0.82 → 0.0.83
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/{chunk-FCTB4WKW.js → chunk-TBXCIKK7.js} +26 -9
- package/dist/chunk-TBXCIKK7.js.map +1 -0
- package/dist/index.cjs +25 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/plugin.cjs +25 -8
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-FCTB4WKW.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -334,9 +334,10 @@ declare function getModelPath(model: GeneratedModel): string;
|
|
|
334
334
|
*
|
|
335
335
|
* @param existingContent - Existing file content (null if file doesn't exist)
|
|
336
336
|
* @param laravelVersion - Laravel version type
|
|
337
|
+
* @param laravelRoot - Laravel root directory (e.g., "./backend" or "")
|
|
337
338
|
* @returns Registration result or null if already registered
|
|
338
339
|
*/
|
|
339
|
-
declare function generateProviderRegistration(existingContent: string | null, laravelVersion: 'laravel11+' | 'laravel10-'): ProviderRegistrationResult | null;
|
|
340
|
+
declare function generateProviderRegistration(existingContent: string | null, laravelVersion: 'laravel11+' | 'laravel10-', laravelRoot?: string): ProviderRegistrationResult | null;
|
|
340
341
|
|
|
341
342
|
/**
|
|
342
343
|
* Laravel Factory Generator
|
package/dist/index.d.ts
CHANGED
|
@@ -334,9 +334,10 @@ declare function getModelPath(model: GeneratedModel): string;
|
|
|
334
334
|
*
|
|
335
335
|
* @param existingContent - Existing file content (null if file doesn't exist)
|
|
336
336
|
* @param laravelVersion - Laravel version type
|
|
337
|
+
* @param laravelRoot - Laravel root directory (e.g., "./backend" or "")
|
|
337
338
|
* @returns Registration result or null if already registered
|
|
338
339
|
*/
|
|
339
|
-
declare function generateProviderRegistration(existingContent: string | null, laravelVersion: 'laravel11+' | 'laravel10-'): ProviderRegistrationResult | null;
|
|
340
|
+
declare function generateProviderRegistration(existingContent: string | null, laravelVersion: 'laravel11+' | 'laravel10-', laravelRoot?: string): ProviderRegistrationResult | null;
|
|
340
341
|
|
|
341
342
|
/**
|
|
342
343
|
* Laravel Factory Generator
|
package/dist/index.js
CHANGED
package/dist/plugin.cjs
CHANGED
|
@@ -2144,12 +2144,14 @@ function generateModels(schemas, options) {
|
|
|
2144
2144
|
function getModelPath(model) {
|
|
2145
2145
|
return model.path;
|
|
2146
2146
|
}
|
|
2147
|
-
function generateProviderRegistration(existingContent, laravelVersion) {
|
|
2147
|
+
function generateProviderRegistration(existingContent, laravelVersion, laravelRoot = "") {
|
|
2148
2148
|
const providerClass = "App\\Providers\\OmnifyServiceProvider::class";
|
|
2149
2149
|
const providerLine = ` ${providerClass},`;
|
|
2150
|
+
const bootstrapPath = laravelRoot ? `${laravelRoot}/bootstrap/providers.php` : "bootstrap/providers.php";
|
|
2151
|
+
const configPath = laravelRoot ? `${laravelRoot}/config/app.php` : "config/app.php";
|
|
2150
2152
|
if (existingContent && existingContent.includes("OmnifyServiceProvider")) {
|
|
2151
2153
|
return {
|
|
2152
|
-
path: laravelVersion === "laravel11+" ?
|
|
2154
|
+
path: laravelVersion === "laravel11+" ? bootstrapPath : configPath,
|
|
2153
2155
|
content: existingContent,
|
|
2154
2156
|
laravelVersion,
|
|
2155
2157
|
alreadyRegistered: true
|
|
@@ -2169,14 +2171,14 @@ function generateProviderRegistration(existingContent, laravelVersion) {
|
|
|
2169
2171
|
result.push(line);
|
|
2170
2172
|
}
|
|
2171
2173
|
return {
|
|
2172
|
-
path:
|
|
2174
|
+
path: bootstrapPath,
|
|
2173
2175
|
content: result.join("\n"),
|
|
2174
2176
|
laravelVersion,
|
|
2175
2177
|
alreadyRegistered: false
|
|
2176
2178
|
};
|
|
2177
2179
|
} else {
|
|
2178
2180
|
return {
|
|
2179
|
-
path:
|
|
2181
|
+
path: bootstrapPath,
|
|
2180
2182
|
content: `<?php
|
|
2181
2183
|
|
|
2182
2184
|
return [
|
|
@@ -2218,7 +2220,7 @@ ${providerLine}
|
|
|
2218
2220
|
const lastNewline = beforeClose.lastIndexOf("\n");
|
|
2219
2221
|
const content = existingContent.substring(0, lastNewline + 1) + providerLine + "\n" + existingContent.substring(lastNewline + 1);
|
|
2220
2222
|
return {
|
|
2221
|
-
path:
|
|
2223
|
+
path: configPath,
|
|
2222
2224
|
content,
|
|
2223
2225
|
laravelVersion,
|
|
2224
2226
|
alreadyRegistered: false
|
|
@@ -3519,6 +3521,18 @@ function getResourcePath(resource) {
|
|
|
3519
3521
|
}
|
|
3520
3522
|
|
|
3521
3523
|
// src/plugin.ts
|
|
3524
|
+
function inferLaravelRoot(providersPath) {
|
|
3525
|
+
const normalized = providersPath.replace(/\\/g, "/");
|
|
3526
|
+
const match = normalized.match(/^(.*)\/app\/Providers\/?$/i);
|
|
3527
|
+
if (match && match[1]) {
|
|
3528
|
+
return match[1];
|
|
3529
|
+
}
|
|
3530
|
+
const baseMatch = normalized.match(/^(.*)\/app\/Providers\/OmnifyBase\/?$/i);
|
|
3531
|
+
if (baseMatch && baseMatch[1]) {
|
|
3532
|
+
return baseMatch[1];
|
|
3533
|
+
}
|
|
3534
|
+
return "";
|
|
3535
|
+
}
|
|
3522
3536
|
function getExistingMigrationTables(migrationsDir) {
|
|
3523
3537
|
const existingTables = /* @__PURE__ */ new Set();
|
|
3524
3538
|
if (!(0, import_node_fs.existsSync)(migrationsDir)) {
|
|
@@ -3788,8 +3802,11 @@ function laravelPlugin(options) {
|
|
|
3788
3802
|
schemaName: model.schemaName
|
|
3789
3803
|
}
|
|
3790
3804
|
}));
|
|
3791
|
-
const
|
|
3792
|
-
const
|
|
3805
|
+
const laravelRoot = inferLaravelRoot(resolved.providersPath);
|
|
3806
|
+
const bootstrapProvidersRelPath = laravelRoot ? `${laravelRoot}/bootstrap/providers.php` : "bootstrap/providers.php";
|
|
3807
|
+
const configAppRelPath = laravelRoot ? `${laravelRoot}/config/app.php` : "config/app.php";
|
|
3808
|
+
const bootstrapProvidersPath = (0, import_node_path.join)(ctx.cwd, bootstrapProvidersRelPath);
|
|
3809
|
+
const configAppPath = (0, import_node_path.join)(ctx.cwd, configAppRelPath);
|
|
3793
3810
|
let existingContent = null;
|
|
3794
3811
|
let laravelVersion;
|
|
3795
3812
|
if ((0, import_node_fs.existsSync)(bootstrapProvidersPath)) {
|
|
@@ -3809,7 +3826,7 @@ function laravelPlugin(options) {
|
|
|
3809
3826
|
} else {
|
|
3810
3827
|
laravelVersion = "laravel11+";
|
|
3811
3828
|
}
|
|
3812
|
-
const registration = generateProviderRegistration(existingContent, laravelVersion);
|
|
3829
|
+
const registration = generateProviderRegistration(existingContent, laravelVersion, laravelRoot);
|
|
3813
3830
|
if (registration && !registration.alreadyRegistered) {
|
|
3814
3831
|
outputs.push({
|
|
3815
3832
|
path: registration.path,
|