git clone git@github.com:Siilwyn/code-class-js-packaging.git
cd code-class-js-packaging- Add information about the minimum Node.js version of 13 to
package.json. Try it out with Node.js 12 through npm and Yarn using astartscript inpackage.jsonthat runsnode ./run.js. - Run
npm installandyarn install, you'll see two modules in your lock files figure out wherefseventscomes from usingnpmandyarncommands. - Add a
buildscript to run therollupbinary located innode_moduleswith npm using the arguments:./src/main.js --format cjs --file ./dist.js.
- Package it with
npm pack! Check the included files, try to influence this with configuration inpackage.jsonso only the needed files are packed. - Use Rollup to create a
main.cjsfile and combine withexportsso the package exposes both CommonJS and ECMAScript interfaces. Bonus: Try it out in Node.js 12 and 13 using the JSrunfiles. - Show it to the world with
npm versionandnpm publish! Don't forget to change the package name and you might need tonpm login. View it through the CLI withnpm view. npm unpublish --force
Install Yarn Berry and run yarn install, look into why node ./src/main.js doesn't work but yarn start does though it is supposed to behave like this.
To get the solution for an exercise apply the solution patch file, for example for the first exercise:
git apply exercise-1/solution.patch