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",
|
"env",
|
||||||
{
|
{
|
||||||
|
"useBuiltIns": "entry",
|
||||||
"modules": false,
|
"modules": false,
|
||||||
"targets": {
|
"targets": {
|
||||||
"browsers": [
|
"browsers": [
|
||||||
"> 1%",
|
"> 0.5%",
|
||||||
"last 2 versions",
|
"last 2 versions",
|
||||||
"not ie <= 8"
|
"Firefox ESR",
|
||||||
|
"not dead"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/rest": "^15.6.2",
|
"@octokit/rest": "^15.6.2",
|
||||||
|
"babel-polyfill": "^6.26.0",
|
||||||
"bottleneck": "^2.3.1",
|
"bottleneck": "^2.3.1",
|
||||||
"octonode": "^0.9.2"
|
"octonode": "^0.9.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ interface ResponseWithMetaLink {
|
|||||||
|
|
||||||
interface ResponseWithDataArrayAndMeta<T>
|
interface ResponseWithDataArrayAndMeta<T>
|
||||||
extends ResponseWithDataArray<T>,
|
extends ResponseWithDataArray<T>,
|
||||||
ResponseWithMetaLink { }
|
ResponseWithMetaLink {}
|
||||||
|
|
||||||
interface ResponseFromGetUserRepo extends ResponseWithMetaLink {
|
interface ResponseFromGetUserRepo extends ResponseWithMetaLink {
|
||||||
data: RepoFromGetUserRepo[];
|
data: RepoFromGetUserRepo[];
|
||||||
@@ -163,7 +163,7 @@ interface RepoNameWithParentRepo {
|
|||||||
|
|
||||||
interface RepoNameWithBranchesAndParent
|
interface RepoNameWithBranchesAndParent
|
||||||
extends RepoNameWithBranches,
|
extends RepoNameWithBranches,
|
||||||
RepoNameWithParentRepo { }
|
RepoNameWithParentRepo {}
|
||||||
|
|
||||||
const username = 'rousan';
|
const username = 'rousan';
|
||||||
|
|
||||||
@@ -204,13 +204,13 @@ async function fetchRepoNameWithBranches(
|
|||||||
|
|
||||||
const branchesResponse: ResponseWithDataArray<
|
const branchesResponse: ResponseWithDataArray<
|
||||||
BranchFromGetBranches
|
BranchFromGetBranches
|
||||||
> = await paginate((tmpFirstParam: Octokit.ReposGetBranchesParams): Promise<
|
> = await paginate((tmpFirstParam: Octokit.ReposGetBranchesParams): Promise<
|
||||||
|
ResponseFromGetBranches
|
||||||
|
> => {
|
||||||
|
return (octokit.repos.getBranches(tmpFirstParam) as any) as Promise<
|
||||||
ResponseFromGetBranches
|
ResponseFromGetBranches
|
||||||
> => {
|
>;
|
||||||
return (octokit.repos.getBranches(tmpFirstParam) as any) as Promise<
|
}, params);
|
||||||
ResponseFromGetBranches
|
|
||||||
>;
|
|
||||||
}, params);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
repoName,
|
repoName,
|
||||||
@@ -319,31 +319,31 @@ async function fetchUserIsNotContributor(
|
|||||||
|
|
||||||
const responseFromGetContributors: ResponseWithDataArray<
|
const responseFromGetContributors: ResponseWithDataArray<
|
||||||
OwnerFromGetContributors
|
OwnerFromGetContributors
|
||||||
> = await paginate(
|
> = await paginate(
|
||||||
async (
|
async (
|
||||||
tmpFirstParam: Octokit.ReposGetContributorsParams
|
tmpFirstParam: Octokit.ReposGetContributorsParams
|
||||||
): Promise<ResponseWithDataArrayAndMeta<OwnerFromGetContributors>> => {
|
): Promise<ResponseWithDataArrayAndMeta<OwnerFromGetContributors>> => {
|
||||||
// Modify getContributors to return empty contributor data array instead of undefined for empty repos
|
// Modify getContributors to return empty contributor data array instead of undefined for empty repos
|
||||||
const response = await ((octokit.repos.getContributors(
|
const response = await ((octokit.repos.getContributors(
|
||||||
tmpFirstParam
|
tmpFirstParam
|
||||||
) as any) as Promise<ResponseFromGetContributors>);
|
) as any) as Promise<ResponseFromGetContributors>);
|
||||||
|
|
||||||
let dataNormalized = response.data;
|
let dataNormalized = response.data;
|
||||||
if (dataNormalized === undefined) {
|
if (dataNormalized === undefined) {
|
||||||
dataNormalized = [];
|
dataNormalized = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const responseNormalized: ResponseWithDataArrayAndMeta<
|
const responseNormalized: ResponseWithDataArrayAndMeta<
|
||||||
OwnerFromGetContributors
|
OwnerFromGetContributors
|
||||||
> = {
|
> = {
|
||||||
data: dataNormalized,
|
data: dataNormalized,
|
||||||
meta: response.meta,
|
meta: response.meta,
|
||||||
};
|
};
|
||||||
|
|
||||||
return responseNormalized;
|
return responseNormalized;
|
||||||
},
|
},
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
|
|
||||||
const contributors = responseFromGetContributors.data;
|
const contributors = responseFromGetContributors.data;
|
||||||
|
|
||||||
@@ -369,7 +369,7 @@ export async function fetchUnusedForkedRepos() {
|
|||||||
): Promise<ResponseFromGetUserRepo> => {
|
): Promise<ResponseFromGetUserRepo> => {
|
||||||
return (octokit.repos.getForUser(tmpFirstParam) as any) as Promise<
|
return (octokit.repos.getForUser(tmpFirstParam) as any) as Promise<
|
||||||
ResponseFromGetUserRepo
|
ResponseFromGetUserRepo
|
||||||
>;
|
>;
|
||||||
},
|
},
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
@@ -514,7 +514,6 @@ export async function fetchUnusedForkedRepos() {
|
|||||||
return unusedRepoNames;
|
return unusedRepoNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function runMain() {
|
export function runMain() {
|
||||||
fetchUnusedForkedRepos().then(unusedRepoNames => {
|
fetchUnusedForkedRepos().then(unusedRepoNames => {
|
||||||
// tslint:disable-next-line:no-console
|
// tslint:disable-next-line:no-console
|
||||||
|
|||||||
+2
-1
@@ -1,10 +1,11 @@
|
|||||||
|
import 'babel-polyfill';
|
||||||
import { Greeter } from './greeter';
|
import { Greeter } from './greeter';
|
||||||
// tslint:disable-next-line:ordered-imports
|
// tslint:disable-next-line:ordered-imports
|
||||||
import { fetchUnusedForkedRepos, runMain } from './gh';
|
import { fetchUnusedForkedRepos, runMain } from './gh';
|
||||||
export * from './greeter';
|
export * from './greeter';
|
||||||
|
|
||||||
// tslint:disable-next-line:only-arrow-functions
|
// tslint:disable-next-line:only-arrow-functions
|
||||||
(function (currentWindow: Window) {
|
(function(currentWindow: Window) {
|
||||||
// execute when load index.js
|
// execute when load index.js
|
||||||
|
|
||||||
// tslint:disable-next-line:no-console
|
// tslint:disable-next-line:no-console
|
||||||
|
|||||||
@@ -13,4 +13,4 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo In webpack, enable uglify for minifying
|
* @todo In webpack, enable uglify for minifying
|
||||||
*/
|
*/
|
||||||
|
|||||||
+4
-4
@@ -22,10 +22,10 @@ module.exports = {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
// new webpack.optimize.UglifyJsPlugin({
|
||||||
include: /\.min\.js$/,
|
// include: /\.min\.js$/,
|
||||||
minimize: true
|
// minimize: true
|
||||||
}) ,
|
// }) ,
|
||||||
new CopyWebpackPlugin([
|
new CopyWebpackPlugin([
|
||||||
{ from: 'demo/index.html', to: 'dist/' }
|
{ from: 'demo/index.html', to: 'dist/' }
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -792,6 +792,14 @@ babel-plugin-transform-strict-mode@^6.24.1:
|
|||||||
babel-runtime "^6.22.0"
|
babel-runtime "^6.22.0"
|
||||||
babel-types "^6.24.1"
|
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:
|
babel-preset-env@^1.6.1:
|
||||||
version "1.7.0"
|
version "1.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.7.0.tgz#dea79fa4ebeb883cd35dab07e260c1c9c04df77a"
|
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"
|
version "1.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11"
|
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:
|
regenerator-runtime@^0.11.0:
|
||||||
version "0.11.1"
|
version "0.11.1"
|
||||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
|
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
|
||||||
|
|||||||
Reference in New Issue
Block a user