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

chore(templates): bring deno template in line with other templates #3221

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .vscode/deno_resolve_npm_imports.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"// Deno-only dependencies may be imported via URL imports (without using import maps).": "",

"imports": {
"mime": "https://esm.sh/mime@3.0.0",
"@remix-run/server-runtime": "https://esm.sh/@remix-run/server-runtime@1.4.3"
"@remix-run/server-runtime": "https://esm.sh/@remix-run/server-runtime@1.5.0",
"mime": "https://esm.sh/mime@3.0.0"
}
}
5 changes: 3 additions & 2 deletions templates/deno/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/node_modules/
node_modules

/.cache
/build
/public/build
/public/build
.env
12 changes: 6 additions & 6 deletions templates/deno/.vscode/resolve_npm_imports.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"// Deno-only dependencies may be imported via URL imports (without using import maps).": "",

"imports": {
"react": "https://esm.sh/react@18.0.0",
"react-dom": "https://esm.sh/react-dom@18.0.0",
"react-dom/server": "https://esm.sh/react-dom@18.0.0/server",
"@remix-run/dev/server-build": "https://esm.sh/@remix-run/dev@1.4.3/server-build",
"@remix-run/deno": "https://esm.sh/@remix-run/deno@1.4.3",
"@remix-run/react": "https://esm.sh/@remix-run/react@1.4.3"
"@remix-run/deno": "https://esm.sh/@remix-run/deno@1.5.0",
"@remix-run/dev/server-build": "https://esm.sh/@remix-run/dev@1.5.0/server-build",
"@remix-run/react": "https://esm.sh/@remix-run/react@1.5.0",
"react": "https://esm.sh/react@17.0.2",
"react-dom": "https://esm.sh/react-dom@17.0.2",
"react-dom/server": "https://esm.sh/react-dom@17.0.2/server"
}
}
4 changes: 2 additions & 2 deletions templates/deno/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"deno.enable": true,
"deno.lint": true,
"deno.importMap": "./.vscode/resolve_npm_imports.json"
"deno.importMap": "./.vscode/resolve_npm_imports.json",
"deno.lint": true
}
3 changes: 1 addition & 2 deletions templates/deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ npx create-remix@latest --template deno

## Managing dependencies

Read about [how we recommend to manage dependencies for Remix projects using Deno](https://github.com/remix-run/remix/blob/main/docs/decisions/0001-use-npm-to-manage-npm-dependencies-for-deno-projects.md
).
Read about [how we recommend to manage dependencies for Remix projects using Deno](https://github.com/remix-run/remix/blob/main/docs/decisions/0001-use-npm-to-manage-npm-dependencies-for-deno-projects.md).

- ✅ You should use `npm` to install NPM packages
```sh
Expand Down
6 changes: 3 additions & 3 deletions templates/deno/app/entry.client.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import ReactDOM from "react-dom";
import { RemixBrowser } from "@remix-run/react";
import * as React from "react";
MichaelDeBoey marked this conversation as resolved.
Show resolved Hide resolved
import { hydrate } from "react-dom";

ReactDOM.hydrate(<RemixBrowser />, document);
hydrate(<RemixBrowser />, document);
6 changes: 3 additions & 3 deletions templates/deno/app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { renderToString } from "react-dom/server";
import { RemixServer } from "@remix-run/react";
import type { EntryContext } from "@remix-run/deno";
import { RemixServer } from "@remix-run/react";
import * as React from "react";
import { renderToString } from "react-dom/server";

export default function handleRequest(
request: Request,
Expand Down
4 changes: 2 additions & 2 deletions templates/deno/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import type { MetaFunction } from "@remix-run/deno";
import {
Links,
LiveReload,
Expand All @@ -7,7 +7,7 @@ import {
Scripts,
ScrollRestoration,
} from "@remix-run/react";
import type { MetaFunction } from "@remix-run/deno";
import * as React from "react";

export const meta: MetaFunction = () => ({
charset: "utf-8",
Expand Down
2 changes: 1 addition & 1 deletion templates/deno/app/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";

export default function Index() {
return (
Expand Down
6 changes: 3 additions & 3 deletions templates/deno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"scripts": {
"build": "remix build",
"dev": "remix build && run-p dev:*",
"dev:remix": "remix watch",
"dev:deno": "cross-env NODE_ENV=development deno run --unstable --watch --allow-net --allow-read --allow-env ./build/index.js",
"start": "cross-env NODE_ENV=production deno run --unstable --allow-net --allow-read --allow-env ./build/index.js",
"dev:remix": "remix watch",
"format": "deno fmt --ignore=node_modules",
"lint": "deno lint --ignore=node_modules",
"format": "deno fmt --ignore=node_modules"
"start": "cross-env NODE_ENV=production deno run --unstable --allow-net --allow-read --allow-env ./build/index.js"
},
"dependencies": {
"@remix-run/deno": "*",
Expand Down
6 changes: 5 additions & 1 deletion templates/deno/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
module.exports = {
serverBuildTarget: "deno",
server: "./server.ts",

/*
If live reload causes page to re-render without changes (live reload is too fast),
increase the dev server broadcast delay.
If live reload seems slow, try to decrease the dev server broadcast delay.
*/
devServerBroadcastDelay: 300,
ignoredRouteFiles: ["**/.*"],
MichaelDeBoey marked this conversation as resolved.
Show resolved Hide resolved
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// serverBuildPath: "build/index.js",
// publicPath: "/build/",
MichaelDeBoey marked this conversation as resolved.
Show resolved Hide resolved
};