How to use the lerna/package.json.version function in lerna

To help you get started, we’ve selected a few lerna 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 chialab / rna-cli / commands / init / tasks / npm.js View on Github external
if (!project.get('private')) {
        // NPMIGNORE
        const ignoreFile = project.file('.npmignore');
        const ignoreTemplate = templates.file('npmignore');

        // "Append" configuration to `.npmignore`.
        configurator(ignoreFile, ignoreTemplate.read(), '# RNA');
    }

    if (project.get('workspaces')) {
        const lernaJson = project.file('lerna.json');
        if (!lernaJson.exists()) {
            const lernaPackage = require('lerna/package.json');
            lernaJson.writeJson({
                lerna: lernaPackage.version,
                version: project.get('version') || '0.0.0',
                npmClient: 'yarn',
                useWorkspaces: true,
            });
        }
    }

    app.logger.success('package.json updated', project.localPath);
};
github google / closure-compiler-npm / build-scripts / lerna-publish.js View on Github external
function main(argv) {
  // For lerna publication to work, the NPM token must be stored in the .npmrc file in the user home directory
  if ((process.env.TRAVIS || process.env.APPVEYOR) && process.env.NPM_TOKEN) {
    fs.writeFileSync(
        path.resolve(process.env.HOME, '.npmrc'),
        `//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}\n`,
        'utf8');
  }

  const context = {
    lernaVersion: pkg.version,
  };

  // yargs instance.
  // Add all the standard lerna commands + our custom travis-publish command
  // This is a direct copy of the lerna cli setup with our custom travis command added.
  return cli()
      .command(addCmd)
      .command(bootstrapCmd)
      .command(changedCmd)
      .command(cleanCmd)
      .command(createCmd)
      .command(diffCmd)
      .command(execCmd)
      .command(importCmd)
      .command(initCmd)
      .command(linkCmd)