@scrypted/server 0.0.26 → 0.0.27

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.

Potentially problematic release.


This version of @scrypted/server might be problematic. Click here for more details.

package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrypted/server",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "scrypted-server": "dist/bin/scrypted-server.js"
@@ -63,13 +63,11 @@
63
63
  "@types/ws": "^7.4.7"
64
64
  },
65
65
  "scripts": {
66
- "pregit-serve": "npm run build",
67
- "git-serve": "node --expose-gc dist/git-serve.js",
68
66
  "preserve": "npm run build",
69
67
  "serve": "node --expose-gc dist/scrypted-main.js",
70
68
  "serve-no-build": "node --expose-gc dist/scrypted-main.js",
71
69
  "ts-serve": "ts-node --expose-gc src/scrypted-main.ts",
72
- "prebuild": "tsc --build --clean && tsc -p ../sdk --outDir dist/sdk",
70
+ "prebuild": "rimraf dist && tsc -p ../sdk --outDir dist/sdk",
73
71
  "build": "tsc --outDir dist",
74
72
  "build-opencv": "cd node_modules/@koush/opencv4nodejs && npm run build",
75
73
  "postbuild": "node test/check-build-output.js",
package/dist/git-serve.js DELETED
@@ -1,60 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const child_process_1 = __importDefault(require("child_process"));
7
- const events_1 = require("events");
8
- const fs_1 = __importDefault(require("fs"));
9
- const rimraf_1 = __importDefault(require("rimraf"));
10
- const path_1 = __importDefault(require("path"));
11
- async function sleep(ms) {
12
- return new Promise(resolve => setTimeout(resolve, ms));
13
- }
14
- const EXIT_FILE = '.exit';
15
- const UPDATE_FILE = '.update';
16
- async function runCommand(command, ...args) {
17
- const cp = child_process_1.default.spawn(command, args, {
18
- stdio: 'inherit'
19
- });
20
- await (0, events_1.once)(cp, 'exit');
21
- }
22
- async function runCommandEatError(command, ...args) {
23
- try {
24
- await runCommand(command, ...args);
25
- }
26
- catch (e) {
27
- console.warn(command, args, 'command exited with error, ignoring', e);
28
- }
29
- }
30
- async function main() {
31
- process.chdir(path_1.default.join(__dirname, '..'));
32
- console.log('cwd', process.cwd());
33
- process.env.SCRYPTED_GIT_SERVE = 'true';
34
- while (true) {
35
- rimraf_1.default.sync(EXIT_FILE);
36
- rimraf_1.default.sync(UPDATE_FILE);
37
- try {
38
- console.log('starting scrypted main...');
39
- await runCommand('npm', 'run', 'serve-no-build');
40
- }
41
- catch (e) {
42
- console.error('scrypted server exited with error', e);
43
- }
44
- if (fs_1.default.existsSync(EXIT_FILE)) {
45
- console.log(`${EXIT_FILE} found. exiting.`);
46
- process.exit();
47
- }
48
- if (fs_1.default.existsSync(UPDATE_FILE)) {
49
- console.log(`${UPDATE_FILE} found. pulling and rebuilding.`);
50
- await runCommandEatError('git', 'reset', '--hard');
51
- await runCommandEatError('git', 'pull');
52
- await runCommandEatError('npm', 'install');
53
- await runCommandEatError('npm', 'run', 'build');
54
- }
55
- console.log(`${EXIT_FILE} not found. restarting momentarily.`);
56
- await sleep(10000);
57
- }
58
- }
59
- main();
60
- //# sourceMappingURL=git-serve.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-serve.js","sourceRoot":"","sources":["../src/git-serve.ts"],"names":[],"mappings":";;;;;AAAA,kEAA0C;AAC1C,mCAA8B;AAC9B,4CAAoB;AACpB,oDAA4B;AAC5B,gDAAwB;AAExB,KAAK,UAAU,KAAK,CAAC,EAAU;IAC3B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,SAAS,GAAG,OAAO,CAAC;AAC1B,MAAM,WAAW,GAAG,SAAS,CAAC;AAE9B,KAAK,UAAU,UAAU,CAAC,OAA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I,YAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;YAC5B,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,iCAAiC,CAAC,CAAC;YAC7D,MAAM,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;YACnD,MAAM,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YACxC,MAAM,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAC3C,MAAM,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;SACnD;QAED,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,qCAAqC,CAAC,CAAC;QAC/D,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;KACtB;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
package/src/git-serve.ts DELETED
@@ -1,65 +0,0 @@
1
- import child_process from 'child_process';
2
- import { once } from 'events';
3
- import fs from 'fs';
4
- import rimraf from 'rimraf';
5
- import path from 'path';
6
-
7
- async function sleep(ms: number) {
8
- return new Promise(resolve => setTimeout(resolve, ms));
9
- }
10
-
11
- const EXIT_FILE = '.exit';
12
- const UPDATE_FILE = '.update';
13
-
14
- async function runCommand(command: string, ...args: string[]) {
15
- const cp = child_process.spawn(command, args, {
16
- stdio: 'inherit'
17
- });
18
- await once(cp, 'exit');
19
- }
20
-
21
- async function runCommandEatError(command: string, ...args: string[]) {
22
- try {
23
- await runCommand(command, ...args);
24
- }
25
- catch (e) {
26
- console.warn(command, args, 'command exited with error, ignoring', e)
27
- }
28
- }
29
-
30
- async function main() {
31
- process.chdir(path.join(__dirname, '..'));
32
- console.log('cwd', process.cwd());
33
- process.env.SCRYPTED_GIT_SERVE = 'true';
34
-
35
- while (true) {
36
- rimraf.sync(EXIT_FILE);
37
- rimraf.sync(UPDATE_FILE);
38
-
39
- try {
40
- console.log('starting scrypted main...');
41
- await runCommand('npm', 'run', 'serve-no-build')
42
- }
43
- catch (e) {
44
- console.error('scrypted server exited with error', e);
45
- }
46
-
47
- if (fs.existsSync(EXIT_FILE)) {
48
- console.log(`${EXIT_FILE} found. exiting.`);
49
- process.exit();
50
- }
51
-
52
- if (fs.existsSync(UPDATE_FILE)) {
53
- console.log(`${UPDATE_FILE} found. pulling and rebuilding.`);
54
- await runCommandEatError('git', 'reset', '--hard');
55
- await runCommandEatError('git', 'pull');
56
- await runCommandEatError('npm', 'install');
57
- await runCommandEatError('npm', 'run', 'build');
58
- }
59
-
60
- console.log(`${EXIT_FILE} not found. restarting momentarily.`);
61
- await sleep(10000);
62
- }
63
- }
64
-
65
- main();