Skip to content

Commit

Permalink
Revert "chore: update Deno import maps on release (remix-run#3225)" (r…
Browse files Browse the repository at this point in the history
…emix-run#3254)

This reverts commit c28e179.
  • Loading branch information
pcattori authored and justjavac committed Jun 11, 2022
1 parent 91d92f0 commit e37e1f9
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 91 deletions.
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": {
"@remix-run/server-runtime": "https://esm.sh/@remix-run/[email protected].0",
"mime": "https://esm.sh/[email protected]"
"mime": "https://esm.sh/[email protected].0",
"@remix-run/server-runtime": "https://esm.sh/@remix-run/[email protected]"
}
}
1 change: 0 additions & 1 deletion contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@
- jesse-deboer
- jesseflorig
- jgarrow
- jiahao-c
- jkup
- jmasson
- JNaftali
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For more, see the [Remix docs](https://remix.run/docs/).
## Install

Installation is done via `npm`, but the code itself is Deno source code.
Read more about [why we use `npm` to manage dependencies for Deno projects](https://github.com/remix-run/remix/blob/main/decisions/0001-use-npm-to-manage-npm-dependencies-for-deno-projects.md) in Remix.
Read more about [why we use `npm` to manage dependencies for Deno projects](https://github.com/remix-run/remix/blob/main/docs/decisions/0001-use-npm-to-manage-npm-dependencies-for-deno-projects.md) in Remix.

```sh
npm install @remix-run/deno
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-server-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Support for each runtime is provided by a corresponding Remix package:

- [`@remix-run/node`](https://github.com/remix-run/remix/tree/main/packages/remix-node)
- [`@remix-run/cloudflare`](https://github.com/remix-run/remix/tree/main/packages/remix-cloudflare)
- [`@remix-run/deno`](https://github.com/remix-run/remix/tree/main/packages/remix-deno)
- [`remix-deno`](https://github.com/remix-run/remix/tree/main/templates/deno/remix-deno) (will be renamed to `@remix-run/deno` when Deno support is stable)

This package defines a "Remix server runtime interface" that each runtime package must conform to.

Expand Down
56 changes: 0 additions & 56 deletions scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,52 +176,6 @@ async function updateDeploymentScriptVersion(nextVersion) {
);
}

/**
* @param {string} importSpecifier
* @returns {[string, string]} [packageName, importPath]
*/
const getPackageNameFromImportSpecifier = (importSpecifier) => {
if (importSpecifier.startsWith("@")) {
let [scope, pkg, ...path] = importSpecifier.split("/");
return [`${scope}/${pkg}`, path.join("/")];
}

let [pkg, ...path] = importSpecifier.split("/");
return [pkg, path.join("/")];
};
/**
* @param {string} importMapPath
* @param {string} nextVersion
*/
const updateDenoImportMap = async (importMapPath, nextVersion) => {
let { imports, ...json } = await jsonfile.readFile(importMapPath);
let remixPackagesFull = remixPackages.all.map(
(remixPackage) => `@remix-run/${remixPackage}`
);

let newImports = Object.fromEntries(
Object.entries(imports).map(([importName, path]) => {
let [packageName, importPath] =
getPackageNameFromImportSpecifier(importName);

return remixPackagesFull.includes(packageName)
? [
importName,
`https://esm.sh/${packageName}@${nextVersion}${
importPath ? `/${importPath}` : ""
}`,
]
: [importName, path];
})
);

return jsonfile.writeFile(
importMapPath,
{ ...json, imports: newImports },
{ spaces: 2 }
);
};

/**
* @param {string} nextVersion
*/
Expand All @@ -233,16 +187,6 @@ async function incrementRemixVersion(nextVersion) {
await updateRemixVersion(`remix-${name}`, nextVersion);
}

// Update version numbers in Deno's import maps
await Promise.all(
[
path.join(".vscode", "deno_resolve_npm_imports.json"),
path.join("templates", "deno", ".vscode", "resolve_npm_imports.json"),
].map((importMapPath) =>
updateDenoImportMap(path.join(rootDir, importMapPath), nextVersion)
)
);

// Update versions in the examples
await updateExamplesRemixVersion(nextVersion);

Expand Down
5 changes: 2 additions & 3 deletions templates/deno/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules
/node_modules/

/.cache
/build
/public/build
.env
/public/build
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": {
"@remix-run/deno": "https://esm.sh/@remix-run/[email protected].0",
"@remix-run/dev/server-build": "https://esm.sh/@remix-run/[email protected]/server-build",
"@remix-run/react": "https://esm.sh/@remix-run/react@1.5.0",
"react": "https://esm.sh/[email protected]",
"react-dom": "https://esm.sh/[email protected]",
"react-dom/server": "https://esm.sh/[email protected]/server"
"react": "https://esm.sh/[email protected].0",
"react-dom": "https://esm.sh/[email protected]",
"react-dom/server": "https://esm.sh/react[email protected]/server",
"@remix-run/dev/server-build": "https://esm.sh/@remix-run/[email protected]/server-build",
"@remix-run/deno": "https://esm.sh/@remix-run/[email protected]",
"@remix-run/react": "https://esm.sh/@remix-run/[email protected]"
}
}
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.importMap": "./.vscode/resolve_npm_imports.json",
"deno.lint": true
"deno.lint": true,
"deno.importMap": "./.vscode/resolve_npm_imports.json"
}
3 changes: 2 additions & 1 deletion templates/deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ 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/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";
import { hydrate } from "react-dom";

hydrate(<RemixBrowser />, document);
ReactDOM.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 type { EntryContext } from "@remix-run/deno";
import { RemixServer } from "@remix-run/react";
import * as React from "react";
import React from "react";
import { renderToString } from "react-dom/server";
import { RemixServer } from "@remix-run/react";
import type { EntryContext } from "@remix-run/deno";

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 type { MetaFunction } from "@remix-run/deno";
import React from "react";
import {
Links,
LiveReload,
Expand All @@ -7,7 +7,7 @@ import {
Scripts,
ScrollRestoration,
} from "@remix-run/react";
import * as React from "react";
import type { MetaFunction } from "@remix-run/deno";

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 * as React from "react";
import 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 @@
"build": "remix build",
"deploy": "deployctl deploy --prod --include=build,public --project=<your deno deploy project> ./build/index.js",
"dev": "remix build && run-p dev:*",
"dev:deno": "cross-env NODE_ENV=development deno run --unstable --watch --allow-net --allow-read --allow-env ./build/index.js",
"dev:remix": "remix watch",
"format": "deno fmt --ignore=node_modules",
"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",
"lint": "deno lint --ignore=node_modules",
"start": "cross-env NODE_ENV=production deno run --unstable --allow-net --allow-read --allow-env ./build/index.js"
"format": "deno fmt --ignore=node_modules"
},
"dependencies": {
"@remix-run/deno": "*",
Expand Down
6 changes: 1 addition & 5 deletions templates/deno/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
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: ["**/.*"],
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// serverBuildPath: "build/index.js",
// publicPath: "/build/",
};
1 change: 0 additions & 1 deletion templates/vercel/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ node_modules
/build/
/public/build
/api/index.js
/api/index.js.map

0 comments on commit e37e1f9

Please sign in to comment.