question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Node, Deno, Browser in the same repo

See original GitHub issue

Motivation

  • 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:closed
  • Created 3 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
hsluoyzcommented, Jan 12, 2021

@fgblomqvist yes, we use Node-Casbin to power the online editor: https://github.com/casbin/casbin-editor

0reactions
nodececommented, Oct 5, 2021

@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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found