@prismicio/manager 0.0.2-alpha.xru-fix-npx-install-warnings.1 → 0.0.2-alpha.xru-fix-npx-install-warnings.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"installDependencies.js","sources":["../../../src/lib/installDependencies.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\nimport { parseNi } from \"@antfu/ni\";\n\nimport { PackageManager } from \"../types\";\n\nconst EXTRA_INSTALL_FLAGS: Record<PackageManager, string[]> = {\n\tnpm: [\"--color=always\", \"--loglevel=info\"],\n\tpnpm: [],\n\tyarn: [],\n\t\"yarn@berry\": [],\n\t\"pnpm@6\": [],\n\tbun: [],\n\tdeno: [],\n};\n\ntype InstallDependenciesArgs = {\n\tpackageManager: PackageManager;\n\tdependencies: Record<string, string>;\n\tdev?: boolean;\n\tcwd?: string;\n\tenv?: NodeJS.ProcessEnv;\n};\n\ntype ResultPromise = Promise<void> & {\n\tstdout: NodeJS.ReadableStream | null;\n\tstderr: NodeJS.ReadableStream | null;\n};\n\ntype InstallDependenciesReturnType = {\n\texecaProcess: ResultPromise;\n};\n\nconst resolveCommand = (\n\tcommand: string | { command: string; args: string[] },\n): string => {\n\tif (typeof command === \"string\") {\n\t\treturn command;\n\t}\n\n\treturn [command.command, ...command.args].join(\" \");\n};\n\nexport const installDependencies = async (\n\targs: InstallDependenciesArgs,\n): Promise<InstallDependenciesReturnType> => {\n\tconst commandArgs = Object.entries(args.dependencies).map(\n\t\t([pkg, range]) => `${pkg}@${range}`,\n\t);\n\n\tif (commandArgs.length && args.dev) {\n\t\tcommandArgs.unshift(\"-D\");\n\t}\n\n\tcommandArgs.push(...EXTRA_INSTALL_FLAGS[args.packageManager]);\n\n\tconst parsedCommand = await parseNi(args.packageManager, commandArgs);\n\n\tif (!parsedCommand) {\n\t\tthrow new Error(\n\t\t\t\"Failed to begin dependency installation (could not parse command)\",\n\t\t\t{\n\t\t\t\tcause: {\n\t\t\t\t\tpackageManager: args.packageManager,\n\t\t\t\t\tdependencies: args.dependencies,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t}\n\n\tconst parsed = resolveCommand(parsedCommand);\n\t\n\tlet command: string;\n\t\n\tif (typeof parsedCommand === \"object\" && parsedCommand !== null) {\n\t\tcommand = [parsedCommand.command, ...parsedCommand.args].join(\" \");\n\t} else {\n\t\tcommand = parsed;\n\t}\n\n\tconst childProcess = spawn(command, {\n\t\tcwd: args.cwd || process.cwd(),\n\t\tenv: { ...process.env, ...args.env },\n\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\tshell: true,\n\t});\n\n\tconst promise = new Promise<void>((resolve, reject) => {\n\t\tchildProcess.on(\"error\", (error) => {\n\t\t\treject(error);\n\t\t});\n\n\t\tchildProcess.on(\"exit\", (code) => {\n\t\t\tif (code === 0) {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\tconst error = new Error(`Command failed with exit code ${code}`);\n\t\t\t\tObject.assign(error, {\n\t\t\t\t\tshortMessage: `Command failed: ${parsed}`,\n\t\t\t\t\tstderr: \"\",\n\t\t\t\t});\n\t\t\t\treject(error);\n\t\t\t}\n\t\t});\n\t}) as ResultPromise;\n\n\tpromise.stdout = childProcess.stdout;\n\tpromise.stderr = childProcess.stderr;\n\n\treturn {\n\t\texecaProcess: promise,\n\t};\n};\n"],"names":[],"mappings":";;AAKA,MAAM,sBAAwD;AAAA,EAC7D,KAAK,CAAC,kBAAkB,iBAAiB;AAAA,EACzC,MAAM,CAAA;AAAA,EACN,MAAM,CAAA;AAAA,EACN,cAAc,CAAA;AAAA,EACd,UAAU,CAAA;AAAA,EACV,KAAK,CAAA;AAAA,EACL,MAAM,CAAA;;AAoBP,MAAM,iBAAiB,CACtB,YACW;AACX,MAAI,OAAO,YAAY,UAAU;AAChC,WAAO;AAAA,EACR;AAEA,SAAO,CAAC,QAAQ,SAAS,GAAG,QAAQ,IAAI,EAAE,KAAK,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AM;AAAA,UACvC,QAAQ;AAAA,QAAA,CACR;AACD,eAAO,KAAK;AAAA,MACb;AAAA,IACD,CAAC;AAAA,EACF,CAAC;AAED,UAAQ,SAAS,aAAa;AAC9B,UAAQ,SAAS,aAAa;AAE9B,SAAO;AAAA,IACN,cAAc;AAAA,EAAA;AAEhB;"}
1
+ {"version":3,"file":"installDependencies.js","sources":["../../../src/lib/installDependencies.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\n\nimport { parseNi } from \"@antfu/ni\";\n\nimport { PackageManager } from \"../types\";\n\nconst EXTRA_INSTALL_FLAGS: Record<PackageManager, string[]> = {\n\tnpm: [\"--color=always\", \"--loglevel=info\"],\n\tpnpm: [],\n\tyarn: [],\n\t\"yarn@berry\": [],\n\t\"pnpm@6\": [],\n\tbun: [],\n\tdeno: [],\n};\n\ntype InstallDependenciesArgs = {\n\tpackageManager: PackageManager;\n\tdependencies: Record<string, string>;\n\tdev?: boolean;\n\tcwd?: string;\n\tenv?: NodeJS.ProcessEnv;\n};\n\ntype ResultPromise = Promise<void> & {\n\tstdout: NodeJS.ReadableStream | null;\n\tstderr: NodeJS.ReadableStream | null;\n};\n\ntype InstallDependenciesReturnType = {\n\texecaProcess: ResultPromise;\n};\n\nconst resolveCommand = (\n\tcommand: string | { command: string; args: string[] },\n): string => {\n\tif (typeof command === \"string\") {\n\t\treturn command;\n\t}\n\n\treturn [command.command, ...command.args].join(\" \");\n};\n\nexport const installDependencies = async (\n\targs: InstallDependenciesArgs,\n): Promise<InstallDependenciesReturnType> => {\n\tconst commandArgs = Object.entries(args.dependencies).map(\n\t\t([pkg, range]) => `${pkg}@${range}`,\n\t);\n\n\tif (commandArgs.length && args.dev) {\n\t\tcommandArgs.unshift(\"-D\");\n\t}\n\n\tcommandArgs.push(...EXTRA_INSTALL_FLAGS[args.packageManager]);\n\n\tconst parsedCommand = await parseNi(args.packageManager, commandArgs);\n\n\tif (!parsedCommand) {\n\t\tthrow new Error(\n\t\t\t\"Failed to begin dependency installation (could not parse command)\",\n\t\t\t{\n\t\t\t\tcause: {\n\t\t\t\t\tpackageManager: args.packageManager,\n\t\t\t\t\tdependencies: args.dependencies,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t}\n\n\tconst parsed = resolveCommand(parsedCommand);\n\n\tlet command: string;\n\n\tif (typeof parsedCommand === \"object\" && parsedCommand !== null) {\n\t\tcommand = [parsedCommand.command, ...parsedCommand.args].join(\" \");\n\t} else {\n\t\tcommand = parsed;\n\t}\n\n\tconst childProcess = spawn(command, {\n\t\tcwd: args.cwd || process.cwd(),\n\t\tenv: { ...process.env, ...args.env },\n\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\tshell: true,\n\t});\n\n\tconst promise = new Promise<void>((resolve, reject) => {\n\t\tchildProcess.on(\"error\", (error) => {\n\t\t\treject(error);\n\t\t});\n\n\t\tchildProcess.on(\"exit\", (code) => {\n\t\t\tif (code === 0) {\n\t\t\t\tresolve();\n\t\t\t} else {\n\t\t\t\tconst error = new Error(`Command failed with exit code ${code}`);\n\t\t\t\tObject.assign(error, {\n\t\t\t\t\tshortMessage: `Command failed: ${parsed}`,\n\t\t\t\t\tstderr: \"\",\n\t\t\t\t});\n\t\t\t\treject(error);\n\t\t\t}\n\t\t});\n\t}) as ResultPromise;\n\n\tpromise.stdout = childProcess.stdout;\n\tpromise.stderr = childProcess.stderr;\n\n\treturn {\n\t\texecaProcess: promise,\n\t};\n};\n"],"names":[],"mappings":";;AAMA,MAAM,sBAAwD;AAAA,EAC7D,KAAK,CAAC,kBAAkB,iBAAiB;AAAA,EACzC,MAAM,CAAA;AAAA,EACN,MAAM,CAAA;AAAA,EACN,cAAc,CAAA;AAAA,EACd,UAAU,CAAA;AAAA,EACV,KAAK,CAAA;AAAA,EACL,MAAM,CAAA;;AAoBP,MAAM,iBAAiB,CACtB,YACW;AACX,MAAI,OAAO,YAAY,UAAU;AAChC,WAAO;AAAA,EACR;AAEA,SAAO,CAAC,QAAQ,SAAS,GAA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AAA,UACpB,cAAc,mBAAmB,MAAM;AAAA,UACvC,QAAQ;AAAA,QAAA,CACR;AACD,eAAO,KAAK;AAAA,MACb;AAAA,IACD,CAAC;AAAA,EACF,CAAC;AAED,UAAQ,SAAS,aAAa;AAC9B,UAAQ,SAAS,aAAa;AAE9B,SAAO;AAAA,IACN,cAAc;AAAA,EAAA;AAEhB;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/manager",
3
- "version": "0.0.2-alpha.xru-fix-npx-install-warnings.1",
3
+ "version": "0.0.2-alpha.xru-fix-npx-install-warnings.2",
4
4
  "description": "Manage all aspects of a Prismic project.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -63,7 +63,7 @@
63
63
  "@antfu/ni": "27.0.1",
64
64
  "@prismicio/client": "7.21.0",
65
65
  "@prismicio/custom-types-client": "2.1.0",
66
- "@prismicio/plugin-kit": "0.0.2-alpha.xru-fix-npx-install-warnings.1",
66
+ "@prismicio/plugin-kit": "0.0.2-alpha.xru-fix-npx-install-warnings.3",
67
67
  "@prismicio/types-internal": "3.16.1",
68
68
  "@segment/analytics-node": "2.3.0",
69
69
  "cookie": "1.1.1",
@@ -1,4 +1,5 @@
1
1
  import { spawn } from "node:child_process";
2
+
2
3
  import { parseNi } from "@antfu/ni";
3
4
 
4
5
  import { PackageManager } from "../types";
@@ -68,9 +69,9 @@ export const installDependencies = async (
68
69
  }
69
70
 
70
71
  const parsed = resolveCommand(parsedCommand);
71
-
72
+
72
73
  let command: string;
73
-
74
+
74
75
  if (typeof parsedCommand === "object" && parsedCommand !== null) {
75
76
  command = [parsedCommand.command, ...parsedCommand.args].join(" ");
76
77
  } else {