Skip to content

Commit a514a32

Browse files
authored
feat: Bun support
Supporting Bun.
2 parents a8e0396 + d5c572e commit a514a32

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

src/content/pm.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ const pm = [
1717
installCommand: 'pnpm install',
1818
uninstallCommand: 'pnpm remove',
1919
},
20+
{
21+
name: 'Bun',
22+
lockFile: 'bun.lockb',
23+
installCommand: 'bun install',
24+
uninstallCommand: 'bun remove',
25+
}
2026
]
2127

2228
export default pm

src/sideBar/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,19 @@ export class ModulesView implements vscode.WebviewViewProvider {
163163
newTerminal(`Nuxtr: ${script}`, `pnpm ${script}`, `${projectRootDirectory()}`)
164164
}
165165
break
166+
case 'Bun':
167+
if (script.includes('build') || script.includes('generate')) {
168+
runCommand({
169+
command: `bun --bun run ${script}`,
170+
message: `Nuxtr: ${script}`,
171+
successMessage: `Nuxtr: ${script} successfully`,
172+
errorMessage: `Nuxtr: ${script} failed`,
173+
logger: true
174+
})
175+
} else {
176+
newTerminal(`Nuxtr: ${script}`, `bun ${script}`, `${projectRootDirectory()}`)
177+
}
178+
break
166179
default:
167180
vscode.window.showErrorMessage('Nuxtr: No package manager found')
168181
}

src/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface ConfigurationProperty {
1212

1313
export interface NuxtrConfiguration {
1414
openItemsAfterCreation: boolean;
15-
defaultPackageManager: "null" | "Yarn" | "NPM" | "pnpm";
15+
defaultPackageManager: "null" | "Yarn" | "NPM" | "pnpm" | "Bun";
1616
monorepoMode: {
1717
DirectoryName: string | null;
1818
};

src/utils/dependency.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@ export const detectPackageManagerByName = () => {
139139
}
140140
}
141141

142+
if (projectDirectory.includes('bun.lockb')) {
143+
return {
144+
name: 'Bun',
145+
lockFile: 'bun.lockb',
146+
installCommand: 'bun install',
147+
uninstallCommand: 'bun remove',
148+
}
149+
}
150+
142151
return undefined
143152
}
144153

@@ -151,6 +160,7 @@ export const getInstallationCommand = async (packageName: string, devFlag: boole
151160
Yarn: `yarn add ${packageName} ${devFlag ? '-D' : ''}`,
152161
NPM: `npm install ${packageName} ${devFlag ? '-D' : ''}`,
153162
pnpm: `pnpm add ${packageName} ${devFlag ? '-D' : ''}`,
163+
Bun: `bun install ${packageName} ${devFlag ? '-D' : ''}`,
154164
}
155165

156166
if (packageManager) {

0 commit comments

Comments
 (0)