Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
Allow lazy data loading and external changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoColomb committed Nov 30, 2018
1 parent fd511b2 commit e392c80
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": true
}
}
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,36 @@

## About

_Alpha version_

Only two sites
* [lemonde.fr](https://www.lemonde.fr)
* [example.com](https://example.com)

## Install

_Alpha version_

1. Go to [the latest release](https://github.com/LeoColomb/capitext/releases/latest)
1. Go to [the latest release](https://github.com/DesignandHuman/capitext/releases/latest)
2. Download `capitext.crx`
3. Go to chrome://extensions
4. Enable dev mode
5. Drag and drop file
6. Install

## Development

[Node.js](https://nodejs.org/) version >= 10 is required.

1. Clone locally the repository.
```bash
git clone https://github.com/DesignandHuman/capitext.git
cd capitext
```
2. Install dependencies.
```bash
npm install
```
3. Start development server.
```bash
npm run start
```

## TODO

- [ ] Full name and description
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"lint:fix": "eslint --fix source/*.js && stylelint --fix source/*.css",
"test": "npm run lint && run-s build",
"build": "webpack --mode=production",
"watch": "webpack --mode=development --watch",
"start": "webpack --mode=development --watch",
"release:amo": "cd distribution && webext submit",
"release:cws": "cd distribution && webstore upload --auto-publish",
"release": "run-s build update-version save-url release:*",
Expand All @@ -23,8 +23,10 @@
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-modules-commonjs": "^7.0.0",
"ava": "^0.25.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.0",
"chrome-webstore-upload-cli": "^1.1.1",
"copy-webpack-plugin": "^4.5.1",
Expand Down
4 changes: 2 additions & 2 deletions source/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { isEmpty } from './libs/utils'

localforage.setDriver([localforage.INDEXEDDB, localforage.WEBSQL])

browser.runtime.onInstalled.addListener(event => {
browser.runtime.onInstalled.addListener(async event => {
if (event.reason === 'install') {
const data = require('./data.json')
const { default: data } = await import(/* webpackChunkName: "data" */ './data.json')
for (let site in data) {
localforage.setItem(site, data[site])
}
Expand Down
Binary file added source/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ module.exports = (env, argv) => ({
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
use: {
loader: 'babel-loader',
options: {
plugins: ['@babel/plugin-syntax-dynamic-import']
}
}
}
]
},
Expand All @@ -28,7 +33,7 @@ module.exports = (env, argv) => ({
{
from: '*',
context: 'source',
ignore: '*.js'
ignore: ['*.js', 'data.json']
},
{
from: 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js'
Expand Down

0 comments on commit e392c80

Please sign in to comment.