Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miniflare #2

Merged
merged 8 commits into from
Jan 15, 2024
Merged

Miniflare #2

merged 8 commits into from
Jan 15, 2024

Conversation

whilefoo
Copy link
Contributor

@whilefoo whilefoo commented Jan 4, 2024

There are actually two options:

  1. Miniflare: we can use Cloudflare workers directly and use Miniflare as a development server which simulates a real worker environment.
  2. Hono: it's a platform agnostic that can run on Cloudflare workers, AWS lambda, Vercel...so it'd allow us to easily move to a different platform. It's meant to run on edge but it also supports running on Node.

I'm currently testing out the first option and it works when I build the worker but not when I build the local server because of some weird errors:

 [ERROR] Could not resolve "node:util"

    .yarn/cache/@fastify-busboy-npm-2.1.0-960844a007-f22c1e5c52.zip/node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js:4:25:
      4 │ const inherits = require('node:util').inherits
        ╵                          ~~~~~~~~~~~

  The Yarn Plug'n'Play manifest forbids importing "node:util" here because it's not listed as a
  dependency of this package:

    .pnp.cjs:659:31:
      659 │         "packageDependencies": [\
          ╵                                ~~

  The package "node:util" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

@whilefoo whilefoo requested a review from 0x4007 January 4, 2024 15:29
@whilefoo
Copy link
Contributor Author

whilefoo commented Jan 6, 2024

I've managed to run Miniflare but it shows some weird C++ errors whenever a request comes so we'll have to run Miniflare with wrangler v3 and run smee client separately.

@0x4007
Copy link
Member

0x4007 commented Jan 6, 2024

I think yarn plug and play can be disabled either directly with a yarn config property or by using a different version of yarn. Perhaps that will help?

I did brief research now on both frameworks:

  1. Miniflare specifically states it's for development purposes only which leads me to believe that it is not a good idea to run it for production.
  2. I never heard of Hono before but maybe it seems okay.

Why can't we just go raw and use neither?

@whilefoo
Copy link
Contributor Author

whilefoo commented Jan 7, 2024

Miniflare can be used as a standalone library or as part of wrangler. And yes it's used for development when you're developing a Cloudflare worker. Basically when you run wrangler dev it runs Miniflare which simulates a Cloudflare worker environment.

I wanted to run Miniflare as standalone so we can run smee together, but since it's not working we will just have to run two commands, one to start smee and one to start wrangler dev server.

Also we don't need esbuild because wrangler dev and wrangler deploy automatically do everything, you just need to provide the JS/TS file.

With the latest commit I got the POC to work, it works by running a dev server and also by deploying to Cloudflare.

@0x4007
Copy link
Member

0x4007 commented Jan 15, 2024

Can't get this to work at ubiquibot-pavlovcik/ubiquibot-sandbox#1

.prettierrc Outdated Show resolved Hide resolved
@0x4007 0x4007 merged commit 516c1e4 into development Jan 15, 2024
2 checks passed
0x4007 added a commit to ubiquity/ts-template that referenced this pull request Jan 23, 2024
ariesgun added a commit to ariesgun/work.ubq.fi that referenced this pull request Oct 13, 2024
* feat: initial commit

* feat: add TS support

* feat: add conventional commits

* feat: add dotenv

* docs: add readme

* feat: add pull request template

* Create cloudflare-deploy

* feat: create helloWorld index.html

* feat: push action for development branch

* feat: update readme

* Update cloudflare-deploy.yml

* fix: rename pull_request_template

* Update conventional-commits.yml

Use our version which supports GitHub UI updates.

* chore: update dependencies and prettier

* chore: update package json

* Update conventional-commits.yml

* Update cloudflare-deploy.yml

Had to fix because `.nvmrc` is not compatible 

```
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=v20.3.0". Got "18.14.1"
```

* Update cloudflare-deploy.yml

* feat: format on lint-staged

* fix: commit-msg script and add lint-staged command

* feat: prefer named functions

* feat: add naming conventions rule

* feat: easy ui support

* feat: easy ui support

* fix: prettier for css

* chore: add .env file to .gitignore

* fix: lint staged

* fix: lint staged

* chore: remove tabs

ubiquity-os/ubiquity-os-kernel#2 (comment)

* feat: reusable deploy script

* feat: ban non null assertions

resolves ubiquity/ts-template#7

* Update README.md

* feat: spell check on commit

* feat: copy typescript rules

https://github.com/krzkaczor/TypeStrict.git
thanks @krzkaczor

* chore: remove no unnecessary condition for false positives

* fix: forgot to include cspell

* fix: cspell ci

* fix(ci): cspell

* chore: remove deprecated

* feat(cspell): support colors

* fix(ci): cspell

* feat: production deploys

related ubiquity/pay.ubq.fi#153

* chore: set up build for cd

* chore(deps): upgrade all

* chore: test on another brnach

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* feat: workflow dispatch

* Merge branch 'test/cd'

* chore: debug cd

* chore: debug cd

* chore: debug cd

* chore: debug cd

* feat: add knip CI configuration

Resolves: ubiquity/ts-template#12

* feat: commit or pr

* feat: workflow dispatch

* chore: test env vars

* Squashed commit of the following:

commit 1dcef50
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 06:52:34 2024 +0900

    chore: test env vars

commit 126e819
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 06:51:03 2024 +0900

    feat: workflow dispatch

commit dbec9e3
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 06:39:04 2024 +0900

    feat: commit or pr

commit d61f01e
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 04:18:18 2024 +0900

    chore: debug cd

commit 9a8fc77
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 04:07:39 2024 +0900

    chore: debug cd

commit ea72c5e
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 04:06:43 2024 +0900

    chore: debug cd

commit de20331
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 04:01:17 2024 +0900

    chore: debug cd

commit dc336a9
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 03:46:41 2024 +0900

    feat: workflow dispatch

commit 0002fec
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 03:41:18 2024 +0900

    chore: bump ci

commit 56a8cf8
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 03:34:16 2024 +0900

    chore: bump ci

commit ad2564c
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 03:33:38 2024 +0900

    chore: bump ci

commit 3ad759b
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 03:20:33 2024 +0900

    chore: bump ci

commit 8b25785
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 01:46:52 2024 +0900

    chore: bump ci

commit d117e10
Author: アレクサンダー.eth <[email protected]>
Date:   Mon Feb 19 23:33:58 2024 +0900

    chore: bump ci

commit d3b5d08
Author: アレクサンダー.eth <[email protected]>
Date:   Mon Feb 19 21:46:37 2024 +0900

    chore: test on another brnach

* fix: whitespace

* fix: transport secrets

* fix: app installation if

* feat: new github env style

* chore: update Knip yaml actions

As suggested during pull request review.

* chore: update supabase key name

ref: ubiquity/pay.ubq.fi#164 (comment)

* fix(ci): on prs

* fix: change dist to static

untested but in a rush and i think this is correct

* Update esbuild-server.ts

* fix: gitignore

* fix: commit sha

* feat: default Jest testing configuration

* Update .github/workflows/jest-testing.yml

* chore: moved jest config from js to ts

* chore: removed unused check to trigger Jest Action

* feat: cypress testing suite

* feat: default Jest testing configuration (ubiquity#19)

* feat: default Jest testing configuration

* Update .github/workflows/jest-testing.yml

* chore: moved jest config from js to ts

* chore: removed unused check to trigger Jest Action

---------

Co-authored-by: アレクサンダー.eth <[email protected]>

* chore: updated yarn.lock

* chore: removed checks for warn messages in the console

* fix: disabled comments on every push, and added default value for coverage

* chore: moved knip configuration

* chore: workflow dispatch for knip

* chore: workflow dispatch for knip

* chore: changed action target to pull_request_target

* chore: added test section to README.md

* ci(cspell): fix

* Create CODEOWNERS

Congratulations on the promotion @FernandVEYRIER

* chore: added missing dep

* chore: added ignore rules to knip

* chore: removed ts-node dep and changed jest config

* chore: added ternary rules for eslint

* chore: fixed trailing space in conf

* ci: add init workflow

* feat: release please Action

* chore: changed release to target default branch

* chore: changed release to target default branch

* chore: added permissions to release please

* chore: removed npm env variable

* Update release-please.yml

* Update CODEOWNERS

* ci: pass cloudflare credentials

* ci: add reusable cloudflare deploy

* ci: use single action

* ci: update deploy.yml

* chore: add pascal case linter to enforce Erc20Permit and Erc721Permit naming conventions

* chore: enable StrictPascalCase on all Identifiers

* chore: undo unnecessary changes

* chore: add eslint-filename plugin

* revert camelCase deletions and change to strictCamelCase

* fix: use regex and ignore e2e.ts

* chore: eslint config type inference

* chore: update knip configuration in the template to run on pull_request

* fix: moved eslint from js to json and accept numbers in file names

* fix: workflow release please

* fix: workflow cypress

* chore: test reporting lib

* chore: test reporting lib

* chore: test reporting lib

* chore: test reporting lib

* Update jest-testing.yml

* chore: find PR number

* chore: remove event

* chore: test pr number

* chore: test pr number

* chore: test pr number

* chore: test comment

* chore: test comment

* chore: revert default branch for release-please.yml

* chore: revert default branch for release-please.yml

* fix: fixed conflicts

---------

Co-authored-by: rndquu <[email protected]>
Co-authored-by: アレクサンダー.eth <[email protected]>
Co-authored-by: 0xCodercrane <[email protected]>
Co-authored-by: アレクサンダー.eth <[email protected]>
Co-authored-by: rndquu <[email protected]>
Co-authored-by: Korrrba <[email protected]>
Co-authored-by: Fernando <[email protected]>
Co-authored-by: Fernand <[email protected]>
Co-authored-by: jordan-ae <[email protected]>
Co-authored-by: jordan-ae <[email protected]>
Co-authored-by: Keyrxng <[email protected]>
Co-authored-by: アレクサンダー.eth <[email protected]>
Co-authored-by: Mentlegen <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Aries Gunawan <[email protected]>
ariesgun added a commit to ariesgun/work.ubq.fi that referenced this pull request Oct 13, 2024
* feat: initial commit

* feat: add TS support

* feat: add conventional commits

* feat: add dotenv

* docs: add readme

* feat: add pull request template

* Create cloudflare-deploy

* feat: create helloWorld index.html

* feat: push action for development branch

* feat: update readme

* Update cloudflare-deploy.yml

* fix: rename pull_request_template

* Update conventional-commits.yml

Use our version which supports GitHub UI updates.

* chore: update dependencies and prettier

* chore: update package json

* Update conventional-commits.yml

* Update cloudflare-deploy.yml

Had to fix because `.nvmrc` is not compatible 

```
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=v20.3.0". Got "18.14.1"
```

* Update cloudflare-deploy.yml

* feat: format on lint-staged

* fix: commit-msg script and add lint-staged command

* feat: prefer named functions

* feat: add naming conventions rule

* feat: easy ui support

* feat: easy ui support

* fix: prettier for css

* chore: add .env file to .gitignore

* fix: lint staged

* fix: lint staged

* chore: remove tabs

ubiquity-os/ubiquity-os-kernel#2 (comment)

* feat: reusable deploy script

* feat: ban non null assertions

resolves ubiquity/ts-template#7

* Update README.md

* feat: spell check on commit

* feat: copy typescript rules

https://github.com/krzkaczor/TypeStrict.git
thanks @krzkaczor

* chore: remove no unnecessary condition for false positives

* fix: forgot to include cspell

* fix: cspell ci

* fix(ci): cspell

* chore: remove deprecated

* feat(cspell): support colors

* fix(ci): cspell

* feat: production deploys

related ubiquity/pay.ubq.fi#153

* chore: set up build for cd

* chore(deps): upgrade all

* chore: test on another brnach

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* chore: bump ci

* feat: workflow dispatch

* Merge branch 'test/cd'

* chore: debug cd

* chore: debug cd

* chore: debug cd

* chore: debug cd

* feat: add knip CI configuration

Resolves: ubiquity/ts-template#12

* feat: commit or pr

* feat: workflow dispatch

* chore: test env vars

* Squashed commit of the following:

commit 1dcef50
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 06:52:34 2024 +0900

    chore: test env vars

commit 126e819
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 06:51:03 2024 +0900

    feat: workflow dispatch

commit dbec9e3
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 06:39:04 2024 +0900

    feat: commit or pr

commit d61f01e
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 04:18:18 2024 +0900

    chore: debug cd

commit 9a8fc77
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 04:07:39 2024 +0900

    chore: debug cd

commit ea72c5e
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 04:06:43 2024 +0900

    chore: debug cd

commit de20331
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 04:01:17 2024 +0900

    chore: debug cd

commit dc336a9
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 03:46:41 2024 +0900

    feat: workflow dispatch

commit 0002fec
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 03:41:18 2024 +0900

    chore: bump ci

commit 56a8cf8
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 03:34:16 2024 +0900

    chore: bump ci

commit ad2564c
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 03:33:38 2024 +0900

    chore: bump ci

commit 3ad759b
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 03:20:33 2024 +0900

    chore: bump ci

commit 8b25785
Author: アレクサンダー.eth <[email protected]>
Date:   Tue Feb 20 01:46:52 2024 +0900

    chore: bump ci

commit d117e10
Author: アレクサンダー.eth <[email protected]>
Date:   Mon Feb 19 23:33:58 2024 +0900

    chore: bump ci

commit d3b5d08
Author: アレクサンダー.eth <[email protected]>
Date:   Mon Feb 19 21:46:37 2024 +0900

    chore: test on another brnach

* fix: whitespace

* fix: transport secrets

* fix: app installation if

* feat: new github env style

* chore: update Knip yaml actions

As suggested during pull request review.

* chore: update supabase key name

ref: ubiquity/pay.ubq.fi#164 (comment)

* fix(ci): on prs

* fix: change dist to static

untested but in a rush and i think this is correct

* Update esbuild-server.ts

* fix: gitignore

* fix: commit sha

* feat: default Jest testing configuration

* Update .github/workflows/jest-testing.yml

* chore: moved jest config from js to ts

* chore: removed unused check to trigger Jest Action

* feat: cypress testing suite

* feat: default Jest testing configuration (ubiquity#19)

* feat: default Jest testing configuration

* Update .github/workflows/jest-testing.yml

* chore: moved jest config from js to ts

* chore: removed unused check to trigger Jest Action

---------

Co-authored-by: アレクサンダー.eth <[email protected]>

* chore: updated yarn.lock

* chore: removed checks for warn messages in the console

* fix: disabled comments on every push, and added default value for coverage

* chore: moved knip configuration

* chore: workflow dispatch for knip

* chore: workflow dispatch for knip

* chore: changed action target to pull_request_target

* chore: added test section to README.md

* ci(cspell): fix

* Create CODEOWNERS

Congratulations on the promotion @FernandVEYRIER

* chore: added missing dep

* chore: added ignore rules to knip

* chore: removed ts-node dep and changed jest config

* chore: added ternary rules for eslint

* chore: fixed trailing space in conf

* ci: add init workflow

* feat: release please Action

* chore: changed release to target default branch

* chore: changed release to target default branch

* chore: added permissions to release please

* chore: removed npm env variable

* Update release-please.yml

* Update CODEOWNERS

* ci: pass cloudflare credentials

* ci: add reusable cloudflare deploy

* ci: use single action

* ci: update deploy.yml

* chore: add pascal case linter to enforce Erc20Permit and Erc721Permit naming conventions

* chore: enable StrictPascalCase on all Identifiers

* chore: undo unnecessary changes

* chore: add eslint-filename plugin

* revert camelCase deletions and change to strictCamelCase

* fix: use regex and ignore e2e.ts

* chore: eslint config type inference

* chore: update knip configuration in the template to run on pull_request

* fix: moved eslint from js to json and accept numbers in file names

* fix: workflow release please

* fix: workflow cypress

* chore: test reporting lib

* chore: test reporting lib

* chore: test reporting lib

* chore: test reporting lib

* Update jest-testing.yml

* chore: find PR number

* chore: remove event

* chore: test pr number

* chore: test pr number

* chore: test pr number

* chore: test comment

* chore: test comment

* chore: revert default branch for release-please.yml

* chore: revert default branch for release-please.yml

---------

Co-authored-by: rndquu <[email protected]>
Co-authored-by: アレクサンダー.eth <[email protected]>
Co-authored-by: 0xCodercrane <[email protected]>
Co-authored-by: アレクサンダー.eth <[email protected]>
Co-authored-by: rndquu <[email protected]>
Co-authored-by: Korrrba <[email protected]>
Co-authored-by: Fernando <[email protected]>
Co-authored-by: Fernand <[email protected]>
Co-authored-by: jordan-ae <[email protected]>
Co-authored-by: jordan-ae <[email protected]>
Co-authored-by: Keyrxng <[email protected]>
Co-authored-by: アレクサンダー.eth <[email protected]>
Co-authored-by: Mentlegen <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants