@lazycatcloud/lzc-cli 1.1.0

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 (64) hide show
  1. package/README.md +21 -0
  2. package/lib/api.js +123 -0
  3. package/lib/archiver.js +128 -0
  4. package/lib/builder.js +183 -0
  5. package/lib/dev.js +300 -0
  6. package/lib/docker/promise.js +91 -0
  7. package/lib/docker-compose.js +51 -0
  8. package/lib/env.js +104 -0
  9. package/lib/generator.js +115 -0
  10. package/lib/key.js +112 -0
  11. package/lib/sdk.js +129 -0
  12. package/lib/utils.js +349 -0
  13. package/package.json +53 -0
  14. package/scripts/cli.js +98 -0
  15. package/template/_lazycat/_gitignore +1 -0
  16. package/template/_lazycat/debug/devforward/50x.html +30 -0
  17. package/template/_lazycat/debug/devforward/Dockerfile +16 -0
  18. package/template/_lazycat/debug/devforward/docker-compose.override.yml.in +11 -0
  19. package/template/_lazycat/debug/devforward/entrypoint.sh +10 -0
  20. package/template/_lazycat/debug/devforward/nginx.conf.template +56 -0
  21. package/template/_lazycat/debug/devforward/sshd_config +116 -0
  22. package/template/_lazycat/debug/shell/50x.html +32 -0
  23. package/template/_lazycat/debug/shell/Dockerfile +16 -0
  24. package/template/_lazycat/debug/shell/build.sh +15 -0
  25. package/template/_lazycat/debug/shell/docker-compose.override.yml.in +23 -0
  26. package/template/_lazycat/debug/shell/entrypoint.sh +10 -0
  27. package/template/_lazycat/debug/shell/nginx.conf.template +64 -0
  28. package/template/_lazycat/debug/shell/sshd_config +117 -0
  29. package/template/_lazycat/docker-compose.yml.in +17 -0
  30. package/template/_lazycat/icon.svg +1 -0
  31. package/template/_lazycat/screenshot.png +0 -0
  32. package/template/golang/.godir +1 -0
  33. package/template/golang/README.md +13 -0
  34. package/template/golang/assets/css/bootstrap-responsive.css +1088 -0
  35. package/template/golang/assets/css/bootstrap-responsive.min.css +9 -0
  36. package/template/golang/assets/css/bootstrap.css +5893 -0
  37. package/template/golang/assets/css/bootstrap.min.css +9 -0
  38. package/template/golang/assets/css/rego.css +45 -0
  39. package/template/golang/assets/img/glyphicons-halflings-white.png +0 -0
  40. package/template/golang/assets/img/glyphicons-halflings.png +0 -0
  41. package/template/golang/assets/js/bootstrap.js +2025 -0
  42. package/template/golang/assets/js/bootstrap.min.js +6 -0
  43. package/template/golang/assets/js/rego.js +121 -0
  44. package/template/golang/go.mod +3 -0
  45. package/template/golang/index.html +267 -0
  46. package/template/golang/rego.go +83 -0
  47. package/template/release/golang/Dockerfile +18 -0
  48. package/template/release/golang/build.sh +14 -0
  49. package/template/release/vue/Dockerfile +9 -0
  50. package/template/release/vue/build.sh +9 -0
  51. package/template/release/vue/docker-compose.yml.in +8 -0
  52. package/template/vue/README.md +24 -0
  53. package/template/vue/_dockerignore +1 -0
  54. package/template/vue/babel.config.js +5 -0
  55. package/template/vue/package.json +43 -0
  56. package/template/vue/public/favicon.ico +0 -0
  57. package/template/vue/public/index.html +33 -0
  58. package/template/vue/src/App.vue +39 -0
  59. package/template/vue/src/lzc.js +110 -0
  60. package/template/vue/src/main.js +19 -0
  61. package/template/vue/src/todo.vue +640 -0
  62. package/template/vue/src/top-bar.vue +100 -0
  63. package/template/vue/src/webdav.vue +183 -0
  64. package/template/vue/vue.config.js +5 -0
@@ -0,0 +1,183 @@
1
+ <template>
2
+ <div class="webdav">
3
+ <div class="fm-title">
4
+ <div class="fm-title-path">
5
+ 当前路径:
6
+ <span>{{ pwd }}</span>
7
+ </div>
8
+ </div>
9
+
10
+ <div class="fm-content">
11
+ <table>
12
+ <thead>
13
+ <tr>
14
+ <th>MIME类型</th>
15
+ <th>最后更新</th>
16
+ <th>大小</th>
17
+ <th>是否文件夹</th>
18
+ <th>文件名</th>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <tr>
23
+ <td></td>
24
+ <td></td>
25
+ <td></td>
26
+ <td></td>
27
+ <td class="fm-arrow" @click="handleLast">&#8629;..</td>
28
+ </tr>
29
+ <tr
30
+ v-for="item in items"
31
+ :key="item.filename"
32
+ :title="`文件路径: ` + item.filename"
33
+ >
34
+ <td>{{ item.mime || "-" }}</td>
35
+ <td>{{ item.lastmod }}</td>
36
+ <td>{{ item.size }}</td>
37
+ <td>{{ item.type === "directory" ? "是" : "否" }}</td>
38
+ <td
39
+ :class="[item.type === 'directory' ? 'is-dir' : 'is-file']"
40
+ @click="handleFile(item)"
41
+ >
42
+ {{ item.basename }}
43
+ </td>
44
+ <td class="fm-delete" @click="handleDelete(item)">&#10007;</td>
45
+ </tr>
46
+ </tbody>
47
+ </table>
48
+ </div>
49
+
50
+ <div class="fm-bottom"></div>
51
+ </div>
52
+ </template>
53
+
54
+ <script>
55
+ function pathJoin(path1, path2) {
56
+ let res = path1 + "/" + path2;
57
+ return (
58
+ "/" +
59
+ res
60
+ .split("/")
61
+ .filter((r) => r !== "")
62
+ .join("/")
63
+ );
64
+ }
65
+
66
+ export default {
67
+ async mounted() {
68
+ this.enterDir(this.pwd);
69
+ },
70
+ data() {
71
+ return {
72
+ pwd: "/",
73
+ items: [],
74
+ };
75
+ },
76
+ methods: {
77
+ async isDir(path) {
78
+ try {
79
+ let res = await this.$lzc.fs.stat(path);
80
+ return res.type === "directory";
81
+ } catch (e) {
82
+ return Promise.reject(e);
83
+ }
84
+ },
85
+ toPwd(path) {
86
+ let p;
87
+ if (path.startsWith("/")) {
88
+ p = path;
89
+ } else {
90
+ p = pathJoin(this.pwd, path);
91
+ }
92
+ return p;
93
+ },
94
+ enterDir(path) {
95
+ return this.$lzc.fs
96
+ .getDirectoryContents(path)
97
+ .then((res) => {
98
+ this.items = res;
99
+ this.pwd = path;
100
+ })
101
+ .catch((err) => console.error(err));
102
+ },
103
+ download(path) {
104
+ let res = this.$lzc.fs.getFileDownloadLink(path);
105
+ let basename = path.split("/").reverse()[0];
106
+ let a = document.createElement("a");
107
+ a.href = res;
108
+ a.download = basename;
109
+ a.click();
110
+ },
111
+ handleFile(item) {
112
+ if (item.type === "directory") {
113
+ return this.enterDir(this.toPwd(item.basename));
114
+ } else {
115
+ return this.download(this.toPwd(item.basename));
116
+ }
117
+ },
118
+ handleLast() {
119
+ let res = this.pwd.split("/").reverse().slice(1);
120
+ this.enterDir("/" + res.reverse().join("/"));
121
+ },
122
+ handleDelete(item) {
123
+ this.$lzc.fs
124
+ .deleteFile(item.filename)
125
+ .then(() => {
126
+ this.enterDir(this.pwd);
127
+ })
128
+ .catch((e) => {
129
+ console.error(e);
130
+ });
131
+ },
132
+ },
133
+ };
134
+ </script>
135
+
136
+ <style scoped>
137
+ .webdav {
138
+ width: 100%;
139
+ }
140
+
141
+ .fm-title {
142
+ margin: 14px;
143
+ }
144
+ .fm-title-path {
145
+ display: flex;
146
+ flex-direction: row;
147
+ }
148
+ .fm-title-path span {
149
+ margin-left: 14px;
150
+ }
151
+
152
+ .fm-item {
153
+ display: flex;
154
+ flex-direction: row;
155
+ }
156
+ .fm-content {
157
+ margin: 14px;
158
+ }
159
+ th,
160
+ td {
161
+ padding: 0 14px;
162
+ }
163
+
164
+ .is-dir {
165
+ color: #3daee9;
166
+ cursor: pointer;
167
+ }
168
+ .is-file {
169
+ color: #1cdc9a;
170
+ cursor: pointer;
171
+ }
172
+ .is-dir:hover {
173
+ text-decoration: underline;
174
+ }
175
+
176
+ .fm-arrow {
177
+ color: #da4453;
178
+ }
179
+ .fm-delete {
180
+ color: #da4453;
181
+ cursor: pointer;
182
+ }
183
+ </style>
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ devServer: {
3
+ historyApiFallback: true,
4
+ },
5
+ };