diff --git a/dashboard/.gitignore b/dashboard/.gitignore index 0772ba5..06b4ddf 100644 --- a/dashboard/.gitignore +++ b/dashboard/.gitignore @@ -38,4 +38,4 @@ explains #Ecosystem ecosystem.config.cjs -ecosystem.config.js \ No newline at end of file +ecosystem.config.js diff --git a/dashboard/package.json b/dashboard/package.json index 89c7ab4..ec9cc53 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -3,8 +3,10 @@ "private": true, "type": "module", "scripts": { - "build": "npm run workspace:shared && nuxt build", - "dev": "npm run workspace:shared && nuxt dev", + "build": "npm run workspace:shared && nuxt build --dotenv .env.testmode", + "build:prod": "npm run workspace:shared && nuxt build --dotenv .env.prod", + "dev": "npm run workspace:shared && nuxt dev --dotenv .env.testmode", + "dev:prod": "npm run workspace:shared && nuxi dev --dotenv .env.prod", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare", diff --git a/scripts/dashboard/deploy.ts b/scripts/dashboard/deploy.ts index f48b908..c7ca982 100644 --- a/scripts/dashboard/deploy.ts +++ b/scripts/dashboard/deploy.ts @@ -22,15 +22,24 @@ async function main() { if (fs.existsSync(TMP_PATH)) fs.rmSync(TMP_PATH, { force: true, recursive: true }); fs.ensureDirSync(TMP_PATH); + + if (!SKIP_BUILD) { console.log('Building'); - child.execSync(`cd ${LOCAL_PATH} && pnpm i && pnpm run build`) + if (MODE === 'testmode') { + child.execSync(`cd ${LOCAL_PATH} && pnpm run build`); + } else if (MODE === 'production') { + child.execSync(`cd ${LOCAL_PATH} && pnpm run build:prod`); + + } } + fs.rmSync(path.join(LOCAL_PATH, '.env'), { force: true }); + console.log('Creating zip file'); const archive = createZip(TMP_PATH + '/' + ZIP_NAME); archive.directory(LOCAL_PATH + '/.output', '/.output'); - + archive.file(LOCAL_PATH + '/ecosystem.config.js', { name: '/ecosystem.config.js' }) await archive.finalize();