@famgia/omnify-laravel 0.0.82 → 0.0.84
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-KKNVSIBX.js} +36 -11
- package/dist/chunk-KKNVSIBX.js.map +1 -0
- package/dist/index.cjs +35 -10
- 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 +35 -10
- 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)) {
|
|
@@ -3825,16 +3842,24 @@ function laravelPlugin(options) {
|
|
|
3825
3842
|
existingContent = null;
|
|
3826
3843
|
}
|
|
3827
3844
|
} else if (existsSync(configAppPath)) {
|
|
3828
|
-
laravelVersion = "laravel10-";
|
|
3829
3845
|
try {
|
|
3830
|
-
|
|
3846
|
+
const configContent = readFileSync(configAppPath, "utf-8");
|
|
3847
|
+
if (/'providers'\s*=>\s*\[/.test(configContent)) {
|
|
3848
|
+
laravelVersion = "laravel10-";
|
|
3849
|
+
existingContent = configContent;
|
|
3850
|
+
} else {
|
|
3851
|
+
laravelVersion = "laravel11+";
|
|
3852
|
+
existingContent = null;
|
|
3853
|
+
}
|
|
3831
3854
|
} catch {
|
|
3855
|
+
laravelVersion = "laravel11+";
|
|
3832
3856
|
existingContent = null;
|
|
3833
3857
|
}
|
|
3834
3858
|
} else {
|
|
3835
3859
|
laravelVersion = "laravel11+";
|
|
3860
|
+
existingContent = null;
|
|
3836
3861
|
}
|
|
3837
|
-
const registration = generateProviderRegistration(existingContent, laravelVersion);
|
|
3862
|
+
const registration = generateProviderRegistration(existingContent, laravelVersion, laravelRoot);
|
|
3838
3863
|
if (registration && !registration.alreadyRegistered) {
|
|
3839
3864
|
outputs.push({
|
|
3840
3865
|
path: registration.path,
|
|
@@ -3979,4 +4004,4 @@ export {
|
|
|
3979
4004
|
getFactoryPath,
|
|
3980
4005
|
laravelPlugin
|
|
3981
4006
|
};
|
|
3982
|
-
//# sourceMappingURL=chunk-
|
|
4007
|
+
//# sourceMappingURL=chunk-KKNVSIBX.js.map
|