{"name":"memfs-or-file-map-to-github-branch","version":"1.0.1","author":{"name":"orta"},"license":"MIT","_id":"memfs-or-file-map-to-github-branch@1.0.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":"9fd7a29583b97837e7c92267860f71b696e46982","tarball":"http://registry-npm.ywwl.com/memfs-or-file-map-to-github-branch/download/memfs-or-file-map-to-github-branch-1.0.1.tgz","fileCount":5,"integrity":"sha512-4CJWmdOnG/H2y6TX/qyAvjdjgC4fhMWxSZQ8oyBeDo2Elw2khv0obR8GsljyZOjLhLUOtaHcUNEMB3GNPkoKBw==","signatures":[{"sig":"MEUCIBH1JR2W5gonYbKcX5Eu117Hthx8cObyMON4aDqxtVIdAiEAq7p8hEIAocNGGcLvKb0NiZerem1cFvbQrnMKQL2Uw8c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9929,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbr6waCRA9TVsSAnZWagAA3lIP/jEN363aLgytIc0v2Crp\n07M+yYU/U6dberHuLNO3O+Z9YU/9xckkLLxfaZigNXgQX55CseAyqAjwWnQz\nxERWSKu8eJW9I4M33nosyGdyFOgi+Ca8I2JibNbJUyHZu6XUNQtuH4Dgdy1S\nvJFa8ggxZ1ypFwQLY/Q+EddLhlWMX+x4S/OtLsfbToJwTpIrry8hos/JM81/\nygjCjfGRi4Q17Y5pvQY4yRSeZuLUVL3+zq97BCHThi56yePDXbjkOY97dG/S\n1jGpwx7lrxhglqe9+Tk/cBnSWn8jm+foMMO4X2kTUI35D8Xd6jIoZCkJXLUG\n+GmLGZtC2fBWlUhvFUanoNmE2RGw1dZkX+YAEZ3dWgoNqJXIJcSgLGkUl2BR\ncTw+nhPoz92TrmbAYk/EGrsuHcCAwhmA/wm/749iZcmGbJyjb/pcra2QUi5I\nwsDFJ0au6nQ/kAB3dfNqFnumSDfwbaZ7clJmpFAbkBt7SGgIRvpFOQQw/kL0\nfyWUSVaxkEnyja9Ds4vTFoEH+DGMtBK0rHcgGlbQ3UdRZe5DugkX41lcj3Pn\nA0FOOQxfRHg4mpciMY5mXHMbnn+h62aDe5AGlQv5KFDBZHfqTtaJR3Mu4nGo\nqVqUshHXWmqHPKl2bX9YYVqOh6xLd7LiFYhMgBSzwzoVcJw+HCDTAWB9Tq1F\ntY09\r\n=3N1t\r\n-----END PGP SIGNATURE-----\r\n","size":2961,"noattachment":false,"key":"/memfs-or-file-map-to-github-branch/-/memfs-or-file-map-to-github-branch-1.0.1.tgz"},"main":"build/index.js","gitHead":"3dcc20e9ee0dd0af5417e0f10433ad2ad6509b5d","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.4.1","description":"Handles making a GitHub branch with the commits from a memfs instance or a file map","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@octokit/rest":"15.12.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^3.1.1","@types/node":"^10.11.3"},"_npmOperationalInternal":{"tmp":"tmp/memfs-or-file-map-to-github-branch_1.0.1_1538239513545_0.0009115607507614865","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":1538239513680,"_cnpm_publish_time":1538239513680,"dist-tags":{"latest":"1.3.0"}}