Socket
Socket
Sign inDemoInstall

memfs-or-file-map-to-github-branch

Package Overview
Dependencies
42
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 1.0.5

8

build/index.d.ts

@@ -11,3 +11,3 @@ import * as GitHub from "@octokit/rest";

/** Base branch to start working from, null is implied to be `heads/master` */
fullBaseBranch: string;
fullBaseBranch?: string;
/** The ref in the URL must `heads/branch`, not just `branch`. */

@@ -33,5 +33,7 @@ fullBranchReference: string;

*
* We want to build on top of the tree that already exists at the last sha
*
* https://developer.github.com/v3/git/trees/
*/
export declare const createTree: (api: GitHub, settings: RepoSettings) => (fileMap: FileMap) => Promise<GitHub.GitdataCreateTreeResponse>;
export declare const createTree: (api: GitHub, settings: RepoSettings) => (fileMap: FileMap, baseSha: string) => Promise<GitHub.GitdataCreateTreeResponse>;
/**

@@ -50,3 +52,3 @@ * A Git commit is a snapshot of the hierarchy (Git tree) and the contents of the files (Git blob) in a Git repository

*/
export declare const updateReference: (api: GitHub, settings: RepoSettings) => (newSha: string, parentSha: string) => Promise<GitHub.Response<GitHub.GitdataUpdateReferenceResponse>>;
export declare const updateReference: (api: GitHub, settings: RepoSettings) => (newSha: string) => Promise<GitHub.Response<GitHub.GitdataCreateReferenceResponse>>;
export {};

@@ -24,5 +24,5 @@ "use strict";

const baseSha = getSha.data.object.sha;
const tree = yield exports.createTree(api, settings)(fileMap);
const tree = yield exports.createTree(api, settings)(fileMap, baseSha);
const commit = yield exports.createACommit(api, settings)(tree.sha, baseSha);
yield exports.updateReference(api, settings)(commit.data.sha, baseSha);
yield exports.updateReference(api, settings)(commit.data.sha);
});

@@ -41,5 +41,7 @@ /** If we want to make a commit, or update a reference, we'll need the original commit */

*
* We want to build on top of the tree that already exists at the last sha
*
* https://developer.github.com/v3/git/trees/
*/
exports.createTree = (api, settings) => (fileMap) => __awaiter(this, void 0, void 0, function* () {
exports.createTree = (api, settings) => (fileMap, baseSha) => __awaiter(this, void 0, void 0, function* () {
const blobSettings = { owner: settings.owner, repo: settings.repo };

@@ -53,3 +55,3 @@ const createBlobs = Object.keys(fileMap).map(filename => api.gitdata.createBlob(Object.assign({}, blobSettings, { content: fileMap[filename] })).then((blob) => ({

const blobs = yield Promise.all(createBlobs);
const tree = yield api.gitdata.createTree(Object.assign({}, blobSettings, { tree: blobs }));
const tree = yield api.gitdata.createTree(Object.assign({}, blobSettings, { tree: blobs, base_tree: baseSha }));
return tree.data;

@@ -76,3 +78,3 @@ });

*/
exports.updateReference = (api, settings) => (newSha, parentSha) => api.gitdata.updateReference({
exports.updateReference = (api, settings) => (newSha) => api.gitdata.createReference({
owner: settings.owner,

@@ -79,0 +81,0 @@ repo: settings.repo,

{
"name": "memfs-or-file-map-to-github-branch",
"version": "1.0.4",
"version": "1.0.5",
"description": "Handles making a GitHub branch with the commits from a memfs instance or a file map",

@@ -5,0 +5,0 @@ "main": "build/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc