diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-19 05:20:07 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-19 05:20:07 +0800 |
commit | 25b6d1a232835b76decbb1c66878da1285afe404 (patch) | |
tree | c73dc3abd7e94510b8f2d6476cff53e021746a4f /packages/monorepo-scripts | |
parent | 880cbd88c2416c9a3281542c68affb862bd90575 (diff) | |
download | dexon-sol-tools-25b6d1a232835b76decbb1c66878da1285afe404.tar dexon-sol-tools-25b6d1a232835b76decbb1c66878da1285afe404.tar.gz dexon-sol-tools-25b6d1a232835b76decbb1c66878da1285afe404.tar.bz2 dexon-sol-tools-25b6d1a232835b76decbb1c66878da1285afe404.tar.lz dexon-sol-tools-25b6d1a232835b76decbb1c66878da1285afe404.tar.xz dexon-sol-tools-25b6d1a232835b76decbb1c66878da1285afe404.tar.zst dexon-sol-tools-25b6d1a232835b76decbb1c66878da1285afe404.zip |
Remove remove_tags script
Diffstat (limited to 'packages/monorepo-scripts')
-rw-r--r-- | packages/monorepo-scripts/src/remove_tags.ts | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/packages/monorepo-scripts/src/remove_tags.ts b/packages/monorepo-scripts/src/remove_tags.ts deleted file mode 100644 index 50e413495..000000000 --- a/packages/monorepo-scripts/src/remove_tags.ts +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env node - -import * as _ from 'lodash'; -import * as path from 'path'; -import { exec as execAsync } from 'promisify-child-process'; -import semverSort = require('semver-sort'); - -import { constants } from './constants'; -import { Changelog } from './types'; -import { utils } from './utils/utils'; - -(async () => { - const shouldIncludePrivate = true; - const updatedPublicLernaPackages = await utils.getUpdatedLernaPackagesAsync(shouldIncludePrivate); - - for (const lernaPackage of updatedPublicLernaPackages) { - const packageName = lernaPackage.package.name; - const currentVersion = lernaPackage.package.version; - const changelogJSONPath = path.join(lernaPackage.location, 'CHANGELOG.json'); - // Private packages don't have changelogs, and their versions are always incremented - // by a patch version. - const changelogJSONIfExists = utils.getChangelogJSONIfExists(changelogJSONPath); - - let latestChangelogVersion: string; - if (!_.isUndefined(changelogJSONIfExists)) { - let changelogs: Changelog; - try { - changelogs = JSON.parse(changelogJSONIfExists); - } catch (err) { - throw new Error( - `${lernaPackage.package.name}'s CHANGELOG.json contains invalid JSON. Please fix and try again.`, - ); - } - latestChangelogVersion = changelogs[0].version; - } else { - latestChangelogVersion = utils.getNextPatchVersion(currentVersion); - } - - const sortedVersions = semverSort.desc([latestChangelogVersion, currentVersion]); - if (sortedVersions[0] === latestChangelogVersion && latestChangelogVersion !== currentVersion) { - const tagName = `${packageName}@${latestChangelogVersion}`; - try { - await execAsync(`git tag -d ${tagName}`, { cwd: constants.monorepoRootPath }); - utils.log(`removed tag: ${tagName}`); - } catch (err) { - if (_.includes(err.message, 'not found')) { - utils.log(`Could not find tag: ${tagName}`); - } else { - throw err; - } - } - } - } -})().catch(err => { - utils.log(err); - process.exit(1); -}); |