feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
15.03k stars 745 forks source link

Deno Support? #1964

Open KartoffelToby opened 4 years ago

KartoffelToby commented 4 years ago

is there any plan to Support the deno runtime?

daffl commented 4 years ago

Yes. The new @feathersjs/hooks is already Deno compatible with the rest of core to follow in v5 (Dove). To clarify, this applies only to

Any other Feathers plugins that rely on third party modules are likely not going to work until there is a Deno equivalent for those third party modules. This means the following things are likely not going to be available right away:

apollo79 commented 1 year ago

Is this still being worked on?

miguelrk commented 1 year ago

Starting from deno@v1.28, npm compatibliity is now marked stable. I've successfully migrated some Node.js projects to deno and adding npm prefix to import {} from "npm:package-name" with import_map.json.

What in my opinion is great about Deno it how it pushes the ecosystem forward in terms of standards, so targeting node from deno with tools like dnt (a deno to npm package build tool) makes sense for a development workflow. Also, the fact Deno has built-in formatting, linting, removes the need for node_modules, package*.json, etc greatly enhances DX.

If this is still being considered, I think now might finally be an adequate time to do so (or actually continue to do so, there has been progress in other branches). Would moving the whole ecosystem e.g. packages like @feathersjs/mongodb be in order?

The following script can be used to convert dependencies in package.json to a valid import_map.json:

// main.ts - run with: `deno run -A main.ts`
const text = await Deno.readTextFile(`${Deno.cwd()}/package.json`);
const deps = JSON.parse(text).dependencies;

const importMap = {
  imports: {
    ...Object.keys(deps).reduce((acc, dep) => {
      acc[dep] = `npm:${dep}@${deps[dep].replace("^", "")}`;
      return acc;
    }, {}),
  },
};

await Deno.writeTextFile(
  `${Deno.cwd()}/importMap.json`,
  JSON.stringify(importMap, null, 2)
);
apollo79 commented 1 year ago

I've done some work in this PR: https://github.com/feathersjs/feathers/pull/2828

The plan was to use dnt to support node and deno but it turned out that that isn't as easy as it sounds... And there are some decisions to make, that should not be made by me but by the core members.

That's the reason why I stopped working on it until dove is stable and @daffl and the other core members can focus more on deno. There has been even opened a channel for deno development and questions in the feathers discord: https://discord.com/channels/509848480760725514/1042225783042736179

The first message in the channel summarizes the work that is done until now and some of the problems I encountered.

But maybe @daffl can give a better answer about the current plan for deno.

miguelrk commented 1 year ago

Thanks for the thorough overview @apollo79 ! I will stick around 👍🏼

Abdillah commented 1 year ago

Now Deno has npm package support. Improving the framework user experience on Deno (compat, getting started, permission, etc) can be a huge plus before really migrating to Deno APIs.