-
Notifications
You must be signed in to change notification settings - Fork 11
feat: implemented Remix server adapter and runtime for Netlify #16
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
Changes from all commits
e141d98
8e56897
79bb70d
379fcf9
c5b3b36
2faaffa
4bc07ea
569bc20
959a30b
a58e06e
853ac97
cb6cdee
21d9bf8
8b3cd57
84fdc49
aaaff6f
7b03c6c
1007d4d
a0038db
f570e9c
9974faa
7b0970a
360b94b
6f258da
e0b4e65
3b2e8cc
e9927b0
4333b20
f788018
c443950
0c15673
ce64771
af313d0
67fe4d4
cfb4cbd
8676091
9ce4b79
27c4b51
cd4d261
daafe3f
f616d4f
993a262
6ed4e65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Run e2e (Remix Edge Demo) | ||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
cypress: | ||
name: Cypress | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
containers: [1] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Generate Github token | ||
uses: navikt/github-app-token-generator@v1 | ||
id: get-token | ||
with: | ||
private-key: ${{ secrets.TOKENS_PRIVATE_KEY }} | ||
app-id: ${{ secrets.TOKENS_APP_ID }} | ||
|
||
- name: Checkout @netlify/wait-for-deploy-action | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: netlify/wait-for-deploy-action | ||
token: ${{ steps.get-token.outputs.token }} | ||
path: ./.github/actions/wait-for-netlify-deploy | ||
|
||
- name: Wait for Netlify Deploy | ||
id: deploy | ||
uses: ./.github/actions/wait-for-netlify-deploy | ||
with: | ||
site-name: remix-edge | ||
timeout: 300 | ||
|
||
- name: Deploy successful | ||
if: ${{ steps.deploy.outputs.origin-url }} | ||
run: echo ${{ steps.deploy.outputs.origin-url }} | ||
|
||
- name: Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- run: npm install | ||
|
||
- name: Cypress run | ||
if: ${{ steps.deploy.outputs.origin-url }} | ||
id: cypress | ||
uses: cypress-io/github-action@v2 | ||
with: | ||
browser: chrome | ||
headless: true | ||
record: true | ||
parallel: true | ||
config-file: cypress/config/edge-cypress.config.ts | ||
group: 'Remix Edge Demo' | ||
env: | ||
DEBUG: '@cypress/github-action' | ||
CYPRESS_baseUrl: ${{ steps.deploy.outputs.origin-url }} | ||
CYPRESS_NETLIFY_CONTEXT: ${{ steps.deploy.outputs.context }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CYPRESS_RECORD_KEY: ${{ secrets.REMIX_EDGE_CYPRESS_RECORD_KEY }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,3 +128,8 @@ dist | |
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
build/ | ||
|
||
# Local Netlify folder | ||
.netlify |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
MIT License Copyright (c) 2023 Nick Taylor | ||
nickytonline marked this conversation as resolved.
Show resolved
Hide resolved
|
||
MIT License Copyright (c) 2023 Netlify Inc. | ||
|
||
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: | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
nickytonline marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
(including the next paragraph) shall be included in all copies or substantial | ||
portions of the Software. | ||
The above copyright notice and this permission notice (including the next paragraph) 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. | ||
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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Remix Compute for Netlify | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mind having a peek at this @stephmarie17? It's to the point, but just want to make sure about the wording. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks good to me! Clear and to the point. |
||
|
||
The Remix Compute for Netlify packages allow you to deploy your Remix apps to | ||
[Netlify Edge Functions](https://docs.netlify.com/edge-functions/overview/). | ||
|
||
This project is not a template for Remix apps. It is a set of packages used by the Netlify Remix template. | ||
|
||
The project is a monorepo. Packages are located in the `packages` directory. There are three packages: | ||
|
||
- `@netlify/remix-runtime` - The Remix runtime for Netlify Edge Functions | ||
- `@netlify/remix-edge-adapter` - The Remix adapter for Netlify Edge Functions | ||
- `@netlify/remix-edge-demo-site` - A demo site for testing the packages | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
This installs all the dependencies for all the packages and builds the `@netlify/remix-runtime` and | ||
`@netlify/remix-edge-adapter` packages. | ||
|
||
## Development | ||
|
||
Run the build watch command to have packages built when they are changed. | ||
|
||
```bash | ||
npm run build:watch | ||
``` | ||
|
||
When you're ready to test your changes, you can run the demo site locally. | ||
|
||
```bash | ||
ntl build --offline | ||
ntl serve | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ import { defineConfig } from 'cypress' | |
|
||
export default defineConfig({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a new Cypress config. It's what's used now instead of cypress.json, ci.json etc. |
||
e2e: { | ||
baseUrl: 'http://localhost:8888', | ||
specPattern: 'cypress/e2e/**/*.spec.ts', | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from 'cypress' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the Cypress format config for the Remix Edge demo. |
||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://localhost:3000', | ||
specPattern: 'cypress/e2e/**/*.spec.ts', | ||
projectId: 'k847hv', | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
describe('Smoke Test', () => { | ||
it('Should load the demo site', () => { | ||
cy.visit('/') | ||
cy.findByRole('heading', { name: /Welcome to Remix/i }).should('exist') | ||
cy.findByRole('link', { name: /15m Quickstart Blog Tutorial/i }).should('exist') | ||
cy.findByRole('link', { name: /Deep Dive Jokes App Tutorial/i }).should('exist') | ||
cy.findByRole('link', { name: /Remix Docs/i }).should('exist') | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,12 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************** | ||
// This example commands.ts shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add('login', (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) | ||
// | ||
// declare global { | ||
// namespace Cypress { | ||
// interface Chainable { | ||
// login(email: string, password: string): Chainable<void> | ||
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element> | ||
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element> | ||
// } | ||
// } | ||
// } | ||
import '@testing-library/cypress/add-commands' | ||
|
||
// Handles React 18 hydration errors | ||
// The hydration errors are because Cypress is manipulating the DOM | ||
// See https://github.com/robipop22/dnb-stack/issues/3#issuecomment-1286112365 | ||
Cypress.on('uncaught:exception', (err) => { | ||
// we check if the error is | ||
if (err.message.includes('Minified React error #418;') || err.message.includes('Minified React error #423;')) { | ||
return false | ||
} | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build] | ||
command = "npm run build:edge-demo" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ascorbic, all the files in It's a monorepo where the edge demo site requires the That was also why I had issues with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than the toml you could set these in the UI, which would let you use different commands and roots for each site There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, good call about using different commands. The root would stay the same though as I need the monorepo to install everything. I'll make this change once we bring the Netlify Functions adapter into the project. |
||
publish = "packages/edge-demo-site/public" |
Uh oh!
There was an error while loading. Please reload this page.