How to use the pkg.version function in pkg

To help you get started, we’ve selected a few pkg 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 MoOx / npmpub / npmpub.js View on Github external
} else {
    log("Git local copy up to date.");
  }
}

const pkg = path.join(process.cwd(), "package.json");
log("package.json is '" + pkg + "'.");
const version = require(pkg).version;
notice("Preparing v" + version + ".");

log("Checking existing tags.");
const gitTags = exec("git tag", { silent: true });
if (gitTags.code !== 0) {
  error("Can't read tags.");
  exit(1);
} else if (gitTags.output.split("\n").indexOf(version) > -1) {
  error("Tag already exist.");
  exit(1);
}

let cleanupPromise;
if (argv["skip-cleanup"]) {
  log("Cleanup skipped.");
  cleanupPromise = Promise.resolve();
} else {
  log("Cleaning node_modules.");
  const nodeModules = path.join(process.cwd(), "node_modules");
  if (argv.verbose) {
    debug("Will delete '" + nodeModules + "'.");
  }
  cleanupPromise = trash([nodeModules]).then(() => {
    log("node_modules deleted.");
github adrianObel / koa2-api-boilerplate / src / modules / health / controller.js View on Github external
export async function ping (ctx) {
  ctx.body = {
    version: pkg.version
  }
}