{"_id":"@0xkilo/pack","name":"@0xkilo/pack","dist-tags":{"latest":"0.0.0"},"versions":{"0.0.0":{"name":"@0xkilo/pack","version":"0.0.0","description":"This is an example TypeScript Package ready to be published on npm. It has been set up with automated tests and package publishing workflow using GitHub Actions CI/CD. It is made primarily for GitHub + VS Code (Windows / Mac / Linux) users who are about t","main":"dist/cjs/index.js","module":"dist/esm/index.js","umd:main":"dist/umd/index.js","types":"dist/types/index.d.js","scripts":{"postinstall":"husky install","prepublishOnly":"pinst --disable","postpublish":"pinst --enable","build":"npm run build:cjs && npm run build:esm && npm run build:umd && npm run build:types","build:cjs":"node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json","build:esm":"node tools/cleanup esm && tsc -p config/tsconfig.esm.json","build:umd":"node tools/cleanup umd && webpack --config config/webpack.config.js","build:types":"node tools/cleanup types && tsc -p config/tsconfig.types.json","clean":"node tools/cleanup","package":"npm run build && npm pack","test":"jest --no-cache --runInBand","test:cov":"jest --coverage --no-cache --runInBand","addscope":"node tools/packagejson name @tomchen/example-typescript-package"},"publishConfig":{"access":"public"},"keywords":["example","typescript","npm","package","sample","boilerplate","starter","demo","cjs","esm","umd"],"author":{"name":"Tom Chen","email":"tomchen.org@gmail.com"},"license":"MIT","homepage":"https://github.com/tomchen/example-typescript-package","repository":{"type":"git","url":"git@github.com:tomchen/example-typescript-package.git"},"bugs":{"url":"https://github.com/tomchen/example-typescript-package/issues"},"dependencies":{},"devDependencies":{"@commitlint/cli":"^13.1.0","@commitlint/config-conventional":"^13.1.0","@types/jest":"^27.0.1","@typescript-eslint/eslint-plugin":"^4.31.1","@typescript-eslint/parser":"^4.31.1","eslint":"^7.32.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","husky":"^7.0.2","jest":"^27.2.0","pinst":"^2.1.6","prettier":"^2.4.0","ts-jest":"^27.0.5","ts-loader":"^9.2.5","typescript":"^4.4.3","webpack":"^5.52.1","webpack-cli":"^4.8.0"},"licenseText":"MIT License\n\nCopyright (c) 2021 Tom Chen (tomchen.org)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@0xkilo/pack@0.0.0","dist":{"shasum":"f38872716b4c6e2c541eb91678354d0606115cc0","integrity":"sha512-m09aKy6bsIzAOBS4+N50YGSbdY/oz1/4Z/6HTVow9Fo/qcqiD5E7kALEbQz/1xPS9lkZszuTtQUXZ5vlcX26BA==","tarball":"https://registry.npmjs.org/@0xkilo/pack/-/pack-0.0.0.tgz","fileCount":16,"unpackedSize":35033,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCsbRo9W3Z61tnd20XETOr2RkZGLcYoGoQBqLp8x0B+MAIgCV5q+BqWvddTV1OhguONbLUrG7cAPgeADQup9B0s9Wc="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJick49ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrcdg/8CzOHsi0Al9X+BmhDAnptaWbZMCleBZy6HjPK9wa//s9MZHZK\r\nxQU+LCPcttxW2pMzV4QQVHDMT0rX7v5R5mk1i3qENTXfMGIBL/2n9zp7vGEX\r\niZ7zaHDB0Tu3KUl9f5mV/UFWjGjfP1c0PcFDe1VyKDg5tactB+JuUcFJTGqg\r\neWJhm4hL+GC1SAFLVBbj71vwoIi00wsJT5EJa2iX4ztfeMW9lpsms1U60Q4M\r\ne0HcGFbJkZcZgUzhNh4PIS0zSOXPO+hWXTYiCQu01PRvx3UzInyU0zfebnml\r\nZpRYs0hUHF95/EivI42+ZLZNXFcyEWWV9IzfzZHJzC1B+F3VWoYhwWgWDZBT\r\n5E5Z9gyvnQiNZCobRB9yY4dMUEXnWLXBgrJ+nF58ejZ1XEPLLYx2MrsliOuh\r\nvogo5nlBs2eqv5oF6LSGee01q9LIey71mPWKSO/leHZAQfrml9zlISj8NTM2\r\nPBdbHte2u6O6tSUw9h7A1J8PcmhFqPD5jt3Gs0LODKM3BlzqniNYI7zWQJ7P\r\nInyKsKn3L0W0JHCOMXRdjiip2/3w5r/O4Qp26i1RkqaFwiP8QxEfj41LA1mg\r\nCQ73kNjOIblETjbKTGfd+E/GI2ShL18UafEQZu8eR/7OoCIlZh8FMdkYM560\r\nH5DpavBEWhWau884du3n7sLI7LzNDnJWHiI=\r\n=8gQC\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"0xkilo","email":"0xkiloshi@gmail.com"},"directories":{},"maintainers":[{"name":"0xkilo","email":"0xkiloshi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pack_0.0.0_1651658301228_0.13108934285100315"},"_hasShrinkwrap":false}},"time":{"created":"2022-05-04T09:58:21.173Z","0.0.0":"2022-05-04T09:58:21.386Z","modified":"2022-05-04T09:58:21.544Z"},"maintainers":[{"name":"0xkilo","email":"0xkiloshi@gmail.com"}],"description":"This is an example TypeScript Package ready to be published on npm. It has been set up with automated tests and package publishing workflow using GitHub Actions CI/CD. It is made primarily for GitHub + VS Code (Windows / Mac / Linux) users who are about t","homepage":"https://github.com/tomchen/example-typescript-package","keywords":["example","typescript","npm","package","sample","boilerplate","starter","demo","cjs","esm","umd"],"repository":{"type":"git","url":"git@github.com:tomchen/example-typescript-package.git"},"author":{"name":"Tom Chen","email":"tomchen.org@gmail.com"},"bugs":{"url":"https://github.com/tomchen/example-typescript-package/issues"},"license":"MIT","readme":"# Example TypeScript Package ready to be published on npm for 2021\n\nThis is an example TypeScript Package ready to be published on npm. It has been set up with automated tests and package publishing workflow using GitHub Actions CI/CD. It is made primarily for GitHub + VS Code (Windows / Mac / Linux) users who are about to write and publish their first TypeScript npm package. This package could serve as a starter / boilerplate / demo for them.\n\n[![npm package](https://img.shields.io/badge/npm%20i-example--typescript--package-brightgreen)](https://www.npmjs.com/package/example-typescript-package) [![version number](https://img.shields.io/npm/v/example-typescript-package?color=green&label=version)](https://github.com/tomchen/example-typescript-package/releases) [![Actions Status](https://github.com/tomchen/example-typescript-package/workflows/Test/badge.svg)](https://github.com/tomchen/example-typescript-package/actions) [![License](https://img.shields.io/github/license/tomchen/example-typescript-package)](https://github.com/tomchen/example-typescript-package/blob/main/LICENSE)\n\nIt uses npm, TypeScript compiler, Jest, webpack, ESLint, Prettier, husky, pinst, commitlint. The production files include CommonJS, ES Modules, UMD version and TypeScript declaration files.\n\n<p align=\"center\">\n<a href=\"https://github.com/\" title=\"Github\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/github-icon.svg\" alt=\"Github\" width=\"21px\" height=\"21px\"></a> <a href=\"https://code.visualstudio.com/\" title=\"Visual Studio Code\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/visual-studio-code.svg\" alt=\"Visual Studio Code\" width=\"21px\" height=\"21px\"></a> <a href=\"https://www.microsoft.com/windows\" title=\"Windows\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/microsoft-windows.svg\" alt=\"Windows\" width=\"21px\" height=\"21px\"></a> <a href=\"https://www.apple.com/macos/\" title=\"Mac OS\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/macOS.svg\" alt=\"Mac OS\" width=\"21px\" height=\"21px\"></a> <a href=\"https://www.linuxfoundation.org/\" title=\"Linux\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/linux-tux.svg\" alt=\"Linux\" width=\"21px\" height=\"21px\"></a> <a href=\"https://www.npmjs.com/\" title=\"npm\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/npm.svg\" alt=\"npm\" width=\"21px\" height=\"21px\"></a> <a href=\"https://www.typescriptlang.org/\" title=\"Typescript\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/typescript-icon.svg\" alt=\"Typescript\" width=\"21px\" height=\"21px\"></a> <a href=\"https://jestjs.io/\" title=\"Jest\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/jest.svg\" alt=\"Jest\" width=\"21px\" height=\"21px\"></a> <a href=\"https://webpack.js.org/\" title=\"webpack\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/webpack.svg\" alt=\"webpack\" width=\"21px\" height=\"21px\"></a> <a href=\"https://eslint.org/\" title=\"ESLint\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/eslint.svg\" alt=\"ESLint\" width=\"21px\" height=\"21px\"></a> <a href=\"https://prettier.io/\" title=\"Prettier\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/prettier.svg\" alt=\"Prettier\" width=\"21px\" height=\"21px\"></a> <a href=\"https://yarnpkg.com/\" title=\"yarn\"><img src=\"https://github.com/get-icon/geticon/raw/master/icons/yarn.svg\" alt=\"yarn\" width=\"21px\" height=\"21px\"></a>\n</p>\n\n## Development\n\n### Use as a template\n\n[![Use the template](https://img.shields.io/static/v1?label=&message=Click%20here%20to%20use%20this%20package%20as%20a%20template%20to%20start%20a%20new%20repo%20on%20GitHub&color=brightgreen&style=for-the-badge)](https://github.com/tomchen/example-typescript-package/generate)\n\n(Click the above button to use this example package as a template for your new GitHub repo, this will initialize a new repository and my commits will not be in your git history)\n\n(If you do not use GitHub, you can [download the archive of the example package](https://github.com/tomchen/example-typescript-package/archive/main.zip))\n\n### Set up tools and environment\n\nYou need to have [Node.js](https://nodejs.org/en/download/) installed. Node includes npm as its default package manager.\n\nOpen the whole package folder with a good code editor, preferably [Visual Studio Code](https://code.visualstudio.com/download). Consider installing VS Code extensions [ES Lint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode).\n\nIn the VS Code top menu: **Terminal** -> **New Terminal**\n\n### Install dependencies\n\nInstall dependencies with npm:\n\n```bash\nnpm i\n```\n\n### Write your code\n\nMake necessary changes in **package.json** (name, version, description, keywords, author, homepage and other URLs).\n\nWrite your code in **src** folder, and unit test in **test** folder, replacing the original files there.\n\nThe VS Code shortcuts for formatting of a code file are: <kbd>Shift</kbd> + <kbd>Alt</kbd> + <kbd>F</kbd> (Windows); <kbd>Shift</kbd> + <kbd>Option (Alt)</kbd> + <kbd>F</kbd> (MacOS); <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>I</kbd> (Linux).\n\nChange code linting and formatting settings in **.prettierrc.js** if you want.\n\n### Test\n\nTest your code with Jest framework:\n\n```bash\nnpm run test\n```\n\n**Note:** Example TypeScript Package uses [husky](https://typicode.github.io/husky/), [pinst](https://github.com/typicode/pinst) and [commitlint](https://commitlint.js.org/) to automatically execute test and [lint commit message](https://www.conventionalcommits.org/) before every commit.\n\n### Build\n\nBuild production (distribution) files in your **dist** folder:\n\n```bash\nnpm run build\n```\n\nIt generates CommonJS (in **dist/cjs** folder), ES Modules (in **dist/esm** folder), bundled and minified UMD (in **dist/umd** folder), as well as TypeScript declaration files (in **dist/types** folder).\n\n### Try it before publishing\n\nRun:\n\n```bash\nnpm link\n```\n\n[npm link](https://docs.npmjs.com/cli/v6/commands/npm-link) will create a symlink in the global folder, which may be **{prefix}/lib/node_modules/example-typescript-package** or **C:\\Users\\<username>\\AppData\\Roaming\\npm\\node_modules\\example-typescript-package**.\n\nCreate an empty folder elsewhere, you don't even need to `npm init` (to generate **package.json**). Open the folder with VS Code, open a terminal and just run:\n\n```bash\nnpm link example-typescript-package\n```\n\nThis will create a symbolic link from globally-installed example-typescript-package to **node_modules/** of the current folder.\n\nYou can then create a, for example, **testnum.ts** file with the content:\n\n```ts\nimport { Num } from 'example-typescript-package'\nconsole.log(new Num(5).add(new Num(6)).val() === 11)\n```\n\nIf you don't see any linting errors in VS Code, if you put your mouse cursor over `Num` and see its type, then it's all good.\n\nWhenever you want to uninstall the globally-installed example-typescript-package and remove the symlink in the global folder, run:\n\n```bash\nnpm uninstall example-typescript-package -g\n```\n\n### Prepare to publish\n\nCreate an [npm](https://www.npmjs.com/) account.\n\n<details><summary><strong>Click to read this section if you do manual publishing</strong></summary>\n\n#### Manual publishing to npm\n\nLog in:\n\n```bash\nnpm adduser\n```\n\nAnd publish:\n\n```bash\nnpm publish\n```\n\n</details>\n\nThis package is configured to use GitHub Actions CI/CD to automate both the **npm** and **GitHub Packages** publishing process. The following are what you have to do.\n\n#### CI publishing to npm\n\nFollow [npm's official instruction](https://docs.npmjs.com/creating-and-viewing-access-tokens) to create an npm token. Choose \"Publish\" from the website, or use `npm token create` without argument with the CLI.\n\nIf you use 2FA, then make sure it's enabled for **authorization** only instead of **authorization and publishing** (**Edit Profile** -> **Modify 2FA**).\n\nOn the page of your newly created or existing GitHub repo, click **Settings** -> **Secrets** -> **New repository secret**, the **Name** should be `NPM_TOKEN` and the **Value** should be your npm token.\n\n#### CI publishing to GitHub Packages\n\nThe default configuration of this example package **assumes you publish package with an unscoped name to npm**. GitHub Packages must be named with a scope name such as \"@tomchen/example-typescript-package\".\n\nChange `scope: '@tomchen'` to your own scope in **.github/workflows/publish.yml**, also change `addscope` in **package.json**.\n\nIf you publish package with a scoped name to npm, change the name to something like \"@tomchen/example-typescript-package\" in **package.json**, and remove the `- run: npm run addscope` line in **.github/workflows/publish.yml**\n\nIf you publish your package to npm only, and don't want to publish to GitHub Packages, then delete the lines from `- name: Setup .npmrc file to publish to GitHub Packages` to the end of the file in **.github/workflows/publish.yml**.\n\n(You might have noticed `secret.GITHUB_TOKEN` in **.github/workflows/publish.yml**. You don't need to set up a secret named `GITHUB_TOKEN` actually, it is [automatically created](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#about-the-github_token-secret))\n\n### Publish\n\nNow everything is set. The example package has automated tests and upload (publishing) already set up with GitHub Actions:\n\n- Every time you `git push` or a pull request is submitted on your `master` or `main` branch, the package is automatically tested against the desired OS and Node.js versions with GitHub Actions.\n- Every time an [**annotated**](https://git-scm.com/book/en/v2/Git-Basics-Tagging#_annotated_tags) (not [lightweight](https://git-scm.com/book/en/v2/Git-Basics-Tagging#_lightweight_tags)) \"v*\" tag is pushed onto GitHub, a GitHub release is automatically generated from this version, it also automatically publishes to the npm registry and/or GitHub Packages registry to update the package there.\n  - [`npm version`](https://docs.npmjs.com/cli/version/) / [`yarn version`](https://yarnpkg.com/cli/version) is useful to create tags.\n  - (npm or yarn v1, not yarn v2) You could also add `\"postversion\": \"git push --follow-tags\"` to **package.json** file to push it automatically after `npm` or `yarn` `version`.\n  - (yarn v1, not v2) because `yarn version` doesn't check whether there are uncommitted changes, you can add `\"preversion\": \"git diff-index --quiet HEAD --\"` to **package.json**\n    - Note: `preversion`, `postversion` doesn't work in yarn v2\n\nFor npm registry: you can unpublish a version or the whole package but can never re-publish the same version under the same name.\n\nIf you want to modify the description / README on the npm package page, you have to publish a new version. You can modify the description on GitHub Packages without publishing.\n\n## Notes\n\n- It uses npm but you can easily switch to yarn, of course (remember to change all \"npm\" in `scripts` in the file **package.json**)\n  - Whether you use npm as your package manager ≠ Whether you can publish to the npm registry\n- Works fine in VS Code. In my configuration **.eslintrc** and **.prettierrc** cooperate perfectly\n- See `scripts` in **package.json** for other predefined script commands\n- [pinst](https://github.com/typicode/pinst) is used to solve [a problem of husky](https://typicode.github.io/husky/#/?id=yarn-2)\n- The installation of the package with npm, yarn v1 and yarn v2+ is ensured in [this test](https://github.com/tomchen/example-typescript-package-test)\n\n## References\n\n- [Creating and publishing unscoped public packages - npm docs](https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages)\n- [npm-publish - npm docs](https://docs.npmjs.com/cli/v6/commands/npm-publish)\n- [Publishing - TypeScript docs](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html)\n- [Publishing Node.js packages - GitHub Docs](https://docs.github.com/en/free-pro-team@latest/actions/guides/publishing-nodejs-packages)\n\nBtw, if you want to publish Python package, go to [Example PyPI (Python Package Index) Package & Tutorial / Instruction / Workflow for 2021](https://github.com/tomchen/example_pypi_package).\n","readmeFilename":"README.md"}