{"id":20625138,"url":"https://github.com/jasonsturges/javascript-npm-package","last_synced_at":"2026-05-19T03:07:29.292Z","repository":{"id":142401675,"uuid":"459018269","full_name":"jasonsturges/javascript-npm-package","owner":"jasonsturges","description":"JavaScript library npm package template","archived":false,"fork":false,"pushed_at":"2022-12-10T21:01:04.000Z","size":112,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T12:17:14.701Z","etag":null,"topics":["boilerplate","library","npm","package","rollup","template"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasonsturges.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-14T04:43:29.000Z","updated_at":"2024-08-24T21:00:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"2764f4d5-4215-4ef9-9516-8589b49e4947","html_url":"https://github.com/jasonsturges/javascript-npm-package","commit_stats":null,"previous_names":["jasonsturges/javascript-npm-package"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/jasonsturges/javascript-npm-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Fjavascript-npm-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Fjavascript-npm-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Fjavascript-npm-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Fjavascript-npm-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonsturges","download_url":"https://codeload.github.com/jasonsturges/javascript-npm-package/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Fjavascript-npm-package/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266691580,"owners_count":23969182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boilerplate","library","npm","package","rollup","template"],"created_at":"2024-11-16T13:08:15.835Z","updated_at":"2026-05-19T03:07:29.257Z","avatar_url":"https://github.com/jasonsturges.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaScript NPM Package\n\nScaffold JavaScript npm packages using this template to bootstrap your next library.\n\nThis boilerplate supports generating TypeScript declarations (`d.ts`) for compatibility with TypeScript projects by using JSDoc comments for types.\n\nProject includes:\n- [TypeScript](https://www.typescriptlang.org/)\n- [Rollup](https://rollupjs.org/)\n- [Microsoft API Extractor](https://api-extractor.com/)\n- [TypeDoc](https://typedoc.org/)\n\nVersions of this template:\n- [Vite TypeScript library npm package](https://github.com/jasonsturges/vite-typescript-npm-package)\n- [Vite JavaScript library npm package](https://github.com/jasonsturges/vite-npm-package)\n- [Rollup JavaScript library npm package](https://github.com/jasonsturges/npm-package-boilerplate)\n- [Rollup TypeScript library npm package](https://github.com/jasonsturges/typescript-npm-package)\n\n\n## Getting Started\n\nBegin via any of the following:\n\n- Press the \"*Use this template*\" button\n\n- Use [degit](https://github.com/Rich-Harris/degit) to execute:\n\n    ```\n    degit github:jasonsturges/npm-package-boilerplate\n    ```\n\n- Use [GitHub CLI](https://cli.github.com/) to execute:\n\n    ```\n    gh repo create \u003cname\u003e --template=\"https://github.com/jasonsturges/npm-package-boilerplate\"\n    ```\n\n- Simply `git clone`, delete the existing .git folder, and then:\n\n    ```\n    git init\n    git add -A\n    git commit -m \"Initial commit\"\n    ````\n\nRemember to use `npm search \u003cterm\u003e` to avoid naming conflicts in the NPM Registery for your new package name.\n\n\n## Usage\n\nThe following tasks are available for `npm run`:\n\n- `dev`: Run Rollup in watch mode to detect changes to files during development\n- `build`: Run Rollup to build a production release distributable\n- `build:types`: Run Microsoft API Extractor to rollup a types declaration (`d.ts`) file \n- `docs:jsdoc`: JSDoc generated documentation in the \"*docs/*\" folder\n- `docs:typedoc`: TypeDoc for TSDoc generated documentation in the \"*docs/*\" folder\n- `clean`: Remove all build artifacts\n\n\n## Development\n\nWhile test driven development (TDD) would be a good approach to develop your library, also consider creating an app for prototyping and local testing of your library.\n\nTo test within the library, consider using [Storybook](https://storybook.js.org/).  This approach runs a `storybook` script to load local source files for development.\n\nOtherwise, follow these steps to test the package from another project:\n\n**From your library project**, issue the `npm link` (or `yarn link`) command:\n\n```\nnpm link\n```\n\nStart Rollup in watch mode:\n\n```\nnpm run dev\n```\n\n**Create a test app project**, by doing the following:\n\nTo use your npm package library locally for development, create a new project in a separate folder:\n\n```\nmkdir test-app \u0026\u0026 cd test-app\nnpm init\n```\n\nTake the defaults from `npm init`\n\nIn the package.json of your test app, add the following two things:\n- Set the `type` of your package to `module`\n- Add a `start` script to execute your app\n\n```json\n\"type\": \"module\",\n\"scripts\": {\n  \"start\": \"node index.js\",\n},\n```\n\nLink to your library using the `npm link \u003cname\u003e` (or `yarn link \u003cname\u003e`) command - be sure the `\u003cname\u003e` matches your library's package.json name.  For example:\n\n```\nnpm link npm-package-boilerplate\n```\n\nNow, run your app via `npm start`.\n\nAs an example, if your library's \"*index.ts*\" file contained:\n\n```ts\nexport const sayHi = () =\u003e {\n  console.log(\"Hi\");\n};\n```\n\n...your test app would implement an import using your package name, such as:\n\n```ts\nimport { sayHi } from \"npm-package-boilerplate\";\n\nsayHi();\n```\n\n\n## Development Cleanup\n\nOnce development completes, `unlink` both your library and test app projects.\n\n**From your test app project**, unlink the library using `npm unlink \u003cname\u003e` (or `yarn unlink \u003cname\u003e`) command:\n\n```\nnpm unlink npm-package-boilerplate\n```\n\n**From your library project**, issue the `npm unlink` (or `yarn unlink`) command:\n\n```\nnpm unlink\n```\n\n\n## Release Publishing\n\nUpdate your `package.json` to next version number, and remember to tag a release.\n\nOnce ready to submit your package to the NPM Registry, execute the following tasks via `npm` (or `yarn`):\n\n- `npm run clean` \u0026mdash; Assure a clean build\n- `npm run build` \u0026mdash; Build the JavaScript package\n- `npm run build:types` \u0026mdash; Build API Extractor (d.ts declarations) for TypeScript compatibility\n\nAssure the proper npm login:\n\n```\nnpm login\n```\n\nSubmit your package to the registry:\n\n```\nnpm publish --access public\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonsturges%2Fjavascript-npm-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonsturges%2Fjavascript-npm-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonsturges%2Fjavascript-npm-package/lists"}