@iobroker/legacy-testing 0.3.5 → 0.3.7

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.
Files changed (3) hide show
  1. package/README.md +7 -1
  2. package/package.json +2 -2
  3. package/setup.js +18 -11
package/README.md CHANGED
@@ -9,9 +9,15 @@ Legacy test modules for ioBroker
9
9
  3. Replace in `tests/testAdapter.js` the code `const setup = require('./lib/setup');` with `const setup = require('@iobroker/legacy-testing');`
10
10
  4. Replace whole file `tests/testPackageFiles.js` with `require('@iobroker/legacy-testing/tests/testPackageFiles');`
11
11
 
12
+ ## Usage of the specific js-controller version
13
+ Set process.env.JS_CONTROLLER_VERSION to version e.g. `5.0.5-alpha.0-20230617-464b0fd6`
14
+
12
15
  ## Changelog
13
16
  <!-- ### **WORK IN PROGRESS** -->
14
- ### 0.3.5 (2023-05-08)
17
+ ### 0.3.7 (2023-07-07)
18
+ * (bluefox) Allowed using the specific version of js-controller
19
+
20
+ ### 0.3.6 (2023-05-08)
15
21
  * (bluefox) Added possibility to install additional adapters at start
16
22
  * (bluefox) Added setOfflineState/getOfflineState
17
23
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.5",
2
+ "version": "0.3.7",
3
3
  "name": "@iobroker/legacy-testing",
4
4
  "main": "setup.js",
5
5
  "files": [
@@ -28,7 +28,7 @@
28
28
  "chai": "^4.3.7"
29
29
  },
30
30
  "devDependencies": {
31
- "@alcalzone/release-script": "^3.5.9",
31
+ "@alcalzone/release-script": "^3.6.0",
32
32
  "@alcalzone/release-script-plugin-license": "^3.5.9"
33
33
  },
34
34
  "scripts": {
package/setup.js CHANGED
@@ -262,13 +262,9 @@ async function installAdapter(customAdapterName, cb) {
262
262
  cb = customAdapterName;
263
263
  customAdapterName = null;
264
264
  }
265
- console.log(`[${customAdapterName || pkg.name}] Install adapter...`);
266
265
 
267
- // if own adapter
268
- if (!customAdapterName) {
269
- installCustomAdapter(pkg.name); // force install from the current directory
270
- customAdapterName = pkg.name;
271
- }
266
+ customAdapterName = customAdapterName || pkg.name;
267
+ console.log(`[${customAdapterName}] Install adapter...`);
272
268
 
273
269
  if (customAdapterName.includes('@')) {
274
270
  installCustomAdapter(customAdapterName);
@@ -398,7 +394,7 @@ async function installJsController(preInstalledAdapters, cb) {
398
394
  if (!fs.existsSync(`${rootDir}tmp/node_modules/${appName}.js-controller`)) {
399
395
  console.log('installJsController: no js-controller => install dev build from npm');
400
396
 
401
- cp.execSync(`npm install ${appName}.js-controller@dev --prefix ./ --production`, {
397
+ cp.execSync(`npm install ${appName}.js-controller@${process.env.JS_CONTROLLER_VERSION || 'dev'} --prefix ./ --production`, {
402
398
  cwd: `${rootDir}tmp/`,
403
399
  stdio: [0, 1, 2],
404
400
  });
@@ -427,7 +423,7 @@ async function installJsController(preInstalledAdapters, cb) {
427
423
  if (fs.existsSync(`${rootDir}node_modules/${appName}.js-controller/${appName}.js`)) {
428
424
  _pid = cp.fork(`${appName}.js`, ['stop'], {
429
425
  cwd: `${rootDir}node_modules/${appName}.js-controller`,
430
- stdio: [0, 1, 2, 'ipc']
426
+ stdio: [0, 1, 2, 'ipc'],
431
427
  });
432
428
  }
433
429
 
@@ -461,9 +457,20 @@ async function installJsController(preInstalledAdapters, cb) {
461
457
  }
462
458
 
463
459
  function copyAdapterToController() {
464
- console.log('Copy adapter...');
465
- // Copy adapter to tmp/node_modules/appName.adapter
466
- copyFolderRecursiveSync(rootDir, `${rootDir}tmp/node_modules/`, ['node_modules', '.github', '.idea', 'test', 'tmp', '.git', 'src', 'src-widgets', `${appName}.js-controller`]);
460
+ console.log('Pack adapter...');
461
+
462
+ fs.existsSync(`${rootDir}${pkg.name}-${pkg.version}.tgz`) && fs.unlinkSync(`${rootDir}${pkg.name}-${pkg.version}.tgz`);
463
+ fs.existsSync(`${rootDir}tmp/${pkg.name}-${pkg.version}.tgz`) && fs.unlinkSync(`${rootDir}tmp/${pkg.name}-${pkg.version}.tgz`);
464
+
465
+ cp.execSync(`npm pack`, {
466
+ cwd: rootDir,
467
+ stdio: [0, 1, 2],
468
+ });
469
+ copyFileSync(`${rootDir}${pkg.name}-${pkg.version}.tgz`, `${rootDir}tmp/${pkg.name}-${pkg.version}.tgz`);
470
+ cp.execSync(`npm install ${pkg.name}-${pkg.version}.tgz --prefix ./ --production`, {
471
+ cwd: `${rootDir}tmp`,
472
+ stdio: [0, 1, 2],
473
+ });
467
474
  console.log('Adapter copied.');
468
475
  }
469
476