{"id":25022925,"url":"https://github.com/codebygio/pkg-template","last_synced_at":"2025-03-30T12:29:03.927Z","repository":{"id":271644467,"uuid":"914111159","full_name":"codebygio/pkg-template","owner":"codebygio","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-09T01:29:40.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T14:20:16.209Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/codebygio.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":"2025-01-09T01:12:58.000Z","updated_at":"2025-01-09T01:38:53.000Z","dependencies_parsed_at":"2025-01-09T02:37:38.966Z","dependency_job_id":"4d742c62-d210-46d9-8746-b41abb5a73cb","html_url":"https://github.com/codebygio/pkg-template","commit_stats":null,"previous_names":["codebygio/pkg-template"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebygio%2Fpkg-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebygio%2Fpkg-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebygio%2Fpkg-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebygio%2Fpkg-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codebygio","download_url":"https://codeload.github.com/codebygio/pkg-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246318610,"owners_count":20758192,"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","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":[],"created_at":"2025-02-05T14:20:08.708Z","updated_at":"2025-03-30T12:29:03.906Z","avatar_url":"https://github.com/codebygio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NPM Package Template\n\nA modern template for creating and publishing NPM packages using TypeScript, TSup, and Changesets.\n\n## Features\n\n- 📦 TypeScript configuration with strict settings\n- 🛠️ TSup for bundling (outputs CommonJS and ESM)\n- 🔄 Automated versioning and publishing with Changesets\n- 🚀 GitHub Actions for CI/CD\n- ✨ Type definitions included\n- 📝 Automated changelog generation\n\n## Getting Started\n\n### Using this template\n\n1. Click the \"Use this template\" button at the top of this repository\n2. Clone your new repository\n3. Install dependencies:\n```bash\nnpm install\n```\n\n### Development\n\n1. Make your changes in the `src` directory\n2. Build the package:\n```bash\nnpm run build\n```\n3. Lint your code:\n```bash\nnpm run lint\n```\n\n### Making Changes\n\nWhen you want to make changes to the package:\n\n1. Create a new branch\n2. Make your changes\n3. Add a changeset:\n```bash\nnpm run changeset\n```\n4. Commit and push your changes\n5. Create a Pull Request\n\n## Project Structure\n\n```\n.\n├── .changeset/\n├── .github/\n│   └── workflows/\n│       ├── main.yaml\n│       └── publish.yaml\n├── src/\n│   └── index.ts\n├── .gitignore\n├── package.json\n├── tsconfig.json\n└── README.md\n```\n\n## Scripts\n\n- `npm run build` - Builds the package using TSup\n- `npm run lint` - Runs TypeScript type checking\n- `npm run changeset` - Creates a new changeset\n- `npm run version` - Applies changesets to create a new version\n- `npm run release` - Publishes the package to NPM\n\n## GitHub Actions Workflows\n\n### Main Workflow (`main.yaml`)\n\n```yaml\nname: CI\non:\n  push:\n    branches:\n      - \"**\"\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      \n      - name: Setup Node.js\n        uses: actions/setup-node@v3\n        with:\n          node-version: 20.x\n          cache: \"npm\"\n      \n      - name: Install Dependencies\n        run: npm install --frozen-lockfile\n      \n      - name: Lint and Build\n        run: npm run lint \u0026\u0026 npm run build\n```\n\n### Publish Workflow (`publish.yaml`)\n\n```yaml\nname: Publish\n\non:\n  workflow_run:\n    workflows: [CI]\n    branches: [main]\n    types: [completed]\n\nconcurrency: ${{ github.workflow }}-${{ github.ref }}\n\npermissions:\n  contents: write\n  pull-requests: write\n\njobs:\n  publish:\n    if: ${{ github.event.workflow_run.conclusion == 'success' }}\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write\n      pull-requests: write\n    steps:\n      - uses: actions/checkout@v3\n\n      - name: Setup Node.js\n        uses: actions/setup-node@v3\n        with:\n          node-version: 20.x\n          cache: \"npm\"\n\n      - name: Install Dependencies\n        run: npm install --frozen-lockfile\n\n      - name: Create Release Pull Request or Publish\n        id: changesets\n        uses: changesets/action@v1\n        with:\n          publish: npm run release\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}\n```\n\n## Configuration Files\n\n### package.json\n\n```json\n{\n  \"name\": \"pkg-template\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/codebygio/pkg-template.git\"\n  },\n  \"version\": \"0.0.1\",\n  \"description\": \"A template for creating npm packages\",\n  \"main\": \"dist/index.js\",\n  \"module\": \"dist/index.mjs\",\n  \"types\": \"dist/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"tsup src/index.ts --format cjs,esm --dts\",\n    \"release\": \"npm run build \u0026\u0026 changeset publish\",\n    \"lint\": \"tsc\"\n  },\n  \"keywords\": [\n    \"npm\",\n    \"package\",\n    \"template\"\n  ],\n  \"author\": \"Giovani Rodriguez\",\n  \"license\": \"MIT\",\n  \"devDependencies\": {\n    \"@changesets/cli\": \"^2.27.9\",\n    \"tsup\": \"^8.3.5\",\n    \"typescript\": \"^5.6.3\"\n  }\n}\n```\n\n### tsconfig.json\n\n```json\n{\n    \"compilerOptions\": {\n        /* Base Options: */\n        \"esModuleInterop\": true,\n        \"skipLibCheck\": true,\n        \"target\": \"es2022\",\n        \"verbatimModuleSyntax\": true,\n        \"allowJs\": true,\n        \"resolveJsonModule\": true,\n        \"moduleDetection\": \"force\",\n        /* Strictness */\n        \"strict\": true,\n        \"noUncheckedIndexedAccess\": true,\n        /* If NOT transpiling with TypeScript: */\n        \"moduleResolution\": \"Bundler\",\n        \"module\": \"ESNext\",\n        \"noEmit\": true,\n        /* If your code runs in the DOM: */\n        \"lib\": [\n            \"es2022\",\n            \"dom\",\n            \"dom.iterable\"\n        ],\n    }\n}\n```\n\n### .gitignore\n\n```\nnode_modules/\ndist/\n.DS_Store\n```\n\n## Publishing\n\n1. Make sure you have an NPM account and are logged in:\n```bash\nnpm login\n```\n\n2. Add an NPM_TOKEN secret to your GitHub repository:\n   - Generate a token on NPM's website\n   - Add it to your repository's secrets as `NPM_TOKEN`\n\n3. When you're ready to publish:\n   - Merge your changes to main\n   - The GitHub Action will automatically create a release PR\n   - Merge the release PR to publish to NPM\n\n## License\n\nMIT\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch\n3. Add a changeset describing your changes\n4. Commit your changes\n5. Push to the branch\n6. Open a Pull Request\n\n---\n\nDon't forget to customize this README with your package's specific details!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebygio%2Fpkg-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodebygio%2Fpkg-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebygio%2Fpkg-template/lists"}