-
Notifications
You must be signed in to change notification settings - Fork 153
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
latest version to npm #38
Comments
@dundalek can you help out? alternatively if you add me as a collaborator on npmjs.org I can help out if you like? |
Also, version-number tagged releases would be nice, so people don't have to depend on a commit hash. |
This is partially caused because the browser and Node.js scripts are separate ( |
And really, I've abandoned the |
When you say you "abandoned the |
I mean exactly what I said above - I haven't touched the file for a while to add any new features or fix any bugs, and I don't plan to. You can use the module script on a webpage no problem: <script type=module>
import rr from "./railroad.js";
Object.assign(window, rr);
</script>
...
<script>
Diagram(...).addTo();
</script> (Unfortunately module scripts don't have access to |
Since esm module is supported natively in nodejs, could you simply merge these two and just release it? |
I'd have to do some research on what exactly's required for an esm node package now, but yeah, I could do this. |
Having that list of things to do, however small, certainly helps a lot. Thanks! |
I've tried the code @tabatkins , but the Diagram is not yet available due to the deferred loading of module scripts. EDIT: see my comment below for the solution i currently use I would have to rely on something like this: <script type="module">
import rr from './railroad.js'
Object.assign(window, rr);
</script>
<script>
function whenLoaded(fn) {
function loop() {
if (window.Diagram)
fn()
else
setTimeout(loop, 100)
}
loop()
}
</script>
<script defer>
whenLoaded(() => Diagram("test").addTo())
</script> Which is not something I am keen on using. Does anybody have a better solution? |
I ended up with the following solution; <script type="module">
import("./railroad.js").then(rr => {
Object.assign(window, rr.default)
document.querySelectorAll("script[type='application/railroad']").forEach(s => {
const r = eval(s.innerHTML)
const div = document.createElement("div")
div.classList.add("railroad-diagram")
r.addTo(div)
s.replaceWith(div)
})
})
</script>
<script type="application/railroad">
Diagram("test")
</script> |
Hi,
Is it possible to publish the latest version of railroad-diagrams to npm?
On npm version 1.0.0, the NonTerminal function is
however in the git repository it is
The text was updated successfully, but these errors were encountered: