How to use libnpmpublish - 2 common examples

To help you get started, we’ve selected a few libnpmpublish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github izmjs / devtools / controllers / npm.server.controller.js View on Github external
if (
    (name && json.name !== name)
    || (version && json.version !== version)
  ) {
    try {
      json.name = name || json.name;
      json.version = version || json.version;
      await writeFile$(pkgPath, JSON.stringify(json, null, '  '));
    } catch (e) {
      // Do nothing, just skip
    }
  }

  try {
    await publish$(
      json,
      createReadStream(tarPath), {
        npmVersion: `${json.name}@${json.version}`,
        ...npm,
      },
    );
    return res.status(204).end();
  } catch (e) {
    return res.status(400).json({
      message: req.t('NPM_REGISTRY_ERROR', {
        msg: e.message,
      }),
    });
  }
};
github asciidoctor / asciidoctor.js / tasks / publish.js View on Github external
const publish = async (directory) => {
    const pkgName = childProcess.execSync(`npm pack`, { cwd: directory }).toString('utf-8').trim()
    const pkg = require(path.join(directory, 'package.json'))
    const pkgPath = path.join(directory, pkgName)
    const tarball = fs.createReadStream(pkgPath)
    if (process.env.DRY_RUN) {
      log.debug(`${pkg.name}@${pkg.version} - ${pkgPath}`)
    } else {
      return npmPublish(pkg, tarball, { token: process.env.NPM_AUTH_TOKEN })
    }
  }

libnpmpublish

Programmatic API for the bits behind npm publish and unpublish

ISC
Latest version published 9 days ago

Package Health Score

98 / 100
Full package analysis

Popular libnpmpublish functions

Similar packages