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

Fresh updater fails when deno.jsonc is in parent folder #2371

Open
sergeysolovev opened this issue Mar 21, 2024 · 1 comment
Open

Fresh updater fails when deno.jsonc is in parent folder #2371

sergeysolovev opened this issue Mar 21, 2024 · 1 comment
Labels
bug Something isn't working.

Comments

@sergeysolovev
Copy link

Hello. I’ve followed the steps from here because I keep my fresh app in a separate app directory, and the parent deno.jsonc contains configuration for both fresh and other code as well. https://fresh.deno.dev/docs/examples/changing-the-src-dir

As a result, automatic fresh updates don’t work. The updater expects the routes folder to be at the same level as deno.jsonc. Is there any workaround or fix for this?

@sergeysolovev
Copy link
Author

My deno.jsonc:

{
  "unstable": ["ffi", "cron", "http", "kv"],
  "tasks": {
    "cache_deps": "deno cache deps/**/*.ts && deno cache app/main.ts && deno cache app/dev.ts",
    "app_check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
    "app_cli": "echo \"import '\\$fresh/src/dev/cli.ts'\" | deno run --unstable -A -",
    "app_manifest": "deno task app_cli manifest $(pwd)/app",
    "app_start": "deno run -A --watch=app/static/,app/routes/ app/dev.ts",
    "app_build": "deno run -A app/dev.ts build",
    "app_preview": "deno run -A app/main.ts",
    "app_update": "deno run -A -r https://fresh.deno.dev/update ."
  },
  "exclude": [
    "dash_app",
    "dash/app/dist",
    "log",
    "node_modules",
    "postgres",
    "sys/ax/test/out/",
    "tmp",
    "**/_fresh/*"
  ],
  "lint": { "rules": { "tags": ["fresh", "recommended"] } },
  "fmt": { "singleQuote": true, "proseWrap": "always" },
  "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" },
  "imports": {
    "app/": "./app/",
    "lib/": "./lib/",
    "deps/": "./deps/",
    "dash/": "./dash/",
    "env/": "./lib/env/",
    "mmap/": "./mmap/",
    "data/": "./data/",
    "sys/": "./sys/",
    "scripts/": "./scripts/",
    "std/": "https://deno.land/std@0.211.0/",
    "$fresh/": "https://deno.land/x/fresh@1.6.5/",
    "ms": "https://esm.sh/ms@2.1.3",
    "preact": "https://esm.sh/preact@10.19.2",
    "preact/": "https://esm.sh/preact@10.19.2/",
    "@preact/signals": "https://esm.sh/*@preact/signals@1.2.1",
    "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.0"
  }
}

If I call deno task app_update I get this error:

error: Uncaught (in promise) NotFound: No such file or directory (os error 2): readdir '/home/ec2-user/bromo/dash/server/routes'
const routes = Array.from(Deno.readDirSync(join(srcDirectory, "routes")));
                               ^
    at Object.readDirSync (ext:deno_fs/30_fs.js:210:10)
    at https://deno.land/x/fresh@1.6.5/update.ts:279:32
    at eventLoopTick (ext:core/01_core.js:169:7)

Calling this command actually updates deno.jsonc, it replaces $fresh/ and does a few other unexpected things, like removes my comments (it’s jsonc after all) and adds build and preview tasks (I already have them under different names).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants