Skip to content

Commit

Permalink
using parcel
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyt committed Dec 12, 2020
1 parent 08b73ab commit a17d239
Show file tree
Hide file tree
Showing 15 changed files with 6,102 additions and 5,647 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: [
'airbnb-typescript/base'
],
parserOptions: {
project: './tsconfig.json',
}
};
31 changes: 0 additions & 31 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ coverage
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build
.cache
dist

# Dependency directory
Expand Down
3 changes: 1 addition & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ module.exports = {
roots: ['<rootDir>/src', '<rootDir>/tests'],
transform: {
"^.+\\.ts?$": "ts-jest"
},
setupFiles: ['<rootDir>/tests/jest.stub.js']
}
}
11,573 changes: 6,049 additions & 5,524 deletions package-lock.json

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@
"description": "",
"main": "index.js",
"scripts": {
"dev": "npx webpack --config webpack.config.js --progress --watch",
"dev:test": "npx jest --watch --passWithNoTests --coverage=true",
"build": "npm run test && npx webpack --config webpack.config.js --mode=production",
"clean": "rm -R dist",
"build": "parcel build src/uglyemail.ts src/background.ts src/loader.ts",
"dev": "parcel watch src/uglyemail.ts src/background.ts src/loader.ts",
"dev:test": "npx jest --watch --passWithNoTests",
"test": "npm run lint && npm run test:unit",
"test:unit": "jest --passWithNoTests",
"lint": "eslint . --ext .ts"
},
"staticFiles": {
"staticPath": "assets",
"watcherGlob": "**"
},
"browserslist": [
"last 2 Chrome versions",
"last 2 Firefox versions"
],
"repository": {
"type": "git",
"url": "git+https://github.com/OneClickLab/ugly-email-extension.git"
Expand All @@ -25,26 +34,17 @@
"gmail-js": "^1.0.5"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.3.1",
"@babel/preset-typescript": "^7.3.3",
"@types/jest": "^24.0.17",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"babel-loader": "^8.0.5",
"copy-webpack-plugin": "^5.1.1",
"eslint": "^6.1.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-loader": "^2.2.1",
"eslint-plugin-import": "^2.18.2",
"fake-indexeddb": "^3.0.0",
"jest": "^25.5.4",
"@types/jest": "^26.0.19",
"@typescript-eslint/eslint-plugin": "^4.9.1",
"eslint": "^7.15.0",
"eslint-config-airbnb-typescript": "^12.0.0",
"eslint-plugin-import": "^2.22.1",
"fake-indexeddb": "^3.1.2",
"jest": "^26.6.3",
"jest-fetch-mock": "^3.0.3",
"ts-jest": "^24.0.2",
"ts-loader": "^5.3.3",
"typescript": "^4.1.2",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12"
"parcel-bundler": "^1.12.4",
"parcel-plugin-static-files-copy": "^2.5.0",
"ts-jest": "^26.4.4",
"typescript": "^4.1.3"
}
}
4 changes: 2 additions & 2 deletions src/services/indexeddb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class IndexedDB {
});
}

upgrade(): Promise<any> {
private upgrade(): Promise<any> {
const createEmails = () => new Promise((resolve) => {
const store = this.db.createObjectStore('emails', { keyPath: 'id' });

Expand All @@ -87,7 +87,7 @@ export class IndexedDB {
return Promise.all([createEmails(), createMeta()]);
}

store(table: string, role: IDBTransactionMode = 'readwrite'): IDBObjectStore {
private store(table: string, role: IDBTransactionMode = 'readwrite'): IDBObjectStore {
return this.db.transaction([table], role).objectStore(table);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/messenger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type Resolver = {
[id: string]: (val: string | null) => void
}
};

export class UglyMessenger {
private resolvers: Resolver = {};
Expand Down
6 changes: 3 additions & 3 deletions src/services/trackers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export class Trackers {
version: number
version: number;

identifiers: string[] = []
identifiers: string[] = [];

pixels = new Map()
pixels = new Map();

async init() {
const trackers = await Trackers.fetchTrackers();
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts → src/uglyemail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import './services/messenger';
/**
* Runs every 2500ms
*/
let timer: NodeJS.Timeout;
let timer: any;

async function observe() {
clearTimeout(timer);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function findAllEmails(): Promise<Email[]> {
}

export async function flushUntracked() {
const emails = await this.findAllEmails();
const emails = await findAllEmails();

// loop through each email in the db and remove the ones that are not tracked.
const removedEmails = emails.reduce((arr: Array<Promise<any>>, email: any) => {
Expand Down
3 changes: 0 additions & 3 deletions tests/jest.stub.js

This file was deleted.

4 changes: 2 additions & 2 deletions tests/services/messenger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable dot-notation */
/* eslint-disable @typescript-eslint/dot-notation */
import messengerInstance, { UglyMessenger } from '../../src/services/messenger';

describe('Worker service', () => {
Expand All @@ -19,6 +19,6 @@ describe('Worker service', () => {
id: '12345',
body: '<div></div>',
from: 'ugly-email-check',
}, 'http://test.com');
}, 'http://localhost');
});
});
15 changes: 10 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"strict": true,
"noImplicitReturns": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es2015",
"declaration": false,
"strictNullChecks": true
"strictPropertyInitialization": false,
"module": "es6",
"moduleResolution": "node",
"target": "ES6",
"allowJs": true,
"esModuleInterop": true
}
}
}
48 changes: 0 additions & 48 deletions webpack.config.js

This file was deleted.

0 comments on commit a17d239

Please sign in to comment.