From b7c119b2aaaa2f3579ca4aeef198eca7f38f1216 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 22 Aug 2018 18:52:17 +0100 Subject: Fix many linter errors that showed up upon upgrading tsutil --- packages/monorepo-scripts/package.json | 4 +++- .../monorepo-scripts/src/doc_generate_and_upload.ts | 3 ++- .../monorepo-scripts/src/publish_release_notes.ts | 6 ++---- .../src/utils/doc_generate_and_upload_utils.ts | 20 ++++++++++---------- .../src/utils/github_release_utils.ts | 18 ++++++++++-------- 5 files changed, 27 insertions(+), 24 deletions(-) (limited to 'packages/monorepo-scripts') diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 41a6e7c91..74be99550 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -38,6 +38,7 @@ "@types/opn": "^5.1.0", "@types/rimraf": "^2.0.2", "@types/semver": "5.5.0", + "@types/yargs": "^10.0.0", "depcheck": "^0.6.9", "make-promises-safe": "^1.1.0", "npm-run-all": "^4.1.2", @@ -64,7 +65,8 @@ "semver": "5.5.0", "semver-diff": "^2.1.0", "semver-sort": "0.0.4", - "typedoc": "0xProject/typedoc" + "typedoc": "0xProject/typedoc", + "yargs": "^10.0.3" }, "publishConfig": { "access": "public" diff --git a/packages/monorepo-scripts/src/doc_generate_and_upload.ts b/packages/monorepo-scripts/src/doc_generate_and_upload.ts index c70ea5ba7..4c4a72701 100644 --- a/packages/monorepo-scripts/src/doc_generate_and_upload.ts +++ b/packages/monorepo-scripts/src/doc_generate_and_upload.ts @@ -1,6 +1,7 @@ import * as yargs from 'yargs'; import { DocGenerateAndUploadUtils } from './utils/doc_generate_and_upload_utils'; +import { utils } from './utils/utils'; const args = yargs .option('package', { @@ -31,6 +32,6 @@ const args = yargs process.exit(0); })().catch(err => { - console.log(err); + utils.log(err); process.exit(1); }); diff --git a/packages/monorepo-scripts/src/publish_release_notes.ts b/packages/monorepo-scripts/src/publish_release_notes.ts index 964f5b0bb..5afcc8775 100644 --- a/packages/monorepo-scripts/src/publish_release_notes.ts +++ b/packages/monorepo-scripts/src/publish_release_notes.ts @@ -1,9 +1,7 @@ -import * as promisify from 'es6-promisify'; -import * as publishRelease from 'publish-release'; - -import { utils } from './utils/utils'; import { publishReleaseNotesAsync } from './utils/github_release_utils'; +import { utils } from './utils/utils'; +// tslint:disable-next-line:no-floating-promises (async () => { const shouldIncludePrivate = false; const allUpdatedPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate); diff --git a/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts index bbc763a6b..1645ba0d6 100644 --- a/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts +++ b/packages/monorepo-scripts/src/utils/doc_generate_and_upload_utils.ts @@ -11,15 +11,15 @@ import { ExportInfo, ExportNameToTypedocNames, ExportPathToExportedItems, Packag import { utils } from './utils'; export class DocGenerateAndUploadUtils { - private _isStaging: boolean; - private _shouldUploadDocs: boolean; - private _packageName: string; - private _omitExports: string[]; - private _packagePath: string; - private _exportPathToExportedItems: ExportPathToExportedItems; - private _exportPathOrder: string[]; - private _monoRepoPkgNameToPath: { [name: string]: string }; - private _packageJson: PackageJSON; + private readonly _isStaging: boolean; + private readonly _shouldUploadDocs: boolean; + private readonly _packageName: string; + private readonly _omitExports: string[]; + private readonly _packagePath: string; + private readonly _exportPathToExportedItems: ExportPathToExportedItems; + private readonly _exportPathOrder: string[]; + private readonly _monoRepoPkgNameToPath: { [name: string]: string }; + private readonly _packageJson: PackageJSON; /** * Recursively iterate over the TypeDoc JSON object and find all type names */ @@ -278,7 +278,7 @@ export class DocGenerateAndUploadUtils { } utils.log(`GENERATE_UPLOAD_DOCS: Doc generation done for ${this._packageName}`); } - private async _uploadDocsAsync(jsonFilePath: string, cwd: string) { + private async _uploadDocsAsync(jsonFilePath: string, cwd: string): Promise { const fileName = `v${this._packageJson.version}.json`; utils.log(`GENERATE_UPLOAD_DOCS: Doc generation successful, uploading docs... as ${fileName}`); diff --git a/packages/monorepo-scripts/src/utils/github_release_utils.ts b/packages/monorepo-scripts/src/utils/github_release_utils.ts index 1f4c4f1e9..28dce70ac 100644 --- a/packages/monorepo-scripts/src/utils/github_release_utils.ts +++ b/packages/monorepo-scripts/src/utils/github_release_utils.ts @@ -1,27 +1,29 @@ -import * as _ from 'lodash'; import * as promisify from 'es6-promisify'; +import { readFileSync } from 'fs'; +import * as _ from 'lodash'; +import * as path from 'path'; +import { exec as execAsync } from 'promisify-child-process'; import * as publishRelease from 'publish-release'; import { constants } from '../constants'; import { Package } from '../types'; -import { utils } from './utils'; -import { readFileSync } from 'fs'; -import * as path from 'path'; -import { exec as execAsync } from 'promisify-child-process'; +import { utils } from './utils'; const publishReleaseAsync = promisify(publishRelease); +// tslint:disable-next-line:completed-docs export async function publishReleaseNotesAsync(updatedPublishPackages: Package[]): Promise { // Git push a tag representing this publish (publish-{commit-hash}) (truncate hash) const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath }); const latestGitCommit = result.stdout; - const shortenedGitCommit = latestGitCommit.slice(0, 7); + const prefixLength = 7; + const shortenedGitCommit = latestGitCommit.slice(0, prefixLength); const tagName = `monorepo@${shortenedGitCommit}`; await execAsync(`git rev-parse ${tagName}`); - await execAsync('git tag ${tagName}'); + await execAsync(`git tag ${tagName}`); - await execAsync('git push origin ${tagName}'); + await execAsync(`git push origin ${tagName}`); const releaseName = `0x monorepo - ${shortenedGitCommit}`; let assets: string[] = []; -- cgit