{"name":"memfs-or-file-map-to-github-branch","version":"1.2.1","author":{"name":"orta"},"license":"MIT","_id":"memfs-or-file-map-to-github-branch@1.2.1","maintainers":[{"name":"orta","email":"orta.therox@gmail.com"}],"homepage":"https://github.com/orta/memfs-or-file-map-to-github-branch#readme","bugs":{"url":"https://github.com/orta/memfs-or-file-map-to-github-branch/issues"},"dist":{"shasum":"fdb9a85408262316a9bd5567409bf89be7d72f96","tarball":"http://registry-npm.ywwl.com/memfs-or-file-map-to-github-branch/download/memfs-or-file-map-to-github-branch-1.2.1.tgz","fileCount":6,"integrity":"sha512-I/hQzJ2a/pCGR8fkSQ9l5Yx+FQ4e7X6blNHyWBm2ojeFLT3GVzGkTj7xnyWpdclrr7Nq4dmx3xrvu70m3ypzAQ==","signatures":[{"sig":"MEQCIETnQ3lYUQ6McxMxMKIt9ZMpTvHbEi1qhoct0VMz801zAiBWzIM7UkjFDA8UBHfnGTMe7Wp7dJ33ujScV636f73ezw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12290,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+OdJCRA9TVsSAnZWagAAUc4P/RdW1Z9+wfWjf3DQ4qz9\niplVIkrUmIZvGkj4k0+ob0zUPCbguCcWCbMdnesoBIAAHwq0oW4GEkndPl5F\nkhWRB1wLO6NnWV2+yfPpece85v6+tJnRpmDXffU9zC/0ikDk94fNFPhVLnDz\n9mxJ31hbotIlon+0MPSd6AHFlzeWu9wz5Tf4xgtkDQpdyjv/IFNuYlN4RKLF\njsPYybvNkjeQCO/+WrHxo0+JFU8yE2/mQlzSliTqF4HZrwB4EJXxMPDeSRf4\nOvEgr2TvyUnEfyobLdt11DxflecIuU6ux1HGR4/RGg/Um7Oej/b3jzoppo/B\ngvP1FqHQuLhcWzqqt5NVU78lDJehYLXjrnx8/ZWQ+SGRfO1EF+z1LUuDm0bS\nwraLwbxnLzP+SRPEvMbFscXtm3gM2xnFfne6ty35+VQY5Zbn4pV7Evs5jUxu\njSAW1pzpA9/YK32PbYoMi7A/WwUkHFsk3zEkHl1p8CwDNXNZVfgQ6CpO9OsC\npQ7UodQJZ22VuF+w82u4kZ2LSNVd/4ixrGfMFQQKOf3Q9pNBj8srijlVS4g5\nZSruuDB8QQYUK4EH0jXkDu6y+KLnnBrKn7dy299yxTcX96MZVIdrRfp2H84a\n40N9ZWDdzyADQd8A10q+MZ3LYVBSms499KTt42kT5ycB7bgzlPYP+2lqMqoe\nrihe\r\n=MJFL\r\n-----END PGP SIGNATURE-----\r\n","size":3632,"noattachment":false,"key":"/memfs-or-file-map-to-github-branch/-/memfs-or-file-map-to-github-branch-1.2.1.tgz"},"main":"build/index.js","gitHead":"c293897e6b7cf80b23f16956ee2dc236953323e7","scripts":{"build":"yarn tsc","prepublish":"yarn build"},"typings":"build/index.d.ts","_npmUser":{"name":"orta","email":"orta.therox@gmail.com"},"repository":{"url":"git+https://github.com/orta/memfs-or-file-map-to-github-branch.git","type":"git"},"_npmVersion":"6.14.15","description":"Handles making a GitHub branch with the commits from a memfs instance or a file map","directories":{},"_nodeVersion":"14.18.1","dependencies":{"@octokit/rest":"^16.43.0 || ^17.11.0 || ^18.12.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^4.5.5","@types/node":"^16.11.21"},"_npmOperationalInternal":{"tmp":"tmp/memfs-or-file-map-to-github-branch_1.2.1_1643702089411_0.8940102546262949","host":"s3://npm-registry-packages"},"readme":"## Take a Source Object and Make a Branch via the GitHub API\n\ne.g. this:\n\n```ts\nconst settings = {\n  owner: \"danger\",\n  repo: \"danger-js\",\n  fullBranchReference: \"heads/new_readme\",\n  message: \"Adds some new stuff\"\n}\n\n// This will make a make a new commit on the branch new_readme, changing README.md\nawait filepathContentsMapToUpdateGitHubBranch(api, { \"README.md\": \"### My README\" }, settings)\n```\n\nand it will make a branch on that repo with those new file contents.\n\n---\n\n## Full API Reference\n\n```ts\n/**\n * The config for creating a branch. Noting the repo,\n * base branch (what should it work from), the new branch\n * and the message for the generated commit. The commit's\n * author will be whomever the API is authenticated with.\n */\nexport interface BranchCreationConfig {\n  /** The danger in danger/danger-js */\n  owner: string\n  /** The danger-js in danger/danger-js */\n  repo: string\n  /** Base branch to start working from, null is implied to be `heads/master` */\n  fullBaseBranch?: string\n  /** The ref in the URL must `heads/branch`, not just `branch`. */\n  fullBranchReference: string\n  /** Message for the commit */\n  message: string\n}\n/** Basically a filename to file contents map */\ninterface FileMap {\n  [filename: string]: string\n}\n/**\n * Creates a bunch of blobs, wraps them in a tree, updates a reference from a memfs volume\n */\nexport declare const memFSToGitHubCommits: (\n  api: GitHub,\n  volume: MemFSVolume,\n  settings: BranchCreationConfig\n) => Promise<void>\n/**\n * Creates a bunch of blobs, wraps them in a tree, updates a reference from a map of files to contents\n */\nexport declare const filepathContentsMapToUpdateGitHubBranch: (\n  api: GitHub,\n  fileMap: FileMap,\n  settings: BranchCreationConfig\n) => Promise<void>\n/**\n * A Git tree object creates the hierarchy between files in a Git repository. To create a tree\n * we need to make a list of blobs (which represent changes to the FS)\n *\n * We want to build on top of the tree that already exists at the last sha\n *\n * https://developer.github.com/v3/git/trees/\n */\nexport declare const createTree: (\n  api: GitHub,\n  settings: BranchCreationConfig\n) => (fileMap: FileMap, baseSha: string) => Promise<GitHub.GitdataCreateTreeResponse>\n/**\n * A Git commit is a snapshot of the hierarchy (Git tree) and the contents of the files (Git blob) in a Git repository\n *\n * https://developer.github.com/v3/git/commits/\n */\nexport declare const createACommit: (\n  api: GitHub,\n  settings: BranchCreationConfig\n) => (treeSha: string, parentSha: string) => Promise<GitHub.Response<GitHub.GitdataCreateCommitResponse>>\n/**\n * A Git reference (git ref) is just a file that contains a Git commit SHA-1 hash. When referring\n * to a Git commit, you can use the Git reference, which is an easy-to-remember name, rather than\n * the hash. The Git reference can be rewritten to point to a new commit.\n *\n * https://developer.github.com/v3/git/refs/#git-references\n */\nexport declare const updateReference: (\n  api: GitHub,\n  settings: BranchCreationConfig\n) => (newSha: string) => Promise<GitHub.Response<GitHub.GitdataCreateReferenceResponse>>\nexport {}\n```\n","publish_time":1643702089577,"_cnpm_publish_time":1643702089577,"dist-tags":{"latest":"1.3.0"}}