Skip to content
This repository has been archived by the owner on Jun 24, 2023. It is now read-only.

Commit

Permalink
some work, new version 0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed May 20, 2023
1 parent 0ff7ccc commit a34d4b1
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 13 deletions.
24 changes: 21 additions & 3 deletions LICENSE
Git LFS file not shown
32 changes: 26 additions & 6 deletions core/strg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import shelljs from "shelljs";
import { existsSync, mkdir } from "fs";
import axios from "axios";
import { join } from "path";

export const CheckDir = async () => {
console.log("Checking Directory...");
Expand Down Expand Up @@ -33,6 +34,14 @@ export const CheckDir = async () => {
.exec(`git config --global init.defaultBranch main`)
.exec(`git config --global pull.ff only`);

if (repo.includes("Not Found")) {
shelljs.exec(
`npx gh-cmd repo create ${process.env
.SG_DIR!.split("/")
.join("_")} --private`
);
}

if (!check) {
if (repo.includes("Not Found")) {
mkdir(process.env.SG_DIR!, async (err) => {
Expand All @@ -41,12 +50,6 @@ export const CheckDir = async () => {
} else {
console.log(`'${process.env.SG_DIR!}' created successfully!`);

shelljs.exec(
`npx gh-cmd repo create ${process.env
.SG_DIR!.split("/")
.join("_")} --private`
);

shelljs.exec(
`npx gh-cmd repo clone ${process.env
.SG_DIR!.split("/")
Expand Down Expand Up @@ -80,6 +83,23 @@ export const CheckDir = async () => {
console.log(`Cloned Successfully 📦`);
}
} else {
if (!existsSync(join(process.env.SG_DIR!, ".git"))) {
shelljs.cd(process.env.SG_DIR!).exec("rm -rf *");

shelljs.exec(
`npx gh-cmd repo clone ${process.env
.SG_DIR!.split("/")
.join("_")} ${process.env.SG_DIR!}`
);

shelljs
.cd(process.env.SG_DIR!)
.exec(`git lfs install`)
.exec("git lfs track *");

shelljs.rm(".gitattributes");
}

shelljs.cd(process.env.SG_DIR!).exec(`git pull`);

console.log(`Directory found 👍`);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@botway/strg",
"version": "0.1.3",
"version": "0.1.4",
"description": "📦 A persistent storage solution that syncs database files located in a Docker container under your GitHub account",
"homepage": "https://github.com/botwayorg/strg",
"bugs": "https://github.com/botwayorg/strg/issues",
Expand Down
22 changes: 19 additions & 3 deletions tsconfig.json
Git LFS file not shown

0 comments on commit a34d4b1

Please sign in to comment.