@arthurgubaidullin/nx-embed-dependencies
Version:
This plugin for [Nx](https://nx.dev) helps injecting local dependencies into a package.
29 lines • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.addPackage = exports.publishPackage = void 0;
const child_process_1 = require("child_process");
const function_1 = require("fp-ts/function");
const E = require("fp-ts/Either");
const IO = require("fp-ts/IO");
const IOE = require("fp-ts/IOEither");
const node_path_1 = require("node:path");
function getStoreFolder(context) {
return () => (0, node_path_1.join)(context.cwd, '.yalc');
}
function publishPackage(context, pathToPackage) {
return (0, function_1.pipe)(getStoreFolder(context), IO.chainFirst(() => () => {
process.chdir(pathToPackage);
}), IO.chain((storeFolder) => () => {
return (0, function_1.pipe)((0, child_process_1.execSync)(`npx yalc publish --store-folder=${storeFolder} --changed --quiet`), String);
}), (f) => IOE.tryCatch(f, E.toError));
}
exports.publishPackage = publishPackage;
function addPackage(context, targetPackage, packageName) {
return (0, function_1.pipe)(getStoreFolder(context), IO.chainFirst(() => () => {
process.chdir(targetPackage);
}), IO.chain((storeFolder) => () => {
return (0, function_1.pipe)((0, child_process_1.execSync)(`npx yalc add ${packageName} --store-folder=${storeFolder}`), String);
}), (f) => IOE.tryCatch(f, E.toError));
}
exports.addPackage = addPackage;
//# sourceMappingURL=YalcClient.js.map