Sha256: 0a593b5c544648d55769428550c69b7c69315b1c4465b6fdaa8b1fc4dfd14768

Contents?: true

Size: 1.39 KB

Versions: 25

Compression:

Stored size: 1.39 KB

Contents

#!/usr/bin/env node
const {resolve} = require('path');
const {execSync} = require('child_process')
const Repository = require(resolve('.', 'node_modules', 'lerna', 'lib', 'Repository'));
const PackageUtilities = require(resolve('.', 'node_modules', 'lerna', 'lib', 'PackageUtilities'));

function npmTag(version) {
  const isNext = ['-beta', '-alpha', '-rc', '-next'].some(distributionType =>
    version.includes(distributionType),
  );
  return isNext ? 'next' : 'latest';
}

const taggedPackages = execSync('git tag --points-at HEAD')
  .toString()
  .trim()
  .split('\n')
  .map(tag => {
    if (tag.startsWith('@')) {
      return `@${tag.split('@')[1]}`;
    }
    return tag.split('@')[0];
  });

const repository = new Repository('.');
const unsortedPackages = PackageUtilities.getPackages({rootPath: '.', packageConfigs: repository.packageConfigs});
const packages = PackageUtilities.topologicallyBatchPackages(unsortedPackages, true)
  .reduce((acc, packageGroup) => [...acc, ...packageGroup], [])
  .filter(({name}) => taggedPackages.includes(name));

packages.forEach(({name, version}) => {
  const command = `node_modules/.bin/lerna publish --yes --npm-client=npm --skip-npm=false --skip-git --force-publish=${name} --repo-version=${version} --scope=${name} --npm-tag=${npmTag(
    version,
  )}`;

  // eslint-disable-next-line no-console
  console.log(command);
  require('child_process').execSync(command);
});

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
shipit-engine-0.39.0 lib/snippets/publish-lerna-independent-packages-legacy
shipit-engine-0.38.0 lib/snippets/publish-lerna-independent-packages-legacy
shipit-engine-0.37.0 lib/snippets/publish-lerna-independent-packages-legacy
shipit-engine-0.36.1 lib/snippets/publish-lerna-independent-packages-legacy
shipit-engine-0.36.0 lib/snippets/publish-lerna-independent-packages-legacy
shipit-engine-0.35.1 lib/snippets/publish-lerna-independent-packages-legacy
shipit-engine-0.35.0 lib/snippets/publish-lerna-independent-packages-legacy
shipit-engine-0.34.0 lib/snippets/publish-lerna-independent-packages-legacy
shipit-engine-0.33.0 lib/snippets/publish-lerna-independent-packages
shipit-engine-0.32.0 lib/snippets/publish-lerna-independent-packages
shipit-engine-0.31.0 lib/snippets/publish-lerna-independent-packages
shipit-engine-0.30.0 lib/snippets/publish-lerna-independent-packages
shipit-engine-0.29.0 lib/snippets/publish-lerna-independent-packages
shipit-engine-0.28.1 lib/snippets/publish-lerna-independent-packages
shipit-engine-0.28.0 lib/snippets/publish-lerna-independent-packages
shipit-engine-0.27.1 lib/snippets/publish-lerna-independent-packages
shipit-engine-0.27.0 lib/snippets/publish-lerna-independent-packages
shipit-engine-0.26.0 lib/snippets/publish-lerna-independent-packages
shipit-engine-0.25.1 lib/snippets/publish-lerna-independent-packages
shipit-engine-0.25.0 lib/snippets/publish-lerna-independent-packages