Skip to content

Commit 113eca0

Browse files
authored
Merge pull request #431 from Garfonso/main
fix dev-server update with .tgz files
2 parents cb731cc + b771e5d commit 113eca0

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

dist/index.js

100644100755
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,16 @@ class DevServer {
299299
.join('\n')}\n\nto use dev-server.`);
300300
}
301301
async update() {
302+
var _a;
302303
await this.checkSetup();
303304
this.log.notice('Updating everything...');
305+
if (!((_a = this.config) === null || _a === void 0 ? void 0 : _a.useSymlinks)) {
306+
this.log.notice('Building local adapter.');
307+
await this.buildLocalAdapter();
308+
await this.installLocalAdapter(false); //do not install, keep .tgz file.
309+
}
304310
this.execSync('npm update --loglevel error', this.profileDir);
305311
this.uploadAdapter('admin');
306-
await this.buildLocalAdapter();
307312
await this.installLocalAdapter();
308313
if (!this.isJSController())
309314
this.uploadAdapter(this.adapterName);
@@ -1288,7 +1293,7 @@ class DevServer {
12881293
this.execSync('npm run build', this.rootDir);
12891294
}
12901295
}
1291-
async installLocalAdapter() {
1296+
async installLocalAdapter(doInstall = true) {
12921297
var _a, _b;
12931298
this.log.notice(`Install local iobroker.${this.adapterName}`);
12941299
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.useSymlinks) {
@@ -1306,9 +1311,11 @@ class DevServer {
13061311
const { stdout } = await this.getExecOutput('npm pack', this.rootDir);
13071312
const filename = stdout.trim();
13081313
this.log.info(`Packed to ${filename}`);
1309-
const fullPath = path.join(this.rootDir, filename);
1310-
this.execSync(`npm install "${fullPath}"`, this.profileDir);
1311-
await this.rimraf(fullPath);
1314+
if (doInstall) {
1315+
const fullPath = path.join(this.rootDir, filename);
1316+
this.execSync(`npm install "${fullPath}"`, this.profileDir);
1317+
await this.rimraf(fullPath);
1318+
}
13121319
}
13131320
}
13141321
async installRepoAdapter(adapterName) {

src/index.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,14 @@ class DevServer {
391391
await this.checkSetup();
392392
this.log.notice('Updating everything...');
393393

394+
if (!this.config?.useSymlinks) {
395+
this.log.notice('Building local adapter.');
396+
await this.buildLocalAdapter();
397+
await this.installLocalAdapter(false); //do not install, keep .tgz file.
398+
}
394399
this.execSync('npm update --loglevel error', this.profileDir);
395400
this.uploadAdapter('admin');
396401

397-
await this.buildLocalAdapter();
398402
await this.installLocalAdapter();
399403
if (!this.isJSController()) this.uploadAdapter(this.adapterName);
400404

@@ -1506,7 +1510,7 @@ class DevServer {
15061510
}
15071511
}
15081512

1509-
private async installLocalAdapter(): Promise<void> {
1513+
private async installLocalAdapter(doInstall = true): Promise<void> {
15101514
this.log.notice(`Install local iobroker.${this.adapterName}`);
15111515

15121516
if (this.config?.useSymlinks) {
@@ -1523,9 +1527,11 @@ class DevServer {
15231527
const { stdout } = await this.getExecOutput('npm pack', this.rootDir);
15241528
const filename = stdout.trim();
15251529
this.log.info(`Packed to ${filename}`);
1526-
const fullPath = path.join(this.rootDir, filename);
1527-
this.execSync(`npm install "${fullPath}"`, this.profileDir);
1528-
await this.rimraf(fullPath);
1530+
if (doInstall) {
1531+
const fullPath = path.join(this.rootDir, filename);
1532+
this.execSync(`npm install "${fullPath}"`, this.profileDir);
1533+
await this.rimraf(fullPath);
1534+
}
15291535
}
15301536
}
15311537

0 commit comments

Comments
 (0)