mirror of
https://github.com/bendtherules/github-delete-unused-repos.git
synced 2026-08-18 13:52:59 +00:00
Merge branch 'feature/browser-support'
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
[
|
||||
"env",
|
||||
{
|
||||
"useBuiltIns": "entry",
|
||||
"modules": false,
|
||||
"targets": {
|
||||
"browsers": [
|
||||
"> 1%",
|
||||
"> 0.5%",
|
||||
"last 2 versions",
|
||||
"not ie <= 8"
|
||||
"Firefox ESR",
|
||||
"not dead"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/rest": "^15.6.2",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"bottleneck": "^2.3.1",
|
||||
"octonode": "^0.9.2"
|
||||
},
|
||||
|
||||
@@ -73,7 +73,7 @@ interface ResponseWithMetaLink {
|
||||
|
||||
interface ResponseWithDataArrayAndMeta<T>
|
||||
extends ResponseWithDataArray<T>,
|
||||
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<ResponseWithDataArrayAndMeta<OwnerFromGetContributors>> => {
|
||||
// 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<ResponseFromGetContributors>);
|
||||
> = await paginate(
|
||||
async (
|
||||
tmpFirstParam: Octokit.ReposGetContributorsParams
|
||||
): Promise<ResponseWithDataArrayAndMeta<OwnerFromGetContributors>> => {
|
||||
// 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<ResponseFromGetContributors>);
|
||||
|
||||
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<ResponseFromGetUserRepo> => {
|
||||
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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+4
-4
@@ -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/' }
|
||||
])
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user