UNPKG

@roots/dependencies

Version:

Automated package installation

53 lines (52 loc) 1.24 kB
import { __decorate } from "tslib"; import { bind } from 'helpful-decorators'; import { Command } from './base.command.js'; /** * Yarn command */ export class Yarn extends Command { /** * Get the latest version of a package from the registry */ async getLatestVersion(signifier) { const result = await this.execute([ `yarn`, `info`, signifier, `version`, ]); if (result?.shift) return result.shift().trim(); // #todo: this is bad return `latest`; // fallback } /** */ async install(dependencies, args = []) { await this.execute([ `yarn`, `add`, ...this.normalizeDependencies(dependencies), ...args, ]); } /** */ async uninstall(dependencies, args = []) { return await this.execute([ `yarn`, `remove`, ...this.normalizeDependencies(dependencies), ...args, ]); } } __decorate([ bind ], Yarn.prototype, "getLatestVersion", null); __decorate([ bind ], Yarn.prototype, "install", null); __decorate([ bind ], Yarn.prototype, "uninstall", null);