Small fixes

This commit is contained in:
Fabio Berger
2018-06-18 23:15:52 +02:00
parent b36ff9103d
commit 50fa02c1d1
3 changed files with 4 additions and 11 deletions

View File

@@ -1,12 +1,9 @@
import * as fs from 'fs';
import * as _ from 'lodash';
import * as path from 'path';
import { exec as execAsync } from 'promisify-child-process';
import semver = require('semver');
import semverSort = require('semver-sort');
import { constants } from './constants';
import { Changelog, PackageRegistryJson } from './types';
import { changelogUtils } from './utils/changelog_utils';
import { npmUtils } from './utils/npm_utils';
import { utils } from './utils/utils';

View File

@@ -1,12 +1,9 @@
#!/usr/bin/env node
import * as promisify from 'es6-promisify';
import * as fs from 'fs';
import lernaGetPackages = require('lerna-get-packages');
import * as _ from 'lodash';
import * as moment from 'moment';
import opn = require('opn');
import * as path from 'path';
import { exec as execAsync, spawn } from 'promisify-child-process';
import * as prompt from 'prompt';
import semver = require('semver');
@@ -14,7 +11,7 @@ import semverDiff = require('semver-diff');
import semverSort = require('semver-sort');
import { constants } from './constants';
import { Changelog, PackageToVersionChange, SemVerIndex, VersionChangelog } from './types';
import { PackageToVersionChange, SemVerIndex, VersionChangelog } from './types';
import { changelogUtils } from './utils/changelog_utils';
import { utils } from './utils/utils';
@@ -164,7 +161,7 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[])
utils.log(`${packageName}: Updated CHANGELOG.json`);
// Generate updated CHANGELOG.md
const changelogMd = changelogUtils.generateChangelogMd(changelog);
await changelogUtils.writeChangelogMdFileAsync(lernaPackage.location, changelog);
await changelogUtils.writeChangelogMdFileAsync(lernaPackage.location, changelogMd);
utils.log(`${packageName}: Updated CHANGELOG.md`);
}

View File

@@ -4,7 +4,6 @@ import * as moment from 'moment';
import * as path from 'path';
import { exec as execAsync } from 'promisify-child-process';
import semver = require('semver');
import semverSort = require('semver-sort');
import { constants } from '../constants';
import { Change, Changelog, VersionChangelog } from '../types';
@@ -94,9 +93,9 @@ export const changelogUtils = {
fs.writeFileSync(changelogJSONPath, JSON.stringify(changelog, null, '\t'));
await this.prettifyAsync(changelogJSONPath, constants.monorepoRootPath);
},
async writeChangelogMdFileAsync(packageLocation: string, changelog: Changelog): Promise<void> {
async writeChangelogMdFileAsync(packageLocation: string, changelogMdString: string): Promise<void> {
const changelogMarkdownPath = path.join(packageLocation, 'CHANGELOG.md');
fs.writeFileSync(changelogMarkdownPath, JSON.stringify(changelog, null, '\t'));
fs.writeFileSync(changelogMarkdownPath, changelogMdString);
await this.prettifyAsync(changelogMarkdownPath, constants.monorepoRootPath);
},
async prettifyAsync(filePath: string, cwd: string): Promise<void> {