From d4444aed3612c13119ea918263a0c23e207fe27c Mon Sep 17 00:00:00 2001 From: Garfonso Date: Mon, 30 Oct 2023 16:33:07 +0100 Subject: [PATCH 1/2] fix update command first try... is this ok? tgz file will still be gone after "real" install at the end. Hm. Maybe a quite good solution? Till everyone uses symlinks at least ;-) --- src/index.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 65b9d4c2..7e73f32c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -391,10 +391,14 @@ class DevServer { await this.checkSetup(); this.log.notice('Updating everything...'); + if (!this.config?.useSymlinks) { + this.log.notice('Building local adapter.'); + await this.buildLocalAdapter(); + await this.installLocalAdapter(false); //do not install, keep .tgz file. + } this.execSync('npm update --loglevel error', this.profileDir); this.uploadAdapter('admin'); - await this.buildLocalAdapter(); await this.installLocalAdapter(); if (!this.isJSController()) this.uploadAdapter(this.adapterName); @@ -1506,7 +1510,7 @@ class DevServer { } } - private async installLocalAdapter(): Promise { + private async installLocalAdapter(doInstall = true): Promise { this.log.notice(`Install local iobroker.${this.adapterName}`); if (this.config?.useSymlinks) { @@ -1523,9 +1527,11 @@ class DevServer { const { stdout } = await this.getExecOutput('npm pack', this.rootDir); const filename = stdout.trim(); this.log.info(`Packed to ${filename}`); - const fullPath = path.join(this.rootDir, filename); - this.execSync(`npm install "${fullPath}"`, this.profileDir); - await this.rimraf(fullPath); + if (doInstall) { + const fullPath = path.join(this.rootDir, filename); + this.execSync(`npm install "${fullPath}"`, this.profileDir); + await this.rimraf(fullPath); + } } } From b771e5d0d95fdc3a264548fc0a0ed69d8fef778a Mon Sep 17 00:00:00 2001 From: Garfonso Date: Mon, 30 Oct 2023 16:33:15 +0100 Subject: [PATCH 2/2] build --- dist/index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) mode change 100644 => 100755 dist/index.js diff --git a/dist/index.js b/dist/index.js old mode 100644 new mode 100755 index df0bb1f1..94a05762 --- a/dist/index.js +++ b/dist/index.js @@ -299,11 +299,16 @@ class DevServer { .join('\n')}\n\nto use dev-server.`); } async update() { + var _a; await this.checkSetup(); this.log.notice('Updating everything...'); + if (!((_a = this.config) === null || _a === void 0 ? void 0 : _a.useSymlinks)) { + this.log.notice('Building local adapter.'); + await this.buildLocalAdapter(); + await this.installLocalAdapter(false); //do not install, keep .tgz file. + } this.execSync('npm update --loglevel error', this.profileDir); this.uploadAdapter('admin'); - await this.buildLocalAdapter(); await this.installLocalAdapter(); if (!this.isJSController()) this.uploadAdapter(this.adapterName); @@ -1288,7 +1293,7 @@ class DevServer { this.execSync('npm run build', this.rootDir); } } - async installLocalAdapter() { + async installLocalAdapter(doInstall = true) { var _a, _b; this.log.notice(`Install local iobroker.${this.adapterName}`); if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.useSymlinks) { @@ -1306,9 +1311,11 @@ class DevServer { const { stdout } = await this.getExecOutput('npm pack', this.rootDir); const filename = stdout.trim(); this.log.info(`Packed to ${filename}`); - const fullPath = path.join(this.rootDir, filename); - this.execSync(`npm install "${fullPath}"`, this.profileDir); - await this.rimraf(fullPath); + if (doInstall) { + const fullPath = path.join(this.rootDir, filename); + this.execSync(`npm install "${fullPath}"`, this.profileDir); + await this.rimraf(fullPath); + } } } async installRepoAdapter(adapterName) {