@lazycatcloud/lzc-cli 1.3.3 → 1.3.4

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/changelog.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.3.4
2
+
3
+ 1. 添加算力舱和浏览器插件打包
4
+
1
5
  # 1.3.3
2
6
 
3
7
  1. 拷贝镜像过程中显示进度
@@ -4,6 +4,7 @@ import logger from "loglevel"
4
4
  import {
5
5
  loadFromYaml,
6
6
  isDirExist,
7
+ isDirSync,
7
8
  isFileExist,
8
9
  dumpToYaml,
9
10
  envTemplateFile,
@@ -255,6 +256,8 @@ export class LpkBuild {
255
256
 
256
257
  const tempDir = fs.mkdtempSync(".lzc-cli-build")
257
258
  let contentdir = this.options["contentdir"]
259
+ let browserExtension = this.options["browser-extension"]
260
+ let aiPodService = this.options["ai-pod-service"]
258
261
  try {
259
262
  if (contentdir) {
260
263
  contentdir = path.resolve(this.pwd, contentdir)
@@ -283,6 +286,32 @@ export class LpkBuild {
283
286
  fs.rmSync(contentdir, { recursive: true })
284
287
  }
285
288
 
289
+ if (browserExtension) {
290
+ browserExtension = path.resolve(this.pwd, browserExtension)
291
+
292
+ if (isDirSync(browserExtension)) {
293
+ // 开始打包 browserExtensionDir,这里打包成 zip 包
294
+ await archiveFolderTo(
295
+ browserExtension,
296
+ path.join(tempDir, "extension.zip")
297
+ )
298
+ } else if (isFileExist(browserExtension)) {
299
+ fs.copyFileSync(browserExtension, path.join(tempDir, "extension.zip"))
300
+ } else {
301
+ throw `${browserExtension} 不存在`
302
+ }
303
+ }
304
+
305
+ if (aiPodService) {
306
+ aiPodService = path.resolve(this.pwd, aiPodService)
307
+ if (!isDirExist(aiPodService)) {
308
+ throw `${aiPodService} 不存在`
309
+ }
310
+ fs.cpSync(aiPodService, path.join(tempDir, "ai-pod-service"), {
311
+ recursive: true
312
+ })
313
+ }
314
+
286
315
  // 开始生成 manifest.yml
287
316
  let manifest = await this.getManifest()
288
317
  if (process.env.LZC_VERSION) {
@@ -306,8 +335,11 @@ export class LpkBuild {
306
335
  }
307
336
 
308
337
  // compose.override.yml
309
- if (this.options['compose_override']) {
310
- dumpToYaml(this.options['compose_override'], path.join(tempDir, "compose.override.yml"))
338
+ if (this.options["compose_override"]) {
339
+ dumpToYaml(
340
+ this.options["compose_override"],
341
+ path.join(tempDir, "compose.override.yml")
342
+ )
311
343
  }
312
344
 
313
345
  // 打包 lpk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-cli",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "lazycat cloud developer kit",
5
5
  "scripts": {
6
6
  "prepublishOnly": "node check-changelog.js"