Add tsconfig.base (#800)

* Add tsconfig.base

* Remove unused package

* yarn

* Adjust paths
This commit is contained in:
Jaco
2021-12-13 07:32:14 +01:00
committed by GitHub
parent 22b3249582
commit 8f00bdb100
11 changed files with 30 additions and 55 deletions
+1
View File
@@ -23,6 +23,7 @@ lerna-debug.log*
npm-debug.log*
package-lock.json
report.*.json
tsconfig.*buildinfo
yarn-debug.log*
yarn-error.log*
NOTES.md
+2 -1
View File
@@ -5,11 +5,12 @@ import fs from 'fs';
import { decodeAddress } from '@polkadot/util-crypto';
import ourAddrList from '../../../address.json';
import { fetchWithTimeout } from './fetch';
const TICKS = '```';
const ourAddrList = JSON.parse(fs.readFileSync('address.json', 'utf-8')) as Record<string, string[]>;
function fetch (url: string): Promise<Response> {
return fetchWithTimeout(url, 5000);
}
+2 -2
View File
@@ -6,8 +6,6 @@ import { load as yamlParse } from 'js-yaml';
import { fetch } from '@polkadot/x-fetch';
import ourSiteList from '../../../all.json';
interface CryptoScamEntry {
addresses: Record<string, string[]>;
category: string;
@@ -24,6 +22,8 @@ interface EthPhishing {
const TICKS = '```';
const ourSiteList = JSON.parse(fs.readFileSync('all.json', 'utf-8')) as { allow: string[]; deny: string[] };
function assertAndLog (check: boolean, site: string, missing: unknown): void {
if (!check) {
process.env.CI_LOG && fs.appendFileSync('./.github/crosscheck.md', `
+8 -5
View File
@@ -1,12 +1,15 @@
// Copyright 2020-2021 @polkadot/phishing authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'fs';
import { decodeAddress } from '@polkadot/util-crypto';
import addresses from '../../../address.json';
import allowed from '../../../known.json';
import { checkAddress, checkIfDenied } from '.';
const addresses = JSON.parse(fs.readFileSync('address.json', 'utf-8')) as Record<string, string[]>;
const allowed = JSON.parse(fs.readFileSync('known.json', 'utf-8')) as Record<string, string[]>;
describe('checkIfDenied', (): void => {
it('returns false when host is not listed', async (): Promise<void> => {
expect(
@@ -74,7 +77,7 @@ describe('checkAddress', (): void => {
describe('check additions', (): void => {
it('has no malformed addresses', (): void => {
const invalids = Object
.entries(addresses as Record<string, string[]>)
.entries(addresses)
.map(([url, addrs]): [string, string[]] => {
return [url, addrs.filter((a) => {
try {
@@ -95,10 +98,10 @@ describe('check additions', (): void => {
it('has no entries on the known addresses list', (): void => {
const added = Object
.values(addresses as Record<string, string[]>)
.values(addresses)
.reduce<string[]>((all, addrs) => all.concat(addrs), []);
const dupes = Object
.entries(allowed as Record<string, string[]>)
.entries(allowed)
.reduce<[string, string][]>((all, [site, addrs]) => all.concat(addrs.map((a) => [site, a])), [])
.filter(([, a]) => added.includes(a));
View File
View File
-19
View File
@@ -1,19 +0,0 @@
{
"author": "Jaco Greeff <jacogr@gmail.com>",
"bugs": "https://github.com/polkadot-js/phishing/issues",
"contributors": [],
"description": "Dummy",
"homepage": "https://github.com/polkadot-js/phishing/tree/master/packages/unused#readme",
"license": "Apache-2.0",
"maintainers": [],
"name": "@polkadot/phishing-unused",
"private": true,
"repository": {
"directory": "packages/unused",
"type": "git",
"url": "https://github.com/polkadot-js/phishing.git"
},
"sideEffects": false,
"version": "0.6.530",
"main": "index.js"
}
-10
View File
@@ -1,10 +0,0 @@
// Copyright 2020-2021 @polkadot/phishing authors & contributors
// SPDX-License-Identifier: Apache-2.0
export interface Dummy {
dummy: string;
}
export default function dummy (): void {
console.error('unused');
}
+15
View File
@@ -0,0 +1,15 @@
{
"extends": "@polkadot/dev/config/tsconfig.json",
"compilerOptions": {
"composite": true,
"paths": {
"@polkadot/phishing": ["phishing/src"],
"@polkadot/phishing/*": ["phishing/src/*"]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"typeRoots": [
"./node_modules/@types"
]
}
}
+2 -12
View File
@@ -1,20 +1,10 @@
{
"extends": "@polkadot/dev/config/tsconfig.json",
"extends": "./tsconfig.base.json",
"exclude": [
"build/**/*",
"**/build/**/*"
],
"compilerOptions": {
"baseUrl": ".",
"paths":
{
"@polkadot/phishing": ["packages/phishing/src"],
"@polkadot/phishing/*": ["packages/phishing/src/*"]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"typeRoots": [
"./node_modules/@types"
]
"baseUrl": "./packages"
}
}
-6
View File
@@ -1967,12 +1967,6 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/phishing-unused@workspace:packages/unused":
version: 0.0.0-use.local
resolution: "@polkadot/phishing-unused@workspace:packages/unused"
languageName: unknown
linkType: soft
"@polkadot/phishing@workspace:packages/phishing":
version: 0.0.0-use.local
resolution: "@polkadot/phishing@workspace:packages/phishing"