qkpr 1.0.7 → 1.0.8

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.
Files changed (2) hide show
  1. package/dist/index.mjs +62 -17
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1767,7 +1767,7 @@ async function promptCreateMergeBranch(mergeBranchName) {
1767
1767
  type: "confirm",
1768
1768
  name: "createMergeBranch",
1769
1769
  message: "Do you want to create a merge branch for conflict resolution?",
1770
- default: true
1770
+ default: false
1771
1771
  }]);
1772
1772
  return createMergeBranch$1;
1773
1773
  }
@@ -1957,6 +1957,55 @@ function compareVersions(v1, v2) {
1957
1957
  return 0;
1958
1958
  }
1959
1959
  /**
1960
+ * Detect the package manager used to install qkpr globally
1961
+ * Returns: 'npm', 'pnpm', 'yarn', or 'bun' (defaults to 'npm')
1962
+ */
1963
+ function detectPackageManager() {
1964
+ const packageName$1 = "qkpr";
1965
+ try {
1966
+ if (execSync(`npm list -g ${packageName$1}`, {
1967
+ encoding: "utf-8",
1968
+ stdio: [
1969
+ "pipe",
1970
+ "pipe",
1971
+ "ignore"
1972
+ ]
1973
+ }).includes(packageName$1)) return "npm";
1974
+ } catch {}
1975
+ try {
1976
+ if (execSync(`pnpm list -g ${packageName$1}`, {
1977
+ encoding: "utf-8",
1978
+ stdio: [
1979
+ "pipe",
1980
+ "pipe",
1981
+ "ignore"
1982
+ ]
1983
+ }).includes(packageName$1)) return "pnpm";
1984
+ } catch {}
1985
+ try {
1986
+ const yarnResult = execSync(`yarn global list`, {
1987
+ encoding: "utf-8",
1988
+ stdio: [
1989
+ "pipe",
1990
+ "pipe",
1991
+ "ignore"
1992
+ ]
1993
+ });
1994
+ if (yarnResult.includes(`"${packageName$1}"`) || yarnResult.includes(`'${packageName$1}'`)) return "yarn";
1995
+ } catch {}
1996
+ try {
1997
+ if (execSync(`bun pm ls -g`, {
1998
+ encoding: "utf-8",
1999
+ stdio: [
2000
+ "pipe",
2001
+ "pipe",
2002
+ "ignore"
2003
+ ]
2004
+ }).includes(packageName$1)) return "bun";
2005
+ } catch {}
2006
+ return "npm";
2007
+ }
2008
+ /**
1960
2009
  * Display update notification and prompt user to update
1961
2010
  */
1962
2011
  async function promptForUpdate(packageName$1, result) {
@@ -1966,29 +2015,21 @@ async function promptForUpdate(packageName$1, result) {
1966
2015
  console.log(yellow("╚═══════════════════════════════════════════════════════════════╝"));
1967
2016
  console.log(dim(` Current version: ${result.currentVersion}`));
1968
2017
  console.log(green(` Latest version: ${result.latestVersion}\n`));
1969
- const { shouldUpdate, packageManager } = await inquirer.prompt([{
2018
+ const { shouldUpdate } = await inquirer.prompt([{
1970
2019
  type: "confirm",
1971
2020
  name: "shouldUpdate",
1972
2021
  message: "Would you like to update now?",
1973
2022
  default: true
1974
- }, {
1975
- type: "list",
1976
- name: "packageManager",
1977
- message: "Select package manager:",
1978
- choices: [
1979
- "npm",
1980
- "pnpm",
1981
- "yarn"
1982
- ],
1983
- default: "npm",
1984
- when: (answers) => answers.shouldUpdate
1985
2023
  }]);
1986
2024
  if (shouldUpdate) try {
1987
- console.log(cyan(`\n⏳ Updating ${packageName$1}...\n`));
2025
+ const packageManager = detectPackageManager();
2026
+ console.log(cyan(`\n⏳ Updating ${packageName$1} using ${packageManager}...\n`));
1988
2027
  let command;
1989
2028
  if (packageManager === "npm") command = `npm install -g ${packageName$1}`;
1990
2029
  else if (packageManager === "pnpm") command = `pnpm add -g ${packageName$1}`;
1991
- else command = `yarn global add ${packageName$1}`;
2030
+ else if (packageManager === "yarn") command = `yarn global add ${packageName$1}`;
2031
+ else if (packageManager === "bun") command = `bun add -g ${packageName$1}`;
2032
+ else command = `npm install -g ${packageName$1}`;
1992
2033
  execSync(command, { stdio: "inherit" });
1993
2034
  console.log(green(`\n✅ Successfully updated to version ${result.latestVersion}!`));
1994
2035
  console.log(yellow("Please restart the command to use the new version.\n"));
@@ -1997,11 +2038,15 @@ async function promptForUpdate(packageName$1, result) {
1997
2038
  console.log(red("\n❌ Failed to update. Please try manually:"));
1998
2039
  console.log(dim(` npm install -g ${packageName$1}`));
1999
2040
  console.log(dim(` or: pnpm add -g ${packageName$1}`));
2000
- console.log(dim(` or: yarn global add ${packageName$1}\n`));
2041
+ console.log(dim(` or: yarn global add ${packageName$1}`));
2042
+ console.log(dim(` or: bun add -g ${packageName$1}\n`));
2001
2043
  }
2002
2044
  else {
2003
2045
  console.log(dim("\nYou can update later by running:"));
2004
- console.log(yellow(` npm install -g ${packageName$1}\n`));
2046
+ console.log(yellow(` npm install -g ${packageName$1}`));
2047
+ console.log(dim(` or: pnpm add -g ${packageName$1}`));
2048
+ console.log(dim(` or: yarn global add ${packageName$1}`));
2049
+ console.log(dim(` or: bun add -g ${packageName$1}\n`));
2005
2050
  }
2006
2051
  }
2007
2052
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qkpr",
3
3
  "type": "module",
4
- "version": "1.0.7",
4
+ "version": "1.0.8",
5
5
  "description": "Create a Pull Request with interactive branch selection",
6
6
  "author": "KazooTTT <work@kazoottt.top>",
7
7
  "license": "MIT",