🐛 Fix deploy command compress issue

This commit is contained in:
LittleSheep 2024-10-03 15:19:34 +08:00
parent 99e4a64b5a
commit 35612d2f18

View File

@ -7,6 +7,7 @@ import * as child_process from "node:child_process"
import * as path from "node:path" import * as path from "node:path"
import { createAuthHeader } from "../utils/auth.ts" import { createAuthHeader } from "../utils/auth.ts"
import { RsLocalConfig } from "../utils/config-local.ts" import { RsLocalConfig } from "../utils/config-local.ts"
import * as os from "node:os"
export class DeployCommand extends Command { export class DeployCommand extends Command {
static paths = [[`deploy`]] static paths = [[`deploy`]]
@ -44,8 +45,8 @@ export class DeployCommand extends Command {
const compressPrefStart = performance.now() const compressPrefStart = performance.now()
const compressSpinner = ora(`Compressing ${chalk.bold(input)}...`).start() const compressSpinner = ora(`Compressing ${chalk.bold(input)}...`).start()
const destName = `${Date.now()}-roadsign-archive.zip` const destName = path.join(os.tmpdir(), `${Date.now()}-roadsign-archive.zip`)
child_process.execSync(`zip -rj ${destName} ${input}`) child_process.execSync(`cd ${input} && zip -r ${destName} .`)
const compressPrefTook = performance.now() - compressPrefStart const compressPrefTook = performance.now() - compressPrefStart
compressSpinner.succeed(`Compressing completed in ${(compressPrefTook / 1000).toFixed(2)}s 🎉`) compressSpinner.succeed(`Compressing completed in ${(compressPrefTook / 1000).toFixed(2)}s 🎉`)
input = destName input = destName