@lazycatcloud/lzc-cli 1.3.6 → 1.3.7

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.7
2
+
3
+ 1. 修复错误的 lzc-manifest 字段读取匹配
4
+
1
5
  # 1.3.6
2
6
 
3
7
  1. 处理创建的应用模板 `routes` 字段命名错误问题
@@ -211,6 +211,9 @@ export class LpkBuild {
211
211
  let lpkM = new LpkManifest()
212
212
  await lpkM.init(this.manifestFilePath)
213
213
  this.manifest = lpkM.manifest
214
+ // manifest使用 text/template模板时,标记为异常manifest
215
+ // 创建lpk时,直接将源文件拷入 lpk
216
+ this.excpManifest = lpkM.excpManifest
214
217
 
215
218
  if (!isValidPackageName(this.manifest["package"])) {
216
219
  throw `${this.manifest["package"]} 含有非法字符,请使用正确的包名格式(java的包名格式),如:cloud.lazycat.apps.video`
@@ -331,7 +334,12 @@ export class LpkBuild {
331
334
  )
332
335
  } else {
333
336
  logger.debug("manifest\n", manifest)
334
- dumpToYaml(manifest, path.join(tempDir, "manifest.yml"))
337
+ // 异常的manifest,就将源文件给转到lpk内
338
+ if (this.excpManifest) {
339
+ fs.writeFileSync(path.join(tempDir, "manifest.yml"), fs.readFileSync(this.manifestFilePath, "utf8"))
340
+ } else {
341
+ dumpToYaml(manifest, path.join(tempDir, "manifest.yml"))
342
+ }
335
343
  }
336
344
 
337
345
  // compose.override.yml
@@ -45,6 +45,7 @@ export class LpkManifest {
45
45
  this.manifest = loadFromYaml(manifestFilePath)
46
46
  } catch (err) {
47
47
  this.manifest = fakeLoadManifestYml(manifestFilePath)
48
+ this.excpManifest = true
48
49
  }
49
50
  }
50
51
  }
package/lib/utils.js CHANGED
@@ -180,13 +180,13 @@ export function fakeLoadManifestYml(file) {
180
180
  }
181
181
  res.split("\n").forEach(v => {
182
182
  let line = v.trim().replace(" ", "")
183
- if (line.includes("package") && line.split(":").length == 2) {
183
+ if (!obj.package && line.includes("package:") && line.split(":").length == 2) {
184
184
  obj.package = line.split(":")[1]
185
185
  }
186
- if (line.includes("subdomain") && line.split(":").length == 2) {
186
+ if (!obj.application.subdomain && line.includes("subdomain:") && line.split(":").length == 2) {
187
187
  obj.application.subdomain = line.split(":")[1]
188
188
  }
189
- if (line.includes("version") && line.split(":").length == 2) {
189
+ if (!obj.version && line.includes("version:") && line.split(":").length == 2) {
190
190
  obj.version = line.split(":")[1]
191
191
  }
192
192
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-cli",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "description": "lazycat cloud developer kit",
5
5
  "scripts": {
6
6
  "prepublishOnly": "node check-changelog.js"