@lazycatcloud/lzc-cli 1.1.8 → 1.1.9

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 (105) hide show
  1. package/README.md +69 -11
  2. package/lib/api.js +71 -39
  3. package/lib/app/index.js +76 -21
  4. package/lib/app/lpk_build.js +95 -63
  5. package/lib/app/lpk_create.js +63 -41
  6. package/lib/app/lpk_create_generator.js +202 -0
  7. package/lib/app/lpk_devshell.js +393 -328
  8. package/lib/app/lpk_devshell_docker.js +211 -0
  9. package/lib/app/lpk_installer.js +63 -26
  10. package/lib/app/lpk_log.js +68 -0
  11. package/lib/app/lpk_status.js +18 -0
  12. package/lib/app/lpk_uninstall.js +19 -0
  13. package/lib/appstore/index.js +37 -0
  14. package/lib/appstore/login.js +96 -93
  15. package/lib/appstore/publish.js +62 -0
  16. package/lib/autologin.js +0 -78
  17. package/lib/box/api/clientapi.js +1322 -0
  18. package/lib/box/api/empty.js +35 -0
  19. package/lib/box/check_qemu.js +1 -0
  20. package/lib/box/index.js +41 -94
  21. package/lib/box/qemu_vm_mgr.js +208 -239
  22. package/lib/box/schemes/vm_box_system_debian.json +1 -1
  23. package/lib/docker-compose.js +1 -2
  24. package/lib/env.js +19 -101
  25. package/lib/key.js +1 -0
  26. package/lib/sdk.js +10 -25
  27. package/lib/utils.js +156 -132
  28. package/package.json +19 -10
  29. package/scripts/cli.js +14 -135
  30. package/template/_lpk/README.md +31 -0
  31. package/template/_lpk/exec.sh +19 -0
  32. package/template/_lpk/golang.manifest.yml.in +16 -0
  33. package/template/_lpk/lazycat.png +0 -0
  34. package/template/_lpk/lite.manifest.yml.in +19 -0
  35. package/template/_lpk/local_devshell/Dockerfile +16 -0
  36. package/template/_lpk/local_devshell/build.sh +5 -0
  37. package/template/_lpk/local_devshell/entrypoint.sh +87 -0
  38. package/template/{_lazycat/debug/shell → _lpk/local_devshell}/sshd_config +8 -8
  39. package/template/_lpk/manifest.yml.in +0 -1
  40. package/template/{vue/lzc-build.yml → _lpk/vue.lzc-build.yml.in} +9 -1
  41. package/template/golang/README.md +0 -2
  42. package/template/golang/_gitignore +2 -0
  43. package/template/golang/build.sh +6 -0
  44. package/template/golang/lazycat.png +0 -0
  45. package/template/golang/lzc-build.yml +9 -1
  46. package/template/golang/rego.go +15 -16
  47. package/template/golang/rego_test.go +13 -0
  48. package/template/ionic_vue3/lazycat.png +0 -0
  49. package/template/ionic_vue3/lzc-build.yml +9 -1
  50. package/template/lite/error_pages/502.html.tpl +13 -0
  51. package/template/lite/lazycat.png +0 -0
  52. package/template/lite/lzc-build.yml +60 -0
  53. package/cmds/app.js +0 -133
  54. package/cmds/config.js +0 -55
  55. package/cmds/create.js +0 -55
  56. package/cmds/dev.js +0 -130
  57. package/cmds/init.js +0 -125
  58. package/cmds/log.js +0 -103
  59. package/cmds/publish.js +0 -116
  60. package/lib/archiver.js +0 -105
  61. package/lib/box/hportal.js +0 -120
  62. package/lib/builder.js +0 -313
  63. package/lib/dev.js +0 -314
  64. package/lib/generator.js +0 -146
  65. package/template/_lazycat/_gitignore +0 -1
  66. package/template/_lazycat/app-config +0 -1
  67. package/template/_lazycat/debug/devforward/50x.html +0 -30
  68. package/template/_lazycat/debug/devforward/Dockerfile +0 -16
  69. package/template/_lazycat/debug/devforward/docker-compose.override.yml.in +0 -11
  70. package/template/_lazycat/debug/devforward/entrypoint.sh +0 -10
  71. package/template/_lazycat/debug/devforward/nginx.conf.template +0 -56
  72. package/template/_lazycat/debug/devforward/sshd_config +0 -116
  73. package/template/_lazycat/debug/shell/50x.html +0 -32
  74. package/template/_lazycat/debug/shell/Dockerfile +0 -18
  75. package/template/_lazycat/debug/shell/build.sh +0 -15
  76. package/template/_lazycat/debug/shell/docker-compose.override.yml.in +0 -13
  77. package/template/_lazycat/debug/shell/entrypoint.sh +0 -12
  78. package/template/_lazycat/docker-compose.yml.in +0 -15
  79. package/template/_lazycat/icon.svg +0 -1
  80. package/template/_lazycat/screenshot.png +0 -0
  81. package/template/_lpk/sync/Dockerfile +0 -16
  82. package/template/_lpk/sync/build.sh +0 -5
  83. package/template/_lpk/sync/entrypoint.sh +0 -8
  84. package/template/_lpk/sync/sshd_config +0 -117
  85. package/template/_lpk/sync.manifest.yml.in +0 -3
  86. package/template/release/golang/Dockerfile +0 -18
  87. package/template/release/golang/build.sh +0 -13
  88. package/template/release/ionic_vue3/Dockerfile +0 -10
  89. package/template/release/ionic_vue3/build.sh +0 -7
  90. package/template/release/ionic_vue3/docker-compose.yml.in +0 -3
  91. package/template/release/vue/Dockerfile +0 -10
  92. package/template/release/vue/build.sh +0 -10
  93. package/template/release/vue/docker-compose.yml.in +0 -3
  94. package/template/vue/README.md +0 -29
  95. package/template/vue/_dockerignore +0 -1
  96. package/template/vue/babel.config.js +0 -3
  97. package/template/vue/package.json +0 -43
  98. package/template/vue/public/favicon.ico +0 -0
  99. package/template/vue/public/index.html +0 -33
  100. package/template/vue/src/App.vue +0 -39
  101. package/template/vue/src/main.js +0 -8
  102. package/template/vue/src/todo.vue +0 -640
  103. package/template/vue/src/top-bar.vue +0 -100
  104. package/template/vue/src/webdav.vue +0 -183
  105. package/template/vue/vue.config.js +0 -21
@@ -1,32 +0,0 @@
1
- <!DOCTYPE >
2
- <html>
3
- <meta charset="utf-8" />
4
- <head>
5
- <title>OMG!!</title>
6
- </head>
7
- <body>
8
- <h1>错误,请检查相关的服务已经启动</h1>
9
- <ul>
10
- <li>执行<code>lzc-cli dev shell</code>进去app容器</li>
11
- <li>进去对应的项目路径启动相关的服务</li>
12
- <li class="warning">
13
- 服务的端口需要与<code>.lazycat/app-config</code>中定义的<code>APP_PORT</code>一致
14
- </li>
15
- </ul>
16
- </body>
17
-
18
- <style>
19
- li {
20
- margin: 14px;
21
- font-size: 1.5rem;
22
- }
23
- code {
24
- color: rgb(115 193 153);
25
- margin: 0px 14px;
26
- }
27
- .warning {
28
- width: fit-content;
29
- background-color: rgb(255 229 100 / 30%);
30
- }
31
- </style>
32
- </html>
@@ -1,18 +0,0 @@
1
- FROM registry.lazycat.cloud/lzc/lzcapp:0.1
2
-
3
- RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
4
-
5
- COPY --from=golang:1.18-alpine /usr/local/go/ /usr/local/go/
6
-
7
- RUN apk add --no-cache openssh rsync musl-dev curl openssl curl nodejs npm \
8
- && echo "root:root" | chpasswd
9
-
10
- EXPOSE 22
11
-
12
- COPY sshd_config /etc/ssh/sshd_config
13
-
14
- COPY entrypoint.sh /entrypoint.sh
15
-
16
- RUN chmod +x /entrypoint.sh
17
-
18
- ENTRYPOINT ./entrypoint.sh
@@ -1,15 +0,0 @@
1
- #!/bin/sh
2
- set -ex
3
-
4
- SHELLDIR="$(dirname "$(realpath "$0")")"
5
-
6
- cd "$SHELLDIR"
7
-
8
- mkdir -p debug/ssh
9
- if [ -f debug/ssh/id_ed25519 ]; then
10
- rm -f debug/ssh/id_ed25519
11
- rm -f debug/ssh/id_ed25519.pub
12
- fi
13
- ssh-keygen -t ed25519 -f debug/ssh/id_ed25519 -q -P ""
14
- chmod 0400 debug/ssh/id_ed25519
15
- cat debug/ssh/id_ed25519.pub > debug/ssh/authorized_keys
@@ -1,13 +0,0 @@
1
- services:
2
- ${APP_ID}:
3
- image: ${APP_IMAGE_NAME}
4
- pull_policy: build
5
- build: .
6
- environment:
7
- - HTTP_SERVICE_PORT=${HTTP_SERVICE_PORT}
8
- volumes:
9
- - ./debug/ssh:/root/.ssh
10
- - project-data:/root/
11
-
12
- volumes:
13
- project-data:
@@ -1,12 +0,0 @@
1
- #!/bin/sh
2
- set -ex
3
-
4
- # generate host keys if not present
5
- ssh-keygen -A
6
-
7
- rsync --daemon
8
-
9
- # do not detach (-D), log to stderr (-e), passthrough other arguments
10
- /usr/sbin/sshd -e "$@"
11
-
12
- exec /usr/bin/lzcinit -listen :$HTTP_SERVICE_PORT -up /="http://127.0.0.1:3000"
@@ -1,15 +0,0 @@
1
- version: "3.9"
2
- x-lazycat-app:
3
- id: ${APP_ID}
4
- title: ${APP_DESCRIPTION}
5
- version: ${APP_VERSION}
6
- description:
7
- icon: icon.svg
8
- categories:
9
- screenshots:
10
- - screenshot.png
11
- ingress:
12
- - service: ${APP_ID}
13
- port: ${HTTP_SERVICE_PORT}
14
- subdomain: ${APP_ID}
15
- auth: auto
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><title>file_type_vue</title><path d="M24.4,3.925H30L16,28.075,2,3.925H12.71L16,9.525l3.22-5.6Z" style="fill:#41b883"/><path d="M2,3.925l14,24.15L30,3.925H24.4L16,18.415,7.53,3.925Z" style="fill:#41b883"/><path d="M7.53,3.925,16,18.485l8.4-14.56H19.22L16,9.525l-3.29-5.6Z" style="fill:#35495e"/></svg>
Binary file
@@ -1,16 +0,0 @@
1
- FROM alpine
2
-
3
- RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
4
-
5
- RUN apk add --no-cache openssh openssl sshfs rsync \
6
- && echo "root:root" | chpasswd
7
-
8
- EXPOSE 22
9
-
10
- COPY sshd_config /etc/ssh/sshd_config
11
-
12
- COPY entrypoint.sh /entrypoint.sh
13
-
14
- RUN chmod +x /entrypoint.sh
15
-
16
- CMD ["./entrypoint.sh"]
@@ -1,5 +0,0 @@
1
- #!/usr/bin/sh
2
-
3
- VERSION=0.0.1
4
- docker build -f Dockerfile . -t registry.lazycat.cloud/lzc-cli/sync:$VERSION
5
- docker push registry.lazycat.cloud/lzc-cli/sync:$VERSION
@@ -1,8 +0,0 @@
1
- #!/bin/sh
2
- set -ex
3
-
4
- # generate host keys if not present
5
- ssh-keygen -A
6
-
7
- # do not detach (-D), log to stderr (-e), passthrough other arguments
8
- exec /usr/sbin/sshd -D -e "$@"
@@ -1,117 +0,0 @@
1
- # $OpenBSD: sshd_config,v 1.104 2021/07/02 05:11:21 dtucker Exp $
2
-
3
- # This is the sshd server system-wide configuration file. See
4
- # sshd_config(5) for more information.
5
-
6
- # This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
7
-
8
- # The strategy used for options in the default sshd_config shipped with
9
- # OpenSSH is to specify options with their default value where
10
- # possible, but leave them commented. Uncommented options override the
11
- # default value.
12
-
13
- # Port 22
14
- #AddressFamily any
15
- #ListenAddress 0.0.0.0
16
- #ListenAddress ::
17
-
18
- #HostKey /etc/ssh/ssh_host_rsa_key
19
- #HostKey /etc/ssh/ssh_host_ecdsa_key
20
- #HostKey /etc/ssh/ssh_host_ed25519_key
21
-
22
- # Ciphers and keying
23
- #RekeyLimit default none
24
-
25
- # Logging
26
- #SyslogFacility AUTH
27
- #LogLevel INFO
28
-
29
- # Authentication:
30
-
31
- #LoginGraceTime 2m
32
- PermitRootLogin yes
33
- #StrictModes yes
34
- #MaxAuthTries 6
35
- #MaxSessions 10
36
-
37
- PubkeyAuthentication yes
38
-
39
- # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
40
- # but this is overridden so installations will only check .ssh/authorized_keys
41
- AuthorizedKeysFile /lzcapp/pkg/content/devshell/authorized_keys
42
-
43
- #AuthorizedPrincipalsFile none
44
-
45
- #AuthorizedKeysCommand none
46
- #AuthorizedKeysCommandUser nobody
47
-
48
- # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
49
- #HostbasedAuthentication no
50
- # Change to yes if you don't trust ~/.ssh/known_hosts for
51
- # HostbasedAuthentication
52
- #IgnoreUserKnownHosts no
53
- # Don't read the user's ~/.rhosts and ~/.shosts files
54
- #IgnoreRhosts yes
55
-
56
- # To disable tunneled clear text passwords, change to no here!
57
- PasswordAuthentication no
58
- PermitEmptyPasswords no
59
-
60
- # Change to no to disable s/key passwords
61
- #KbdInteractiveAuthentication yes
62
-
63
- # Kerberos options
64
- #KerberosAuthentication no
65
- #KerberosOrLocalPasswd yes
66
- #KerberosTicketCleanup yes
67
- #KerberosGetAFSToken no
68
-
69
- # GSSAPI options
70
- #GSSAPIAuthentication no
71
- #GSSAPICleanupCredentials yes
72
-
73
- # Set this to 'yes' to enable PAM authentication, account processing,
74
- # and session processing. If this is enabled, PAM authentication will
75
- # be allowed through the KbdInteractiveAuthentication and
76
- # PasswordAuthentication. Depending on your PAM configuration,
77
- # PAM authentication via KbdInteractiveAuthentication may bypass
78
- # the setting of "PermitRootLogin without-password".
79
- # If you just want the PAM account and session checks to run without
80
- # PAM authentication, then enable this but set PasswordAuthentication
81
- # and KbdInteractiveAuthentication to 'no'.
82
- #UsePAM no
83
-
84
- #AllowAgentForwarding yes
85
- # Feel free to re-enable these if your use case requires them.
86
- AllowTcpForwarding yes
87
- GatewayPorts yes
88
- X11Forwarding no
89
- #X11DisplayOffset 10
90
- #X11UseLocalhost yes
91
- #PermitTTY yes
92
- #PrintMotd yes
93
- #PrintLastLog yes
94
- #TCPKeepAlive yes
95
- #PermitUserEnvironment no
96
- #Compression delayed
97
- ClientAliveInterval 3
98
- ClientAliveCountMax 0
99
- #UseDNS no
100
- #PidFile /run/sshd.pid
101
- #MaxStartups 10:30:100
102
- #PermitTunnel no
103
- #ChrootDirectory none
104
- #VersionAddendum none
105
-
106
- # no default banner path
107
- #Banner none
108
-
109
- # override default of no subsystems
110
- Subsystem sftp /usr/lib/ssh/sftp-server
111
-
112
- # Example of overriding settings on a per-user basis
113
- #Match User anoncvs
114
- # X11Forwarding no
115
- # AllowTcpForwarding no
116
- # PermitTTY no
117
- # ForceCommand cvs server
@@ -1,3 +0,0 @@
1
- services:
2
- sync:
3
- image: registry.lazycat.cloud/lzc-cli/sync:0.0.1
@@ -1,18 +0,0 @@
1
- FROM golang:alpine
2
- ARG HTTP_SERVICE_PORT
3
- ARG BUILD_CMD
4
-
5
- WORKDIR /app
6
- ADD build/src.tar .
7
-
8
- RUN go mod download
9
- ENV HTTP_SERVICE_PORT ${HTTP_SERVICE_PORT}
10
-
11
- RUN $BUILD_CMD
12
-
13
- EXPOSE $HTTP_SERVICE_PORT
14
-
15
- CMD ["/app/release"]
16
-
17
-
18
- # CMD caddy file-server --listen :$HTTP_SERVICE_PORT
@@ -1,13 +0,0 @@
1
- #!/bin/sh
2
- set -ex
3
-
4
- SHELLDIR="$(dirname "$(readlink -f "$0")")"
5
- cd "$SHELLDIR"
6
-
7
- mkdir build
8
-
9
- tar -cf build/src.tar --exclude='.lazycat' --exclude='.git' ../../
10
-
11
- # docker -H ssh://box@$BUILD_DOMAIN:2222 build . -t $APP_IMAGE --build-arg BUILD_CMD="$BUILD_CMD"
12
-
13
- # rm src.tar
@@ -1,10 +0,0 @@
1
- FROM registry.lazycat.cloud/lzc/lzcapp:0.1
2
-
3
- ARG HTTP_SERVICE_PORT
4
-
5
- WORKDIR /app
6
- COPY dist .
7
- EXPOSE $HTTP_SERVICE_PORT
8
-
9
- ENV HTTP_SERVICE_PORT ${HTTP_SERVICE_PORT}
10
- CMD /usr/bin/lzcinit --listen :$HTTP_SERVICE_PORT --www .
@@ -1,7 +0,0 @@
1
- #!/bin/sh
2
- set -ex
3
-
4
- SHELLDIR="$(dirname "$(readlink -f "$0")")"
5
- cd "$SHELLDIR"
6
-
7
- npm run build
@@ -1,3 +0,0 @@
1
- services:
2
- ${APP_ID}:
3
- image: ${APP_IMAGE_NAME}
@@ -1,10 +0,0 @@
1
- FROM registry.lazycat.cloud/lzc/lzcapp:0.1
2
-
3
- ARG HTTP_SERVICE_PORT
4
-
5
- WORKDIR /app
6
- COPY dist .
7
- EXPOSE $HTTP_SERVICE_PORT
8
-
9
- ENV HTTP_SERVICE_PORT ${HTTP_SERVICE_PORT}
10
- CMD /usr/bin/lzcinit -listen :$HTTP_SERVICE_PORT -up /="file://./"
@@ -1,10 +0,0 @@
1
- #!/bin/sh
2
- set -ex
3
-
4
-
5
- SHELLDIR="$(dirname "$(readlink -f "$0")")"
6
- cd "$SHELLDIR"
7
-
8
- ## 该文件运行时路径为 .lazycat 对应的目录
9
-
10
- npm run build
@@ -1,3 +0,0 @@
1
- services:
2
- ${APP_ID}:
3
- image: ${APP_IMAGE_NAME}
@@ -1,29 +0,0 @@
1
- # hc_test
2
-
3
- ## Project setup
4
-
5
- ```
6
- npm install
7
- ```
8
-
9
- ### Compiles and hot-reloads for development
10
-
11
- ```
12
- npm run serve
13
- ```
14
-
15
- ### Compiles and minifies for production
16
-
17
- ```
18
- npm run build
19
- ```
20
-
21
- ### Lints and fixes files
22
-
23
- ```
24
- npm run lint
25
- ```
26
-
27
- ### Customize configuration
28
-
29
- See [Configuration Reference](https://cli.vuejs.org/config/).
@@ -1 +0,0 @@
1
- node_modules
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- presets: ["@vue/cli-plugin-babel/preset"],
3
- };
@@ -1,43 +0,0 @@
1
- {
2
- "name": "hc_test",
3
- "version": "0.1.0",
4
- "private": true,
5
- "scripts": {
6
- "serve": "vue-cli-service serve",
7
- "build": "vue-cli-service build",
8
- "lint": "vue-cli-service lint"
9
- },
10
- "dependencies": {
11
- "core-js": "^3.6.5",
12
- "vue": "^2.6.11",
13
- "webdav": "^4.7.0"
14
- },
15
- "devDependencies": {
16
- "@vue/cli-plugin-babel": "~4.5.0",
17
- "@vue/cli-plugin-eslint": "~4.5.0",
18
- "@vue/cli-service": "~4.5.0",
19
- "babel-eslint": "^10.1.0",
20
- "eslint": "^6.7.2",
21
- "eslint-plugin-vue": "^6.2.2",
22
- "vue-template-compiler": "^2.6.11"
23
- },
24
- "eslintConfig": {
25
- "root": true,
26
- "env": {
27
- "node": true
28
- },
29
- "extends": [
30
- "plugin:vue/essential",
31
- "eslint:recommended"
32
- ],
33
- "parserOptions": {
34
- "parser": "babel-eslint"
35
- },
36
- "rules": {}
37
- },
38
- "browserslist": [
39
- "> 1%",
40
- "last 2 versions",
41
- "not dead"
42
- ]
43
- }
Binary file
@@ -1,33 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
- <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
- <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
8
- <title><%= htmlWebpackPlugin.options.title %></title>
9
- <style>
10
- body {
11
- font: 14px "Helvetica Neue", Helvetica, Arial, sans-serif;
12
- line-height: 1.4em;
13
- background: #f5f5f5;
14
- color: #4d4d4d;
15
- margin: 0 auto;
16
- -webkit-font-smoothing: antialiased;
17
- -moz-osx-font-smoothing: grayscale;
18
- font-weight: 300;
19
- }
20
- </style>
21
- </head>
22
- <body>
23
- <noscript>
24
- <strong
25
- >We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
26
- properly without JavaScript enabled. Please enable it to
27
- continue.</strong
28
- >
29
- </noscript>
30
- <div id="app"></div>
31
- <!-- built files will be auto injected -->
32
- </body>
33
- </html>
@@ -1,39 +0,0 @@
1
- <template>
2
- <div class="app-list">
3
- <top-bar @login="isLogged = true" @logout="isLogged = false"></top-bar>
4
- <todo v-if="isLogged"></todo>
5
- <web-dav v-if="isLogged"></web-dav>
6
- </div>
7
- </template>
8
-
9
- <script>
10
- export default {
11
- components: {
12
- TopBar: () => import("./top-bar.vue"),
13
- Todo: () => import("./todo.vue"),
14
- WebDav: () => import("./webdav.vue"),
15
- },
16
- mounted() {
17
- this.isLogged = this.$lzc.isLogged();
18
- },
19
- data() {
20
- return {
21
- isLogged: false,
22
- };
23
- },
24
- };
25
- </script>
26
-
27
- <style scoped>
28
- .app-list {
29
- width: 100%;
30
- display: flex;
31
- flex-direction: column;
32
- min-width: 230px;
33
- max-width: 800px;
34
- margin: auto;
35
- }
36
- .app-list > div {
37
- margin: 50px 0px;
38
- }
39
- </style>
@@ -1,8 +0,0 @@
1
- import Vue from "vue";
2
- import App from "./App.vue";
3
-
4
- Vue.config.productionTip = false;
5
-
6
- new Vue({
7
- render: (h) => h(App),
8
- }).$mount("#app");