@blocklet/cli 1.16.33 → 1.16.34-beta-20241120-080738-bbbe036c

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 (87) hide show
  1. package/README.md +32 -25
  2. package/bin/blocklet.js +292 -1
  3. package/config.example.yml +33 -0
  4. package/lib/arcblock.js +53 -0
  5. package/lib/commands/blocklet/add.js +124 -0
  6. package/lib/commands/blocklet/assets/git-ignore +28 -0
  7. package/lib/commands/blocklet/assets/index.html +9 -0
  8. package/lib/commands/blocklet/assets/index.js +14 -0
  9. package/lib/commands/blocklet/assets/logo.png +0 -0
  10. package/lib/commands/blocklet/bundle/bundle.js +184 -0
  11. package/lib/commands/blocklet/bundle/bundlers/blocklet.js +138 -0
  12. package/lib/commands/blocklet/bundle/bundlers/changelog.js +100 -0
  13. package/lib/commands/blocklet/bundle/bundlers/logo.js +56 -0
  14. package/lib/commands/blocklet/bundle/bundlers/markdown.js +241 -0
  15. package/lib/commands/blocklet/bundle/bundlers/preference.js +50 -0
  16. package/lib/commands/blocklet/bundle/bundlers/readme.js +43 -0
  17. package/lib/commands/blocklet/bundle/bundlers/screenshots.js +94 -0
  18. package/lib/commands/blocklet/bundle/bundlers/simple.js +70 -0
  19. package/lib/commands/blocklet/bundle/compact/bundle-compact-file.js +48 -0
  20. package/lib/commands/blocklet/bundle/compact/bundle-merge-extra.js +66 -0
  21. package/lib/commands/blocklet/bundle/compact/default-external.js +5 -0
  22. package/lib/commands/blocklet/bundle/compact/index.js +88 -0
  23. package/lib/commands/blocklet/bundle/index.js +139 -0
  24. package/lib/commands/blocklet/bundle/pack.js +8 -0
  25. package/lib/commands/blocklet/bundle/parse-external-dependencies.js +97 -0
  26. package/lib/commands/blocklet/bundle/simple/index.js +62 -0
  27. package/lib/commands/blocklet/bundle/zip/archive.js +35 -0
  28. package/lib/commands/blocklet/bundle/zip/dependencies.js +333 -0
  29. package/lib/commands/blocklet/bundle/zip/index.js +165 -0
  30. package/lib/commands/blocklet/bundle/zip/main.js +124 -0
  31. package/lib/commands/blocklet/bundle/zip/node.js +59 -0
  32. package/lib/commands/blocklet/bundle/zip/resolve.js +93 -0
  33. package/lib/commands/blocklet/cleanup.js +52 -0
  34. package/lib/commands/blocklet/config.js +108 -0
  35. package/lib/commands/blocklet/connect.js +87 -0
  36. package/lib/commands/blocklet/create.js +38 -0
  37. package/lib/commands/blocklet/deploy.js +435 -0
  38. package/lib/commands/blocklet/dev.js +1000 -0
  39. package/lib/commands/blocklet/document.js +39 -0
  40. package/lib/commands/blocklet/exec.js +106 -0
  41. package/lib/commands/blocklet/init.js +300 -0
  42. package/lib/commands/blocklet/meta.js +22 -0
  43. package/lib/commands/blocklet/remove.js +35 -0
  44. package/lib/commands/blocklet/test.js +201 -0
  45. package/lib/commands/blocklet/upload.js +105 -0
  46. package/lib/commands/blocklet/version.js +81 -0
  47. package/lib/commands/server/cleanup.js +32 -0
  48. package/lib/commands/server/command.js +131 -0
  49. package/lib/commands/server/info.js +92 -0
  50. package/lib/commands/server/init.js +433 -0
  51. package/lib/commands/server/logs.js +99 -0
  52. package/lib/commands/server/rescue.js +71 -0
  53. package/lib/commands/server/start.js +821 -0
  54. package/lib/commands/server/status.js +107 -0
  55. package/lib/commands/server/stop.js +163 -0
  56. package/lib/commands/server/upgrade.js +123 -0
  57. package/lib/constant.js +21 -2
  58. package/lib/debug.js +20 -0
  59. package/lib/manager/config.js +122 -0
  60. package/lib/manager/deploy.js +75 -0
  61. package/lib/manager/index.js +23 -0
  62. package/lib/manager/process.js +47 -0
  63. package/lib/node.js +214 -0
  64. package/lib/port.js +19 -0
  65. package/lib/postinstall.js +3 -0
  66. package/lib/process/daemon.js +196 -0
  67. package/lib/process/service.js +86 -0
  68. package/lib/ui.js +137 -0
  69. package/lib/util/blocklet/config.js +78 -0
  70. package/lib/util/blocklet/env.js +172 -0
  71. package/lib/util/blocklet/meta.js +36 -0
  72. package/lib/util/blocklet/payment.js +88 -0
  73. package/lib/util/blocklet/sign.js +21 -0
  74. package/lib/util/blocklet/tar.js +119 -0
  75. package/lib/util/convert-to-nosources-sourcemap.js +37 -0
  76. package/lib/util/docker-status-log.js +17 -0
  77. package/lib/util/exit-when-server-stopped.js +44 -0
  78. package/lib/util/get-cli-binary-name.js +8 -0
  79. package/lib/util/get-download-bundle-step.js +36 -0
  80. package/lib/util/get-service-instance-number.js +12 -0
  81. package/lib/util/index.js +626 -0
  82. package/lib/util/print-error.js +11 -0
  83. package/lib/util/print.js +9 -0
  84. package/lib/util/what-uri.js +40 -0
  85. package/package.json +123 -27
  86. package/lib/run.d.ts +0 -2
  87. package/lib/run.js +0 -73
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@blocklet/cli",
3
- "version": "1.16.33",
4
- "description": "Command line tools to manage Blocklet and Blocklet Server",
3
+ "version": "1.16.34-beta-20241120-080738-bbbe036c",
4
+ "description": "Command line tools to manage Blocklet Server",
5
5
  "homepage": "https://github.com/ArcBlock/blocklet-server#readme",
6
- "main": "bin/blocklet.js",
7
6
  "bin": {
8
7
  "blocklet": "bin/blocklet.js"
9
8
  },
@@ -11,18 +10,16 @@
11
10
  "access": "public"
12
11
  },
13
12
  "scripts": {
14
- "lint": "eslint bin",
15
- "lint:fix": "eslint bin --fix",
13
+ "lint": "eslint lib bin",
14
+ "lint:fix": "eslint lib bin --fix",
16
15
  "test": "node tools/jest.js",
17
- "coverage": "npm run test -- --coverage",
18
- "clean": "rm -fr lib",
19
- "build:blocklet-cli": "npm run build",
20
- "build": "npm run clean && tsc && cp src/constant.js lib",
21
- "deploy": "npm run build && npm uninstall -g blocklet && npm install -g . -f"
16
+ "coverage": "ABT_NODE_HOST='' npm run test -- --coverage",
17
+ "postinstall": "node lib/postinstall.js"
22
18
  },
23
19
  "files": [
24
- "bin",
25
- "lib"
20
+ "lib",
21
+ "config.example.yml",
22
+ "bin"
26
23
  ],
27
24
  "author": {
28
25
  "name": "wangshijun",
@@ -38,25 +35,124 @@
38
35
  "url": "https://github.com/ArcBlock/blocklet-server/issues"
39
36
  },
40
37
  "dependencies": {
41
- "@abtnode/cli": "1.16.33",
42
- "colors": "1.4.0",
43
- "cross-spawn": "^7.0.3",
44
- "shelljs": "^0.8.5"
45
- },
46
- "devDependencies": {
47
- "@types/jest": "^29.5.13",
48
- "@types/joi": "^17.2.3",
49
- "@typescript-eslint/eslint-plugin": "^5.42.0",
50
- "@typescript-eslint/parser": "^5.42.0",
51
- "jest": "^29.7.0",
52
- "ts-jest": "^29.2.5",
53
- "typescript": "^5.6.3"
38
+ "@abtnode/blocklet-services": "1.16.34-beta-20241120-080738-bbbe036c",
39
+ "@abtnode/client": "1.16.34-beta-20241120-080738-bbbe036c",
40
+ "@abtnode/constant": "1.16.34-beta-20241120-080738-bbbe036c",
41
+ "@abtnode/core": "1.16.34-beta-20241120-080738-bbbe036c",
42
+ "@abtnode/logger": "1.16.34-beta-20241120-080738-bbbe036c",
43
+ "@abtnode/router-provider": "1.16.34-beta-20241120-080738-bbbe036c",
44
+ "@abtnode/util": "1.16.34-beta-20241120-080738-bbbe036c",
45
+ "@abtnode/webapp": "1.16.34-beta-20241120-080738-bbbe036c",
46
+ "@arcblock/did": "1.18.139",
47
+ "@arcblock/event-hub": "1.18.139",
48
+ "@arcblock/ipfs-only-hash": "^0.0.2",
49
+ "@arcblock/jwt": "1.18.139",
50
+ "@arcblock/ws": "1.18.139",
51
+ "@blocklet/constant": "1.16.34-beta-20241120-080738-bbbe036c",
52
+ "@blocklet/form-collector": "^0.1.8",
53
+ "@blocklet/images": "1.16.34-beta-20241120-080738-bbbe036c",
54
+ "@blocklet/meta": "1.16.34-beta-20241120-080738-bbbe036c",
55
+ "@blocklet/resolver": "1.16.34-beta-20241120-080738-bbbe036c",
56
+ "@blocklet/store": "1.16.34-beta-20241120-080738-bbbe036c",
57
+ "@ocap/client": "1.18.139",
58
+ "@ocap/mcrypto": "1.18.139",
59
+ "@ocap/util": "1.18.139",
60
+ "@ocap/wallet": "1.18.139",
61
+ "@vercel/ncc": "^0.38.1",
62
+ "archiver": "^7.0.1",
63
+ "async": "^3.2.4",
64
+ "axios": "^1.7.5",
65
+ "byte-size": "^7.0.1",
66
+ "chalk": "^4.1.2",
67
+ "cli-progress": "3.10.0",
68
+ "cli-table3": "^0.6.5",
69
+ "clipboardy": "^2.3.0",
70
+ "columnify": "^1.6.0",
71
+ "commander": "^11.1.0",
72
+ "common-path-prefix": "^2.0.0",
73
+ "cp-file": "^7.0.0",
74
+ "debug": "^4.3.7",
75
+ "dotenv-flow": "^4.1.0",
76
+ "end-of-stream": "^1.4.4",
77
+ "envinfo": "^7.13.0",
78
+ "expand-tilde": "^2.0.2",
79
+ "fast-glob": "^3.3.2",
80
+ "figlet": "^1.5.2",
81
+ "filesize": "^10.1.1",
82
+ "find-up": "^4.1.0",
83
+ "form-data": "^4.0.0",
84
+ "fs-extra": "^11.2.0",
85
+ "fuzzy": "^0.1.3",
86
+ "get-port": "^5.1.1",
87
+ "git-rev-sync": "^3.0.2",
88
+ "git-user-name": "^2.0.0",
89
+ "glob": "^10.4.1",
90
+ "gradient-string": "^2.0.2",
91
+ "image-size": "^1.0.2",
92
+ "ini": "^2.0.0",
93
+ "inquirer": "^7.3.3",
94
+ "inquirer-autocomplete-prompt": "^1.4.0",
95
+ "is-glob": "^4.0.3",
96
+ "is-url": "^1.2.4",
97
+ "iso-639-1": "^2.1.15",
98
+ "js-yaml": "^4.1.0",
99
+ "json-stable-stringify": "^1.0.1",
100
+ "junk": "^3.1.0",
101
+ "locate-path": "^5.0.0",
102
+ "lodash": "^4.17.21",
103
+ "log-symbols": "^3.0.0",
104
+ "make-dir": "^4.0.0",
105
+ "maskdata": "^1.2.2",
106
+ "mdast-util-from-markdown": "0.8.5",
107
+ "mdast-util-to-markdown": "0.6.5",
108
+ "minimatch": "^9.0.4",
109
+ "npm-packlist": "^7.0.4",
110
+ "open": "^7.4.2",
111
+ "ora": "^4.1.1",
112
+ "p-all": "^3.0.0",
113
+ "p-map": "^4.0.0",
114
+ "p-retry": "^4.6.2",
115
+ "p-wait-for": "^3.2.0",
116
+ "path-exists": "^4.0.0",
117
+ "pkg-dir": "^4.2.0",
118
+ "please-upgrade-node": "^3.2.0",
119
+ "port-used": "^2.0.8",
120
+ "posthtml-parser": "^0.11.0",
121
+ "posthtml-render": "^3.0.0",
122
+ "precinct": "^11.0.0",
123
+ "pretty-ms-i18n": "^1.0.3",
124
+ "rc": "^1.2.8",
125
+ "read-last-lines": "^1.8.0",
126
+ "require-package-name": "^2.0.1",
127
+ "resolve": "^2.0.0-next.4",
128
+ "semver": "^7.6.3",
129
+ "sequelize": "^6.35.0",
130
+ "shelljs": "^0.8.5",
131
+ "slugify": "^1.6.5",
132
+ "source-map": "^0.7.4",
133
+ "sqlite3": "^5.1.7",
134
+ "ssri": "^8.0.1",
135
+ "tar": "^6.1.11",
136
+ "terminal-link": "^2.1.1",
137
+ "tweetnacl": "^1.0.3",
138
+ "tweetnacl-sealedbox-js": "^1.2.0",
139
+ "ufo": "^1.5.3",
140
+ "unixify": "^1.0.0",
141
+ "update-notifier": "^5.1.0",
142
+ "valid-url": "^1.0.9",
143
+ "validate.io-uri": "^1.0.0",
144
+ "xbytes": "^1.8.0"
54
145
  },
55
146
  "resolutions": {
56
- "colors": "1.4.0"
147
+ "colors": "1.4.0",
148
+ "minimatch": "9.0.4"
57
149
  },
58
150
  "engines": {
59
151
  "node": ">=14"
60
152
  },
61
- "gitHead": "f314706b7a6150adbf6bf700f06d2989981eaf1f"
153
+ "gitHead": "4bc345b51743e28a95bf09f7e0c0740838b39ad3",
154
+ "devDependencies": {
155
+ "@types/fs-extra": "^11.0.4",
156
+ "@types/jest": "^29.5.13"
157
+ }
62
158
  }
package/lib/run.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare const _default: () => void;
2
- export = _default;
package/lib/run.js DELETED
@@ -1,73 +0,0 @@
1
- "use strict";
2
- /* eslint-disable global-require */
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
- const constant_1 = require("@abtnode/cli/lib/constant");
30
- // !!! PM_HOME must be set before everything
31
- process.env.PM2_HOME = constant_1.PM2_HOME;
32
- process.env.ABT_NODE_HOME = constant_1.ABT_NODE_HOME;
33
- process.env.ABT_NODE_MAX_CLUSTER_SIZE = constant_1.ABT_NODE_MAX_CLUSTER_SIZE;
34
- const cross_spawn_1 = __importDefault(require("cross-spawn"));
35
- const get_cli_binary_name_1 = __importDefault(require("@abtnode/cli/lib/util/get-cli-binary-name"));
36
- const exit_when_server_stopped_1 = __importDefault(require("@abtnode/cli/lib/util/exit-when-server-stopped"));
37
- const print_error_1 = __importDefault(require("@abtnode/cli/lib/util/print-error"));
38
- const constant_2 = require("./constant");
39
- const keepAliveParams = ['--keep-alive', '-k'];
40
- const parseArgv = () => {
41
- const binaryName = (0, get_cli_binary_name_1.default)();
42
- const isServer = process.argv[2] === 'server';
43
- const isStart = process.argv[3] === 'start';
44
- const keepAlive = keepAliveParams.some((x) => process.argv.includes(x));
45
- return { binaryName, isServer, isStart, keepAlive };
46
- };
47
- module.exports = () => {
48
- process.env.ABT_NODE_PACKAGE_NAME = constant_2.name;
49
- const { binaryName, isServer, isStart, keepAlive } = parseArgv();
50
- if (isServer && isStart && keepAlive) {
51
- const argv = process.argv.slice(4).filter((x) => !keepAliveParams.includes(x));
52
- const { error, status } = cross_spawn_1.default.sync(binaryName, ['server', 'start', ...argv], {
53
- timeout: 3 * 60 * 1000,
54
- detached: false,
55
- windowsHide: true, // required for Windows
56
- shell: false,
57
- stdio: 'inherit',
58
- });
59
- if (error) {
60
- (0, print_error_1.default)(error.message);
61
- process.exit(error.errno || -1);
62
- return; // just for test
63
- }
64
- if (status !== 0) {
65
- process.exit(status);
66
- return; // just for test
67
- }
68
- (0, exit_when_server_stopped_1.default)();
69
- }
70
- else {
71
- Promise.resolve().then(() => __importStar(require('@abtnode/cli/bin/blocklet')));
72
- }
73
- };