{"_id":"@andatoshiki/readme-box","_rev":"1-2a347cb9a048bde771a4b549915e745d","name":"@andatoshiki/readme-box","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@andatoshiki/readme-box","author":{"name":"Anda Toshiki","email":"hello@toshiki.dev"},"description":"Lil' helper for replacing a section of the contents of a README.","version":"1.0.0","license":"MIT","repository":{"type":"git","url":"git+https://github.com/andatoshiki/readme-box.git"},"scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test","lint":"tsdx lint","prepare":"tsdx build"},"main":"dist/index.js","typings":"dist/index.d.ts","module":"dist/readme-box.esm.js","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":80,"semi":false,"singleQuote":true},"dependencies":{"@octokit/request":"^5.6.0"},"devDependencies":{"husky":"^6.0.0","nock":"^13.1.0","pretty-quick":"^3.1.1","tsdx":"^0.14.1","tslib":"^2.3.0","typescript":"^4.3.4"},"gitHead":"69bbf3e48f9e2c7f935f7a5115c0df040efdb779","bugs":{"url":"https://github.com/andatoshiki/readme-box/issues"},"homepage":"https://github.com/andatoshiki/readme-box#readme","_id":"@andatoshiki/readme-box@1.0.0","_nodeVersion":"16.18.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-hmHULXievFnvyl9eFwaPko61oLnNE909h1y6X+kP3p7j/hs6dltnVs44x1hmcKVdbMeFlPjnpuzyxhbAwP1Ofg==","shasum":"33a01c2dec74c7119e1c39c6b888906def0390b4","tarball":"https://registry.npmjs.org/@andatoshiki/readme-box/-/readme-box-1.0.0.tgz","fileCount":12,"unpackedSize":227433,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDVUDoFcFEXT9jHZl6fHfLEK959DYo80oQth+MqAJKV5gIgMnenzWr6wnpNehI/MH0MsiKRa+ezk1tdSJ+p4fT0cOY="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjf46jACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpw0RAAm/8uIK+ow7qKfHpfBAB6XFKy2pvPqdEm8e+gIm7ozJR1xZNJ\r\nmlsKFdh7KwaHsj/7LzGBWxxbl/P5WjSLxkevLuu7UK4VBCKl1maeqscVU6+2\r\nde4hEKsphb2ZUMzD1XPJtvJef4fSraPvdY0DmJ6x2BuBa9ou94wdKcX9eU2+\r\nwDwsYdZmlkGiXz+Dt9rMQRLZ+RaE3ZmbklgRL/WV6hHPtcMMul55onj6KKh9\r\nbxgiXzHc0ZljpbNcwy/eX9iO5AV5ZI9x6C4X8fsskYKDS+x8uSSRYdwQbWb0\r\nWPg/llGOHzkxcZTIl08aU3GgQmlMdM4sVQlhP/DbFlRf72QItRavkbbwaqj2\r\nizIOmayJKRdYUKkX7mrkyBE935ciHQUFwmaghOtDIWsmGrMo0AXPHIe0vB43\r\nsTFm93jvQp9/hVTVhec1KByvgpqtUeqUucS4qlors90RcF8KK7ArUf3x2G6p\r\nSI1XbaaDnrMUP6EUAI7+iLlx72vB+zJC7nAiErkdSged+MLvpdjQK6cxYA35\r\nk/WE43PVg053Gub2a5NJi66sJE44jqvXrMpIKBDd3R6/qbVk+DrrbHlhW9k9\r\nK6UlqJIzvUuVVfuPS6Ml+3TKYryJNt13GYUCrUPugXfiUr4ek3RmqoqXmp5g\r\n67rr/2CQFXMpAm9qd8oCTOvAH3HQnC1w8no=\r\n=Gtkh\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"andatoshiki","email":"andatoshiki@outlook.com"},"directories":{},"maintainers":[{"name":"andatoshiki","email":"andatoshiki@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readme-box_1.0.0_1669303971524_0.017432748950136023"},"_hasShrinkwrap":false},"1.0.1":{"name":"@andatoshiki/readme-box","author":{"name":"Anda Toshiki","email":"hello@toshiki.dev"},"description":"Lil' helper for replacing a section of the contents of a README.","version":"1.0.1","license":"MIT","repository":{"type":"git","url":"git+https://github.com/andatoshiki/readme-box.git"},"scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test","lint":"tsdx lint","prepare":"tsdx build"},"main":"dist/index.js","typings":"dist/index.d.ts","module":"dist/readme-box.esm.js","husky":{"hooks":{"pre-commit":"pretty-quick --staged"}},"prettier":{"printWidth":80,"semi":false,"singleQuote":true},"dependencies":{"@octokit/request":"^5.6.0"},"devDependencies":{"husky":"^6.0.0","nock":"^13.1.0","pretty-quick":"^3.1.1","tsdx":"^0.14.1","tslib":"^2.3.0","typescript":"^4.3.4"},"gitHead":"3de471f5a091bec8bfbd64ba6f42b23dc447beec","bugs":{"url":"https://github.com/andatoshiki/readme-box/issues"},"homepage":"https://github.com/andatoshiki/readme-box#readme","_id":"@andatoshiki/readme-box@1.0.1","_nodeVersion":"16.18.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-IGhePOMnydU3WXqWuyxtJj/Uy+Ls2UKu+O2kImTjPx6Shpomr1u9zCP7aHV0dowWtBw1qQvob8/POrdwGugAoA==","shasum":"f96ff5dcac1d085479500b1964e53b4644d34140","tarball":"https://registry.npmjs.org/@andatoshiki/readme-box/-/readme-box-1.0.1.tgz","fileCount":12,"unpackedSize":227527,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCJHQGo0jN9lAgspTe2D3j8NBRxZRYy7EKn0dTtlHmhUwIhAIJrF5ec1g+qi5zPuK+GRDWSIEEOPD6GMWu7/SCep9jp"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjiYugACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqZfQ/9GhgHoppnhHSgCvvlhKy+2aZrqm8SltQBp2Y4sS0bJBAxfH7s\r\nw1J3RlCG2bbz6poh79ibf/LGO93a8ggkjlGUcXnVDhmtvAwIOXVcD08txQiy\r\nOmy7QD7fuGybCwlB59+Pi1h6oltQmMuNv1YzvFplTY3NjrXB7Tv+mXsG5Rs/\r\nfevk1Ls/NzxlnisI/Ior9F0WM17K2n1IisJiytdvaNXuXZD3hHx5PqIoCjup\r\nMtjb/39DU1aCht3gkKZPkUTjrz/PSocbN/0tEiHeYziLlcZ2zLnltnabDsYY\r\nXsjmpHLwqHy0P1m63ZG9WjfdbP9VHtXH3yJOte9+ML57ctsYE7O9KurgmvsO\r\n/ynfm96pZRKzqY78cntzrcFScse2FdLS3GYx/BBar/BfclhJq8mrYTVL/MnL\r\n0rbvf5YrL16c7DJPOrRMVjP52Y4V/fiycAErQ2NxISMw3h4Z8jEcBI20p7Xz\r\nPz7hckm0kY3r4n5LHTpQRP49Y5RfnnXLkA3KRgS/7edtPPOQahJMMqlRJhTp\r\nmbolHpNBlSPDQ2fKJfgveCPhy4tf2S8XD34MdMoM1szP6aU1TXlcuUCIhd7L\r\nWtNZwHfx4cPbwkhos1Lxx2tA/JcFvnsr7lrow1jN+M9Nmaq1iHKJQ0kxUQCx\r\ni29M60v2uAPYf2MEcnCJn+Vdti3k27w1wnA=\r\n=bKID\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"andatoshiki","email":"andatoshiki@outlook.com"},"directories":{},"maintainers":[{"name":"andatoshiki","email":"andatoshiki@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/readme-box_1.0.1_1669958560278_0.606075519562816"},"_hasShrinkwrap":false}},"time":{"created":"2022-11-24T15:32:51.378Z","1.0.0":"2022-11-24T15:32:51.753Z","modified":"2022-12-02T05:22:40.545Z","1.0.1":"2022-12-02T05:22:40.471Z"},"maintainers":[{"name":"andatoshiki","email":"andatoshiki@outlook.com"}],"description":"Lil' helper for replacing a section of the contents of a README.","homepage":"https://github.com/andatoshiki/readme-box#readme","repository":{"type":"git","url":"git+https://github.com/andatoshiki/readme-box.git"},"author":{"name":"Anda Toshiki","email":"hello@toshiki.dev"},"bugs":{"url":"https://github.com/andatoshiki/readme-box/issues"},"license":"MIT","readme":"# README-Box\n> Lil' helper for replacing a section of the contents of a README.\n\n<a href=\"https://npmjs.com/package/@andatoshiki/readme-box\"><img src=\"https://badgen.net/npm/v/readme-box\" alt=\"NPM\"></a> <img alt=\"CI\" src=\"https://github.com/andatoshiki/readme-box/workflows/CI/badge.svg\" /> <a href=\"https://codecov.io/gh/andatoshiki/readme-box\" > <img src=\"https://codecov.io/gh/andatoshiki/readme-box/branch/master/graph/badge.svg?token=FYjxHd1Z8C\"/></a>\n\n## Usage\n\n### Installation\n\n```sh\n$ npm install @andatoshiki/readme-box\n```\n\n```js\nconst { ReadmeBox } = require('@andatoshiki/readme-box')\nimport { ReadmeBox } from '@andatoshiki/readme-box'\n```\n\nYou can quickly update a section of a README:\n\n```js\nconst result = await ReadmeBox.updateSection('New contents!', {\n  owner: 'andatoshiki',\n  repo: 'example',\n  token: process.env.GITHUB_TOKEN,\n  // branch is assumed to be 'master' by default, you can also specify `branch: 'master'`\n  branch: 'master',\n  section: 'example-section',\n  // set to `true` to allow empty commits when there are no changes\n  emptyCommits: false\n})\n\n// `result` is the response object of the README update request or\n// `undefined` if no changes were made.\n```\n\nOr, if you need to access parts of it more granularly, you can use the `ReadmeBox` class methods:\n\n```js\nconst box = new ReadmeBox({ owner, repo, token })\n\n// Get the contents of the README from the API\nconst { content, sha } = await box.getReadme()\n\n// Get the contents of a section of the provided string\nconst sectionContents = box.getSection('example-section', content)\n\n// Return a string with the replaced contents\nconst replacedContents = box.replaceSection({\n  section: 'example-section',\n  oldContent,\n  newContent\n})\n\n// Update the README via the API, with an optional commit message\nawait box.updateReadme({ content, sha, message: 'Updating the README!' })\n```\n\n## How it works\n\n`ReadmeBox.updateSection` combines a couple of the methods exposed on the `ReadmeBox` class, to do the following:\n\n- Get the README file's contents from the API\n- Replace a section of it using Regular Expressions\n- Update the file via the API\n\nIt expects your README to have a \"section\", using HTML comments:\n\n```html\nCheck out this README!\n\n<!--START_SECTION:example-section-->\nOld contents...\n<!--END_SECTION:example-section-->\n```\n\nWhen the above example code is run, everything between the start and end comments will be replaced.\n\n## Local Development\n\nThis project was bootstrapped with [TSDX](https://github.com/jaredpalmer/tsdx). Below is a list of commands you will probably find useful.\n\n### `npm start`\n\nRuns the project in development/watch mode. The project will be rebuilt upon changes. TSDX has a special logger for you convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab. The library will be rebuilt if you make edits.\n\n### `npm run build`\n\nBundles the package to the `dist` folder.\nThe package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).\ns\n\n### `npm test`\n\nRuns the test watcher (Jest) in an interactive mode.\nBy default, runs tests related to files changed since the last commit.\n","readmeFilename":"README.md"}