Advertisement
Guest User

Untitled

a guest
Feb 12th, 2020
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import * as git from 'isomorphic-git';
  2. import FS from "@isomorphic-git/lightning-fs";
  3.  
  4. window.fs = new FS("fs");
  5. git.plugins.set("fs", window.fs);
  6. window.pfs = window.fs.promises;
  7. window.dir = "/dirk"
  8. pfs.mkdir(dir);
  9.  
  10. git.clone({
  11.   fs,
  12.   dir,
  13.   url: "https://cors-anywhere.herokuapp.com/https://gitlab.com/milan.lakhani/crash-system-safety-analysis",
  14.   ref: "master",
  15.   singleBranch: true,
  16.   depth: 10
  17. });
  18.  
  19. pfs.readdir(dir);
  20. pfs.writeFile(`${dir}/README.md`, "# I am from the React script!", "utf8");
  21. git.status({dir, filepath: "README.md"});
  22. git.add({dir, filepath: "README.md"});
  23. git.status({dir, filepath: "README.md"});
  24.  
  25. let sha = git.commit({
  26.   dir,
  27.   message: "test iso git",
  28.   author: {
  29.     name: "Milan Lakhani",
  30.     email: "milan.l@hotmail.co.uk"
  31.   }
  32. })
  33.  
  34. console.log(git.log({dir, depth:1}));
  35.  
  36. git.addRemote({dir, remote:"origin2", url:"https://gitlab.com/milan.lakhani/crash-system-safety-analysis"});
  37.  
  38. let pushResponse = git.push({
  39.   dir: "/",
  40.   remote: "origin2",
  41.   ref: "master",
  42.   token: "*********", // Not telling you this Jakub!
  43.   url:"https://gitlab.com/milan.lakhani/crash-system-safety-analysis"
  44. });
  45. console.log(pushResponse);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement