Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate the cloudflare worker into this repo (#530)
* Refactor how the version and host properties are defined These will be replaced via the webpack compile step later on * Add first pass approach at building worker using webpack's node api This is not working yet * Getting it kinda working * Getting webpack compilation working * Move test/worker into worker/test before splitting out into separate repo * Adding working compilation linked to readme * Add generated scaffolding from yeoman generator * Add dist to ignore files * Fix lint issues * Remove TODO from code * Prettier * Add case for invalid js being provided * Add some better logging from within the worker Make sure logs are turned off during testing * Switch so that the recommended way of using this module is by setting the following headers: - x-readme-id - id of the caller - x-readme-label - label of the caller * Remove the concept of compiling whatever code they send us Just return the compiled code for a given host/apiKey * Simplify compile step to just swap out apiKey in the dist file This should make it much faster! * There appears to be a bug with running `prepare` scripts in npm when installing from a git dependency, so i'm just gunna commit this for now and make sure this happens on prepublish I think the correct place is a `prepare` script though * Prefixing metrics api call with /v1 * Add circle ci config * Add link to the docs in readme * Adding `access: public` so it can be put onto npm * 1.0.0 * Add latest dist * Make sure to fetch and error about x-readme-* headers from the correct place Right now this was broken, and we were expecting them to be set on the initial request object (which would in effect mean from the originating HTTP request). What we need to do is consume the original request, and make sure the *response* from the backend API has these headers set. Then use the headers from here as IDs to send to the metrics backend. I've tested this using a local instance of hoot.at and ngrok with Cloudflare workers. https://app.asana.com/0/681252538274980/923335774941624 * Attempting to fix CI with coverage * 1.0.1 * Add latest dist * Fix error message complaining about missing headers We used to (incorrectly) look for these headers on the request object then we switched to correctly looking on the API response, but I forgot to change the error message. * Default cf-connecting-ip header to 0.0.0.0 In cloudflare workers testing mode, this appears to be set to `null` which causes validation errors from the metrics API https://community.cloudflare.com/t/cf-connecting-ip-returns-null-in-latest-version-of-workers/13597/2 * 1.1.0 * Add latest dist * feature complete: 1. Template for app store usage 2. Function handler for custom routing emulating cloudflare route matching * Testing WIP * Unit Testing complete * Migrated regex to seperate file, changed path from lookbehind to lookahead, more test cases * Replaced global key * Update install.json Co-Authored-By: domharrington <domharrington@users.noreply.github.com> * Responded to PR comments, style changes * migrate to prettier * Remove compile function, unminify webpack * Updated using cloudflare's env injection, test updates, endpoint updates * ripped out unnecessary hook: * Whitespace and casing * fix: package.json points to the wrong git url (#6) * test: setting up a workflow for running ci on github instead of circleci (#7) * test: setting up a workflow for running ci on github instead of circleci * test: removing circleci configs * docs: swapping the ci badge on the readme * build: 1.1.1 release * Update ReadMe Link to Docs (#8) * feature/allow-x-readme-email (#9) * Prelim functionality for adding 'x-readme-email' to worker app: dquote> We'd like to add more context to calls for our frontend, and we currently only support sending label/id. Adding email for this purpose * Adding dist * More test coverage * docs: adding a security policy and pr template * ci: setting up codeql * feat: dependency overhauls (#11) * ci: changing the ci workflow to run on LTS node versions * chore: rebuilding the lockfile with npm7 * chore(deps-dev): loading in our coding standards * test: moving tests over to using jest * chore(deps-dev): removing module-alias as its now unused * chore(deps-dev): bumping node-fetch * feat: moving us to webpack@5 * ci: setting up dependabot * ci: ignoring node-fetch updates as its now an ESM package * docs: adding a code of conduct * chore(deps): bump actions/setup-node from 2.4.0 to 2.4.1 (#13) Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2.4.0 to 2.4.1. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v2.4.0...v2.4.1) * chore(deps-dev): bump webpack from 5.53.0 to 5.55.1 (#14) Bumps [webpack](https://github.com/webpack/webpack) from 5.53.0 to 5.55.1. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](webpack/webpack@v5.53.0...v5.55.1) * chore(deps-dev): bump node-fetch from 2.6.2 to 2.6.5 (#15) Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.2 to 2.6.5. - [Release notes](https://github.com/node-fetch/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/v2.6.5/CHANGELOG.md) - [Commits](node-fetch/node-fetch@v2.6.2...v2.6.5) * chore(deps-dev): bump jest from 27.2.0 to 27.2.4 (#16) Bumps [jest](https://github.com/facebook/jest) from 27.2.0 to 27.2.4. - [Release notes](https://github.com/facebook/jest/releases) - [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md) - [Commits](jestjs/jest@v27.2.0...v27.2.4) * chore(deps): bump actions/checkout from 2.3.4 to 2.3.5 (#17) * chore(deps-dev): bump jest from 27.2.4 to 27.3.1 (#18) * chore(deps-dev): bump @readme/eslint-config from 7.1.1 to 7.2.2 (#22) * chore(deps-dev): bump nock from 13.1.3 to 13.1.4 (#23) * ci: disabling dependabot Disabling Dependabot for now until somebody has time to take this project under their wing. * feat: directory cleanup and reorganization on the cloudflare worker * chore: removing the editorconfig from the cloudflare package Co-authored-by: Dom Harrington <dom@harrington-mail.com> Co-authored-by: Dom Harrington <domharrington@protonmail.com> Co-authored-by: Gabriel Ratcliff <gaberatcliff@gmail.com> Co-authored-by: domharrington <domharrington@users.noreply.github.com> Co-authored-by: Sean <dokko1230@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information