mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
write as cjs
This commit is contained in:
parent
6ebb9d4a08
commit
e4a06081ec
@ -2,11 +2,12 @@ require("dotenv").config()
|
||||
|
||||
const packagejson = require("../package.json")
|
||||
|
||||
import fs from "fs"
|
||||
import path from "path"
|
||||
import express from "express"
|
||||
import cors from "cors"
|
||||
import setupLatestRelease from "./lib/setupDist"
|
||||
const fs = require("fs")
|
||||
const path = require("path")
|
||||
const express = require("express")
|
||||
const cors = require("cors")
|
||||
|
||||
const { setupLatestRelease } = require("./lib/setupDist")
|
||||
|
||||
global.remoteRepo = "ragestudio/comty"
|
||||
global.cachePath = path.join(process.cwd(), "cache")
|
||||
@ -44,6 +45,7 @@ async function runServer() {
|
||||
|
||||
app.listen(portListen)
|
||||
|
||||
console.log(`Running Wrapper v${packagejson.version}`)
|
||||
console.log(`🌐 Listening app in port [${portListen}]`)
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ const octokit = new Octokit({
|
||||
// auth: process.env.GITHUB_TOKEN
|
||||
})
|
||||
|
||||
export async function getLatestReleaseBundleFromGithub() {
|
||||
async function getLatestReleaseBundleFromGithub() {
|
||||
console.log("Getting latest release bundle from github...")
|
||||
|
||||
const release = await octokit.repos.getLatestRelease({
|
||||
@ -21,7 +21,7 @@ export async function getLatestReleaseBundleFromGithub() {
|
||||
return bundle
|
||||
}
|
||||
|
||||
export async function downloadBundle(bundle) {
|
||||
async function downloadBundle(bundle) {
|
||||
// check if bundle exists
|
||||
if (fs.existsSync(path.join(global.cachePath, "app_dist.7z"))) {
|
||||
fs.unlinkSync(path.join(global.cachePath, "app_dist.7z"))
|
||||
@ -43,7 +43,7 @@ export async function downloadBundle(bundle) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function extractBundle() {
|
||||
async function extractBundle() {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log("Extracting bundle...")
|
||||
|
||||
@ -57,7 +57,7 @@ export async function extractBundle() {
|
||||
})
|
||||
}
|
||||
|
||||
export async function setupLatestRelease() {
|
||||
async function setupLatestRelease() {
|
||||
// create cache folder
|
||||
if (!fs.existsSync(global.cachePath)) {
|
||||
fs.mkdirSync(global.cachePath)
|
||||
@ -84,4 +84,9 @@ export async function setupLatestRelease() {
|
||||
}
|
||||
}
|
||||
|
||||
export default setupLatestRelease
|
||||
module.exports = {
|
||||
getLatestReleaseBundleFromGithub,
|
||||
downloadBundle,
|
||||
extractBundle,
|
||||
setupLatestRelease,
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user