Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Subject: Improvements to support TypeScript for scripts. (#1486)
Improvements to support TypeScript for scripts.

DEV
  • Loading branch information
niceilm authored and dsmilkov committed Apr 8, 2019
1 parent 12fe550 commit 69e0f5d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 11 deletions.
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -17,7 +17,9 @@
"devDependencies": {
"@octokit/rest": "15.2.6",
"@types/jasmine": "2.8.7",
"@types/mkdirp": "^0.5.2",
"@types/node": "~9.6.1",
"@types/shelljs": "^0.8.4",
"babel-core": "~6.26.3",
"clang-format": "~1.2.2",
"commander": "~2.14.1",
Expand Down
7 changes: 3 additions & 4 deletions scripts/release_notes/release_notes.ts
Expand Up @@ -42,14 +42,13 @@
*/

import * as commander from 'commander';
import * as shell from 'shelljs';
import * as mkdirp from 'mkdirp';
// tslint:disable-next-line:no-require-imports
const octokit = require('@octokit/rest')();
import * as readline from 'readline';
import * as fs from 'fs';
import * as util from './util';
import {$, Repo, RepoCommits, Commit} from './util';
import {$, Commit, Repo, RepoCommits} from './util';
// tslint:disable-next-line:no-require-imports
const octokit = require('@octokit/rest')();

const TMP_DIR = '/tmp/tfjs-release-notes';

Expand Down
6 changes: 2 additions & 4 deletions scripts/release_notes/release_notes_test.ts
Expand Up @@ -16,12 +16,10 @@
* =============================================================================
*/

import * as release_notes from './release_notes';
import {RepoCommits, OctokitGetCommit} from './util';
import * as util from './util';
import {release} from 'os';
import { OctokitGetCommit, RepoCommits } from './util';

const fakeCommitContributors = {
const fakeCommitContributors: {[key: string]: string;} = {
'sha1': 'fakecontributor1',
'sha2': 'fakecontributor2',
'sha3': 'fakecontributor3'
Expand Down
6 changes: 3 additions & 3 deletions scripts/release_notes/util.ts
Expand Up @@ -23,7 +23,7 @@ import * as shell from 'shelljs';
* @param cmd The bash command to execute.
* @returns stdout returned by the executed bash script.
*/
export function $(cmd) {
export function $(cmd: string) {
const result = shell.exec(cmd, {silent: true});
if (result.code > 0) {
console.log('$', cmd);
Expand Down Expand Up @@ -92,7 +92,7 @@ export async function getReleaseNotesDraft(
for (let i = 0; i < repoCommits.length; i++) {
const repoCommit = repoCommits[i];

const getUsernameForCommit = async sha => {
const getUsernameForCommit = async (sha: string) => {
const result = await octokit.repos.getCommit(
{owner: 'tensorflow', repo: repoCommit.repo.identifier, sha});
return result.data.author.login;
Expand Down Expand Up @@ -169,7 +169,7 @@ export async function getReleaseNotesDraft(
}
}

const repoLines = [];
const repoLines: string[] = [];
SECTION_TAGS.forEach(({tag, section}) => {
if (tagEntries[tag].length !== 0) {
const sectionNotes = tagEntries[tag].join('\n');
Expand Down
34 changes: 34 additions & 0 deletions yarn.lock
Expand Up @@ -49,11 +49,37 @@
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.38.tgz#c1be40aa933723c608820a99a373a16d215a1ca2"
integrity sha512-F/v7t1LwS4vnXuPooJQGBRKRGIoxWUTmA4VHfqjOccFsNDThD5bfUNpITive6s352O7o384wcpEaDV8rHCehDA==

"@types/events@*":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==

"@types/glob@*":
version "7.1.1"
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575"
integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==
dependencies:
"@types/events" "*"
"@types/minimatch" "*"
"@types/node" "*"

"@types/jasmine@2.8.7":
version "2.8.7"
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.7.tgz#3fe583928ae0a22cdd34cedf930eeffeda2602fd"
integrity sha512-RdbrPcW1aD78UmdLiDa9ZCKrbR5Go8PXh6GCpb4oIOkWVEusubSJJDrP4c5RYOu8m/CBz+ygZpicj6Pgms5a4Q==

"@types/minimatch@*":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==

"@types/mkdirp@^0.5.2":
version "0.5.2"
resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-0.5.2.tgz#503aacfe5cc2703d5484326b1b27efa67a339c1f"
integrity sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==
dependencies:
"@types/node" "*"

"@types/node-fetch@^2.1.2":
version "2.1.4"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.1.4.tgz#093d1beae11541aef25999d70aa09286fd025b1a"
Expand All @@ -76,6 +102,14 @@
resolved "https://registry.yarnpkg.com/@types/seedrandom/-/seedrandom-2.4.27.tgz#9db563937dd86915f69092bc43259d2f48578e41"
integrity sha1-nbVjk33YaRX2kJK8QyWdL0hXjkE=

"@types/shelljs@^0.8.4":
version "0.8.4"
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.8.4.tgz#b903e41ad5e5195b7d5e34d3cd33c94bdbd07895"
integrity sha512-UNACC6scKFVljWEvO3rHBkbbKXu3QkKPBOMCisxI7au9cnFK7tjOGPsKh5OjedAPLmtsKSarmk+YeehKTQSKtg==
dependencies:
"@types/glob" "*"
"@types/node" "*"

"@types/strip-bom@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/strip-bom/-/strip-bom-3.0.0.tgz#14a8ec3956c2e81edb7520790aecf21c290aebd2"
Expand Down

0 comments on commit 69e0f5d

Please sign in to comment.