@serverless-devs/s 3.0.0-beta.3 → 3.0.0-bf1e45c7

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 (55) hide show
  1. package/lib/daemon/lib.js +327 -0
  2. package/lib/daemon/report.js +50 -0
  3. package/lib/daemon/update-cli.js +20 -0
  4. package/lib/daemon/update-component.js +21 -0
  5. package/lib/daemon/update-templates.js +19 -0
  6. package/lib/index.js +1405 -524
  7. package/package.json +56 -31
  8. package/readme.md +1 -1
  9. package/lib/command/clean/index.js +0 -125
  10. package/lib/command/config/command/add.js +0 -100
  11. package/lib/command/config/command/default.js +0 -78
  12. package/lib/command/config/command/get.js +0 -100
  13. package/lib/command/config/command/remove.js +0 -77
  14. package/lib/command/config/command/rename.js +0 -84
  15. package/lib/command/config/index.js +0 -27
  16. package/lib/command/config/utils/index.js +0 -19
  17. package/lib/command/custom/help.js +0 -246
  18. package/lib/command/custom/index.js +0 -182
  19. package/lib/command/custom/types.js +0 -3
  20. package/lib/command/custom/v1/index.js +0 -295
  21. package/lib/command/index.js +0 -96
  22. package/lib/command/init/constant.js +0 -600
  23. package/lib/command/init/index.js +0 -101
  24. package/lib/command/init/manager.js +0 -181
  25. package/lib/command/registry/command/detail.js +0 -71
  26. package/lib/command/registry/command/list.js +0 -69
  27. package/lib/command/registry/command/login.js +0 -90
  28. package/lib/command/registry/command/publish.js +0 -67
  29. package/lib/command/registry/command/remove.js +0 -70
  30. package/lib/command/registry/index.js +0 -27
  31. package/lib/command/set/command/analysis.js +0 -94
  32. package/lib/command/set/command/log.js +0 -94
  33. package/lib/command/set/command/proxy.js +0 -98
  34. package/lib/command/set/command/registry.js +0 -115
  35. package/lib/command/set/index.js +0 -25
  36. package/lib/constant.js +0 -25
  37. package/lib/daemon/template.js +0 -20
  38. package/lib/daemon/update.js +0 -9
  39. package/lib/error/command-error.js +0 -29
  40. package/lib/error/config-delete-error.js +0 -29
  41. package/lib/error/config-error.js +0 -29
  42. package/lib/error/config-get-error.js +0 -29
  43. package/lib/error/human-error.js +0 -71
  44. package/lib/error/human-warning.js +0 -18
  45. package/lib/error/index.js +0 -68
  46. package/lib/error/init-error.js +0 -29
  47. package/lib/error/serverless-error.js +0 -12
  48. package/lib/i18n/en.js +0 -4
  49. package/lib/i18n/index.js +0 -16
  50. package/lib/i18n/zh.js +0 -4
  51. package/lib/logger.js +0 -82
  52. package/lib/utils/check-node-version.js +0 -15
  53. package/lib/utils/get-pid.js +0 -55
  54. package/lib/utils/index.js +0 -43
  55. package/lib/utils/set-proxy.js +0 -21
@@ -0,0 +1,50 @@
1
+ const { Report } = require('./lib');
2
+
3
+ (async () => {
4
+ try {
5
+ console.log('********Starting report in daemon********');
6
+
7
+ // Exit process when offline
8
+ setTimeout(process.exit, 1000 * 30);
9
+ const { type, template, uid, argv, command, component, message, userAgent } = JSON.parse(process.argv[2]);
10
+ console.log('type', type);
11
+ const instance = new Report();
12
+ const run = async () => {
13
+ if (type === 'init') {
14
+ console.log('template', template);
15
+ return await instance.reportInit({ template });
16
+ }
17
+ console.log('userAgent', userAgent);
18
+ console.log('command', command);
19
+ if (type === 'command') {
20
+ console.log('uid', uid);
21
+ console.log('argv', argv);
22
+ console.log('component', component);
23
+ return await instance.reportCommand({ uid, argv, command, component, userAgent });
24
+ }
25
+ // 解析异常
26
+ if (type === 'parseException') {
27
+ console.log('uid', uid);
28
+ console.log('argv', argv);
29
+ console.log('message', message);
30
+ return await instance.reportParseException({ argv, command, message, userAgent });
31
+ }
32
+ // 执行异常
33
+ if (type === 'runtimeException') {
34
+ console.log('uid', uid);
35
+ console.log('argv', argv);
36
+ console.log('component', component);
37
+ console.log('message', message);
38
+ return await instance.reportRuntimeException({ uid, argv, command, component, message, userAgent });
39
+ }
40
+ };
41
+ await run();
42
+ console.log('********report successfully in daemon********');
43
+ // Call process exit explicitly to terminate the child process,
44
+ // otherwise the child process will run forever, according to the Node.js docs
45
+ process.exit();
46
+ } catch (error) {
47
+ console.error(error);
48
+ process.exit(1);
49
+ }
50
+ })();
@@ -0,0 +1,20 @@
1
+ const { UpdateNotifier } = require('./lib');
2
+
3
+ (async () => {
4
+ try {
5
+ console.log('********Starting update cli in daemon********');
6
+
7
+ // Exit process when offline
8
+ setTimeout(process.exit, 1000 * 30);
9
+
10
+ const updateNotifier = new UpdateNotifier();
11
+ await updateNotifier.update();
12
+ console.log('********Update cli successfully in daemon********');
13
+ // Call process exit explicitly to terminate the child process,
14
+ // otherwise the child process will run forever, according to the Node.js docs
15
+ process.exit();
16
+ } catch (error) {
17
+ console.error(error);
18
+ process.exit(1);
19
+ }
20
+ })();
@@ -0,0 +1,21 @@
1
+ const { Component } = require('./lib');
2
+
3
+ (async () => {
4
+ try {
5
+ console.log('********Starting update component in daemon********');
6
+
7
+ // Exit process when offline
8
+ setTimeout(process.exit, 1000 * 30);
9
+ const { component } = JSON.parse(process.argv[2]);
10
+ console.log('component', component);
11
+ const instance = new Component(component);
12
+ await instance.update();
13
+ console.log('********Update component successfully in daemon********');
14
+ // Call process exit explicitly to terminate the child process,
15
+ // otherwise the child process will run forever, according to the Node.js docs
16
+ process.exit();
17
+ } catch (error) {
18
+ console.error(error);
19
+ process.exit(1);
20
+ }
21
+ })();
@@ -0,0 +1,19 @@
1
+ const { Templates } = require('./lib');
2
+
3
+ (async () => {
4
+ try {
5
+ console.log('******** Starting update templates in daemon ********');
6
+ // Exit process when offline
7
+ setTimeout(process.exit, 1000 * 30);
8
+
9
+ const instance = new Templates();
10
+ await instance.update();
11
+ console.log('******** Update templates successfully in daemon ********');
12
+ // Call process exit explicitly to terminate the child process,
13
+ // otherwise the child process will run forever, according to the Node.js docs
14
+ process.exit();
15
+ } catch (error) {
16
+ console.error(error);
17
+ process.exit(1);
18
+ }
19
+ })();