@tutinoko2048/mcutil 1.0.2 → 1.0.4

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.mjs CHANGED
@@ -166,28 +166,29 @@ async function detectPackageManagers(cwd) {
166
166
  const checks = [
167
167
  {
168
168
  name: "pnpm",
169
- file: "pnpm-lock.yaml"
169
+ files: ["pnpm-lock.yaml"]
170
170
  },
171
171
  {
172
172
  name: "npm",
173
- file: "package-lock.json"
173
+ files: ["package-lock.json"]
174
174
  },
175
175
  {
176
176
  name: "yarn",
177
- file: "yarn.lock"
177
+ files: ["yarn.lock"]
178
178
  },
179
179
  {
180
180
  name: "bun",
181
- file: "bun.lockb"
181
+ files: ["bun.lock", "bun.lockb"]
182
182
  }
183
183
  ];
184
184
  const matches = [];
185
185
  await Promise.all(checks.map(async (check) => {
186
- try {
187
- await fs.access(path.join(cwd, check.file));
186
+ for (const file of check.files) try {
187
+ await fs.access(path.join(cwd, file));
188
188
  matches.push(check.name);
189
+ break;
189
190
  } catch {
190
- return;
191
+ continue;
191
192
  }
192
193
  }));
193
194
  return matches;
@@ -356,7 +357,7 @@ function registerPkgCommand(program) {
356
357
 
357
358
  //#endregion
358
359
  //#region package.json
359
- var version = "1.0.2";
360
+ var version = "1.0.4";
360
361
 
361
362
  //#endregion
362
363
  //#region src/cli.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tutinoko2048/mcutil",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/cli.mjs",
@@ -94,21 +94,24 @@ function getCurrentVersion(pkgJson: PackageJson, name: string): string | null {
94
94
  }
95
95
 
96
96
  async function detectPackageManagers(cwd: string): Promise<PackageManager[]> {
97
- const checks: Array<{ name: PackageManager; file: string }> = [
98
- { name: "pnpm", file: "pnpm-lock.yaml" },
99
- { name: "npm", file: "package-lock.json" },
100
- { name: "yarn", file: "yarn.lock" },
101
- { name: "bun", file: "bun.lockb" },
97
+ const checks: Array<{ name: PackageManager; files: string[] }> = [
98
+ { name: "pnpm", files: ["pnpm-lock.yaml"] },
99
+ { name: "npm", files: ["package-lock.json"] },
100
+ { name: "yarn", files: ["yarn.lock"] },
101
+ { name: "bun", files: ["bun.lock", "bun.lockb"] },
102
102
  ];
103
103
 
104
104
  const matches: PackageManager[] = [];
105
105
  await Promise.all(
106
106
  checks.map(async (check) => {
107
- try {
108
- await fs.access(path.join(cwd, check.file));
109
- matches.push(check.name);
110
- } catch {
111
- return;
107
+ for (const file of check.files) {
108
+ try {
109
+ await fs.access(path.join(cwd, file));
110
+ matches.push(check.name);
111
+ break;
112
+ } catch {
113
+ continue;
114
+ }
112
115
  }
113
116
  })
114
117
  );