Skip to content

Commit

Permalink
Merge pull request #29 from karlicoss/cleanup-webpack
Browse files Browse the repository at this point in the history
Cleanup webpack
  • Loading branch information
karlicoss committed Feb 14, 2020
2 parents 7b63756 + 8f827fa commit af24c99
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 157 deletions.
15 changes: 9 additions & 6 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ from subprocess import check_call
from pathlib import Path


TARGETS = ['chrome', 'firefox']
# TODO FIXME copypaste from promnesia
# TODO FIXME use it in ci script
TARGETS = ['chrome', 'firefox']
def main():
p = argparse.ArgumentParser()
# TODO rename to --production??
p.add_argument('--release', action='store_true')
p.add_argument('--sign', action='store_true')
p.add_argument('--lint', action='store_true')
Expand All @@ -22,6 +21,7 @@ def main():
args = p.parse_args()
target = args.target

assert target is not None

dist_dir = Path(__file__).absolute().parent / 'dist'
def webext(*args, **kwargs):
Expand All @@ -33,10 +33,9 @@ def main():
*args,
], **kwargs)

maybe_release = {'NODE_ENV': 'production'} if args.release else {}
env = {
'TARGET': target,
**maybe_release,
'RELEASE': 'YES' if args.release else 'NO',
**os.environ,
}
check_call([
Expand All @@ -56,11 +55,12 @@ def main():
if target not in ['firefox', 'firefox-mobile']:
raise RuntimeError("{target} is not supported for signing yet".format(target=target))

dist_dir = Path(__file__).absolute().parent / 'dist'
src_dir = dist_dir / target

from firefox_dev_secrets import API_KEY, API_SECRET
webext(
# TODO use UUID? https://addons.mozilla.org/en-GB/developers/addon/grasp/edit
# TODO right, wouldn't work because it's listed..
'--source-dir' , str(src_dir),
'--artifacts-dir', str(dist_dir),
'--api-key' , API_KEY,
'--api-secret', API_SECRET,
Expand All @@ -69,3 +69,6 @@ def main():

if __name__ == '__main__':
main()

# TODO use UUID? https://addons.mozilla.org/en-GB/developers/addon/grasp/edit
# TODO right, wouldn't work because it's listed..
16 changes: 5 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "grasp-extension",
"name": "grasp",
"version": "0.6.6",
"description": "Reliably capture links and webpage content in a plaintext file (org-mode/markdown)",
"main": "dist/background.js",
"scripts": {
"build": "webpack --progress --profile --colors",
"watch": "webpack --watch --progress --colors",
Expand All @@ -13,27 +14,20 @@
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"@babel/preset-flow": "^7.0.0",
"babel-loader": "^8.0.5",
"babel-eslint": "^10.0.1",
"clean-webpack-plugin": "^1.0.0",
"copy-webpack-plugin": "^4.2.0",
"css-loader": "^2.1.0",
"eslint": "^5.12.0",
"eslint-config-google": "^0.11.0",
"eslint-plugin-flowtype": "^3.2.0",
"file-loader": "^3.0.1",
"flow-bin": "^0.89.0",
"flow-interfaces-chrome": "^0.5.3",
"fs-extra": "^7.0.1",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"style-loader": "^0.23.1",
"style-loader": "^1.0.0",
"webpack": "^4.28.3",
"webpack-cli": "^3.2.0",
"webpack-dev-server": "^3.1.14",
"webpack-extension-manifest-plugin": "^0.4.3",
"write-file-webpack-plugin": "^4.5.0"
},
"dependencies": {
"babel-loader": "^8.0.5"
"webpack-extension-manifest-plugin": "^0.4.3"
}
}
1 change: 1 addition & 0 deletions server/test_with_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def get_webdriver():
driver.install_addon(str(addon_path), temporary=True)
yield driver
finally:
# confirm('ready to continue?')
driver.close()


Expand Down
9 changes: 0 additions & 9 deletions src/background.html

This file was deleted.

2 changes: 1 addition & 1 deletion src/js/options_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function refreshPermissionValidation(endpoint: string) {
}

function restoreOptions() {
getSaveButton().addEventListener('click', saveOptions);
get_options(opts => {
const ep = opts.endpoint;
getEndpoint().value = ep;
Expand Down Expand Up @@ -74,4 +75,3 @@ function saveOptions() {


document.addEventListener('DOMContentLoaded', restoreOptions);
getSaveButton().addEventListener('click', saveOptions);
14 changes: 8 additions & 6 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"icons": {
"128": "unicorn.png"
"name": "<webpack managed>",
"version": "<webpack managed>",
"background": {
"scripts": ["background.js"],
"persistent": false
},
"options_ui": {
"page": "options.html"
},

"background": {
"page": "background.html"
},
"browser_action": {
"default_icon": "unicorn.png",
"default_popup": "popup.html",
Expand All @@ -22,5 +21,8 @@
"description": "Capture page, with extra information"
}
},
"icons": {
"128": "unicorn.png"
},
"manifest_version": 2
}
2 changes: 1 addition & 1 deletion src/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="options_page.js"/></script>
<style>
input:invalid {
background-color: red;
Expand Down
1 change: 1 addition & 0 deletions src/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="popup.js"></script>
</head>
<body>
<!-- TODO ugh didn't work -->
Expand Down
9 changes: 0 additions & 9 deletions utils/build.js

This file was deleted.

6 changes: 0 additions & 6 deletions utils/env.js

This file was deleted.

34 changes: 0 additions & 34 deletions utils/webserver.js

This file was deleted.

Loading

0 comments on commit af24c99

Please sign in to comment.