Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update node modules installation check to npm exclusively #14

Merged
merged 2 commits into from
Mar 22, 2024
Merged
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
28 changes: 7 additions & 21 deletions packages/vscode-extension/src/dependency/DependencyChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { command } from "../utilities/subprocess";
import path from "path";
import { getIosSourceDir } from "../builders/buildIOS";
import { getAppRootFolder } from "../utilities/extensionContext";
import { resolvePackageManager } from "../utilities/packageManager";

export class DependencyChecker implements Disposable {
private disposables: Disposable[] = [];
Expand Down Expand Up @@ -78,25 +77,10 @@ export class DependencyChecker implements Disposable {
}

public async checkNodeModulesInstalled() {
let installed = false;
const packageManager = await resolvePackageManager();
if (packageManager === "yarn") {
installed = await checkIfCLIInstalled(`yarn list --json`, {
cwd: getAppRootFolder(),
});
} else if (packageManager === "pnpm") {
installed = await checkIfCLIInstalled(`pnpm list --json`, {
cwd: getAppRootFolder(),
});
} else if (packageManager === "bun") {
installed = await checkIfCLIInstalled(`bun pm ls --json`, {
cwd: getAppRootFolder(),
});
} else {
installed = await checkIfCLIInstalled(`npm list --json`, {
cwd: getAppRootFolder(),
});
}
const installed = await checkIfCLIInstalled(`npm list --json`, {
cwd: getAppRootFolder(),
});

const errorMessage = "Node modules are not installed.";
this.webview.postMessage({
command: "isNodeModulesInstalled",
Expand Down Expand Up @@ -169,7 +153,9 @@ export class DependencyChecker implements Disposable {
const installed = await checkIosDependenciesInstalled();
const nodeModulesInstalled = await this.checkNodeModulesInstalled();
const errorMessage = "iOS dependencies are not installed.";
const extraInfoMessage = nodeModulesInstalled ? "" : " Node modules need to be installed first.";
const extraInfoMessage = nodeModulesInstalled
? ""
: " Node modules need to be installed first.";

this.webview.postMessage({
command: "isPodsInstalled",
Expand Down
Loading