prisma-laravel-migrate 3.1.17 → 3.1.19

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
@@ -328,12 +328,12 @@ function decorate(name, opts) {
328
328
  const suf = opts.tableSuffix ?? "";
329
329
  return `${pre}${name}${suf}`.trim();
330
330
  }
331
+ var config = {};
331
332
  function addToConfig(key, value) {
332
- global._config = global._config ?? {};
333
- global._config[key] = value;
333
+ config[key] = value;
334
334
  }
335
335
  function getConfig(key, property) {
336
- const cfg = global._config ?? {};
336
+ const cfg = config;
337
337
  const section = cfg[key];
338
338
  return property ? section?.[property] : section;
339
339
  }
@@ -1102,8 +1102,8 @@ async function writeWithMerge(filePath, theirs, type, overwrite = true, currentP
1102
1102
  const readPath = currentPath ?? filePath;
1103
1103
  if (!overwrite && existsSync(filePath)) return;
1104
1104
  const doFormat = (code) => {
1105
- const globalCfg = global?._config ?? {};
1106
- const typeCfg = globalCfg[type] ?? {};
1105
+ const globalCfg = getConfig(type);
1106
+ const typeCfg = globalCfg ?? {};
1107
1107
  const usePrettier = !!typeCfg.prettier;
1108
1108
  if (!usePrettier || !code) return code;
1109
1109
  const parser = typeCfg.parser ?? (type === "ts" ? "typescript" : "php");
@@ -3235,6 +3235,7 @@ async function generateTypesFromPrisma(options) {
3235
3235
  mkdirSync(tsOutDir, { recursive: true });
3236
3236
  }
3237
3237
  addToConfig("typescript", cfg);
3238
+ addToConfig("model", { tablePrefix: cfg.tablePrefix, tableSuffix: cfg.tableSuffix });
3238
3239
  global._config = global._config || {};
3239
3240
  global._config.ts = {
3240
3241
  prettier: !!cfg.prettier
@@ -3349,7 +3350,7 @@ async function runGenerators(configPath, skipPrismaGenerate = false) {
3349
3350
  const { migCfg, modCfg, tsCfg } = await getLaravelGeneratorConfigs(datamodel);
3350
3351
  const sdk = dmf.default ?? dmf;
3351
3352
  const dmmf = await sdk.getDMMF({ datamodel });
3352
- const config = (conf) => {
3353
+ const config2 = (conf) => {
3353
3354
  return {
3354
3355
  dmmf,
3355
3356
  // pass the models block config directly
@@ -3362,9 +3363,9 @@ async function runGenerators(configPath, skipPrismaGenerate = false) {
3362
3363
  version: ""
3363
3364
  };
3364
3365
  };
3365
- await generateLaravelSchema(config(migCfg));
3366
- await generateLaravelModels(config(modCfg));
3367
- await generateTypesFromPrisma(config(tsCfg));
3366
+ await generateLaravelSchema(config2(migCfg));
3367
+ await generateLaravelModels(config2(modCfg));
3368
+ await generateTypesFromPrisma(config2(tsCfg));
3368
3369
  };
3369
3370
  if (skipPrismaGenerate) {
3370
3371
  await doRun();
@@ -240,12 +240,12 @@ function decorate(name, opts) {
240
240
  const suf = opts.tableSuffix ?? "";
241
241
  return `${pre}${name}${suf}`.trim();
242
242
  }
243
+ var config = {};
243
244
  function addToConfig(key, value) {
244
- global._config = global._config ?? {};
245
- global._config[key] = value;
245
+ config[key] = value;
246
246
  }
247
247
  function getConfig(key, property) {
248
- const cfg = global._config ?? {};
248
+ const cfg = config;
249
249
  const section = cfg[key];
250
250
  return property ? section?.[property] : section;
251
251
  }
@@ -1013,8 +1013,8 @@ async function writeWithMerge(filePath, theirs, type, overwrite = true, currentP
1013
1013
  const readPath = currentPath ?? filePath;
1014
1014
  if (!overwrite && existsSync(filePath)) return;
1015
1015
  const doFormat = (code) => {
1016
- const globalCfg = global?._config ?? {};
1017
- const typeCfg = globalCfg[type] ?? {};
1016
+ const globalCfg = getConfig(type);
1017
+ const typeCfg = globalCfg ?? {};
1018
1018
  const usePrettier = !!typeCfg.prettier;
1019
1019
  if (!usePrettier || !code) return code;
1020
1020
  const parser = typeCfg.parser ?? ("php");
@@ -77,12 +77,12 @@ function decorate(name, opts) {
77
77
  const suf = opts.tableSuffix ?? "";
78
78
  return `${pre}${name}${suf}`.trim();
79
79
  }
80
+ var config = {};
80
81
  function addToConfig(key, value) {
81
- global._config = global._config ?? {};
82
- global._config[key] = value;
82
+ config[key] = value;
83
83
  }
84
84
  function getConfig(key, property) {
85
- const cfg = global._config ?? {};
85
+ const cfg = config;
86
86
  const section = cfg[key];
87
87
  return property ? section?.[property] : section;
88
88
  }
@@ -1047,8 +1047,8 @@ async function writeWithMerge(filePath, theirs, type, overwrite = true, currentP
1047
1047
  const readPath = filePath;
1048
1048
  if (!overwrite && existsSync(filePath)) return;
1049
1049
  const doFormat = (code) => {
1050
- const globalCfg = global?._config ?? {};
1051
- const typeCfg = globalCfg[type] ?? {};
1050
+ const globalCfg = getConfig(type);
1051
+ const typeCfg = globalCfg ?? {};
1052
1052
  const usePrettier = !!typeCfg.prettier;
1053
1053
  if (!usePrettier || !code) return code;
1054
1054
  const parser = typeCfg.parser ?? ("php");
@@ -167,14 +167,14 @@ function decorate(name, opts) {
167
167
  const suf = opts.tableSuffix ?? "";
168
168
  return `${pre}${name}${suf}`.trim();
169
169
  }
170
+ var config = {};
170
171
  function addToConfig(key, value) {
171
- global._config = global._config ?? {};
172
- global._config[key] = value;
172
+ config[key] = value;
173
173
  }
174
174
  function getConfig(key, property) {
175
- const cfg = global._config ?? {};
175
+ const cfg = config;
176
176
  const section = cfg[key];
177
- return property ? section?.[property] : section;
177
+ return section;
178
178
  }
179
179
  var isForModel = (t) => (t & 1 /* Model */) !== 0;
180
180
  function parseTargetDirective(tag, doc, defaultFlags = 1 /* Model */) {
@@ -1541,8 +1541,8 @@ async function writeWithMerge(filePath, theirs, type, overwrite = true, currentP
1541
1541
  const readPath = filePath;
1542
1542
  if (!overwrite && existsSync(filePath)) return;
1543
1543
  const doFormat = (code) => {
1544
- const globalCfg = global?._config ?? {};
1545
- const typeCfg = globalCfg[type] ?? {};
1544
+ const globalCfg = getConfig(type);
1545
+ const typeCfg = globalCfg ?? {};
1546
1546
  const usePrettier = !!typeCfg.prettier;
1547
1547
  if (!usePrettier || !code) return code;
1548
1548
  const parser = typeCfg.parser ?? ("typescript" );
@@ -1689,6 +1689,7 @@ async function generateTypesFromPrisma(options) {
1689
1689
  mkdirSync(tsOutDir, { recursive: true });
1690
1690
  }
1691
1691
  addToConfig("typescript", cfg);
1692
+ addToConfig("model", { tablePrefix: cfg.tablePrefix, tableSuffix: cfg.tableSuffix });
1692
1693
  global._config = global._config || {};
1693
1694
  global._config.ts = {
1694
1695
  prettier: !!cfg.prettier
package/dist/index.js CHANGED
@@ -392,12 +392,12 @@ function decorate(name, opts) {
392
392
  const suf = opts.tableSuffix ?? "";
393
393
  return `${pre}${name}${suf}`.trim();
394
394
  }
395
+ var config = {};
395
396
  function addToConfig(key, value) {
396
- global._config = global._config ?? {};
397
- global._config[key] = value;
397
+ config[key] = value;
398
398
  }
399
399
  function getConfig(key, property) {
400
- const cfg = global._config ?? {};
400
+ const cfg = config;
401
401
  const section = cfg[key];
402
402
  return property ? section?.[property] : section;
403
403
  }
@@ -1166,8 +1166,8 @@ async function writeWithMerge(filePath, theirs, type, overwrite = true, currentP
1166
1166
  const readPath = currentPath ?? filePath;
1167
1167
  if (!overwrite && existsSync(filePath)) return;
1168
1168
  const doFormat = (code) => {
1169
- const globalCfg = global?._config ?? {};
1170
- const typeCfg = globalCfg[type] ?? {};
1169
+ const globalCfg = getConfig(type);
1170
+ const typeCfg = globalCfg ?? {};
1171
1171
  const usePrettier = !!typeCfg.prettier;
1172
1172
  if (!usePrettier || !code) return code;
1173
1173
  const parser = typeCfg.parser ?? (type === "ts" ? "typescript" : "php");
@@ -3230,6 +3230,7 @@ async function generateTypesFromPrisma(options) {
3230
3230
  mkdirSync(tsOutDir, { recursive: true });
3231
3231
  }
3232
3232
  addToConfig("typescript", cfg);
3233
+ addToConfig("model", { tablePrefix: cfg.tablePrefix, tableSuffix: cfg.tableSuffix });
3233
3234
  global._config = global._config || {};
3234
3235
  global._config.ts = {
3235
3236
  prettier: !!cfg.prettier
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-laravel-migrate",
3
- "version": "3.1.17",
3
+ "version": "3.1.19",
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,8 +54,7 @@
54
54
  "minimatch": "^10.0.3",
55
55
  "node-diff3": "^3.1.2",
56
56
  "pluralize": "^8.0.0",
57
- "prettier": "^3.6.2",
58
- "prisma-laravel-migrate": "^3.1.16"
57
+ "prettier": "^3.6.2"
59
58
  },
60
59
  "devDependencies": {
61
60
  "@types/ejs": "^3.1.5",