Skip to content

Commit

Permalink
Adapter plugin (#4)
Browse files Browse the repository at this point in the history
* remove hardcoded api output directory

* add generated directory to .gitignore

* patch to 7d9257af with custom vercel adapter

* add inverted .vercelignore

* revert adding .vercelignore

* add debug output

* add debug output

* add debug output

* remove generated api dir from .gitignore

* test using vercel build output

* configure build output version

* add public build output to vercel build output

* adapt API routes to Vercel build output format

* hardcoded API functions output test

* try with servless example from vercel docs

* try with stricter formatting?

* revert try with stricter formatting?

* test do not bundle static dir into output dir

* add public output back to build output

* add some logging at the top of the file

* specify launcherType config for API routes

* add package.json for module type support for API routes

* add logging and use response.send

* use shouldAddHelpers flag

* restore original adapter functionality

* adapt SSR pages for build output configuration

* generate package.json with ESM support for SSR pages

* make sure execute route module is bundled with serverless SSR pages

* remove extra test pages

* add comment

* handle conditional exectuteRouteModule vercel build output dependency

* upgrade greenwood v0.29.0-alpha.1

* update TODO checklist in README

* sync with latest upstream

* log out handler request and response

* support response headers

* additional logging

* SSR pages should return a text/html content type

* SSR pages should return a text/html content type

* finishing touches

* upgrade latest greenwood with vercel adapter plugin

* README touch up
  • Loading branch information
thescientist13 authored Aug 12, 2023
1 parent 78a56cd commit 937bb7c
Show file tree
Hide file tree
Showing 10 changed files with 4,072 additions and 21,153 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

node_modules/
public/
.vercel
.vercel
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# greenwood-demo-adapter-vercel

A demonstration repo for using Greenwood with Vercel Serverless and Edge functions.

> ⚠️ _**Note**: Currently this repo is a WIP_
A demonstration repo for deploying a full-stack Greenwood app with Vercel static hosting and Serverless + Edge functions.

A demonstration repo for using Greenwood with Vercel Serverless and Edge functions for APIs and SSR pages and used in part of crafting the design for [introducing platform "adapters" into Greenwood](https://github.com/ProjectEvergreen/greenwood/issues/1008). It also takes reference from [this repo / presentation](https://github.com/thescientist13/web-components-at-the-edge/) for some earlier prototypes for server rendering Web Components.

Expand Down Expand Up @@ -59,11 +57,11 @@ TODO

## Adapter Implementation Thoughts / Questions

1. [ ] Will need to generate the _api/_ folder on-demand / as part of the build instead of hardcoding, likely from _manifest.json_
1. [ ] How to manage vercel configuration (e.g. redirects for pages)? Auto generate, auto merge into _vercel.json_?
1. [ ] How to best manage local dev (runtime "compliance")
1. [x] Will need to generate the _api/_ folder on-demand / as part of the build instead of hardcoding, likely from _manifest.json_
1. [x] How to manage vercel configuration (e.g. redirects for pages)? Auto generate, auto merge into _vercel.json_?
1. [x] How to best manage local dev (runtime "compliance") - just for production builds
- proxy vercel cli dev option?
- should use _src/_ or _public/_? depends on dev vs production mode? Interestingly, the manual way only worked deployed when using _public/_
1. [ ] Make sure to spread all headers / response properties in netlify functions adapter output
1. [x] Make sure to spread all headers / response properties in netlify functions adapter output
1. [ ] Keep it as an experimental feature for 1.0 (or per platform?)
1. [ ] Will SSR pages need access to the request object?
15 changes: 0 additions & 15 deletions api/artists.js

This file was deleted.

15 changes: 0 additions & 15 deletions api/fragment.js

This file was deleted.

15 changes: 0 additions & 15 deletions api/greeting.js

This file was deleted.

7 changes: 7 additions & 0 deletions greenwood.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { greenwoodPluginAdapterVercel } from '@greenwood/plugin-adapter-vercel';

export default {
plugins: [
greenwoodPluginAdapterVercel()
]
};
Loading

0 comments on commit 937bb7c

Please sign in to comment.