@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
|
@@ -2169,12 +2169,14 @@ function generateModels(schemas, options) {
|
|
|
2169
2169
|
function getModelPath(model) {
|
|
2170
2170
|
return model.path;
|
|
2171
2171
|
}
|
|
2172
|
-
function generateProviderRegistration(existingContent, laravelVersion) {
|
|
2172
|
+
function generateProviderRegistration(existingContent, laravelVersion, laravelRoot = "") {
|
|
2173
2173
|
const providerClass = "App\\Providers\\OmnifyServiceProvider::class";
|
|
2174
2174
|
const providerLine = ` ${providerClass},`;
|
|
2175
|
+
const bootstrapPath = laravelRoot ? `${laravelRoot}/bootstrap/providers.php` : "bootstrap/providers.php";
|
|
2176
|
+
const configPath = laravelRoot ? `${laravelRoot}/config/app.php` : "config/app.php";
|
|
2175
2177
|
if (existingContent && existingContent.includes("OmnifyServiceProvider")) {
|
|
2176
2178
|
return {
|
|
2177
|
-
path: laravelVersion === "laravel11+" ?
|
|
2179
|
+
path: laravelVersion === "laravel11+" ? bootstrapPath : configPath,
|
|
2178
2180
|
content: existingContent,
|
|
2179
2181
|
laravelVersion,
|
|
2180
2182
|
alreadyRegistered: true
|
|
@@ -2194,14 +2196,14 @@ function generateProviderRegistration(existingContent, laravelVersion) {
|
|
|
2194
2196
|
result.push(line);
|
|
2195
2197
|
}
|
|
2196
2198
|
return {
|
|
2197
|
-
path:
|
|
2199
|
+
path: bootstrapPath,
|
|
2198
2200
|
content: result.join("\n"),
|
|
2199
2201
|
laravelVersion,
|
|
2200
2202
|
alreadyRegistered: false
|
|
2201
2203
|
};
|
|
2202
2204
|
} else {
|
|
2203
2205
|
return {
|
|
2204
|
-
path:
|
|
2206
|
+
path: bootstrapPath,
|
|
2205
2207
|
content: `<?php
|
|
2206
2208
|
|
|
2207
2209
|
return [
|
|
@@ -2243,7 +2245,7 @@ ${providerLine}
|
|
|
2243
2245
|
const lastNewline = beforeClose.lastIndexOf("\n");
|
|
2244
2246
|
const content = existingContent.substring(0, lastNewline + 1) + providerLine + "\n" + existingContent.substring(lastNewline + 1);
|
|
2245
2247
|
return {
|
|
2246
|
-
path:
|
|
2248
|
+
path: configPath,
|
|
2247
2249
|
content,
|
|
2248
2250
|
laravelVersion,
|
|
2249
2251
|
alreadyRegistered: false
|
|
@@ -3544,6 +3546,18 @@ function getResourcePath(resource) {
|
|
|
3544
3546
|
}
|
|
3545
3547
|
|
|
3546
3548
|
// src/plugin.ts
|
|
3549
|
+
function inferLaravelRoot(providersPath) {
|
|
3550
|
+
const normalized = providersPath.replace(/\\/g, "/");
|
|
3551
|
+
const match = normalized.match(/^(.*)\/app\/Providers\/?$/i);
|
|
3552
|
+
if (match && match[1]) {
|
|
3553
|
+
return match[1];
|
|
3554
|
+
}
|
|
3555
|
+
const baseMatch = normalized.match(/^(.*)\/app\/Providers\/OmnifyBase\/?$/i);
|
|
3556
|
+
if (baseMatch && baseMatch[1]) {
|
|
3557
|
+
return baseMatch[1];
|
|
3558
|
+
}
|
|
3559
|
+
return "";
|
|
3560
|
+
}
|
|
3547
3561
|
function getExistingMigrationTables(migrationsDir) {
|
|
3548
3562
|
const existingTables = /* @__PURE__ */ new Set();
|
|
3549
3563
|
if (!existsSync(migrationsDir)) {
|
|
@@ -3813,8 +3827,11 @@ function laravelPlugin(options) {
|
|
|
3813
3827
|
schemaName: model.schemaName
|
|
3814
3828
|
}
|
|
3815
3829
|
}));
|
|
3816
|
-
const
|
|
3817
|
-
const
|
|
3830
|
+
const laravelRoot = inferLaravelRoot(resolved.providersPath);
|
|
3831
|
+
const bootstrapProvidersRelPath = laravelRoot ? `${laravelRoot}/bootstrap/providers.php` : "bootstrap/providers.php";
|
|
3832
|
+
const configAppRelPath = laravelRoot ? `${laravelRoot}/config/app.php` : "config/app.php";
|
|
3833
|
+
const bootstrapProvidersPath = join(ctx.cwd, bootstrapProvidersRelPath);
|
|
3834
|
+
const configAppPath = join(ctx.cwd, configAppRelPath);
|
|
3818
3835
|
let existingContent = null;
|
|
3819
3836
|
let laravelVersion;
|
|
3820
3837
|
if (existsSync(bootstrapProvidersPath)) {
|
|
@@ -3834,7 +3851,7 @@ function laravelPlugin(options) {
|
|
|
3834
3851
|
} else {
|
|
3835
3852
|
laravelVersion = "laravel11+";
|
|
3836
3853
|
}
|
|
3837
|
-
const registration = generateProviderRegistration(existingContent, laravelVersion);
|
|
3854
|
+
const registration = generateProviderRegistration(existingContent, laravelVersion, laravelRoot);
|
|
3838
3855
|
if (registration && !registration.alreadyRegistered) {
|
|
3839
3856
|
outputs.push({
|
|
3840
3857
|
path: registration.path,
|
|
@@ -3979,4 +3996,4 @@ export {
|
|
|
3979
3996
|
getFactoryPath,
|
|
3980
3997
|
laravelPlugin
|
|
3981
3998
|
};
|
|
3982
|
-
//# sourceMappingURL=chunk-
|
|
3999
|
+
//# sourceMappingURL=chunk-TBXCIKK7.js.map
|