{"id":20625078,"url":"https://github.com/jasonsturges/tsup-npm-package","last_synced_at":"2026-04-16T21:35:20.952Z","repository":{"id":259648559,"uuid":"847076049","full_name":"jasonsturges/tsup-npm-package","owner":"jasonsturges","description":"TypeScript library npm package template","archived":false,"fork":false,"pushed_at":"2024-10-27T03:50:15.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T12:17:15.622Z","etag":null,"topics":["boilerplate","esbuild","library","npm","package","template","tsup","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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":"2024-08-24T19:23:23.000Z","updated_at":"2024-12-25T17:57:32.000Z","dependencies_parsed_at":"2024-10-27T04:42:13.895Z","dependency_job_id":"2e20c760-8c8f-404a-b8ec-371d123fd650","html_url":"https://github.com/jasonsturges/tsup-npm-package","commit_stats":null,"previous_names":["jasonsturges/tsup-npm-package"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/jasonsturges/tsup-npm-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Ftsup-npm-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Ftsup-npm-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Ftsup-npm-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Ftsup-npm-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonsturges","download_url":"https://codeload.github.com/jasonsturges/tsup-npm-package/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Ftsup-npm-package/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31905887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","esbuild","library","npm","package","template","tsup","typescript"],"created_at":"2024-11-16T13:08:04.020Z","updated_at":"2026-04-16T21:35:20.910Z","avatar_url":"https://github.com/jasonsturges.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tsup NPM Package\n\nScaffold TypeScript npm packages using this template to bootstrap your next library.\n\n## Getting Started\n\nBegin via any of the following:\n\n- Press the \"_Use this template_\" button\n\n- Use [GitHub CLI](https://cli.github.com/) to execute:\n\n  ```\n  gh repo create \u003cname\u003e --template=\"https://github.com/jasonsturges/tsup-npm-package\"\n  ```\n\n- Simply `git clone`, delete the existing .git folder, and initialize a fresh repo:\n\n  ```\n  git clone https://github.com/jasonsturges/tsup-npm-package.git\n  cd tsup-npm-package\n  rm -rf .git\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## Usage\n\nThe following tasks are available:\n\n- `dev`: Run tsup in watch mode to detect changes - all modules are compiled to the `dist/` folder, as well all types to a d.ts declaration file\n- `build`: Run tsup to build a production release distributable\n\nRollup all your exports to the top-level index.ts for inclusion into the build distributable.\n\nFor example, if you have a `utils/` folder that contains an `arrayUtils.ts` file.\n\n/src/utils/arrayUtils.ts:\n\n```ts\nexport const distinct = \u003cT\u003e(array: T[] = []) =\u003e [...new Set(array)];\n```\n\nInclude that export in the top-level `index.ts` .\n\n/src/index.ts:\n\n```ts\n// Main library exports - these are packaged in your distributable\nexport { distinct } from \"./utils/arrayUtils\";\n```\n\n## Development\n\nTo use this library with other app projects before submitting to a registry such as NPM, run the `dev` script and link packages.\n\nUsing the `dev` task, tsup detects changes and compiles all modules to the `dist/` folder, as well as rollup of all types to a d.ts declaration file.\n\nTo test your library from within an app:\n\n- **From this library**: run `npm link` or `yarn link` command to register the package\n- **From your app**: run `npm link \"mylib\"` or `yarn link \"mylib\"` command to use the library inside your app during development\n\nInside your app's `node_modules/` folder, a symlink is created to the library.\n\n## Development Cleanup\n\nOnce development completes, `unlink` both your library and test app projects.\n\n- **From your app**: run `npm unlink \"mylib\"` or `yarn unlink \"mylib\"` command to remove the library symlink\n- **From your library**: run `npm unlink` or `yarn unlink` command to unregister the package\n\nIf you mistakenly forget to `unlink`, you can manually clean up artifacts from `yarn` or `npm`.\n\nFor `yarn`, the `link` command creates symlinks which can be deleted from your home directory:\n\n```\n~/.config/yarn/link\n```\n\nFor `npm`, the `link` command creates global packages which can be removed by executing:\n\n```bash\nsudo npm rm --global \"mylib\"\n```\n\nConfirm your npm global packages with the command:\n\n```bash\nnpm ls --global --depth 0\n```\n\nFor your app, simply reinstall dependencies to clear any forgotten linked packages. This will remove any symlinks in the `node_modules/` folder.\n\n## Release Publishing\n\nUpdate your `package.json` to the next version number and tag a release.\n\nAssure that your package lockfile is also updated by running an install. For npm, this will assure the lockfile has the updated version number. Yarn does not duplicate the version number in the lockfile.\n\nIf you are publishing to a private registry such as GitHub packages, update your `package.json` to include `publishConfig` and `repository`:\n\npackage.json:\n\n```json\n  \"publishConfig\": {\n    \"registry\": \"https://npm.pkg.github.com/@MyOrg\"\n  }\n```\n\nUnless you are using a continuous integration service such as GitHub Actions, assure that your `dist/` folder is cleanly build. Note that `npm publish` will ship anything inside the distributable folder.\n\nFor clean builds, you may want to install the `rimraf` package and add a `clean` or `prebuild` script to your `package.json` to remove any artifacts from your `dist/` folder. Or, manually delete the `dist/` folder yourself.\n\npackage.json:\n\n```json\n  \"scripts\": {\n    \"clean\": \"rimraf dist\"\n  }\n```\n\nBefore you submit for the first time, make sure your package name is available by using `npm search`. If npm rejects your package name, update your `package.json` and resubmit.\n\n```bash\nnpm search \u003cterm\u003e\n```\n\nOnce ready to submit your package to the NPM Registry, execute the following tasks via `npm` (or `yarn`):\n\n```bash\nnpm run build\n```\n\nAssure the proper npm login:\n\n```bash\nnpm login\n```\n\nSubmit your package to the registry:\n\n```bash\nnpm publish --access public\n```\n\n## Continuous Integration\n\nFor continuous integration with GitHub Actions, create a `.github/workflows/publish.yml`.\n\nFor public NPM packages, use the following workflow:\n\n```yml\nname: Publish Package to npmjs\non:\n  release:\n    types: [created]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      packages: write\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 20\n          registry-url: \"https://registry.npmjs.org\"\n      - run: npm ci\n      - run: npm run build\n      - run: npm publish\n        env:\n          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}\n```\n\nFor private GitHub packages, use the following workflow:\n\n```yml\nname: Publish Package to GitHub Packages\non:\n  release:\n    types: [created]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n      packages: write\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 20\n          registry-url: \"https://registry.npmjs.org\"\n          scope: \"@MyOrg\"\n        env:\n          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n      - run: npm ci\n      - run: npm run build\n      - run: npm publish\n```\n\nThis will deploy your build artifact when a release is tagged.\n\nObtain an \"Automation\" CI/CD access token to bypass 2FA from [npm](https://www.npmjs.com/) by selecting your profile image in the upper right, and chosing \"Access Tokens\".\n\nTo add secrets to your repository:\n\n- From your repository, select _Settings_\n- From the _Security_ section of the sidebar, expand _Secrets and variables_ and select _Actions_\n- From the _Secrets_ tab, press _New repository secret_ to add the `NPM_TOKEN` key\n\nTo add secrets to your organization:\n\n- From your organization, select _Settings_\n- From the _Security_ section of the sidebar, expand _Secrets and variables_ and select _Actions_\n- From the _Secrets_ tab, press _New organization secret_ to add the `NPM_TOKEN` key\n\nAssure either a `.npmrc` or `publishConfig` in your `package.json`:\n\npackage.json:\n\n```json\n  \"publishConfig\": {\n    \"access\": \"public\",\n    \"registry\": \"https://registry.npmjs.org/\",\n    \"scope\": \"username\"\n  }\n```\n\nFor more information, see:\n\n- [Using secrets in GitHub Actions](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions)\n- [Publish to npmjs and GPR with npm](https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonsturges%2Ftsup-npm-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonsturges%2Ftsup-npm-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonsturges%2Ftsup-npm-package/lists"}