@prisma/migrate 5.22.0-integration-remove-custom-yarn-logic.5 → 5.22.0-integration-engines-5-22-0-27-metrics3-phantasmagoria-of-the-lost-recorder-47785ced2c48f59d114bb0f15b5495cf6c0a7b8e.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,15 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_O6RO4YUZ_exports = {};
30
- __export(chunk_O6RO4YUZ_exports, {
29
+ var chunk_LLGEQ76N_exports = {};
30
+ __export(chunk_LLGEQ76N_exports, {
31
31
  MigrateDev: () => MigrateDev,
32
32
  init_MigrateDev: () => init_MigrateDev
33
33
  });
34
- module.exports = __toCommonJS(chunk_O6RO4YUZ_exports);
34
+ module.exports = __toCommonJS(chunk_LLGEQ76N_exports);
35
35
  var import_chunk_IFCV5MY4 = require("./chunk-IFCV5MY4.js");
36
36
  var import_chunk_SGCF5OHF = require("./chunk-SGCF5OHF.js");
37
- var import_chunk_YKUZUAXA = require("./chunk-YKUZUAXA.js");
37
+ var import_chunk_EFPE3Q7J = require("./chunk-EFPE3Q7J.js");
38
38
  var import_chunk_WOOPRG54 = require("./chunk-WOOPRG54.js");
39
39
  var import_chunk_6QFE3AWR = require("./chunk-6QFE3AWR.js");
40
40
  var import_chunk_MWEO3VUS = require("./chunk-MWEO3VUS.js");
@@ -60,7 +60,7 @@ var init_MigrateDev = (0, import_chunk_WWAWV7DQ.__esm)({
60
60
  (0, import_chunk_WOOPRG54.init_printFiles)();
61
61
  (0, import_chunk_6QFE3AWR.init_printMigrationId)();
62
62
  (0, import_chunk_IFCV5MY4.init_promptForMigrationName)();
63
- (0, import_chunk_YKUZUAXA.init_seed)();
63
+ (0, import_chunk_EFPE3Q7J.init_seed)();
64
64
  debug = (0, import_debug.default)("prisma:migrate:dev");
65
65
  _MigrateDev = class _MigrateDev2 {
66
66
  static new() {
@@ -268,10 +268,10 @@ ${(0, import_chunk_6TE2RIPN.green)("Your database is now in sync with your schem
268
268
  }
269
269
  if ((wasDbCreated || devDiagnostic.action.tag === "reset") && !process.env.PRISMA_MIGRATE_SKIP_SEED && !args["--skip-seed"]) {
270
270
  try {
271
- const seedCommandFromPkgJson = await (0, import_chunk_YKUZUAXA.getSeedCommandFromPackageJson)(process.cwd());
271
+ const seedCommandFromPkgJson = await (0, import_chunk_EFPE3Q7J.getSeedCommandFromPackageJson)(process.cwd());
272
272
  if (seedCommandFromPkgJson) {
273
273
  process.stdout.write("\n");
274
- const successfulSeeding = await (0, import_chunk_YKUZUAXA.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson });
274
+ const successfulSeeding = await (0, import_chunk_EFPE3Q7J.executeSeedCommand)({ commandFromConfig: seedCommandFromPkgJson });
275
275
  if (successfulSeeding) {
276
276
  process.stdout.write(`
277
277
  ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been executed.
@@ -281,7 +281,7 @@ ${process.platform === "win32" ? "" : "\u{1F331} "}The seed command has been ex
281
281
  }
282
282
  } else {
283
283
  const { schemaPath: schemaPath2 } = await (0, import_internals.getSchemaWithPath)(args["--schema"]);
284
- await (0, import_chunk_YKUZUAXA.verifySeedConfigAndReturnMessage)(schemaPath2);
284
+ await (0, import_chunk_EFPE3Q7J.verifySeedConfigAndReturnMessage)(schemaPath2);
285
285
  }
286
286
  } catch (e) {
287
287
  console.error(e);
@@ -26,15 +26,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_B4GG72YU_exports = {};
30
- __export(chunk_B4GG72YU_exports, {
29
+ var chunk_UY4MANZT_exports = {};
30
+ __export(chunk_UY4MANZT_exports, {
31
31
  MigrateDiff: () => MigrateDiff,
32
32
  init_MigrateDiff: () => init_MigrateDiff
33
33
  });
34
- module.exports = __toCommonJS(chunk_B4GG72YU_exports);
34
+ module.exports = __toCommonJS(chunk_UY4MANZT_exports);
35
35
  var import_chunk_VWV2NY26 = require("./chunk-VWV2NY26.js");
36
36
  var import_chunk_XRTNIFND = require("./chunk-XRTNIFND.js");
37
37
  var import_chunk_TKAGMA5K = require("./chunk-TKAGMA5K.js");
38
+ var import_chunk_WIZM7TFT = require("./chunk-WIZM7TFT.js");
38
39
  var import_chunk_MWEO3VUS = require("./chunk-MWEO3VUS.js");
39
40
  var import_chunk_LVFPGUOH = require("./chunk-LVFPGUOH.js");
40
41
  var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
@@ -10753,7 +10754,7 @@ var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
10753
10754
  "../internals/package.json"(exports, module2) {
10754
10755
  module2.exports = {
10755
10756
  name: "@prisma/internals",
10756
- version: "5.22.0-integration-remove-custom-yarn-logic.5",
10757
+ version: "5.22.0-integration-engines-5-22-0-27-metrics3-phantasmagoria-of-the-lost-recorder-47785ced2c48f59d114bb0f15b5495cf6c0a7b8e.1",
10757
10758
  description: "This package is intended for Prisma's internal use",
10758
10759
  main: "dist/index.js",
10759
10760
  types: "dist/index.d.ts",
@@ -10838,7 +10839,7 @@ var require_package = (0, import_chunk_WWAWV7DQ.__commonJS)({
10838
10839
  "@prisma/fetch-engine": "workspace:*",
10839
10840
  "@prisma/generator-helper": "workspace:*",
10840
10841
  "@prisma/get-platform": "workspace:*",
10841
- "@prisma/prisma-schema-wasm": "5.22.0-12.8263a1f2b3deb0a72687cad83ceb981a25624db8",
10842
+ "@prisma/prisma-schema-wasm": "5.22.0-27.metrics3-phantasmagoria-of-the-lost-recorder-47785ced2c48f59d114bb0f15b5495cf6c0a7b8e",
10842
10843
  "@prisma/schema-files-loader": "workspace:*",
10843
10844
  arg: "5.0.2",
10844
10845
  prompts: "2.4.2"
@@ -11207,9 +11208,14 @@ async function getSchemaWithPathInternal(schemaPathFromArgs, { cwd, argumentName
11207
11208
  if (defaultResult.ok) {
11208
11209
  return defaultResult;
11209
11210
  }
11211
+ const yarnResult = await getSchemaFromYarn1Workspace(cwd, defaultResult.error.failures);
11212
+ if (yarnResult.ok) {
11213
+ return yarnResult;
11214
+ }
11215
+ const finalError = yarnResult.error.kind === "Yarn1WorkspaceSchemaNotFound" ? defaultResult.error : yarnResult.error;
11210
11216
  return {
11211
11217
  ok: false,
11212
- error: defaultResult.error
11218
+ error: finalError
11213
11219
  };
11214
11220
  }
11215
11221
  function renderLookupError(error) {
@@ -11284,6 +11290,47 @@ async function getSchemaFromPackageJson(cwd) {
11284
11290
  }
11285
11291
  return lookupResult;
11286
11292
  }
11293
+ async function getSchemaFromYarn1Workspace(cwd, pastFailures) {
11294
+ if (!process.env.npm_config_user_agent?.includes("yarn")) {
11295
+ return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
11296
+ }
11297
+ let workspaces;
11298
+ try {
11299
+ const { stdout: version2 } = await import_execa.default.command("yarn --version", {
11300
+ cwd
11301
+ });
11302
+ if (version2.startsWith("2")) {
11303
+ return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
11304
+ }
11305
+ const { stdout } = await import_execa.default.command("yarn workspaces info --json", {
11306
+ cwd
11307
+ });
11308
+ const json = getJson(stdout);
11309
+ workspaces = Object.values(json);
11310
+ } catch {
11311
+ return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
11312
+ }
11313
+ const workspaceRootDir = await findWorkspaceRoot(cwd);
11314
+ if (!workspaceRootDir) {
11315
+ return { ok: false, error: { kind: "Yarn1WorkspaceSchemaNotFound" } };
11316
+ }
11317
+ for (const workspace of workspaces) {
11318
+ const workspacePath = import_path5.default.join(workspaceRootDir, workspace.location);
11319
+ const workspaceSchema = await tryWorkspacePath(workspacePath, pastFailures);
11320
+ if (workspaceSchema.ok) {
11321
+ return workspaceSchema;
11322
+ }
11323
+ }
11324
+ const rootPathSchema = await tryWorkspacePath(workspaceRootDir, pastFailures);
11325
+ return rootPathSchema;
11326
+ }
11327
+ async function tryWorkspacePath(cwd, pastFailures) {
11328
+ const pkgJson = await getSchemaFromPackageJson(cwd);
11329
+ if (pkgJson.ok) {
11330
+ return pkgJson;
11331
+ }
11332
+ return getDefaultSchema(cwd, pastFailures);
11333
+ }
11287
11334
  async function getDefaultSchema(cwd, failures = []) {
11288
11335
  const schemaPrisma = {
11289
11336
  schemaPath: {
@@ -11348,11 +11395,50 @@ async function loadSchemaFromDefaultLocation(lookupPath) {
11348
11395
  return readSchemaFromDirectory(lookupPath.path);
11349
11396
  }
11350
11397
  }
11351
- var import_schema_files_loader, readFile, stat, debug2;
11398
+ function getJson(stdout) {
11399
+ const firstCurly = stdout.indexOf("{");
11400
+ const lastCurly = stdout.lastIndexOf("}");
11401
+ const sliced = stdout.slice(firstCurly, lastCurly + 1);
11402
+ return JSON.parse(sliced);
11403
+ }
11404
+ function isPkgJsonWorkspaceRoot(pkgJson) {
11405
+ const workspaces = pkgJson.workspaces;
11406
+ if (!workspaces) {
11407
+ return false;
11408
+ }
11409
+ return Array.isArray(workspaces) || workspaces.packages !== void 0;
11410
+ }
11411
+ async function isNearestPkgJsonWorkspaceRoot(cwd) {
11412
+ const pkgJson = await readPackageUp({ cwd, normalize: false });
11413
+ if (!pkgJson) {
11414
+ return null;
11415
+ }
11416
+ return {
11417
+ isRoot: isPkgJsonWorkspaceRoot(pkgJson.packageJson),
11418
+ path: pkgJson.path
11419
+ };
11420
+ }
11421
+ async function findWorkspaceRoot(cwd) {
11422
+ let pkgJson = await isNearestPkgJsonWorkspaceRoot(cwd);
11423
+ if (!pkgJson) {
11424
+ return null;
11425
+ }
11426
+ if (pkgJson.isRoot === true) {
11427
+ return import_path5.default.dirname(pkgJson.path);
11428
+ }
11429
+ const pkgJsonParentDir = import_path5.default.dirname(import_path5.default.dirname(pkgJson.path));
11430
+ pkgJson = await isNearestPkgJsonWorkspaceRoot(pkgJsonParentDir);
11431
+ if (!pkgJson || pkgJson.isRoot === false) {
11432
+ return null;
11433
+ }
11434
+ return import_path5.default.dirname(pkgJson.path);
11435
+ }
11436
+ var import_schema_files_loader, import_execa, readFile, stat, debug2;
11352
11437
  var init_getSchema = (0, import_chunk_WWAWV7DQ.__esm)({
11353
11438
  "../internals/src/cli/getSchema.ts"() {
11354
11439
  "use strict";
11355
11440
  import_schema_files_loader = (0, import_chunk_WWAWV7DQ.__toESM)(require_dist());
11441
+ import_execa = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_WIZM7TFT.require_execa)());
11356
11442
  (0, import_chunk_6TE2RIPN.init_colors)();
11357
11443
  init_read_package_up();
11358
11444
  init_engine_commands();