feat: unwrap Archive namespace to flat exports + barrel (#22722)
This commit is contained in:
@@ -8,7 +8,7 @@ import fs from "fs/promises"
|
|||||||
import { Filesystem } from "../util/filesystem"
|
import { Filesystem } from "../util/filesystem"
|
||||||
import { Instance } from "../project/instance"
|
import { Instance } from "../project/instance"
|
||||||
import { Flag } from "../flag/flag"
|
import { Flag } from "../flag/flag"
|
||||||
import { Archive } from "../util/archive"
|
import { Archive } from "../util"
|
||||||
import { Process } from "../util/process"
|
import { Process } from "../util/process"
|
||||||
import { which } from "../util/which"
|
import { which } from "../util/which"
|
||||||
import { Module } from "@opencode-ai/shared/util/module"
|
import { Module } from "@opencode-ai/shared/util/module"
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
import path from "path"
|
import path from "path"
|
||||||
import { Process } from "./process"
|
import { Process } from "./process"
|
||||||
|
|
||||||
export namespace Archive {
|
export async function extractZip(zipPath: string, destDir: string) {
|
||||||
export async function extractZip(zipPath: string, destDir: string) {
|
if (process.platform === "win32") {
|
||||||
if (process.platform === "win32") {
|
const winZipPath = path.resolve(zipPath)
|
||||||
const winZipPath = path.resolve(zipPath)
|
const winDestDir = path.resolve(destDir)
|
||||||
const winDestDir = path.resolve(destDir)
|
// $global:ProgressPreference suppresses PowerShell's blue progress bar popup
|
||||||
// $global:ProgressPreference suppresses PowerShell's blue progress bar popup
|
const cmd = `$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path '${winZipPath}' -DestinationPath '${winDestDir}' -Force`
|
||||||
const cmd = `$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path '${winZipPath}' -DestinationPath '${winDestDir}' -Force`
|
await Process.run(["powershell", "-NoProfile", "-NonInteractive", "-Command", cmd])
|
||||||
await Process.run(["powershell", "-NoProfile", "-NonInteractive", "-Command", cmd])
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await Process.run(["unzip", "-o", "-q", zipPath, "-d", destDir])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await Process.run(["unzip", "-o", "-q", zipPath, "-d", destDir])
|
||||||
}
|
}
|
||||||
|
|||||||
1
packages/opencode/src/util/index.ts
Normal file
1
packages/opencode/src/util/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * as Archive from "./archive"
|
||||||
Reference in New Issue
Block a user