test add git modules
This commit is contained in:
32
test/git.ts
Normal file
32
test/git.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Git } from '../src/git/index.ts'
|
||||
import { token, cookie, showMore } from './common.ts';
|
||||
|
||||
const git = new Git({ token, cookie });
|
||||
|
||||
const repo = 'kevisual/cnb';
|
||||
|
||||
const listFiles = async () => {
|
||||
// const res = await git.getContentWithPath(repo, 'README.md');
|
||||
// console.log("res", showMore(res));
|
||||
const res2 = await git.getContentWithPath(repo, 'src/issue');
|
||||
console.log("res2", showMore(res2));
|
||||
const res3 = await git.getContentWithPath(repo, 'src/issue/index.ts');
|
||||
console.log("res3", showMore(res3));
|
||||
}
|
||||
|
||||
// listFiles();
|
||||
|
||||
const createBlob = async () => {
|
||||
const res = await git.createBlob(repo, {
|
||||
content: 'Hello, CNB!',
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
console.log("createBlob res", showMore(res));
|
||||
}
|
||||
|
||||
createBlob();
|
||||
|
||||
const getRaw = async () => {
|
||||
const res = await git.getRaw(repo, 'main:README.md');
|
||||
console.log("getRaw res", showMore(res));
|
||||
}
|
||||
Reference in New Issue
Block a user