callmephilipC
Denoβ€’13mo agoβ€’
2 replies
callmephilip

Cannot access files inside package when running from jsr

I have the following "init" script populating new project using files in project-template

import path from "node:path";

// ...

if (import.meta.main) {
  copySync(new URL("../project-template", import.meta.url), projectPath, {
    overwrite: false,
  });
}


When invoked locally it works as expected. However, if I attempt to run it from jsr like so

deno run -R -W jsr:@myorg/stuff/init


It fails since meta resolves as https://jsr.io/@myorg/stuff/0.1.21/project-template. How can I get this to work consistently both locally and remotely? How do you guys usually handle this sorts of stuff?
Was this page helpful?