spec-3nweb-server 1.6.4 → 1.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-3nweb-server",
3
- "version": "1.6.4",
3
+ "version": "1.7.0",
4
4
  "description": "3NWeb spec server.",
5
5
  "main": "build/lib.js",
6
6
  "types": "build/lib.d.ts",
@@ -9,7 +9,9 @@
9
9
  "test": "node build/tests/jasmine.js",
10
10
  "clear-for-packing": "npm prune --production && bash -c \"rm -rf build/mock build/tests 'node_modules/ecma-nacl/c sources'\"",
11
11
  "clear-for-packing-mock": "npm prune --production && bash -c \"rm -rf build/tests 'node_modules/ecma-nacl/c sources'\"",
12
- "pack-deb": "npm run clear-for-packing && bash packing/deb/create-bin.sh"
12
+ "pack": "pkg --config package.json build/main.js",
13
+ "pack-deb": "npm run pack && bash packing/deb/create-bin.sh",
14
+ "postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
13
15
  },
14
16
  "repository": {
15
17
  "type": "git",
@@ -29,8 +31,12 @@
29
31
  },
30
32
  "license": "GPL-3.0",
31
33
  "dependencies": {
34
+ "command-line-args": "^5.2.1",
35
+ "command-line-usage": "^7.0.1",
32
36
  "ecma-nacl": "^2.4.0",
33
37
  "express": "^4.18.0",
38
+ "js-yaml": "^4.1.0",
39
+ "prompts": "^2.4.2",
34
40
  "punycode": "^2.1.1",
35
41
  "ws": "^7.4.6",
36
42
  "xsp-files": "^2.0.0"
@@ -41,9 +47,16 @@
41
47
  "@types/node": "^16.11.7",
42
48
  "@types/ws": "^4.0.0",
43
49
  "jasmine": "^3.9.0",
50
+ "pkg": "^5.8.1",
44
51
  "rxjs": "^5.3.0",
45
52
  "typescript": "^4.7.4",
46
53
  "xhr2": "^0.1.3"
47
54
  },
55
+ "pkg": {
56
+ "targets": [
57
+ "node18-linux-x64"
58
+ ],
59
+ "outputPath": "dist"
60
+ },
48
61
  "readmeFilename": "README.md"
49
62
  }
package/postinstall.js ADDED
@@ -0,0 +1,25 @@
1
+
2
+ function is(it) {
3
+ return !!it && it !== '0' && it !== 'false';
4
+ }
5
+
6
+ const env = process.env;
7
+
8
+ const ADBLOCK = is(env.ADBLOCK);
9
+ const SILENT = ['silent', 'error', 'warn'].includes(env.npm_config_loglevel) ;
10
+ const COLOR = is(env.npm_config_color);
11
+
12
+ const BANNER = `\u001B[96mThank you for using spec-server (\u001B[94m https://github.com/3nsoft/spec-server.git \u001B[96m) of 3NWeb uitlity services. This server is developed together with defining 3NWeb protocols by PrivacySafe\u001B[0m
13
+
14
+ \u001B[96mThe project needs your help! Please consider supporting PrivacySafe on Open Collective: \u001B[0m
15
+ \u001B[96m>\u001B[94m https://opencollective.com/privacysafe \u001B[0m
16
+ `;
17
+
18
+ function isBannerRequired() {
19
+ if (ADBLOCK || SILENT) { return false; }
20
+ return true;
21
+ }
22
+
23
+ if (isBannerRequired()) {
24
+ console.log(COLOR ? BANNER : BANNER.replace(/\u001B\[\d+m/g, ''));
25
+ }