{"name":"memfs-or-file-map-to-github-branch","version":"1.0.0","author":{"name":"orta"},"license":"MIT","_id":"memfs-or-file-map-to-github-branch@1.0.0","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":"70e1a8d8bee392db0e10c33e87671a8962853b5a","tarball":"http://registry-npm.ywwl.com/memfs-or-file-map-to-github-branch/download/memfs-or-file-map-to-github-branch-1.0.0.tgz","fileCount":5,"integrity":"sha512-X0sATyYPaHHr4Ci6JHv861clBx+U/uiD7QYs0wNyienOP7j4ZsIlkFW7dJATJmP3tzJl/eelQYUWmswgtE3WVA==","signatures":[{"sig":"MEQCIHz9e53Uf98UMPFcDWv9uNU4cJdFwK0s0MDHyd/xpIedAiBqOddXffFDL252gWI856b/0aRCVMxparAAWhZ8wmVr3w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9842,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjXtQCRA9TVsSAnZWagAA/R8P/13Dh3yfboUfOoc3MdIu\nzgWDu5LRzPKoQqy5ZVx1TpdHFxho9mdeCrI6dGefERT5X09PgtVv8acZMae7\ni0w67SFgreH0MwVylKcdlvGtSCMdLk+1kpRZ3qCoYh3x1EE42hJHsjBbAhMY\neIcCltifDiLqCw3ev4g5qKvUI6XBcNpkfx689de06r7BM4cbVZgTvfLtIaQV\n8KOv4OxcY0sK9t0/UYDstf5hBWn9SeZjZAkCESGRcWSnkuKL8JAIgrVMqfcH\nMKflpw+QV517ITZmIkFsFqIt1BpOpCNVy1Zl6sWH2ExFZIudCXubpqHYEAtS\nZQIzj9fuwAg2LnRnjUg2861efBt7WTyTrOMNVZYjiMraMlDPSGI5fhpEzO70\nXSvi4IcwLucXIDtuCURh5D4ZGy9tTvAk9x5XdJ+S07DC8h70M1BN4qLjUCx6\nx8vGigGPu2QTWhOudgXjpH+9649xWDmD9kwXcxFVczC0m9H8GXf56yl+/9Wb\nhKa0W1TrnlCLjwKEIdXo1hV83NZC58alQQ/4EOikeQnfm2TRqs88gwD2EiXm\ngZ7Kf5UxfG1tR2TR9y85ADLSRgZwdsWBVuBpGUzTddC8MRCyCf3xChRs+XY7\nDlHtth1Fq6pfDN/9DX44A/YKKGQbO/WuLeqcLmVbCdBi7r5dDx8x83mUBmQr\nhxQ0\r\n=AGJH\r\n-----END PGP SIGNATURE-----\r\n","size":2924,"noattachment":false,"key":"/memfs-or-file-map-to-github-branch/-/memfs-or-file-map-to-github-branch-1.0.0.tgz"},"main":"build/index.js","gitHead":"676a7f15cc289622069ac089838281dc94cd601b","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":"*"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^3.0.3","@types/node":"^10.9.4"},"_npmOperationalInternal":{"tmp":"tmp/memfs-or-file-map-to-github-branch_1.0.0_1535998799911_0.3907313101520449","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":1535998800257,"_cnpm_publish_time":1535998800257,"dist-tags":{"latest":"1.3.0"}}