
Explore how to structure, test, and publish your first open source JavaScript library with tools like Jest, Prettier, ESLint, Husky, Rollup, and TypeScript.
Publish your first open source JavaScript library by following prerequisites, essential tools, and setup with VS Code, Node.js, Git, and npm.
Learn to build an open-source JavaScript library in two phases—plain JavaScript with Jest, Prettier, and Rollup, then TypeScript with static typing, formatting, linting, and bundling.
Use npm to validate your open-source idea by researching existing packages, inspecting their source code (e.g., a password generator), and outlining the minimum requirements before publishing your library.
Prepare codebase for publishing an open-source JavaScript library by refactoring into a class, using vanilla JavaScript, and adding tests to verify password generation with Node and npm.
Create a minimal package.json with npm init, set a name and entry point, and write a README to guide installation with npm install and local testing.
Set up a test folder and package.json, declare dependencies, reference the genpass package in test.js, and use npm to prepare a local package for publishing on npm.
Publish your first open-source JavaScript library by logging into npm, preparing your package.json and readme, and publishing with npm publish, then verify the package and run tests.
Apply code formatting with Prettier to enforce quality, configure options in package.json, and run a format script; organize code into src and examples and verify with npm run format.
Lint your code with ESLint to perform static analysis and catch issues early. Use Node.js version 18.x, install via npm, and run npm run lint with recommended rules.
Learn to test your JavaScript code with Jest, focusing on unit tests and coverage. Set up with npm install -D jest, create a test folder and run npx jest.
Bundle your code using Rollup to combine JavaScript modules into a single, runnable library, exploring CommonJS, AMD, UMD, and ESM formats, tree shaking, and code splitting.
Set up git hooks with Husky to enforce quality in a local repo, configure gitignore, and ensure tests pass before commits, paving the way for lint-staged workflows.
Install and configure lint-staged to run eslint on JavaScript and prettier on staged files. Block commits to main, work on dev branch, and show linting and formatting feedback.
Explore TypeScript, a strongly typed superset of JavaScript, and learn how its syntax and tooling improve developer experience when building open-source JavaScript libraries.
Refactor the codebase by introducing TypeScript, installing typings, creating tsconfig.json, renaming files to .ts, and updating modules with ES6 imports, interfaces, and options to ensure type safety and better tooling.
Refactor tests while converting TypeScript to JavaScript in a build workflow, updating package.json and preparing ESLint, Prettier, and Rollup integration as you refactor testing.
Adjust test tooling to support TypeScript by installing ts-jest and adding tsconfig.dev, configuring Jest to transform TS to JS for your open-source JavaScript library, with a development setup.
Learn to adapt ESLint for TypeScript using TypeScript ESLint, migrate from legacy ESLint setups, and configure eslint.config.js and tsconfig.dev.json. Explore linting and bundling with Rollup for ES modules.
Generate and include declaration files for a TypeScript open-source library by configuring tsconfig, using rollup-plugin-dts, and updating package.json to publish lib/types.d.ts.
Test your code locally, adjust package metadata, add keywords like password and generation, and restructure devDependencies near scripts. Then compile TypeScript and publish with npm publish after login.
Evaluate dependencies before adding them by checking necessity, security, credibility, maintenance, and end-of-life. Explore examples like yargs-parser and well-supported libraries to gauge documentation, maintainers, and open-source practices.
Identify and add runtime dependencies, manage package.json, and install with npm install. Switch Node versions with nvm, install yargs-parser, and prepare cli parsing to infer option types.
Explore updating a JavaScript library to provide a cli by configuring entry points, parsing options, setting usage and versioning, and exporting a bin for global npm installation.
Publish the latest updates to your open-source JavaScript library by preparing changes, validating TypeScript support, linting, and committing clear messages for a CLI release on GitHub and npm.
Review package emphasizes clear documentation, a reachable repository, and essential files like license, package.json, and readme. It also highlights code structure in lib and index and notes upcoming runtime environments.
Configure rollup to support es modules by adding index.mjs and tsconfig.esm.json for an esm output. Switch between CommonJS and module formats, export a UMD bundle for browser use, like lib/bundle.js.
Test a JavaScript library across browser and node runtimes using shims to expose APIs. Compare Bun and Deno benchmarks, validate builds, and ensure browser execution works.
Test a published package in Bun and Deno by initializing Bun test, adding dependencies, and running start to verify password generation with genpass in both environments.
Wraps up by showcasing ci/cd with GitHub actions across OS and Node versions, adds tests, linting, bundling, issue templates, pre-push hook, updated docs, tsconfig, and minified bundle via Rollup.
Publish an npm package and manage its life cycle from development to deployment. Foster an open source community with clear security, contribution policies, and active support across multiple channels.
Explore how AI impacts development and learning, balancing powerful AI tools with building a solid foundation, solving problems, and continuing to code as you publish an open-source JavaScript library.
Hey there, fellow developer!
At some point in your journey, you've probably built something cool using tools crafted by other devs. Whether those tools were open-source or not, their creators made the decision to share them with the world—pretty awesome, right? Well, now it might be your turn to do the same! Whether you're looking to contribute to open source, level up your skills, or just satisfy your curiosity about how JavaScript libraries are built and shared, you're in the right place.
This course is designed for Junior to Mid-level developers who are ready to put their work out there (which, by the way, takes real courage—so kudos to you!). My goal is to help you do it the right way, while avoiding common pitfalls that frustrate even experienced developers (yep, been there myself!).
Since the JavaScript ecosystem is packed with tools, I’ve carefully selected the essentials to keep this course focused and practical. You’ll learn how to:
build a Node.js library and publish it on npm;
use Rollup for bundling your library;
work with TypeScript to write maintainable code;
set up key tools like Jest (for testing), Prettier (for formatting), and ESLint (for linting).
Now, just a heads-up—this isn't a JavaScript fundamentals course. Instead, think of it as your roadmap to launching an open-source project and getting your work into the hands of other developers.
This course was designed with care and built with love, so I hope it makes your journey into open source an exciting and rewarding experience. Thanks for considering this course, and I can't wait to see what you create!