LOADING: An error occurred. Update Chrome, try Firefox, or visit this post for more details.

⚠️Reddit changed how removals work, which breaks Reveddit's website. Install the extension to track removed content:Add to chromeAdd to firefoxWhat changed?
✖︎
about reveddit
⚙F.A.Q.add-ons
r/
status
copy sharelink
[+] show filters
10
Creating first node library(self.node)
submitted 2 years ago by [deleted] to /r/node (327.8k)
22 commentsredditother-discussionssubreddit-indexmessage mods
[–]

What is basic requirement to create node library? How to deploy node packages? I am sure there must already a reddit discussion about this, so if you know please ping me

[–] view less

since 2 years ago
23 of 23

Tip Reveddit Real-Time can notify you when your content is removed.

your account history
(check your username's removed content. why?)
Tip Check if your account has any removed comments.
view my removed comments
[–][deleted]18 points2 years ago
[deleted] by user
(check your username's removed content. why?)
hide replies (3)as-of
[–]gigastack3 points2 years ago

None of those are basic requirements though, those are just opinions. The actual requirement is to create an NPM account, a package.json file, and at least 1 .js file and npm publish.

permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–]Positive_Method30221 point2 years ago

You are right. But I would not install a package without sourcemaps or if I have to use a transpiler. It increases project complexity and makes it hard to maintain. This are "opinions" that I believe should be the "goto" for every node developer creating packages because it improves de environment.

permalinkparentcontextauthor-focusas-ofpreserve
[–]Positive_Method30221 point2 years ago

I've added a really simple example I did few months ago. You can change it to do what you need.

permalinkparentcontextauthor-focusas-ofpreserve
[–]guest271314-12 points2 years ago

.mjs extension is no longer necessary.

node --experimental-default-type=module file.js

permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–]MastonDZN6 points2 years ago

> no longer necessary

> use this experimental feature thats not even available on all current maintained versions of node

???

permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–]guest271314-5 points2 years ago

use this experimental feature thats not even available on all current maintained versions of node

I only run node nightly release.

ESM: --experimental-default-type flag to flip module defaults

We are also exploring using detection of ES module syntax as a way of Node.js knowing when to interpret files as ES modules. Our goal is to eventually find a way to support ES module syntax by default with minimal breaking changes.

permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–]MastonDZN5 points2 years ago

I didn't ask what the feature does, im aware of it, the problem is that you're suggesting that he bundles esm js files instead of mjs because... you use nightly with experimental flag so ignore everything else?

permalinkparentcontexthide replies (2)author-focusas-ofpreserve
[–]guest271314-2 points2 years ago

To be such Node.js fans you folks sure ain't keeping up with what's going on in Node.js world.

This ain't 2009.

permalinkparentcontextauthor-focusas-ofpreserve
[–]guest271314-3 points2 years ago

What part of the PR to merge the flag into v18.19.0 do you not understand?

The new flag --experimental-default-type can be used to flip the default module system used by Node.js.

Ecmascript standardized Ecmascript Modules, not CommonJS.

permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–]MastonDZN1 point2 years ago

You still don't get it do you? The flag is experimental and not in all maintained versions of node, and the common behavior right now is to count js files without type: module as cjs, you are asking him to ship a package that is broken and only works under a experimental flag.. It doesn't matter even if it was in v18. You're literally acting like a child saying that the pr might merge that enables this experimental flag that their users might not even know to use! You are literally suggesting the guy to gate the lib under a experimental flag wtf?

permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–]guest271314-2 points2 years ago

If the flag exists the flag can be used until the flag does not exist. I highly suspect Node.js maintainers are not going to go backwards on this issue. CommonJS is over. .cjs and .ms are over. WinterCG ain't talking about CommonJS. Nobody accept folks exclusively tethered to stable Node.js releases, and the Bun folks who managed to figure out how to run CommonJS and Ecmascript Modules in the same file before Node.js maintainers!

​

Now, it might be a whole bunch of common folks exhibiting common behavior. I ain't common.

I'm on the edge. I actually test multiple tip-of-tree JavaScript engines, runtimes, and browsers. You folks ain't testing anything. You're reading the Node.js stable release like it's gospel and think that's "common behavior". Well, it might be from a myopic perspective. Not in the field where developers and hackers are on the cutting edge developing and hacking up JavaScript from all angles.

permalinkparentcontextauthor-focusas-ofpreserve
[–]f3rno645 points2 years ago

I created a template for this, a Node.JS lib written in TypeScript.

The blog post is here: https://f3rno64.io/a-modern-nodejs-typescript-lib-template

The GitHub repo is here: https://github.com/f3rno64/node-ts-lib-template

Feel free to fork it. Let me know if you find it useful!

permalinkauthor-focusas-ofpreserve
[–]bselect1 point2 years ago

npm init && npm publish

The bare minimum. Better though is something like https://x.com/bitandbang/status/1082331715471925250

permalinkhide replies (1)author-focusas-ofpreserve
[–]guest271314-10 points2 years ago

Neither npm nor npx nor GitHub owned NPM are necessary nor required to create a Node.js library.

permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–]bselect13 points2 years ago

You must be fun to work with.

permalinkparentcontexthide replies (2)author-focusas-ofpreserve
[–]guest271314-6 points2 years ago

Missing from your comment is any refutation of the technical facts I posted. Because you can't refute the technical facts I posted.

You had better have somebody on your crew that is not caught up in having fun at work, rather is looking at the prints and vetting everybody's claims and work. It's called V.I.F.: Verify in the Field.

permalinkparentcontextauthor-focusas-ofpreserve
[–]guest271314-8 points2 years ago

You must be fun to work with.

You sensitive needs folks wouldn't last 2 minutes in the domains I purvey my wares.

FYI my last 2 gigs have been by referral. Not because I am chumming it up with folks. Because of my attention to detail and not trying to chum it up with folks. I am going to ask questions, and make sure no garbage is sent through the window.

permalinkparentcontexthide replies (1)author-focusas-ofpreserve
[–]bselect5 points2 years ago

Thanks for proving my point so throughly.

permalinkparentcontexthide replies (2)author-focusas-ofpreserve
[–]guest2713140 points2 years ago

You are talking about your emotions. You are carefully staying away from the technical facts I posted.

I don't go to work to make friends. I have enough friends already. I certainly ain't on these boards to make friends or appease folks' sensitive needs or give little Billy a virtual hug.

permalinkparentcontextauthor-focusas-ofpreserve
[–]guest2713140 points2 years ago

You made no point.

permalinkparentcontextauthor-focusas-ofpreserve
[–]guest271314-11 points2 years ago

Write some code. Publish the code on GitHub and/or GitLab.

permalinkhide replies (1)author-focusas-ofpreserve
[–]izuriel1 point2 years ago

It’s true! The absolute bare minimum is a JS file available for people to download. This is pretty idiotic advice though. If you actually want users to leverage your library there are many varying levels of effort you will need to put in order to attract developers to use it.

You’ve (@op) gotten plenty of useful advice already in other comments so I’ll refrain from repeating what’s been said. The process may feel daunting (or not) but it’s actually simple, if not a bit involved in some areas depending on exactly how much effort your wanting to do up front (docs, types, etc.) outside of your actual library.

permalinkparentcontextauthor-focusas-ofpreserve
r/revedditremoved.substack.com
🚨 NEWS 🚨
✖︎

Important: Reddit Changed How Removals Work

A recent Reddit update makes mod-removed content disappear from profile pages, which breaks Reveddit's website.

Install the browser extension to receive removal alerts.

Add to chromeAdd to firefox

What changed?

r/revedditremoved.substack.com