Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const modulePath = resolve("./node_modules/@lerna/npm-publish/npm-publish.js");
const cachedModuleExports = require("module")._cache[modulePath].exports;
// just monkey-patching npmPack is not enough or even useful -- that API is not used directly,
// it is only used through makePacker
cachedModuleExports.npmPack = npmPack;
// original redundantly specifies opts here
// passing no opts will cause originalNpmPack to create opts = makePackOptions(rootManifest)
// which is what we want
cachedModuleExports.makePacker = (rootManifest: any) => (packages: Package[]) => npmPack(rootManifest, packages);
process.argv.splice(0, 2, "publish");
const publishCmd = require("@lerna/publish/command");
require("@lerna/cli")()
.command(publishCmd)
.parse(process.argv);
const modulePath = resolve("./node_modules/@lerna/npm-publish/npm-publish.js");
const cachedModuleExports = require("module")._cache[modulePath].exports;
// just monkey-patching npmPack is not enough or even useful -- that API is not used directly,
// it is only used through makePacker
cachedModuleExports.npmPack = npmPack;
// original redundantly specifies opts here
// passing no opts will cause originalNpmPack to create opts = makePackOptions(rootManifest)
// which is what we want
cachedModuleExports.makePacker = (rootManifest: any) => (packages: Package[]) => npmPack(rootManifest, packages);
process.argv.splice(0, 2, "publish");
const publishCmd = require("@lerna/publish/command");
require("@lerna/cli")()
.command(publishCmd)
.parse(process.argv);