diff --git a/packages/wrapper/src/index.js b/packages/wrapper/src/index.js index 60d9d817..c51f23af 100644 --- a/packages/wrapper/src/index.js +++ b/packages/wrapper/src/index.js @@ -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}]`) } diff --git a/packages/wrapper/src/lib/setupDist.js b/packages/wrapper/src/lib/setupDist.js index 2106934a..c4bb78c0 100644 --- a/packages/wrapper/src/lib/setupDist.js +++ b/packages/wrapper/src/lib/setupDist.js @@ -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 \ No newline at end of file +module.exports = { + getLatestReleaseBundleFromGithub, + downloadBundle, + extractBundle, + setupLatestRelease, +} \ No newline at end of file