nim_config
nim_config copied to clipboard
Idea: Option for target NodeJS and generate *.min.js
- [ ] Implement an option to target NodeJS
js -d:nodejs -d:release
. - [ ] When used it should generate a
*.js
and*.min.js
. - [ ] What else is needed, lets say I want to publish my Nim module as NPM module :grey_question:
For the "Backend" of this idea please have a look at:
- https://parceljs.org/cli.html
- https://parceljs.org
That's a great idea. FYI, I have no JS or npm knowledge. But if you are leading this effort, I follow that PR closely (you can start a WIP PR as you get something going), and I can chime in wherever I can help.
Thanks.
To publish to npm, you need a file called package.json
. There's a few keys you should have:
{
"name": "my-lib-rulez",
"version": "1.0.1",
"license": "MIT",
"files": ["readme.md", "dist"],
"main": "dist/my-lib-rules.min.js"
}
Your build process should compile (optionally minify -- though i wouldn't sweat it these days) and drop it in a .gitignore
'd dist
directory (name is subjective - though dist
is popular).
To publish, you type npm publish
. npm
then makes a tarball based on the packing list of files/dirs found in your files
key in your package.json
and uploads that to the central npm repository for everyone to access.
The tooling landscape in JavaScript is vast, but by sticking to the bare minimum steps, it's actually quite simple.
EDIT 1,2: i can't type json in a textarea to save my life.
I think that calling js -d:nodejs -d:release
should be relatively easy.
The rest might need more research or someone with experience on NPM.