prisma-laravel-migrate 3.1.16 → 3.1.17

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/cli/cli.js CHANGED
@@ -1176,11 +1176,11 @@ function safeUnlink(p) {
1176
1176
  } catch {
1177
1177
  }
1178
1178
  }
1179
- async function loadSharedConfig(schemaDir) {
1179
+ async function loadSharedConfig(schemaDir, type) {
1180
1180
  const envOverride = process.env.PRISMA_LARAVEL_CFG;
1181
1181
  const defaultPath = path13.join(schemaDir, "prisma-laravel.config.js");
1182
1182
  const cfgPath = envOverride ? path13.resolve(envOverride) : defaultPath;
1183
- console.log("Loading shared config from - " + cfgPath);
1183
+ console.log("Loading shared config for " + type + " from - " + cfgPath);
1184
1184
  try {
1185
1185
  await fs.accessSync(cfgPath);
1186
1186
  const mod = await loadConfig(cfgPath);
@@ -1196,7 +1196,7 @@ async function generateLaravelSchema(options) {
1196
1196
  const { dmmf, generator } = options;
1197
1197
  const raw = generator.config ?? {};
1198
1198
  const schemaDir = path13.dirname(generator.sourceFilePath ?? path13.resolve(options.schemaPath));
1199
- const shared = await loadSharedConfig(schemaDir);
1199
+ const shared = await loadSharedConfig(schemaDir, "migrations");
1200
1200
  let groups = [];
1201
1201
  const loadGroups = async (p) => {
1202
1202
  const abs = path13.resolve(process.cwd(), p);
@@ -2258,7 +2258,7 @@ async function generateLaravelModels(options) {
2258
2258
  const { dmmf, generator } = options;
2259
2259
  const raw = generator.config ?? {};
2260
2260
  const schemaDir = path13.dirname(generator.sourceFilePath ?? path13.resolve(options.schemaPath));
2261
- const shared = await loadSharedConfig(schemaDir);
2261
+ const shared = await loadSharedConfig(schemaDir, "models");
2262
2262
  let groups = [];
2263
2263
  if (raw["groups"]) {
2264
2264
  const groupsModulePath = path13.resolve(process.cwd(), raw["groups"]);
@@ -3183,8 +3183,8 @@ function hasModelSpecificTsStub(model, cfg) {
3183
3183
  async function generateTypesFromPrisma(options) {
3184
3184
  const { dmmf, generator } = options;
3185
3185
  const raw = generator.config ?? {};
3186
- const schemaDir = path13.dirname(options.schemaPath);
3187
- const shared = await loadSharedConfig(schemaDir);
3186
+ const schemaDir = path13.dirname(generator.sourceFilePath ?? path13.resolve(options.schemaPath));
3187
+ const shared = await loadSharedConfig(schemaDir, "typescript");
3188
3188
  let groups = [];
3189
3189
  if (raw["groups"]) {
3190
3190
  const groupsModulePath = path13.resolve(process.cwd(), raw["groups"]);
@@ -3234,6 +3234,7 @@ async function generateTypesFromPrisma(options) {
3234
3234
  if (!existsSync(tsOutDir)) {
3235
3235
  mkdirSync(tsOutDir, { recursive: true });
3236
3236
  }
3237
+ addToConfig("typescript", cfg);
3237
3238
  global._config = global._config || {};
3238
3239
  global._config.ts = {
3239
3240
  prettier: !!cfg.prettier
@@ -1145,11 +1145,11 @@ async function loadConfig2(configPath) {
1145
1145
  }
1146
1146
 
1147
1147
  // src/utils/loadSharedCfg.ts
1148
- async function loadSharedConfig(schemaDir) {
1148
+ async function loadSharedConfig(schemaDir, type) {
1149
1149
  const envOverride = process.env.PRISMA_LARAVEL_CFG;
1150
1150
  const defaultPath = path7.join(schemaDir, "prisma-laravel.config.js");
1151
1151
  const cfgPath = envOverride ? path7.resolve(envOverride) : defaultPath;
1152
- console.log("Loading shared config from - " + cfgPath);
1152
+ console.log("Loading shared config for " + type + " from - " + cfgPath);
1153
1153
  try {
1154
1154
  await fs2.accessSync(cfgPath);
1155
1155
  const mod = await loadConfig2(cfgPath);
@@ -1165,7 +1165,7 @@ async function generateLaravelSchema(options) {
1165
1165
  const { dmmf, generator } = options;
1166
1166
  const raw = generator.config ?? {};
1167
1167
  const schemaDir = path7.dirname(generator.sourceFilePath ?? path7.resolve(options.schemaPath));
1168
- const shared = await loadSharedConfig(schemaDir);
1168
+ const shared = await loadSharedConfig(schemaDir, "migrations");
1169
1169
  let groups = [];
1170
1170
  const loadGroups = async (p) => {
1171
1171
  const abs = path7.resolve(process.cwd(), p);
@@ -1279,7 +1279,7 @@ generatorHandler({
1279
1279
  if (!migrationsOutput && options.sourceFilePath) {
1280
1280
  try {
1281
1281
  const schemaDir = path7.dirname(options.sourceFilePath);
1282
- const shared = await loadSharedConfig(schemaDir);
1282
+ const shared = await loadSharedConfig(schemaDir, "models");
1283
1283
  migrationsOutput = shared?.migrate?.outputDir ?? shared?.output?.migrations ?? void 0;
1284
1284
  } catch {
1285
1285
  }
@@ -1179,11 +1179,11 @@ async function loadConfig2(configPath) {
1179
1179
  }
1180
1180
 
1181
1181
  // src/utils/loadSharedCfg.ts
1182
- async function loadSharedConfig(schemaDir) {
1182
+ async function loadSharedConfig(schemaDir, type) {
1183
1183
  const envOverride = process.env.PRISMA_LARAVEL_CFG;
1184
1184
  const defaultPath = path7.join(schemaDir, "prisma-laravel.config.js");
1185
1185
  const cfgPath = envOverride ? path7.resolve(envOverride) : defaultPath;
1186
- console.log("Loading shared config from - " + cfgPath);
1186
+ console.log("Loading shared config for " + type + " from - " + cfgPath);
1187
1187
  try {
1188
1188
  await fs.accessSync(cfgPath);
1189
1189
  const mod = await loadConfig2(cfgPath);
@@ -1264,7 +1264,7 @@ async function generateLaravelModels(options) {
1264
1264
  const { dmmf, generator } = options;
1265
1265
  const raw = generator.config ?? {};
1266
1266
  const schemaDir = path7.dirname(generator.sourceFilePath ?? path7.resolve(options.schemaPath));
1267
- const shared = await loadSharedConfig(schemaDir);
1267
+ const shared = await loadSharedConfig(schemaDir, "models");
1268
1268
  let groups = [];
1269
1269
  if (raw["groups"]) {
1270
1270
  const groupsModulePath = path7.resolve(process.cwd(), raw["groups"]);
@@ -1355,7 +1355,7 @@ generatorHandler({
1355
1355
  if (options.sourceFilePath) {
1356
1356
  try {
1357
1357
  const schemaDir = path7.dirname(options.sourceFilePath);
1358
- const shared = await loadSharedConfig(schemaDir);
1358
+ const shared = await loadSharedConfig(schemaDir, "models");
1359
1359
  if (!modelOutput) {
1360
1360
  modelOutput = shared?.modeler?.outputDir ?? shared?.output?.models ?? void 0;
1361
1361
  }
@@ -68,11 +68,11 @@ async function loadConfig(configPath) {
68
68
  }
69
69
 
70
70
  // src/utils/loadSharedCfg.ts
71
- async function loadSharedConfig(schemaDir) {
71
+ async function loadSharedConfig(schemaDir, type) {
72
72
  const envOverride = process.env.PRISMA_LARAVEL_CFG;
73
73
  const defaultPath = path7.join(schemaDir, "prisma-laravel.config.js");
74
74
  const cfgPath = envOverride ? path7.resolve(envOverride) : defaultPath;
75
- console.log("Loading shared config from - " + cfgPath);
75
+ console.log("Loading shared config for " + type + " from - " + cfgPath);
76
76
  try {
77
77
  await fs.accessSync(cfgPath);
78
78
  const mod = await loadConfig(cfgPath);
@@ -167,6 +167,10 @@ function decorate(name, opts) {
167
167
  const suf = opts.tableSuffix ?? "";
168
168
  return `${pre}${name}${suf}`.trim();
169
169
  }
170
+ function addToConfig(key, value) {
171
+ global._config = global._config ?? {};
172
+ global._config[key] = value;
173
+ }
170
174
  function getConfig(key, property) {
171
175
  const cfg = global._config ?? {};
172
176
  const section = cfg[key];
@@ -1633,8 +1637,8 @@ function hasModelSpecificTsStub(model, cfg) {
1633
1637
  async function generateTypesFromPrisma(options) {
1634
1638
  const { dmmf, generator } = options;
1635
1639
  const raw = generator.config ?? {};
1636
- const schemaDir = path7.dirname(options.schemaPath);
1637
- const shared = await loadSharedConfig(schemaDir);
1640
+ const schemaDir = path7.dirname(generator.sourceFilePath ?? path7.resolve(options.schemaPath));
1641
+ const shared = await loadSharedConfig(schemaDir, "typescript");
1638
1642
  let groups = [];
1639
1643
  if (raw["groups"]) {
1640
1644
  const groupsModulePath = path7.resolve(process.cwd(), raw["groups"]);
@@ -1684,6 +1688,7 @@ async function generateTypesFromPrisma(options) {
1684
1688
  if (!existsSync(tsOutDir)) {
1685
1689
  mkdirSync(tsOutDir, { recursive: true });
1686
1690
  }
1691
+ addToConfig("typescript", cfg);
1687
1692
  global._config = global._config || {};
1688
1693
  global._config.ts = {
1689
1694
  prettier: !!cfg.prettier
@@ -1771,7 +1776,7 @@ generatorHandler({
1771
1776
  if (!defaultOutput && options.sourceFilePath) {
1772
1777
  try {
1773
1778
  const schemaDir = path7.dirname(options.sourceFilePath);
1774
- const shared = await loadSharedConfig(schemaDir);
1779
+ const shared = await loadSharedConfig(schemaDir, "typescript");
1775
1780
  if (shared && shared.ts) {
1776
1781
  defaultOutput = shared.ts.outputDir;
1777
1782
  }
package/dist/index.js CHANGED
@@ -1298,11 +1298,11 @@ async function loadConfig2(configPath) {
1298
1298
  }
1299
1299
 
1300
1300
  // src/utils/loadSharedCfg.ts
1301
- async function loadSharedConfig(schemaDir) {
1301
+ async function loadSharedConfig(schemaDir, type) {
1302
1302
  const envOverride = process.env.PRISMA_LARAVEL_CFG;
1303
1303
  const defaultPath = path9.join(schemaDir, "prisma-laravel.config.js");
1304
1304
  const cfgPath = envOverride ? path9.resolve(envOverride) : defaultPath;
1305
- console.log("Loading shared config from - " + cfgPath);
1305
+ console.log("Loading shared config for " + type + " from - " + cfgPath);
1306
1306
  try {
1307
1307
  await fs2.accessSync(cfgPath);
1308
1308
  const mod = await loadConfig2(cfgPath);
@@ -1318,7 +1318,7 @@ async function generateLaravelSchema(options) {
1318
1318
  const { dmmf, generator } = options;
1319
1319
  const raw = generator.config ?? {};
1320
1320
  const schemaDir = path9.dirname(generator.sourceFilePath ?? path9.resolve(options.schemaPath));
1321
- const shared = await loadSharedConfig(schemaDir);
1321
+ const shared = await loadSharedConfig(schemaDir, "migrations");
1322
1322
  let groups = [];
1323
1323
  const loadGroups = async (p) => {
1324
1324
  const abs = path9.resolve(process.cwd(), p);
@@ -2253,7 +2253,7 @@ async function generateLaravelModels(options) {
2253
2253
  const { dmmf, generator } = options;
2254
2254
  const raw = generator.config ?? {};
2255
2255
  const schemaDir = path9.dirname(generator.sourceFilePath ?? path9.resolve(options.schemaPath));
2256
- const shared = await loadSharedConfig(schemaDir);
2256
+ const shared = await loadSharedConfig(schemaDir, "models");
2257
2257
  let groups = [];
2258
2258
  if (raw["groups"]) {
2259
2259
  const groupsModulePath = path9.resolve(process.cwd(), raw["groups"]);
@@ -3178,8 +3178,8 @@ function hasModelSpecificTsStub(model, cfg) {
3178
3178
  async function generateTypesFromPrisma(options) {
3179
3179
  const { dmmf, generator } = options;
3180
3180
  const raw = generator.config ?? {};
3181
- const schemaDir = path9.dirname(options.schemaPath);
3182
- const shared = await loadSharedConfig(schemaDir);
3181
+ const schemaDir = path9.dirname(generator.sourceFilePath ?? path9.resolve(options.schemaPath));
3182
+ const shared = await loadSharedConfig(schemaDir, "typescript");
3183
3183
  let groups = [];
3184
3184
  if (raw["groups"]) {
3185
3185
  const groupsModulePath = path9.resolve(process.cwd(), raw["groups"]);
@@ -3229,6 +3229,7 @@ async function generateTypesFromPrisma(options) {
3229
3229
  if (!existsSync(tsOutDir)) {
3230
3230
  mkdirSync(tsOutDir, { recursive: true });
3231
3231
  }
3232
+ addToConfig("typescript", cfg);
3232
3233
  global._config = global._config || {};
3233
3234
  global._config.ts = {
3234
3235
  prettier: !!cfg.prettier
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-laravel-migrate",
3
- "version": "3.1.16",
3
+ "version": "3.1.17",
4
4
  "description": "Generate laravel migrations and/or models using prisma files",
5
5
  "bin": {
6
6
  "prisma-laravel-migrations": "./dist/cli/migrator.index.js",
@@ -54,7 +54,8 @@
54
54
  "minimatch": "^10.0.3",
55
55
  "node-diff3": "^3.1.2",
56
56
  "pluralize": "^8.0.0",
57
- "prettier": "^3.6.2"
57
+ "prettier": "^3.6.2",
58
+ "prisma-laravel-migrate": "^3.1.16"
58
59
  },
59
60
  "devDependencies": {
60
61
  "@types/ejs": "^3.1.5",