mirror of
https://github.com/koush/scrypted.git
synced 2026-02-03 14:13:28 +00:00
cli: add support for version launch hint
This commit is contained in:
3
packages/cli/.vscode/launch.json
vendored
3
packages/cli/.vscode/launch.json
vendored
@@ -21,8 +21,7 @@
|
||||
],
|
||||
"preLaunchTask": "npm: build",
|
||||
"args": [
|
||||
"rtsp",
|
||||
"/Volumes/Seagate/video/scrypted-1370/1720470474217/1720470474217/1720470474217.rtsp",
|
||||
"serve",
|
||||
],
|
||||
"sourceMaps": true,
|
||||
"resolveSourceMapLocations": [
|
||||
|
||||
4
packages/cli/package-lock.json
generated
4
packages/cli/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "scrypted",
|
||||
"version": "1.3.19",
|
||||
"version": "1.3.20",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "scrypted",
|
||||
"version": "1.3.19",
|
||||
"version": "1.3.20",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@scrypted/client": "^1.3.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "scrypted",
|
||||
"version": "1.3.19",
|
||||
"version": "1.3.20",
|
||||
"description": "",
|
||||
"main": "./dist/packages/cli/src/main.js",
|
||||
"bin": {
|
||||
|
||||
@@ -12,6 +12,7 @@ async function sleep(ms: number) {
|
||||
|
||||
const EXIT_FILE = '.exit';
|
||||
const UPDATE_FILE = '.update';
|
||||
const VERSION_FILE = '.version';
|
||||
|
||||
async function runCommand(command: string, ...args: string[]) {
|
||||
if (os.platform() === 'win32') {
|
||||
@@ -117,6 +118,15 @@ export async function installServe(installVersion: string, ignoreError?: boolean
|
||||
}
|
||||
|
||||
export async function serveMain(installVersion?: string) {
|
||||
const { installDir, volume } = cwdInstallDir();
|
||||
if (!installVersion) {
|
||||
try {
|
||||
installVersion = fs.readFileSync(path.join(volume, VERSION_FILE)).toString().trim();
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
const options = ((): { install: true; version: string } | { install: false } => {
|
||||
if (installVersion) {
|
||||
console.log(`Installing @scrypted/server@${installVersion}`);
|
||||
@@ -139,7 +149,6 @@ export async function serveMain(installVersion?: string) {
|
||||
}
|
||||
})();
|
||||
|
||||
const { installDir, volume } = cwdInstallDir();
|
||||
|
||||
if (options.install) {
|
||||
await installServe(options.version, true);
|
||||
|
||||
Reference in New Issue
Block a user