@lazycatcloud/lzc-cli 1.2.59 → 1.2.61

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.
Files changed (58) hide show
  1. package/changelog.md +8 -0
  2. package/lib/app/lpk_build.js +5 -0
  3. package/lib/app/lpk_create_generator.js +0 -152
  4. package/lib/appstore/login.js +13 -1
  5. package/package.json +1 -1
  6. package/template/blank/lzc-build.yml +15 -16
  7. package/template/blank/lzc-manifest.yml +4 -4
  8. package/template/_lpk/golang.manifest.yml.in +0 -16
  9. package/template/_lpk/lite.manifest.yml.in +0 -19
  10. package/template/golang/.godir +0 -1
  11. package/template/golang/README.md +0 -10
  12. package/template/golang/_gitignore +0 -2
  13. package/template/golang/assets/css/bootstrap-responsive.css +0 -1091
  14. package/template/golang/assets/css/bootstrap-responsive.min.css +0 -1073
  15. package/template/golang/assets/css/bootstrap.css +0 -6264
  16. package/template/golang/assets/css/bootstrap.min.css +0 -5307
  17. package/template/golang/assets/css/rego.css +0 -45
  18. package/template/golang/assets/img/glyphicons-halflings-white.png +0 -0
  19. package/template/golang/assets/img/glyphicons-halflings.png +0 -0
  20. package/template/golang/assets/js/bootstrap.js +0 -2054
  21. package/template/golang/assets/js/bootstrap.min.js +0 -1241
  22. package/template/golang/assets/js/rego.js +0 -132
  23. package/template/golang/build.sh +0 -12
  24. package/template/golang/go.mod +0 -3
  25. package/template/golang/index.html +0 -269
  26. package/template/golang/lazycat.png +0 -0
  27. package/template/golang/lzc-build.yml +0 -60
  28. package/template/golang/rego.go +0 -82
  29. package/template/golang/rego_test.go +0 -13
  30. package/template/ionic_vue3/README.md +0 -46
  31. package/template/ionic_vue3/_eslintrc.cjs +0 -24
  32. package/template/ionic_vue3/_gitignore +0 -29
  33. package/template/ionic_vue3/_vscode/extensions.json +0 -6
  34. package/template/ionic_vue3/capacitor.config.ts +0 -10
  35. package/template/ionic_vue3/env.d.ts +0 -1
  36. package/template/ionic_vue3/index.html +0 -13
  37. package/template/ionic_vue3/ionic.config.json +0 -7
  38. package/template/ionic_vue3/lazycat.png +0 -0
  39. package/template/ionic_vue3/lzc-build.yml +0 -61
  40. package/template/ionic_vue3/package-lock.json +0 -8100
  41. package/template/ionic_vue3/package.json +0 -52
  42. package/template/ionic_vue3/postcss.config.js +0 -6
  43. package/template/ionic_vue3/public/favicon.ico +0 -0
  44. package/template/ionic_vue3/src/App.vue +0 -11
  45. package/template/ionic_vue3/src/assets/logo.svg +0 -1
  46. package/template/ionic_vue3/src/index.css +0 -3
  47. package/template/ionic_vue3/src/main.ts +0 -35
  48. package/template/ionic_vue3/src/router/index.ts +0 -15
  49. package/template/ionic_vue3/src/theme/variables.css +0 -231
  50. package/template/ionic_vue3/src/views/Home.vue +0 -38
  51. package/template/ionic_vue3/tailwind.config.js +0 -7
  52. package/template/ionic_vue3/tsconfig.json +0 -16
  53. package/template/ionic_vue3/tsconfig.vite-config.json +0 -8
  54. package/template/ionic_vue3/vite.config.ts +0 -28
  55. package/template/lite/_gitignore +0 -4
  56. package/template/lite/error_pages/502.html.tpl +0 -13
  57. package/template/lite/lazycat.png +0 -0
  58. package/template/lite/lzc-build.yml +0 -59
package/changelog.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 1.2.61
2
+ 1. 修复 lzc-build 文件配置 `compose.override` 字段不生效问题
3
+
4
+ # 1.2.60
5
+ 1. 添加用户登录友好提示
6
+ 2. 移除已弃用模版
7
+ 3. 支持 lzc-build 文件配置 `compose.override` 字段
8
+
1
9
  # 1.2.59
2
10
 
3
11
  1. 修复 copy-image 网关超时
@@ -305,6 +305,11 @@ export class LpkBuild {
305
305
  dumpToYaml(manifest, path.join(tempDir, "manifest.yml"))
306
306
  }
307
307
 
308
+ // compose.override.yml
309
+ if (this.options['compose_override']) {
310
+ dumpToYaml(this.options['compose_override'], path.join(tempDir, "compose.override.yml"))
311
+ }
312
+
308
313
  // 打包 lpk
309
314
  if (this.beforeDumpLpkFn.length > 0) {
310
315
  await this.beforeDumpLpkFn.reduce(async (prev, curr) => {
@@ -55,81 +55,6 @@ export async function generate(type, to, opts = {}) {
55
55
  writeFileTree(to, files)
56
56
  }
57
57
 
58
- function appendREADME(dir) {
59
- const readme = path.resolve(dir, "README.md")
60
- const readmeTemplate = path.resolve(
61
- __dirname,
62
- "..",
63
- "..",
64
- "template",
65
- "_lpk",
66
- "README.md"
67
- )
68
- if (!isFileExist(readme)) {
69
- fs.copyFileSync(readmeTemplate, readme)
70
- } else {
71
- const contentStream = fs.readFileSync(readmeTemplate, {
72
- encoding: "utf-8"
73
- })
74
- fs.writeFileSync(readme, contentStream, { flag: "a" })
75
- }
76
- }
77
-
78
- function vueTemplate(type) {
79
- const v = type == "vue3" ? "vue@3" : "vue@2"
80
- return {
81
- build: async (to, option) => {
82
- spawn.sync("npm", ["init", v, path.basename(to)], { stdio: "inherit" })
83
- },
84
- after: async function (name, cwd) {
85
- spawn.sync("npm", ["install"], {
86
- cwd: path.resolve(cwd, name),
87
- stdio: "inherit"
88
- })
89
-
90
- const lzcBuildTemplatePath = path.resolve(
91
- __dirname,
92
- "..",
93
- "..",
94
- "template",
95
- "_lpk",
96
- "vue.lzc-build.yml.in"
97
- )
98
- logger.debug("复制", lzcBuildTemplatePath)
99
- fs.copyFileSync(lzcBuildTemplatePath, path.resolve(name, "lzc-build.yml"))
100
-
101
- const iconPngPath = path.resolve(
102
- __dirname,
103
- "..",
104
- "..",
105
- "template",
106
- "_lpk",
107
- "lazycat.png"
108
- )
109
- fs.copyFileSync(iconPngPath, path.resolve(name, "lazycat.png"))
110
-
111
- // 更改默认的端口
112
- const packageJson = path.resolve(name, "package.json")
113
- const pkgInfo = JSON.parse(fs.readFileSync(packageJson))
114
- pkgInfo["scripts"]["dev"] = `vite --port 3000 --host`
115
- fs.writeFileSync(packageJson, JSON.stringify(pkgInfo, null, " "))
116
-
117
- appendREADME(path.resolve(cwd, name))
118
-
119
- console.log(
120
- chalk.green(
121
- `
122
- 🚀 构建 lpk 包
123
- ${chalk.yellow(`lzc-cli project build -o ${name}.lpk`)}
124
- ⚙️ 将应用安装至设备中:
125
- ${chalk.yellow(`lzc-cli app install ${name}.lpk`)}
126
- `.trim()
127
- )
128
- )
129
- }
130
- }
131
- }
132
-
133
58
  function appCreateSuccessTip(name) {
134
59
  console.log(
135
60
  chalk.green(
@@ -162,82 +87,5 @@ export const TemplateConfig = {
162
87
  )
163
88
  )
164
89
  }
165
- },
166
- // vue3: vueTemplate("vue3"),
167
- vue2: vueTemplate("vue2"),
168
- lite: {
169
- build: async (to, option) => {
170
- await generate("lite", to, option)
171
- },
172
- after: async function (name, cwd) {
173
- appendREADME(path.resolve(cwd, name))
174
-
175
- console.log(
176
- chalk.green(
177
- `
178
- ✨ 懒猫云应用 ${name} 已创建:
179
- ${chalk.yellow(`cd ${name}`)}
180
- 🚀 构建 lpk 包
181
- ${chalk.yellow(`lzc-cli project build -o ${name}.lpk`)}
182
- ⚙️ 将应用安装至设备中:
183
- ${chalk.yellow(`lzc-cli app install ${name}.lpk`)}
184
- `.trim()
185
- )
186
- )
187
- }
188
- },
189
- ionic_vue3: {
190
- build: async (to, option) => {
191
- await generate("ionic_vue3", to, option)
192
- },
193
- after: async function (name, cwd) {
194
- appendREADME(path.resolve(cwd, name))
195
-
196
- console.log(chalk.green("开始安装依赖"))
197
- spawn.sync("npm", ["install"], {
198
- cwd: path.join(cwd, name),
199
- stdio: "inherit"
200
- })
201
-
202
- console.log(
203
- chalk.green(
204
- `
205
- ✨ 懒猫云应用 ${name} 已创建:
206
- ${chalk.yellow(`cd ${name}`)}
207
- ${chalk.yellow(`npm run dev`)}
208
- 🚀 构建 lpk 包
209
- ${chalk.yellow(`lzc-cli project build -o ${name}.lpk`)}
210
- ⚙️ 将应用安装至设备中:
211
- ${chalk.yellow(`lzc-cli app install ${name}.lpk`)}
212
- 📄 生成android代码:
213
- ${chalk.yellow(`npm run build_android`)}
214
- 📄 生成ios代码:
215
- ${chalk.yellow(`npm run build_ios`)}
216
- `.trim()
217
- )
218
- )
219
- }
220
- },
221
- golang: {
222
- build: async (to, option) => {
223
- await generate("golang", to, option)
224
- },
225
- after: function (name, cwd) {
226
- appendREADME(path.resolve(cwd, name))
227
-
228
- console.log(
229
- chalk.green(
230
- `
231
- ✨ 懒猫云应用 ${name} 已创建:
232
- ${chalk.yellow(`cd ${name}`)}
233
- ${chalk.yellow(`go run .`)}
234
- 🚀 构建 lpk 包
235
- ${chalk.yellow(`lzc-cli project build -o ${name}.lpk`)}
236
- ⚙️ 将应用安装至设备中:
237
- ${chalk.yellow(`lzc-cli app install ${name}.lpk`)}
238
- `.trim()
239
- )
240
- )
241
- }
242
90
  }
243
91
  }
@@ -84,11 +84,19 @@ async function interactiveLogin() {
84
84
  await login(info.username, info.password)
85
85
  } catch (e) {
86
86
  logger.debug("login error: ", e)
87
- logger.info("帐号或者密码错误,请重新输入!")
87
+ logger.error("帐号或者密码错误,请重新输入!")
88
88
  return interactiveLogin()
89
89
  }
90
90
  }
91
91
 
92
+ function tipsFirstLogin() {
93
+ let token = env.get("token")
94
+ if (!token) {
95
+ // 还没登录过的用户提示用户前往 https://developer.lazycat.cloud/manage 注册开发者账号
96
+ logger.info("请登录懒猫微服社区账号,账号注册以及开发者权限申请地址: https://developer.lazycat.cloud/manage")
97
+ }
98
+ }
99
+
92
100
  export async function reLogin() {
93
101
  let token = await isLogin()
94
102
  if (token) {
@@ -105,6 +113,8 @@ export async function reLogin() {
105
113
  logger.info(`token: ${token}`)
106
114
  return
107
115
  }
116
+ } else {
117
+ tipsFirstLogin()
108
118
  }
109
119
  await interactiveLogin()
110
120
  }
@@ -114,6 +124,8 @@ export async function autoLogin() {
114
124
  if (token) {
115
125
  logger.debug("appstore 已经登录")
116
126
  return
127
+ } else {
128
+ tipsFirstLogin()
117
129
  }
118
130
 
119
131
  logger.debug("token错误,尝试自动登录")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazycatcloud/lzc-cli",
3
- "version": "1.2.59",
3
+ "version": "1.2.61",
4
4
  "description": "lazycat cloud developer kit",
5
5
  "scripts": {
6
6
  "prepublishOnly": "node check-changelog.js"
@@ -3,13 +3,13 @@
3
3
  # buildscript
4
4
  # - 可以为构建脚本的路径地址
5
5
  # - 如果构建命令简单,也可以直接写 sh 的命令
6
- buildscript: npm run build
6
+ # buildscript:
7
7
 
8
8
  # manifest: 指定 lpk 包的 manifest.yml 文件路径
9
9
  manifest: ./lzc-manifest.yml
10
10
 
11
11
  # contentdir: 指定打包的内容,将会打包到 lpk 中
12
- contentdir: ./dist
12
+ # contentdir: ./
13
13
 
14
14
  # pkgout: lpk 包的输出路径
15
15
  pkgout: ./
@@ -17,7 +17,6 @@ pkgout: ./
17
17
  # icon 指定 lpk 包 icon 的路径路径,如果不指定将会警告
18
18
  # icon 仅仅允许 png 后缀的文件
19
19
  icon: ./lzc-icon.png
20
-
21
20
  # devshell 自定义应用的开发容器环境
22
21
  # - routers 指定应用容器的访问路由
23
22
 
@@ -44,16 +43,16 @@ icon: ./lzc-icon.png
44
43
  # dvshell 指定开发依赖的情况
45
44
  # 这种情况下,选用 alpine:latest 作为基础镜像,在 dependencies 中添加所需要的开发依赖即可
46
45
  # 如果 dependencies 和 build 同时存在,将会优先使用 dependencies
47
- devshell:
48
- routes:
49
- - /=http://127.0.0.1:3000
50
- dependencies:
51
- - nodejs
52
- - npm
53
- # setupscript 每次进入到app container后都会执行的配置脚本
54
- # - 可以为脚本的路径地址
55
- # - 如果构建命令简单,也可以直接写 sh 的命令
56
- # setupscript: export GOPROXY=https://goproxy.cn
57
- # setupscript: ./setupscript.sh
58
- setupscript: |
59
- export npm_config_registry=https://registry.npmmirror.com
46
+ # devshell:
47
+ # routes:
48
+ # - /=http://127.0.0.1:3000
49
+ # dependencies:
50
+ # - nodejs
51
+ # - npm
52
+ # # setupscript 每次进入到app container后都会执行的配置脚本
53
+ # # - 可以为脚本的路径地址
54
+ # # - 如果构建命令简单,也可以直接写 sh 的命令
55
+ # # setupscript: export GOPROXY=https://goproxy.cn
56
+ # # setupscript: ./setupscript.sh
57
+ # setupscript: |
58
+ # export npm_config_registry=https://registry.npmmirror.com
@@ -2,11 +2,11 @@ lzc-sdk-version: 0.1
2
2
  name: helloworld
3
3
  package: cloud.lazycat.app.helloworld
4
4
  version: 0.0.1
5
- description:
5
+ description:
6
6
  license: https://choosealicense.com/licenses/mit/
7
- homepage:
8
- author:
7
+ homepage:
8
+ author:
9
9
  application:
10
10
  subdomain: helloworld
11
11
  routes:
12
- - /=file:///lzcapp/pkg/content/dist
12
+ - /=https://developer.lazycat.cloud/
@@ -1,16 +0,0 @@
1
- lzc-sdk-version: 0.1
2
-
3
- package: ${package} # app的唯一标识符
4
- version: ${version} # app的版本
5
- name: ${name} # app名称
6
- description: ${description} # app描述
7
-
8
- license: https://choosealicense.com/licenses/mit/
9
- homepage: ${homepage} # 出现bug时候提交反馈的地方
10
- author: ${author} # app author
11
-
12
- #application作为一个特殊的container运行,对应的service名称为固定的`app`,其他service可以通过此名称与app进行通讯
13
- application:
14
- subdomain: ${subdomain} #期望的app域名
15
- routes:
16
- - /=exec://3000,/lzcapp/pkg/content/rego -html /lzcapp/pkg/content/index.html
@@ -1,19 +0,0 @@
1
- lzc-sdk-version: 0.1
2
-
3
- package: ${package} # app的唯一标识符
4
- version: ${version} # app的版本
5
- name: ${name} # app名称
6
- description: ${description} # app描述
7
-
8
- license: https://choosealicense.com/licenses/mit/
9
- homepage: ${homepage} # 出现bug时候提交反馈的地方
10
- author: ${author} # app author
11
-
12
- #application作为一个特殊的container运行,对应的service名称为固定的`app`,其他service可以通过此名称与app进行通讯
13
- application:
14
- subdomain: ${subdomain} #期望的app域名
15
- routes:
16
- - /=https://lazycat.cloud
17
- handlers:
18
- error_page_templates:
19
- 502: /lzcapp/pkg/content/502.html.tpl
@@ -1 +0,0 @@
1
- rego
@@ -1,10 +0,0 @@
1
- # rego
2
-
3
- Rego is an online Go regular expression tester
4
-
5
- Inspired by [rubular](http://rubular.com/).
6
-
7
- ## TODO
8
-
9
- - Sharing (permalink)
10
- - Add developer documentation
@@ -1,2 +0,0 @@
1
- build/*
2
- *.lpk