@lazycatcloud/lzc-cli 1.3.6 → 1.3.8

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,11 @@
1
+ # 1.3.8
2
+
3
+ 1. 修复hellowrold路由路径不对
4
+
5
+ # 1.3.7
6
+
7
+ 1. 修复错误的 lzc-manifest 字段读取匹配
8
+
1
9
  # 1.3.6
2
10
 
3
11
  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
@@ -178,16 +178,23 @@ export function fakeLoadManifestYml(file) {
178
178
  subdomain: undefined,
179
179
  },
180
180
  }
181
+
181
182
  res.split("\n").forEach(v => {
182
- let line = v.trim().replace(" ", "")
183
- if (line.includes("package") && line.split(":").length == 2) {
184
- obj.package = line.split(":")[1]
183
+ let line = v.trim()
184
+ const arr = line.split(":")
185
+ if (arr.length != 2) {
186
+ return
187
+ }
188
+ let [key, value] = arr
189
+ value = value.trim()
190
+ if (!obj.package && key == "package") {
191
+ obj.package = value
185
192
  }
186
- if (line.includes("subdomain") && line.split(":").length == 2) {
187
- obj.application.subdomain = line.split(":")[1]
193
+ if (!obj.application.subdomain && key == "subdomain") {
194
+ obj.application.subdomain = value
188
195
  }
189
- if (line.includes("version") && line.split(":").length == 2) {
190
- obj.version = line.split(":")[1]
196
+ if (!obj.version && key == "version") {
197
+ obj.version = value
191
198
  }
192
199
  })
193
200
  return obj
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.8",
4
4
  "description": "lazycat cloud developer kit",
5
5
  "scripts": {
6
6
  "prepublishOnly": "node check-changelog.js"
@@ -11,4 +11,4 @@ author: # app author
11
11
  application:
12
12
  subdomain: ${subdomain} #期望的app域名
13
13
  routes:
14
- - /=file:///lzcapp/pkg/content
14
+ - /=file:///lzcapp/pkg/content/dist