Skip to content

Commit

Permalink
refactor: code cleanup and handlebars template
Browse files Browse the repository at this point in the history
  • Loading branch information
ovflowd committed Sep 27, 2023
1 parent ed01248 commit f7600bd
Show file tree
Hide file tree
Showing 23 changed files with 395 additions and 295 deletions.
7 changes: 2 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"env": {
"es2022": true
},
"root": true,
"plugins": ["@typescript-eslint", "prettier"],
"overrides": [
{
"files": ["*.ts"],
"plugins": ["@typescript-eslint", "prettier"],
"parser": "@typescript-eslint/parser",
"env": { "es2022": true },
"parserOptions": {
"sourceType": "module",
"project": "./tsconfig.json"
Expand Down
7 changes: 0 additions & 7 deletions LICENSE

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 flakey5

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# dist-worker
# release-cloudflare-worker

New infra for serving Node.js downloads and documentation.

For more information, check out [nodejs/build#3461](https://github.com/nodejs/build/issues/3461).

## Dev Setup

View [docs/dev-setup.md](./docs/dev-setup.md)

## License

This repo is licensed under the terms of the [MIT License](./LICENSE.md). It is based off of [Kotx's render worker](https://github.com/kotx/render), which is also licensed under the MIT license.
10 changes: 7 additions & 3 deletions docs/deploy.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
# Deploy

This worker is auto-deployed by Github Actions. The workflow is defined [here](../.github/workflows/deploy.yml).

## Staging

This worker is deployed to staging every time a pr is merged into the main branch.

## Prod

This worker is deployed into prod by a manual trigger.

## Actions Setup

How to setup the actions for automated deployments.

* Create a Cloudflare API Token (https://developers.cloudflare.com/fundamentals/api/get-started/create-token/)
* Set Github secret `CF_API_TOKEN` on the repo to the token you generated
* They should be working now
- Create a Cloudflare API Token (https://developers.cloudflare.com/fundamentals/api/get-started/create-token/)
- Set Github secret `CF_API_TOKEN` on the repo to the token you generated
- They should be working now
9 changes: 8 additions & 1 deletion docs/dev-setup.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
# Dev Setup

Guide to setting up this worker for development.

## Have Node Installed

Node needs to be installed for the thing that serves Node downloads (latest LTS/even numbered major recommended)

## Install Dependencies

Run `npm install`

## Testing

To run unit tests, `npm run test:unit`. To run e2e (end-to-end) tests, `npm run test:e2e`.

See the [/test](../tests/) folder for more info on testing.

## Running Locally

Spin up a Workerd instance on your machine that serves this worker

### Login to Cloudflare Dash From Wrangler CLI

Run `wrangler login`

### R2 Buckets

Depending on the environment you're running in, you will need a different R2 bucket on your account.
For dev (the default), it's `dist-dev`. For staging, `dist-staging`. For prod, `dist-prod`.
These buckets will either need to have a copy of Node's dist folder in them or something mimicing the folder there.

### Starting the Local Server
Run `npm start`. This starts a Workerd instance in remote mode.

Run `npm start`. This starts a Workerd instance in remote mode.
Loading

0 comments on commit f7600bd

Please sign in to comment.