Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ on:
jobs:
everything:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
- uses: actions/setup-node@v4
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: pnpm install
Expand Down
13 changes: 10 additions & 3 deletions src/lib/package-manager/helpers/infer-from-files.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from "fs-extra";
import { execSync } from "node:child_process";
import path from "node:path";
import { getErrorMessage } from "~/lib/utils";
import { getMajorVersion } from "~/lib/utils/get-major-version";
import type { PackageManager, PackageManagerName } from "../names";
import { getLockfileFileName, supportedPackageManagerNames } from "../names";
Expand All @@ -9,10 +10,16 @@ export function inferFromFiles(workspaceRoot: string): PackageManager {
for (const name of supportedPackageManagerNames) {
const lockfileName = getLockfileFileName(name);

const version = getVersion(name);

if (fs.existsSync(path.join(workspaceRoot, lockfileName))) {
return { name, version, majorVersion: getMajorVersion(version) };
try {
const version = getVersion(name);

return { name, version, majorVersion: getMajorVersion(version) };
} catch (err) {
throw new Error(
`Failed to find package manager version for ${name}: ${getErrorMessage(err)}`
);
}
}
}

Expand Down