Default to type: module (#146)

* Default to type: module

* latest
This commit is contained in:
Jaco Greeff
2021-03-03 10:22:58 +01:00
committed by GitHub
parent 1931b752ea
commit a6b2a357b4
11 changed files with 309 additions and 301 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
yarnPath: .yarn/releases/yarn-2.4.0.cjs
yarnPath: .yarn/releases/yarn-2.4.1.cjs
+3 -2
View File
@@ -6,7 +6,8 @@ const config = require('@polkadot/dev/config/jest.cjs');
module.exports = Object.assign({}, config, {
moduleNameMapper: {},
modulePathIgnorePatterns: [
'<rootDir>/build'
'<rootDir>/build',
'<rootDir>/packages/phishing/build'
],
resolver: '@polkadot/dev/config/jest-resolver.cjs'
transformIgnorePatterns: ['/node_modules/(?!@polkadot|@babel/runtime/helpers/esm/)']
});
+3 -3
View File
@@ -7,7 +7,7 @@
"packages/*"
],
"resolutions": {
"typescript": "^4.1.5"
"typescript": "^4.2.2"
},
"scripts": {
"build": "polkadot-dev-build-ts",
@@ -23,12 +23,12 @@
},
"devDependencies": {
"@babel/core": "^7.13.8",
"@polkadot/dev": "^0.61.30",
"@polkadot/dev": "^0.62.5",
"@types/jest": "^26.0.20"
},
"version": "0.6.2",
"dependencies": {
"@pinata/sdk": "^1.1.12",
"@pinata/sdk": "^1.1.13",
"dnslink-cloudflare": "^3.0.0"
}
}
+5 -4
View File
@@ -1,6 +1,7 @@
{
"name": "@polkadot/phishing",
"version": "0.6.2",
"type": "module",
"description": "Simple phishing scripts from a central source",
"main": "index.js",
"sideEffects": false,
@@ -12,10 +13,10 @@
"repository": "github.com:polkadot-js/phishing",
"homepage": "https://github.com/polkadot-js/common/tree/master/packages/phishing#readme",
"dependencies": {
"@babel/runtime": "^7.13.8",
"@polkadot/util": "^5.9.2",
"@polkadot/util-crypto": "^5.9.2",
"@polkadot/x-fetch": "^5.9.2"
"@babel/runtime": "^7.13.9",
"@polkadot/util": "^6.0.1-5",
"@polkadot/util-crypto": "^6.0.1-5",
"@polkadot/x-fetch": "^6.0.1-5"
},
"devDependencies": {
"@types/js-yaml": "^4.0.0",
+1 -13
View File
@@ -3,23 +3,11 @@
import fs from 'fs';
import { fetch } from '@polkadot/x-fetch';
import { fetchWithTimeout } from './fetch';
import { retrieveAddrList } from '.';
const TICKS = '```';
// a timeout with a 2s timeout
async function fetchWithTimeout (url: string, timeout = 2000): Promise<Response> {
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), timeout);
const response = await fetch(url, { signal: controller.signal });
clearTimeout(id);
return response;
}
// loop through each site for a number of times, applying the transform
async function loopSome (site: string, matcher: () => Promise<string[] | null>): Promise<[string, string[]]> {
const found: string[] = [];
+15
View File
@@ -0,0 +1,15 @@
// Copyright 2020-2021 @polkadot/phishing authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { fetch } from '@polkadot/x-fetch';
// a fetch with a 2s timeout
export async function fetchWithTimeout (url: string, timeout = 2000): Promise<Response> {
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), timeout);
const response = await fetch(url, { signal: controller.signal });
clearTimeout(id);
return response;
}
+4 -3
View File
@@ -5,7 +5,8 @@ import type { AddressList, HostList } from './types';
import { u8aEq } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { fetch } from '@polkadot/x-fetch';
import { fetchWithTimeout } from './fetch';
// Equivalent to https://raw.githubusercontent.com/polkadot-js/phishing/master/{address,all}.json
const ADDRESS_JSON = 'https://polkadot.js.org/phishing/address.json';
@@ -36,7 +37,7 @@ export async function retrieveAddrList (allowCached = true): Promise<AddressList
return cacheAddrList;
}
const response = await fetch(ADDRESS_JSON);
const response = await fetchWithTimeout(ADDRESS_JSON);
const list = (await response.json()) as AddressList;
cacheAddrEnd = now + CACHE_TIMEOUT;
@@ -71,7 +72,7 @@ export async function retrieveHostList (allowCached = true): Promise<HostList> {
return cacheHostList;
}
const response = await fetch(ALL_JSON);
const response = await fetchWithTimeout(ALL_JSON);
const list = (await response.json()) as HostList;
cacheHostEnd = now + CACHE_TIMEOUT;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2021 @polkadot/dev authors & contributors
// Copyright 2017-2021 @polkadot/phishing authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Auto-generated by @polkadot/dev, do not edit
+272 -270
View File
File diff suppressed because it is too large Load Diff