diff --git a/.babelrc b/.babelrc index 0538273..ea7b9d6 100644 --- a/.babelrc +++ b/.babelrc @@ -15,13 +15,16 @@ } } ], - "@babel/typescript", "@babel/react" ], "plugins": [ ["@babel/plugin-proposal-class-properties"], - ["@babel/plugin-transform-destructuring", { "useBuiltIns": true }], - ["@babel/plugin-proposal-object-rest-spread", { "useBuiltIns": true }], + ["@babel/plugin-transform-destructuring", { + "useBuiltIns": true + }], + ["@babel/plugin-proposal-object-rest-spread", { + "useBuiltIns": true + }], [ // Polyfills the runtime needed for async/await and generators "@babel/plugin-transform-runtime", diff --git a/.eslintignore b/.eslintignore index 912010f..92479ea 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,4 @@ node_modules/ -dist/ extension/ .yarn/ .pnp.js \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index 0a74928..c1be54f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": [ - "@abhijithvijayan/eslint-config/typescript", + "@abhijithvijayan/eslint-config", "@abhijithvijayan/eslint-config/react" ], "rules": { @@ -12,4 +12,4 @@ "env": { "webextensions": true } -} +} \ No newline at end of file diff --git a/LICENCE b/LICENCE index 1edc780..d0df46b 100644 --- a/LICENCE +++ b/LICENCE @@ -1,6 +1,6 @@ MIT License -Copyright (c) Abhijith Vijayan <34790378+abhijithvijayan@users.noreply.github.com> (abhijithvijayan.in) +Copyright (c) Abhijith Vijayan  (abhijithvijayan.in) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 4752560..c469c33 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@

🚀 web-extension-starter

-

TypeScript + React Version

Web Extension starter to build "Write Once Run on Any Browser" extension

- Travis Build + Travis Build @@ -31,7 +30,11 @@ ❤️ it? ⭐️ it on [GitHub](https://github.com/abhijithvijayan/web-extension-starter) or [Tweet](https://twitter.com/intent/tweet?text=Check%20out%20web-extension-starter%21%20by%20%40_abhijithv%0A%0AWeb%20Extension%20starter%20to%20build%20%22Write%20Once%20Run%20on%20Any%20Browser%22%20extension.%20https%3A%2F%2Fgithub.com%2Fabhijithvijayan%2Fweb-extension-starter%0A%0A%23javascript%20%23react%20%23typescript%20%23sass%20%23webextension%20%23chrome%20%23firefox%20%23opera) about it. -👶🏼 Looking for [Non React/TypeScript Version](https://github.com/abhijithvijayan/web-extension-starter/tree/master) instead? +😨 **React + JavaScript** = [This](https://github.com/abhijithvijayan/web-extension-starter/tree/react-javascript) branch + +🧙‍♂️ **React + TypeScript** = Checkout [react-typescript](https://github.com/abhijithvijayan/web-extension-starter/tree/react-typescript) branch + +👶🏼 **HTML + JavaScript** = Checkout [master](https://github.com/abhijithvijayan/web-extension-starter/tree/master) branch ## Features @@ -40,7 +43,6 @@ - Automatic build on code changes - Auto packs browser specific build files - SASS styling -- TypeScript by default - ES6 modules support - React UI Library by default - Smart reload @@ -60,7 +62,7 @@ Create a new directory and run ``` -curl -fsSL https://github.com/abhijithvijayan/web-extension-starter/archive/react-typescript.tar.gz | tar -xz --strip-components=1 +curl -fsSL https://github.com/abhijithvijayan/web-extension-starter/archive/react-javascript.tar.gz | tar -xz --strip-components=1 ``` ## 🚀 Quick Start @@ -165,10 +167,9 @@ See the original [README](https://github.com/abhijithvijayan/wext-manifest-loade Please file an issue [here](https://github.com/abhijithvijayan/web-extension-starter/issues/new) for bugs, missing documentation, or unexpected behavior. -### Linting & TypeScript Config +### Linting Config - Shared Eslint & Prettier Configuration - [`@abhijithvijayan/eslint-config`](https://www.npmjs.com/package/@abhijithvijayan/eslint-config) -- Shared TypeScript Configuration - [`@abhijithvijayan/tsconfig`](https://www.npmjs.com/package/@abhijithvijayan/tsconfig) ## License diff --git a/package.json b/package.json index 39443f8..1011add 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,14 @@ { "name": "web-extension-starter", - "version": "2.0.0", - "description": "Web extension starter using react and typescript", + "version": "3.0.0", + "description": "Web extension starter using react and javascript", "private": true, "repository": "https://github.com/abhijithvijayan/web-extension-starter.git", - "author": "abhijithvijayan <34790378+abhijithvijayan@users.noreply.github.com>", + "author": { + "name": "abhijithvijayan", + "email": "email@abhijithvijayan.in", + "url": "https://abhijithvijayan.in" + }, "license": "MIT", "engines": { "node": ">=10.0.0", @@ -18,8 +22,8 @@ "build:firefox": "cross-env NODE_ENV=production cross-env TARGET_BROWSER=firefox webpack", "build:opera": "cross-env NODE_ENV=production cross-env TARGET_BROWSER=opera webpack", "build": "yarn run build:chrome && yarn run build:firefox && yarn run build:opera", - "lint": "eslint . --ext .ts,.tsx", - "lint:fix": "eslint . --ext .ts,.tsx --fix" + "lint": "eslint . --ext .js,.jsx", + "lint:fix": "eslint . --ext .js,.jsx --fix" }, "dependencies": { "@babel/runtime": "^7.9.6", @@ -28,11 +32,10 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "webext-base-css": "^1.1.0", - "webextension-polyfill-ts": "^0.15.0" + "webextension-polyfill": "^0.6.0" }, "devDependencies": { "@abhijithvijayan/eslint-config": "^1.4.0", - "@abhijithvijayan/tsconfig": "^1.1.2", "@babel/core": "^7.9.6", "@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-object-rest-spread": "^7.9.6", @@ -40,10 +43,6 @@ "@babel/plugin-transform-runtime": "^7.9.6", "@babel/preset-env": "^7.9.6", "@babel/preset-react": "^7.9.4", - "@babel/preset-typescript": "^7.9.0", - "@types/react": "^16.9.35", - "@types/react-dom": "^16.9.8", - "@types/webpack": "^4.41.13", "@typescript-eslint/eslint-plugin": "^2.34.0", "@typescript-eslint/parser": "^2.34.0", "autoprefixer": "^9.8.0", @@ -61,7 +60,6 @@ "eslint-plugin-prettier": "^3.1.3", "eslint-plugin-react": "^7.20.0", "eslint-plugin-react-hooks": "^2.5.1", - "fork-ts-checker-webpack-plugin": "^4.1.3", "html-webpack-plugin": "^3.2.0", "mini-css-extract-plugin": "^0.9.0", "node-sass": "^4.14.1", @@ -71,7 +69,6 @@ "resolve-url-loader": "^3.1.1", "sass-loader": "^8.0.2", "terser-webpack-plugin": "^2.3.6", - "typescript": "^3.9.3", "webpack": "^4.43.0", "webpack-cli": "^3.3.11", "webpack-extension-reloader": "^1.1.4", @@ -79,4 +76,4 @@ "wext-manifest-webpack-plugin": "^1.1.1", "zip-webpack-plugin": "^3.0.0" } -} \ No newline at end of file +} diff --git a/source/Background/index.js b/source/Background/index.js new file mode 100644 index 0000000..d86519d --- /dev/null +++ b/source/Background/index.js @@ -0,0 +1,6 @@ +import 'emoji-log'; +import browser from 'webextension-polyfill'; + +browser.runtime.onInstalled.addListener(() => { + console.emoji('🦄', 'extension installed'); +}); diff --git a/source/Background/index.ts b/source/Background/index.ts deleted file mode 100644 index 39efddb..0000000 --- a/source/Background/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import 'emoji-log'; -import {browser} from 'webextension-polyfill-ts'; - -browser.runtime.onInstalled.addListener((): void => { - console.emoji('🦄', 'extension installed'); -}); diff --git a/source/ContentScript/index.ts b/source/ContentScript/index.js similarity index 100% rename from source/ContentScript/index.ts rename to source/ContentScript/index.js diff --git a/source/Options/Options.tsx b/source/Options/Options.jsx similarity index 94% rename from source/Options/Options.tsx rename to source/Options/Options.jsx index 7ad0fae..50a4a99 100644 --- a/source/Options/Options.tsx +++ b/source/Options/Options.jsx @@ -2,7 +2,7 @@ import React from 'react'; import './styles.scss'; -const Options: React.FC = () => { +const Options = () => { return (
diff --git a/source/Options/index.tsx b/source/Options/index.jsx similarity index 100% rename from source/Options/index.tsx rename to source/Options/index.jsx diff --git a/source/Popup/Popup.tsx b/source/Popup/Popup.jsx similarity index 78% rename from source/Popup/Popup.tsx rename to source/Popup/Popup.jsx index 498229f..e6d04a1 100644 --- a/source/Popup/Popup.tsx +++ b/source/Popup/Popup.jsx @@ -1,20 +1,20 @@ import React from 'react'; -import {browser, Tabs} from 'webextension-polyfill-ts'; +import browser from 'webextension-polyfill'; import './styles.scss'; -function openWebPage(url: string): Promise { +function openWebPage(url) { return browser.tabs.create({url}); } -const Popup: React.FC = () => { +const Popup = () => { return (