UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

39 lines 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GoPackageManager = void 0; const spruce_skill_utils_1 = require("@sprucelabs/spruce-skill-utils"); class GoPackageManager { commandService; constructor(options) { const { commandService } = options; this.commandService = commandService; } async installDependencies(pkg) { const first = Array.isArray(pkg) ? pkg[0] : pkg; if (first) { await this.commandService.execute('go', { args: ['get', first], env: this.buildEnv(), }); return { totalInstalled: 1, totalSkipped: 0, }; } return { totalInstalled: 0, totalSkipped: 0, }; } buildEnv() { const cwd = this.commandService.getCwd(); const goCacheDir = spruce_skill_utils_1.diskUtil.resolvePath(cwd, '.go-cache'); spruce_skill_utils_1.diskUtil.createDir(goCacheDir); return { HOME: process.env.HOME ?? cwd, GOCACHE: process.env.GOCACHE ?? goCacheDir, }; } } exports.GoPackageManager = GoPackageManager; //# sourceMappingURL=GoPackageManager.js.map