Skip to content

Commit

Permalink
feat: only support deno 2
Browse files Browse the repository at this point in the history
  • Loading branch information
redabacha committed Oct 9, 2024
1 parent 24e3ee5 commit a3c1bcc
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"deno.config": "./templates/deno/deno.jsonc",
"deno.config": "./templates/deno/deno.json",
"deno.enablePaths": ["./packages/remix-deno/", "./templates/deno"],
"deno.disablePaths": ["./templates/deno/app"]
}
3 changes: 1 addition & 2 deletions integration/helpers/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ export async function createProject(
}

export function installDependenciesDeno(cwd: string) {
let installProc = spawnSync(denoBin, ["install", "--no-lock"], {
let installProc = spawnSync(denoBin, ["install"], {
cwd,
env: { ...process.env, DENO_FUTURE: "1" },
stdio: "pipe",
});
if (installProc.status !== 0) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"clean:build": "node ./scripts/clean-build.mjs",
"clean:integration": "node ./integration/helpers/cleanup.mjs",
"format": "prettier --cache --ignore-path .eslintignore --write ./ && npm run lint:fix",
"format:deno": "deno fmt --config ./templates/deno/deno.jsonc integration/helpers/deno-template packages/remix-deno templates/deno",
"format:deno": "deno fmt --config ./templates/deno/deno.json integration/helpers/deno-template packages/remix-deno templates/deno",
"license": "node ./scripts/license.js",
"lint": "eslint .",
"lint:deno": "deno lint --config ./templates/deno/deno.jsonc integration/helpers/deno-template packages/remix-deno templates/deno",
"lint:deno": "deno lint --config ./templates/deno/deno.json integration/helpers/deno-template packages/remix-deno templates/deno",
"lint:fix": "pnpm lint --fix",
"playground:new": "node ./scripts/playground/new.js",
"publish": "node ./scripts/publish.js",
Expand Down
5 changes: 3 additions & 2 deletions packages/create-remix/__tests__/create-remix-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ describe("create-remix CLI", () => {
expect(stdout).toContain("`package.json` file not found.");
expect(status).toBe(0);
expect(fse.existsSync(path.join(projectDir, "deno.json"))).toBeTruthy();
expect(fse.existsSync(path.join(projectDir, "deno.lock"))).toBeTruthy();
expect(fse.existsSync(path.join(projectDir, "test.txt"))).toBeTruthy();
expect(fse.readFileSync(path.join(projectDir, "test.txt"), "utf8")).toBe(
"added via remix.init, isOdd(1): true"
Expand Down Expand Up @@ -926,8 +927,8 @@ describe("create-remix CLI", () => {

expect(execa).toHaveBeenCalledWith(
"deno",
expect.arrayContaining(["install", "--no-lock"]),
expect.objectContaining({ env: { DENO_FUTURE: "1" } })
expect.arrayContaining(["install"]),
expect.anything()
);
delete process.versions.deno;
});
Expand Down
15 changes: 5 additions & 10 deletions packages/create-remix/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ const packageManagerExecScript: Record<PackageManager, string> = {
yarn: "yarn remix",
pnpm: "pnpm exec remix",
bun: "bunx remix",
deno: "deno run --no-lock -A npm:@remix-run/dev",
deno: "deno run -A npm:@remix-run/dev",
};

function validatePackageManager(pkgManager: string): PackageManager {
Expand All @@ -670,15 +670,10 @@ async function installDependencies({
showInstallOutput: boolean;
}) {
try {
await execa(
pkgManager,
["install", ...(pkgManager === "deno" ? ["--no-lock"] : [])],
{
cwd,
env: pkgManager === "deno" ? { DENO_FUTURE: "1" } : undefined,
stdio: showInstallOutput ? "inherit" : "ignore",
}
);
await execa(pkgManager, ["install"], {
cwd,
stdio: showInstallOutput ? "inherit" : "ignore",
});
} catch (err) {
error("Oh no!", "Failed to install dependencies.");
throw err;
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/cli/detectServerRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let disjunctionListFormat = new Intl.ListFormat("en", {
type: "disjunction",
});

let denoConfigFilenames = ["deno.jsonc", "deno.json"];
let denoConfigFilenames = ["deno.json", "deno.jsonc"];

const isDenoProject = (dir: string) => {
for (let configFilename of denoConfigFilenames) {
Expand Down
6 changes: 3 additions & 3 deletions templates/deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ deploying to [Deno Deploy](https://deno.com/deploy).
2. [Create a new Deno Deploy project](https://dash.deno.com/new) for this app.
3. Replace `<your deno deploy project>` in the `deploy` script in `deno.jsonc`
3. Replace `<your deno deploy project>` in the `deploy` script in `deno.json`
with your Deno Deploy project name:
```json filename=deno.jsonc
```json filename=deno.json
{
"tasks": {
"deploy": "deployctl deploy --prod --include=deno.jsonc,deno.lock,build,server.production.ts --project=<your deno deploy project> ./server.production.ts"
"deploy": "deployctl deploy --prod --include=deno.json,deno.lock,build,server.production.ts --project=<your deno deploy project> ./server.production.ts"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion templates/deno/deno.jsonc → templates/deno/deno.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"tasks": {
"build": "deno run -A npm:@remix-run/dev@^2.11.2 vite:build",
"deploy": "deployctl deploy --prod --include=deno.jsonc,deno.lock,build,server.production.ts --project=<your deno deploy project> ./server.production.ts",
"deploy": "deployctl deploy --prod --include=deno.json,deno.lock,build,server.production.ts --project=<your deno deploy project> ./server.production.ts",
"dev": "deno run -A npm:@remix-run/dev@^2.11.2 vite:dev",
"lint": "deno lint && deno run -A npm:eslint@^8.57.0 --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "deno serve -A --parallel ./server.production.ts",
Expand Down

0 comments on commit a3c1bcc

Please sign in to comment.