diff --git a/.babelrc b/.babelrc index d6bfc30..eec6ce6 100644 --- a/.babelrc +++ b/.babelrc @@ -3,12 +3,14 @@ [ "env", { + "useBuiltIns": "entry", "modules": false, "targets": { "browsers": [ - "> 1%", + "> 0.5%", "last 2 versions", - "not ie <= 8" + "Firefox ESR", + "not dead" ] } } diff --git a/package.json b/package.json index 66ae5c2..dd78813 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ }, "dependencies": { "@octokit/rest": "^15.6.2", + "babel-polyfill": "^6.26.0", "bottleneck": "^2.3.1", "octonode": "^0.9.2" }, diff --git a/src/gh.ts b/src/gh.ts index 8703b31..db3f968 100644 --- a/src/gh.ts +++ b/src/gh.ts @@ -73,7 +73,7 @@ interface ResponseWithMetaLink { interface ResponseWithDataArrayAndMeta extends ResponseWithDataArray, - ResponseWithMetaLink { } + ResponseWithMetaLink {} interface ResponseFromGetUserRepo extends ResponseWithMetaLink { data: RepoFromGetUserRepo[]; @@ -163,7 +163,7 @@ interface RepoNameWithParentRepo { interface RepoNameWithBranchesAndParent extends RepoNameWithBranches, - RepoNameWithParentRepo { } + RepoNameWithParentRepo {} const username = 'rousan'; @@ -204,13 +204,13 @@ async function fetchRepoNameWithBranches( const branchesResponse: ResponseWithDataArray< BranchFromGetBranches - > = await paginate((tmpFirstParam: Octokit.ReposGetBranchesParams): Promise< + > = await paginate((tmpFirstParam: Octokit.ReposGetBranchesParams): Promise< + ResponseFromGetBranches + > => { + return (octokit.repos.getBranches(tmpFirstParam) as any) as Promise< ResponseFromGetBranches - > => { - return (octokit.repos.getBranches(tmpFirstParam) as any) as Promise< - ResponseFromGetBranches - >; - }, params); + >; + }, params); return { repoName, @@ -319,31 +319,31 @@ async function fetchUserIsNotContributor( const responseFromGetContributors: ResponseWithDataArray< OwnerFromGetContributors - > = await paginate( - async ( - tmpFirstParam: Octokit.ReposGetContributorsParams - ): Promise> => { - // Modify getContributors to return empty contributor data array instead of undefined for empty repos - const response = await ((octokit.repos.getContributors( - tmpFirstParam - ) as any) as Promise); + > = await paginate( + async ( + tmpFirstParam: Octokit.ReposGetContributorsParams + ): Promise> => { + // Modify getContributors to return empty contributor data array instead of undefined for empty repos + const response = await ((octokit.repos.getContributors( + tmpFirstParam + ) as any) as Promise); - let dataNormalized = response.data; - if (dataNormalized === undefined) { - dataNormalized = []; - } + let dataNormalized = response.data; + if (dataNormalized === undefined) { + dataNormalized = []; + } - const responseNormalized: ResponseWithDataArrayAndMeta< - OwnerFromGetContributors - > = { - data: dataNormalized, - meta: response.meta, - }; + const responseNormalized: ResponseWithDataArrayAndMeta< + OwnerFromGetContributors + > = { + data: dataNormalized, + meta: response.meta, + }; - return responseNormalized; - }, - params - ); + return responseNormalized; + }, + params + ); const contributors = responseFromGetContributors.data; @@ -369,7 +369,7 @@ export async function fetchUnusedForkedRepos() { ): Promise => { return (octokit.repos.getForUser(tmpFirstParam) as any) as Promise< ResponseFromGetUserRepo - >; + >; }, params ); @@ -514,7 +514,6 @@ export async function fetchUnusedForkedRepos() { return unusedRepoNames; } - export function runMain() { fetchUnusedForkedRepos().then(unusedRepoNames => { // tslint:disable-next-line:no-console diff --git a/src/index.ts b/src/index.ts index b9ed9bb..20e5a8e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,11 @@ +import 'babel-polyfill'; import { Greeter } from './greeter'; // tslint:disable-next-line:ordered-imports import { fetchUnusedForkedRepos, runMain } from './gh'; export * from './greeter'; // tslint:disable-next-line:only-arrow-functions -(function (currentWindow: Window) { +(function(currentWindow: Window) { // execute when load index.js // tslint:disable-next-line:no-console diff --git a/todo.js b/todo.js index 93d3c27..3dd9f25 100644 --- a/todo.js +++ b/todo.js @@ -13,4 +13,4 @@ /** * @todo In webpack, enable uglify for minifying -*/ \ No newline at end of file +*/ diff --git a/webpack.config.js b/webpack.config.js index c37c10f..876d4fd 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -22,10 +22,10 @@ module.exports = { ] }, plugins: [ - new webpack.optimize.UglifyJsPlugin({ - include: /\.min\.js$/, - minimize: true - }) , + // new webpack.optimize.UglifyJsPlugin({ + // include: /\.min\.js$/, + // minimize: true + // }) , new CopyWebpackPlugin([ { from: 'demo/index.html', to: 'dist/' } ]) diff --git a/yarn.lock b/yarn.lock index 66c9058..e52f7d0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -792,6 +792,14 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" +babel-polyfill@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153" + dependencies: + babel-runtime "^6.26.0" + core-js "^2.5.0" + regenerator-runtime "^0.10.5" + babel-preset-env@^1.6.1: version "1.7.0" resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.7.0.tgz#dea79fa4ebeb883cd35dab07e260c1c9c04df77a" @@ -4660,6 +4668,10 @@ regenerate@^1.2.1: version "1.4.0" resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" +regenerator-runtime@^0.10.5: + version "0.10.5" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" + regenerator-runtime@^0.11.0: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"