{"name":"memfs-or-file-map-to-github-branch","version":"1.3.0","description":"Handles making a GitHub branch with the commits from a memfs instance or a file map","main":"build/index.js","typings":"build/index.d.ts","repository":{"type":"git","url":"git+https://github.com/orta/memfs-or-file-map-to-github-branch.git"},"author":{"name":"orta"},"license":"MIT","scripts":{"build":"yarn tsc","prepublish":"yarn build"},"devDependencies":{"@types/node":"^16.11.21 || ^22.13.10","typescript":"^4.5.5 || ^5.8.2"},"dependencies":{"@octokit/rest":"*"},"_id":"memfs-or-file-map-to-github-branch@1.3.0","gitHead":"a4135ecd8405d9baab841b6d5dcfd3315e221cb3","bugs":{"url":"https://github.com/orta/memfs-or-file-map-to-github-branch/issues"},"homepage":"https://github.com/orta/memfs-or-file-map-to-github-branch#readme","_nodeVersion":"20.18.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-AzgIEodmt51dgwB3TmihTf1Fh2SmszdZskC6trFHy4v71R5shLmdjJSYI7ocVfFa7C/TE6ncb0OZ9eBg2rmkBQ==","shasum":"4d02379460b1e5d1cd54ff46413813ea3a4dc134","tarball":"http://registry-npm.ywwl.com/memfs-or-file-map-to-github-branch/download/memfs-or-file-map-to-github-branch-1.3.0.tgz","fileCount":6,"unpackedSize":12282,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCrNrsneFTE4x2kq3UtK1kxXunH+C7ykGqmWsRhYL60YwIgLNjTcnyqwZrQhoiHMdTTV37EU09poDTk1O/zePy2uXw="}],"size":3619,"noattachment":false,"key":"/memfs-or-file-map-to-github-branch/-/memfs-or-file-map-to-github-branch-1.3.0.tgz"},"_npmUser":{"name":"orta","email":"orta.therox@gmail.com"},"directories":{},"maintainers":[{"name":"orta","email":"orta.therox@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/memfs-or-file-map-to-github-branch_1.3.0_1741768902581_0.11722858393773405"},"_hasShrinkwrap":false,"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":1741768902762,"_cnpm_publish_time":1741768902762,"dist-tags":{"latest":"1.3.0"}}