@lazycatcloud/lzc-cli 1.2.34 → 1.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app/lpk_devshell.js +1 -1
- package/lib/app/lpk_installer.js +2 -3
- package/lib/appstore/prePublish.js +2 -3
- package/lib/appstore/publish.js +2 -3
- package/lib/utils.js +11 -0
- package/package.json +2 -1
package/lib/app/lpk_devshell.js
CHANGED
|
@@ -447,7 +447,7 @@ class DevShell {
|
|
|
447
447
|
try {
|
|
448
448
|
execSync(
|
|
449
449
|
`rsync ${rsyncDebug} --rsh='${rsh}' --recursive --relative --perms --update -F --filter=':- .gitignore' --ignore-errors . ${dest}`,
|
|
450
|
-
{ stdio: ["ignore", "inherit", "inherit"] }
|
|
450
|
+
{ stdio: ["ignore", isDebugMode() ? "inherit" : "ignore", "inherit"] }
|
|
451
451
|
)
|
|
452
452
|
} catch (err) {
|
|
453
453
|
logger.error("rsync 同步失败")
|
package/lib/app/lpk_installer.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import logger from "loglevel"
|
|
2
2
|
import fs from "node:fs"
|
|
3
3
|
import path from "node:path"
|
|
4
|
-
import { loadFromYaml, Downloader } from "../utils.js"
|
|
5
|
-
import { spawnSync } from "node:child_process"
|
|
4
|
+
import { loadFromYaml, Downloader, unzipSync } from "../utils.js"
|
|
6
5
|
import { DebugBridge } from "./lpk_debug_bridge.js"
|
|
7
6
|
import shellapi from "../shellapi.js"
|
|
8
7
|
import { triggerApk } from "./apkshell.js"
|
|
@@ -94,7 +93,7 @@ export class LpkInstaller {
|
|
|
94
93
|
const tempDir = fs.mkdtempSync(".lzc-cli-install")
|
|
95
94
|
let manifest
|
|
96
95
|
try {
|
|
97
|
-
|
|
96
|
+
unzipSync(pkgPath, tempDir)
|
|
98
97
|
manifest = loadFromYaml(path.join(tempDir, "manifest.yml"))
|
|
99
98
|
logger.debug("是否生成APK:", installConfig.apk)
|
|
100
99
|
if (installConfig.apk) {
|
|
@@ -3,9 +3,8 @@ import logger from "loglevel"
|
|
|
3
3
|
import FormData from "form-data"
|
|
4
4
|
import fs from "node:fs"
|
|
5
5
|
import inquirer from "inquirer"
|
|
6
|
-
import { spawnSync } from "node:child_process"
|
|
7
6
|
import path from "node:path"
|
|
8
|
-
import { isFileExist, isPngWithFile } from "../utils.js"
|
|
7
|
+
import { isFileExist, isPngWithFile, unzipSync } from "../utils.js"
|
|
9
8
|
import env from "../env.js"
|
|
10
9
|
|
|
11
10
|
async function askChangeLog() {
|
|
@@ -50,7 +49,7 @@ export class PrePublish {
|
|
|
50
49
|
preCheck(pkgPath) {
|
|
51
50
|
const tempDir = fs.mkdtempSync(".lzc-cli-publish")
|
|
52
51
|
try {
|
|
53
|
-
|
|
52
|
+
unzipSync(pkgPath, tempDir)
|
|
54
53
|
if (isFileExist(path.join(tempDir, "devshell"))) {
|
|
55
54
|
logger.error(
|
|
56
55
|
"不能发布一个devshell的版本,请重新使用 `lzc-cli project build` 构建"
|
package/lib/appstore/publish.js
CHANGED
|
@@ -3,9 +3,8 @@ import logger from "loglevel"
|
|
|
3
3
|
import FormData from "form-data"
|
|
4
4
|
import fs from "node:fs"
|
|
5
5
|
import inquirer from "inquirer"
|
|
6
|
-
import { spawnSync } from "node:child_process"
|
|
7
6
|
import path from "node:path"
|
|
8
|
-
import { isFileExist, isPngWithFile } from "../utils.js"
|
|
7
|
+
import { isFileExist, isPngWithFile, unzipSync } from "../utils.js"
|
|
9
8
|
|
|
10
9
|
async function askChangeLog() {
|
|
11
10
|
const noEmpty = (value) => value != ""
|
|
@@ -36,7 +35,7 @@ export class Publish {
|
|
|
36
35
|
preCheck(pkgPath) {
|
|
37
36
|
const tempDir = fs.mkdtempSync(".lzc-cli-publish")
|
|
38
37
|
try {
|
|
39
|
-
|
|
38
|
+
unzipSync(pkgPath, tempDir)
|
|
40
39
|
if (isFileExist(path.join(tempDir, "devshell"))) {
|
|
41
40
|
logger.error(
|
|
42
41
|
"不能发布一个devshell的版本,请重新使用 `lzc-cli project build` 构建"
|
package/lib/utils.js
CHANGED
|
@@ -17,6 +17,7 @@ import logger from "loglevel"
|
|
|
17
17
|
import * as tar from "tar"
|
|
18
18
|
import dns from "node:dns/promises"
|
|
19
19
|
import axios from "axios"
|
|
20
|
+
import AdmZip from "adm-zip"
|
|
20
21
|
|
|
21
22
|
// 创建 Axios 实例
|
|
22
23
|
export const api = axios.create()
|
|
@@ -475,3 +476,13 @@ export function sshCmd(...args) {
|
|
|
475
476
|
const options = [...defaultOptions, ...args].join(" ")
|
|
476
477
|
return `${baseCommand} ${options}`
|
|
477
478
|
}
|
|
479
|
+
|
|
480
|
+
export function unzipSync(zipPath, destPath) {
|
|
481
|
+
// 确保目标目录存在
|
|
482
|
+
fs.mkdirSync(destPath, { recursive: true })
|
|
483
|
+
// 创建 zip 实例
|
|
484
|
+
const zip = new AdmZip(zipPath)
|
|
485
|
+
|
|
486
|
+
// 同步解压所有文件
|
|
487
|
+
zip.extractAllTo(destPath, true)
|
|
488
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazycatcloud/lzc-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.35",
|
|
4
4
|
"description": "lazycat cloud developer kit",
|
|
5
5
|
"files": [
|
|
6
6
|
"template",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"@balena/dockerignore": "^1.0.2",
|
|
21
21
|
"@grpc/grpc-js": "^1.11.1",
|
|
22
22
|
"@grpc/proto-loader": "^0.7.13",
|
|
23
|
+
"adm-zip": "^0.5.16",
|
|
23
24
|
"archiver": "^7.0.1",
|
|
24
25
|
"axios": "^1.7.7",
|
|
25
26
|
"chalk": "^5.3.0",
|