@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.cjs
CHANGED
|
@@ -2215,12 +2215,14 @@ function generateModels(schemas, options) {
|
|
|
2215
2215
|
function getModelPath(model) {
|
|
2216
2216
|
return model.path;
|
|
2217
2217
|
}
|
|
2218
|
-
function generateProviderRegistration(existingContent, laravelVersion) {
|
|
2218
|
+
function generateProviderRegistration(existingContent, laravelVersion, laravelRoot = "") {
|
|
2219
2219
|
const providerClass = "App\\Providers\\OmnifyServiceProvider::class";
|
|
2220
2220
|
const providerLine = ` ${providerClass},`;
|
|
2221
|
+
const bootstrapPath = laravelRoot ? `${laravelRoot}/bootstrap/providers.php` : "bootstrap/providers.php";
|
|
2222
|
+
const configPath = laravelRoot ? `${laravelRoot}/config/app.php` : "config/app.php";
|
|
2221
2223
|
if (existingContent && existingContent.includes("OmnifyServiceProvider")) {
|
|
2222
2224
|
return {
|
|
2223
|
-
path: laravelVersion === "laravel11+" ?
|
|
2225
|
+
path: laravelVersion === "laravel11+" ? bootstrapPath : configPath,
|
|
2224
2226
|
content: existingContent,
|
|
2225
2227
|
laravelVersion,
|
|
2226
2228
|
alreadyRegistered: true
|
|
@@ -2240,14 +2242,14 @@ function generateProviderRegistration(existingContent, laravelVersion) {
|
|
|
2240
2242
|
result.push(line);
|
|
2241
2243
|
}
|
|
2242
2244
|
return {
|
|
2243
|
-
path:
|
|
2245
|
+
path: bootstrapPath,
|
|
2244
2246
|
content: result.join("\n"),
|
|
2245
2247
|
laravelVersion,
|
|
2246
2248
|
alreadyRegistered: false
|
|
2247
2249
|
};
|
|
2248
2250
|
} else {
|
|
2249
2251
|
return {
|
|
2250
|
-
path:
|
|
2252
|
+
path: bootstrapPath,
|
|
2251
2253
|
content: `<?php
|
|
2252
2254
|
|
|
2253
2255
|
return [
|
|
@@ -2289,7 +2291,7 @@ ${providerLine}
|
|
|
2289
2291
|
const lastNewline = beforeClose.lastIndexOf("\n");
|
|
2290
2292
|
const content = existingContent.substring(0, lastNewline + 1) + providerLine + "\n" + existingContent.substring(lastNewline + 1);
|
|
2291
2293
|
return {
|
|
2292
|
-
path:
|
|
2294
|
+
path: configPath,
|
|
2293
2295
|
content,
|
|
2294
2296
|
laravelVersion,
|
|
2295
2297
|
alreadyRegistered: false
|
|
@@ -3594,6 +3596,18 @@ function getResourcePath(resource) {
|
|
|
3594
3596
|
}
|
|
3595
3597
|
|
|
3596
3598
|
// src/plugin.ts
|
|
3599
|
+
function inferLaravelRoot(providersPath) {
|
|
3600
|
+
const normalized = providersPath.replace(/\\/g, "/");
|
|
3601
|
+
const match = normalized.match(/^(.*)\/app\/Providers\/?$/i);
|
|
3602
|
+
if (match && match[1]) {
|
|
3603
|
+
return match[1];
|
|
3604
|
+
}
|
|
3605
|
+
const baseMatch = normalized.match(/^(.*)\/app\/Providers\/OmnifyBase\/?$/i);
|
|
3606
|
+
if (baseMatch && baseMatch[1]) {
|
|
3607
|
+
return baseMatch[1];
|
|
3608
|
+
}
|
|
3609
|
+
return "";
|
|
3610
|
+
}
|
|
3597
3611
|
function getExistingMigrationTables(migrationsDir) {
|
|
3598
3612
|
const existingTables = /* @__PURE__ */ new Set();
|
|
3599
3613
|
if (!(0, import_node_fs.existsSync)(migrationsDir)) {
|
|
@@ -3863,8 +3877,11 @@ function laravelPlugin(options) {
|
|
|
3863
3877
|
schemaName: model.schemaName
|
|
3864
3878
|
}
|
|
3865
3879
|
}));
|
|
3866
|
-
const
|
|
3867
|
-
const
|
|
3880
|
+
const laravelRoot = inferLaravelRoot(resolved.providersPath);
|
|
3881
|
+
const bootstrapProvidersRelPath = laravelRoot ? `${laravelRoot}/bootstrap/providers.php` : "bootstrap/providers.php";
|
|
3882
|
+
const configAppRelPath = laravelRoot ? `${laravelRoot}/config/app.php` : "config/app.php";
|
|
3883
|
+
const bootstrapProvidersPath = (0, import_node_path.join)(ctx.cwd, bootstrapProvidersRelPath);
|
|
3884
|
+
const configAppPath = (0, import_node_path.join)(ctx.cwd, configAppRelPath);
|
|
3868
3885
|
let existingContent = null;
|
|
3869
3886
|
let laravelVersion;
|
|
3870
3887
|
if ((0, import_node_fs.existsSync)(bootstrapProvidersPath)) {
|
|
@@ -3884,7 +3901,7 @@ function laravelPlugin(options) {
|
|
|
3884
3901
|
} else {
|
|
3885
3902
|
laravelVersion = "laravel11+";
|
|
3886
3903
|
}
|
|
3887
|
-
const registration = generateProviderRegistration(existingContent, laravelVersion);
|
|
3904
|
+
const registration = generateProviderRegistration(existingContent, laravelVersion, laravelRoot);
|
|
3888
3905
|
if (registration && !registration.alreadyRegistered) {
|
|
3889
3906
|
outputs.push({
|
|
3890
3907
|
path: registration.path,
|