Add webpack build stage to deal with current limitations of workers platform
This commit is contained in:
parent
e9795343e6
commit
a4e1dece04
|
@ -9,3 +9,4 @@ worker/
|
||||||
node_modules/
|
node_modules/
|
||||||
.cargo-ok
|
.cargo-ok
|
||||||
wrangler.toml
|
wrangler.toml
|
||||||
|
.wrangler
|
||||||
|
|
|
@ -21,7 +21,10 @@ This ends up being specially useful for communities, in order to follow the work
|
||||||
4. Create KV namespaces and add their ids to the `kv_namespaces` setting on `wrangler.toml`
|
4. Create KV namespaces and add their ids to the `kv_namespaces` setting on `wrangler.toml`
|
||||||
5. Add your `account_id` and customize all the `vars` in `wrangler.toml`. `FEEDS` should be
|
5. Add your `account_id` and customize all the `vars` in `wrangler.toml`. `FEEDS` should be
|
||||||
a string of coma separated urls, to each of the RSS/ATOM sources that will be part of your planet.
|
a string of coma separated urls, to each of the RSS/ATOM sources that will be part of your planet.
|
||||||
6. Run `wrangler deploy`
|
6. Build the worker bundle: `npm run build`
|
||||||
|
7. Deploy your new worker: `npm run deploy`
|
||||||
|
|
||||||
|
**Note:** For the last step you might need to set the `CLOUDFLARE_API_TOKEN` environment variable.
|
||||||
|
|
||||||
## Configuration variables
|
## Configuration variables
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
|
@ -5,9 +5,9 @@
|
||||||
"description": "Generate a single feed of content from multiple RSS/Atom sources. Runs on Cloudflare Workers.",
|
"description": "Generate a single feed of content from multiple RSS/Atom sources. Runs on Cloudflare Workers.",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"format": "prettier --write '**/*.{js,css,json,md}' '!**/worker/*' '!**/templates/*'",
|
||||||
"format": "prettier --write '**/*.{js,css,json,md}'",
|
|
||||||
"template": "handlebars -c handlebars/runtime",
|
"template": "handlebars -c handlebars/runtime",
|
||||||
|
"build": "webpack",
|
||||||
"dev": "wrangler dev",
|
"dev": "wrangler dev",
|
||||||
"deploy": "wrangler deploy"
|
"deploy": "wrangler deploy"
|
||||||
},
|
},
|
||||||
|
@ -15,11 +15,14 @@
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prettier": "^1.18.2",
|
"prettier": "^1.18.2",
|
||||||
"wrangler": "^3.1.1"
|
"webpack": "^4.46.0",
|
||||||
|
"webpack-cli": "^4.10.0",
|
||||||
|
"wrangler": "^3.1.1",
|
||||||
|
"wranglerjs-compat-webpack-plugin": "^0.0.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"feed": "^4.2.2",
|
"feed": "^4.2.2",
|
||||||
"handlebars": "^4.7.7",
|
"handlebars": "^4.7.7",
|
||||||
"rss-parser": "^3.13.0"
|
"rss-parser": "^3.13.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
const path = require('path')
|
||||||
|
const {
|
||||||
|
WranglerJsCompatWebpackPlugin,
|
||||||
|
} = require('wranglerjs-compat-webpack-plugin')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: './index.js',
|
||||||
|
plugins: [new WranglerJsCompatWebpackPlugin()],
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
name = "worker-planet"
|
name = "worker-planet"
|
||||||
main = "index.js"
|
main = "./worker/script.js"
|
||||||
compatibility_date = "2023-05-18"
|
compatibility_date = "2023-05-18"
|
||||||
node_compat = true
|
node_compat = true
|
||||||
account_id = ""
|
account_id = ""
|
||||||
|
|
Loading…
Reference in New Issue