@boostercloud/cli
Version:
CLI of the Booster Framework, the next level of abstraction for cloud-native applications
25 lines (24 loc) • 1.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RushPackageManager = exports.makeRushPackageManager = void 0;
const _1 = require(".");
const effect_1 = require("@boostercloud/framework-types/dist/effect");
const common_1 = require("./common");
// TODO: Look recursively up for a rush.json file and run ./common/scripts/install-run-rushx.js
exports.makeRushPackageManager = (0, effect_1.gen)(function* ($) {
// Create a reference to store the current project directory
const projectDirRef = yield* $(effect_1.Ref.makeRef(''));
// Create a function to run a script in the project directory
const runRush = yield* $((0, common_1.makeScopedRun)('rush', projectDirRef));
const runRushX = yield* $((0, common_1.makeScopedRun)('rushx', projectDirRef));
const commonService = yield* $((0, common_1.makePackageManager)('rush'));
const service = {
...commonService,
runScript: (scriptName, args) => (0, effect_1.pipe)(runRushX(scriptName, null, args), (0, effect_1.mapError)((error) => new _1.RunScriptError(error.error))),
build: (args) => (0, effect_1.pipe)(runRush('build', null, args), (0, effect_1.mapError)((error) => new _1.RunScriptError(error.error))),
installProductionDependencies: () => (0, effect_1.fail)(new _1.InstallDependenciesError(new Error('Rush is a monorepo manager, so it does not support installing production dependencies'))),
installAllDependencies: () => (0, effect_1.pipe)(runRush('update', null, []), (0, effect_1.mapError)((error) => new _1.InstallDependenciesError(error.error))),
};
return service;
});
exports.RushPackageManager = effect_1.Layer.fromEffect(_1.PackageManagerService)((0, effect_1.orDie)(exports.makeRushPackageManager));