Support Node, Deno, Browser in the same repo
See original GitHub issueMotivation
- Share most of the code: We don’t need to update the same code multiple times.
- Concentrated community: The same problem may occur on different platforms (because they almost use the same code). It is more convenient to discuss in the same repo.
Design
First, we should strip out code that only uses javascript
. (no dom API, no node API…)
Then write platform-specific code in their respective folders.
Finally, use a unified entry to dynamically load module according to the user’s platform. (For Deno, we can export esmodule and then import it through pika’s cdn)
To do all of the above, we can rename the repo to casbin.js
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (10 by maintainers)
Top Results From Across the Web
As a library author, how do I dual publish to both node and ...
Write mainly in Deno. And if you want to support both Browsers and Node (and Deno, hence the source) you can use a...
Read more >Using npm/Node.js code | Manual
Current Node.js supports both CommonJS and ES Modules, while Deno only supports ES Modules. ... Deno resolves modules the same way a browser...
Read more >Guide To Porting Node Modules To Deno
Denoify is a handy tool for taking an existing Node module and creating Deno compatible assets, meaning you can support both JavaScript runtimes ......
Read more >How we converted our Node.js library to Deno (using Deno)
A general purpose methodology for converting a Node.js package to Deno. ... Deno is a new runtime for JavaScript that supports TypeScript ...
Read more >What is Deno, and how is it different from Node.js?
Deno aims to be browser-compatible. Technically speaking, when using the ES modules, we don't have to use any build tools like webpack to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@fgblomqvist yes, we use Node-Casbin to power the online editor: https://github.com/casbin/casbin-editor
@transtone I made a PR for casbin.js: https://github.com/casbin/casbin.js/pull/227, this PR for deno prepare, could you review this PR?