Skip to content

Commit

Permalink
Merge branch 'dev' into markdalgleish/dedupe-prefetch-links
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish authored Aug 8, 2023
2 parents 17ebefd + b788f34 commit 0136026
Show file tree
Hide file tree
Showing 77 changed files with 563 additions and 3,231 deletions.
5 changes: 0 additions & 5 deletions .changeset/big-papayas-jam.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/brown-gifts-chew.md

This file was deleted.

4 changes: 1 addition & 3 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
"@remix-run/dev",
"@remix-run/eslint-config",
"@remix-run/express",
"@remix-run/netlify",
"@remix-run/node",
"@remix-run/react",
"@remix-run/serve",
"@remix-run/server-runtime",
"@remix-run/testing",
"@remix-run/vercel"
"@remix-run/testing"
]
],
"linked": [],
Expand Down
5 changes: 5 additions & 0 deletions .changeset/disabled-link-preload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/react": patch
---

Add `<link rel="preload">` timeout counter and disabling logic in case preloading is disabled by the user in Firefox. This prevents us from hanging on client-side navigations when we try to preload stylesheets and never receive a `load`/`error` event on the `link` tag.
13 changes: 13 additions & 0 deletions .changeset/fair-falcons-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@remix-run/vercel": major
---

The `@remix-run/vercel` runtime adapter has been removed in favor of out of the box Vercel functionality. Please update
your code by removing `@remix-run/vercel` & `@vercel/node` from your `package.json`, removing your
`server.ts`/`server.js` file, and removing the `server` & `serverBuildPath` options from your `remix.config.js`.

Due to the removal of this adapter, we also removed our [Vercel template][vercel-template] in favor of the
[official Vercel template][official-vercel-template].

[vercel-template]: https://github.com/remix-run/remix/tree/main/templates/vercel
[official-vercel-template]: https://github.com/vercel/vercel/tree/main/examples/remix
5 changes: 5 additions & 0 deletions .changeset/olive-lemons-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/react": patch
---

Use unique key for `script:ld+json` meta descriptors
2 changes: 0 additions & 2 deletions .changeset/purple-zoos-refuse.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
"@remix-run/deno": major
"@remix-run/dev": major
"@remix-run/express": major
"@remix-run/netlify": major
"@remix-run/node": major
"@remix-run/react": major
"@remix-run/serve": major
"@remix-run/server-runtime": major
"@remix-run/testing": major
"@remix-run/vercel": major
---

Require Node >=18.0.0
17 changes: 17 additions & 0 deletions .changeset/strong-rice-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"@remix-run/netlify": major
---

The `@remix-run/netlify` runtime adapter has removed in favor of [`@netlify/remix-adapter`][official-netlify-adapter]
& [`@netlify/remix-edge-adapter`][official-netlify-edge-adapter]. Please update your code by changing all
`@remix-run/netlify` imports to `@netlify/remix-adapter`.
Keep in mind that `@netlify/remix-adapter` requires `@netlify/functions@^1.0.0`, which is a breaking change compared
to the previous supported `@netlify/functions` versions in `@remix-run/netlify`.

Due to the removal of this adapter, we also removed our [Netlify template][netlify-template] in favor of the
[official Netlify template][official-netlify-template].

[official-netlify-adapter]: https://github.com/netlify/remix-compute/tree/main/packages/remix-adapter
[official-netlify-edge-adapter]: https://github.com/netlify/remix-compute/tree/main/packages/remix-edge-adapter
[netlify-template]: https://github.com/remix-run/remix/tree/main/templates/netlify
[official-netlify-template]: https://github.com/netlify/remix-template
5 changes: 5 additions & 0 deletions .changeset/tasty-apricots-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/server-runtime": patch
---

correctly infer deferred types for top-level promises
2 changes: 0 additions & 2 deletions .changeset/v2-remove-auto-globals-install.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
---
"@remix-run/architect": major
"@remix-run/express": major
"@remix-run/netlify": major
"@remix-run/node": major
"@remix-run/serve": major
"@remix-run/vercel": major
---

For preparation of using Node's built in fetch implementation, installing the fetch globals is now a responsibility of the app server. If you are using `remix-serve`, nothing is required. If you are using your own app server, you will need to install the globals yourself.
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/deduplicate-yarn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: ⚙️ Deduplicate yarn.lock

on:
push:
branches:
- dev
paths:
- ./yarn.lock

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
format:
if: github.repository == 'remix-run/remix'
runs-on: ubuntu-latest

steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "yarn"

- name: ️️⚙️ Dedupe yarn.lock
run: npx yarn-deduplicate && rm -rf ./node_modules && yarn

- name: 💪 Commit
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
if [ -z "$(git status --porcelain)" ]; then
echo "💿 no deduplication needed"
exit 0
fi
git commit -m "chore: deduplicate `yarn.lock`"
git push
echo "💿 https://github.com/$GITHUB_REPOSITORY/commit/$(git rev-parse HEAD)"
77 changes: 0 additions & 77 deletions .github/workflows/deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ on:
required: true
TEST_FLY_TOKEN:
required: true
TEST_NETLIFY_TOKEN:
required: true
TEST_VERCEL_TOKEN:
required: true
TEST_VERCEL_USER_ID:
required: true

jobs:
arc_deploy:
Expand Down Expand Up @@ -222,74 +216,3 @@ jobs:
working-directory: ./scripts/deployment-test
env:
FLY_API_TOKEN: ${{ secrets.TEST_FLY_TOKEN }}

netlify_deploy:
name: "Netlify Deploy"
if: github.repository == 'remix-run/remix'
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]

- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: npm
cache-dependency-path: ./scripts/deployment-test/package.json # no lockfile, key caching off package.json

# some deployment targets require the latest version of npm
# TODO: remove this eventually when the default version we get
# is "latest" enough.
- name: 📦 Install latest version of npm
run: npm install -g npm@latest
working-directory: ./scripts/deployment-test

- name: 📥 Install deployment-test deps
run: npm install
working-directory: ./scripts/deployment-test

- name: 🚀 Deploy to Netlify
run: node ./netlify.mjs
working-directory: ./scripts/deployment-test
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.TEST_NETLIFY_TOKEN }}

vercel_deploy:
name: "Vercel Deploy"
if: github.repository == 'remix-run/remix'
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]

- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: npm
cache-dependency-path: ./scripts/deployment-test/package.json # no lockfile, key caching off package.json

# some deployment targets require the latest version of npm
# TODO: remove this eventually when the default version we get
# is "latest" enough.
- name: 📦 Install latest version of npm
run: npm install -g npm@latest
working-directory: ./scripts/deployment-test

- name: 📥 Install deployment-test deps
run: npm install
working-directory: ./scripts/deployment-test

- name: 🚀 Deploy to Vercel
run: node ./vercel.mjs
working-directory: ./scripts/deployment-test
env:
VERCEL_TOKEN: ${{ secrets.TEST_VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.TEST_VERCEL_USER_ID }}
3 changes: 0 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ jobs:
TEST_CF_API_TOKEN: ${{ secrets.TEST_CF_API_TOKEN }}
TEST_DENO_DEPLOY_TOKEN: ${{ secrets.TEST_DENO_DEPLOY_TOKEN }}
TEST_FLY_TOKEN: ${{ secrets.TEST_FLY_TOKEN }}
TEST_NETLIFY_TOKEN: ${{ secrets.TEST_NETLIFY_TOKEN }}
TEST_VERCEL_TOKEN: ${{ secrets.TEST_VERCEL_TOKEN }}
TEST_VERCEL_USER_ID: ${{ secrets.TEST_VERCEL_USER_ID }}

stacks:
needs: [nightly]
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ jobs:
TEST_CF_API_TOKEN: ${{ secrets.TEST_CF_API_TOKEN }}
TEST_DENO_DEPLOY_TOKEN: ${{ secrets.TEST_DENO_DEPLOY_TOKEN }}
TEST_FLY_TOKEN: ${{ secrets.TEST_FLY_TOKEN }}
TEST_NETLIFY_TOKEN: ${{ secrets.TEST_NETLIFY_TOKEN }}
TEST_VERCEL_TOKEN: ${{ secrets.TEST_VERCEL_TOKEN }}
TEST_VERCEL_USER_ID: ${{ secrets.TEST_VERCEL_USER_ID }}

stacks:
name: 🥞 Remix Stacks Test
Expand Down
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@
- vorcigernix
- wangbinyq
- weavdale
- wilcoschoneveld
- willhack
- willin
- wizardlyhel
Expand Down
2 changes: 0 additions & 2 deletions docs/file-conventions/remix-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ There are a few conventions that Remix uses you should be aware of.
[cloudflare-pages]: https://pages.cloudflare.com
[cloudflare-workers]: https://workers.cloudflare.com
[deno]: https://deno.land
[netlify]: https://www.netlify.com
[node-cjs]: https://nodejs.org/en
[vercel]: https://vercel.com
[dilum-sanjaya]: https://twitter.com/DilumSanjaya
[an-awesome-visualization]: https://remix-routing-demo.netlify.app
[remix-dev]: ../other-api/dev#remix-dev
Expand Down
7 changes: 2 additions & 5 deletions docs/guides/envvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,8 @@ Then, you can pass those through via `getLoadContext` in your server file:
```ts
export const onRequest = createPagesFunctionHandler({
build,
getLoadContext(context) {
// Hand-off Cloudflare ENV vars to the Remix `context` object
return { env: context.env };
},
mode: process.env.NODE_ENV,
getLoadContext: (context) => ({ env: context.env }), // Hand-off Cloudflare ENV vars to the Remix `context` object
mode: build.mode,
});
```

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/manual-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ app.all(
? createDevRequestHandler(build)
: createRequestHandler({
build,
mode: process.env.NODE_ENV,
mode: build.mode,
})
);
```
Expand Down
60 changes: 10 additions & 50 deletions docs/other-api/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ Idiomatic Remix apps can generally be deployed anywhere because Remix adapts the
- `@remix-run/cloudflare-pages`
- `@remix-run/cloudflare-workers`
- `@remix-run/express`
- `@remix-run/netlify`
- `@remix-run/vercel`

These adapters are imported into your server's entry and are not used inside of your Remix app itself.
These adapters are imported into your server's entry and are not used inside your Remix app itself.

If you initialized your app with `npx create-remix@latest` with something other than the built-in Remix App Server, you will note a `server/index.js` file that imports and uses one of these adapters.

Expand All @@ -28,7 +26,10 @@ Each adapter has the same API. In the future we may have helpers specific to the

- [`@fastly/remix-server-adapter`][fastly-remix-server-adapter] - For [Fastly Compute@Edge][fastly-compute-at-edge].
- [`@mcansh/remix-fastify`][remix-fastify] - For [Fastify][fastify].
- [`@mcansh/remix-raw-http`][remix-raw-http] - For a good ol barebones Node server.
- [`@mcansh/remix-raw-http`][remix-raw-http] - For a good old bare bones Node server.
- [`@netlify/remix-adapter`][netlify-remix-adapter] - For [Netlify][netlify].
- [`@netlify/remix-edge-adapter`][netlify-remix-edge-adapter] - For [Netlify][netlify] Edge.
- [`@vercel/remix`][vercel-remix] - For [Vercel][vercel].
- [`remix-google-cloud-functions`][remix-google-cloud-functions] - For [Google Cloud][google-cloud-functions] and [Firebase][firebase-functions] functions.

## Creating an Adapter
Expand Down Expand Up @@ -83,52 +84,6 @@ exports.handler = createRequestHandler({
});
```

Here's an example with Vercel:

```ts
const {
createRequestHandler,
} = require("@remix-run/vercel");
module.exports = createRequestHandler({
build: require("./build"),
});
```

Here's an example with Netlify:

```ts
const path = require("node:path");

const {
createRequestHandler,
} = require("@remix-run/netlify");

const BUILD_DIR = path.join(process.cwd(), "netlify");

function purgeRequireCache() {
// purge require cache on requests for "server side HMR" this won't let
// you have in-memory objects between requests in development,
// netlify typically does this for you, but we've found it to be hit or
// miss and some times requires you to refresh the page after it auto reloads
// or even have to restart your server
for (const key in require.cache) {
if (key.startsWith(BUILD_DIR)) {
delete require.cache[key];
}
}
}

exports.handler =
process.env.NODE_ENV === "production"
? createRequestHandler({ build: require("./build") })
: (event, context) => {
purgeRequireCache();
return createRequestHandler({
build: require("./build"),
})(event, context);
};
```

Here's an example with the simplified Cloudflare Workers API:

```ts
Expand Down Expand Up @@ -189,3 +144,8 @@ addEventListener("fetch", (event) => {
[remix-fastify]: https://github.com/mcansh/remix-fastify
[fastify]: https://www.fastify.io
[remix-raw-http]: https://github.com/mcansh/remix-node-http-server
[netlify-remix-adapter]: https://github.com/netlify/remix-compute/tree/main/packages/remix-adapter
[netlify-remix-edge-adapter]: https://github.com/netlify/remix-compute/tree/main/packages/remix-edge-adapter
[netlify]: https://netlify.com
[vercel-remix]: https://github.com/vercel/remix/blob/main/packages/vercel-remix
[vercel]: https://vercel.com
Loading

0 comments on commit 0136026

Please sign in to comment.