@iobroker/legacy-testing 1.0.6 → 1.0.8

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 +6 -0
  2. package/package.json +1 -1
  3. package/setup.js +15 -10
package/README.md CHANGED
@@ -14,6 +14,12 @@ Set process.env.JS_CONTROLLER_VERSION to version e.g. `5.0.5-alpha.0-20230617-46
14
14
 
15
15
  ## Changelog
16
16
  <!-- ### **WORK IN PROGRESS** -->
17
+ ### 1.0.8 (2023-12-19)
18
+ * (foxriver76) use hardcoded appName instead of inference with a heuristic approach
19
+
20
+ ### 1.0.7 (2023-12-19)
21
+ * (foxriver76) allow re-initialization after config change
22
+
17
23
  ### 1.0.6 (2023-12-19)
18
24
  * (foxriver76) allow to specify the `rootDir`
19
25
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.6",
2
+ "version": "1.0.8",
3
3
  "name": "@iobroker/legacy-testing",
4
4
  "main": "setup.js",
5
5
  "files": [
package/setup.js CHANGED
@@ -18,8 +18,7 @@ if (adapterName[adapterName.length - 2] === 'vis-2-widgets-testing') {
18
18
  }
19
19
  adapterName = adapterName[adapterName.length - 2];
20
20
 
21
- let pkg = require(`${rootDir}package.json`);
22
- pkg.main = pkg.main || 'main.js';
21
+ let pkg;
23
22
 
24
23
  const adaptersStarted = {};
25
24
  const pids = {};
@@ -28,13 +27,18 @@ let objects;
28
27
  let states;
29
28
  let systemConfig = null;
30
29
 
31
- function getAppName() {
32
- const parts = rootDir.replace(/\\/g, '/').split('/');
33
- parts.pop();
34
- return parts.pop().split('.')[0];
30
+ initialize();
31
+
32
+ /**
33
+ * Initialize logic, you can re-trigger it after config has changed
34
+ */
35
+ function initialize() {
36
+ pkg = require(`${rootDir}package.json`);
37
+ pkg.main = pkg.main || 'main.js';
35
38
  }
36
39
 
37
- const appName = getAppName().toLowerCase();
40
+ /** Lowercase application name */
41
+ const appName = 'iobroker';
38
42
 
39
43
  function loadJSONLDB() {
40
44
  if (!JSONLDB) {
@@ -400,7 +404,7 @@ async function installJsController(preInstalledAdapters, cb) {
400
404
  if (!fs.existsSync(`${rootDir}tmp/node_modules/${appName}.js-controller`)) {
401
405
  console.log('installJsController: no js-controller => install dev build from npm');
402
406
 
403
- cp.execSync(`npm install ${appName}.js-controller@${process.env.JS_CONTROLLER_VERSION || 'dev'} --prefix ./ --production`, {
407
+ cp.execSync(`npm install ${appName}.js-controller@${process.env.JS_CONTROLLER_VERSION || 'dev'} --prefix ./ --omit=dev`, {
404
408
  cwd: `${rootDir}tmp/`,
405
409
  stdio: [0, 1, 2],
406
410
  });
@@ -473,7 +477,7 @@ function copyAdapterToController() {
473
477
  stdio: [0, 1, 2],
474
478
  });
475
479
  copyFileSync(`${rootDir}${pkg.name}-${pkg.version}.tgz`, `${rootDir}tmp/${pkg.name}-${pkg.version}.tgz`);
476
- cp.execSync(`npm install ${pkg.name}-${pkg.version}.tgz --prefix ./ --production`, {
480
+ cp.execSync(`npm install ${pkg.name}-${pkg.version}.tgz --prefix ./ --omit=dev`, {
477
481
  cwd: `${rootDir}tmp`,
478
482
  stdio: [0, 1, 2],
479
483
  });
@@ -483,7 +487,7 @@ function copyAdapterToController() {
483
487
  function installCustomAdapter(adapterName) {
484
488
  if (!fs.existsSync(`${rootDir}tmp/node_modules/${adapterName}`)) {
485
489
  console.log(`Install ${adapterName}`);
486
- cp.execSync(`npm install ${adapterName} --prefix ./ --production`, {
490
+ cp.execSync(`npm install ${adapterName} --prefix ./ --omit=dev`, {
487
491
  cwd: `${rootDir}tmp/`,
488
492
  stdio: [0, 1, 2],
489
493
  });
@@ -980,4 +984,5 @@ if (typeof module !== undefined && module.parent) {
980
984
  module.exports.getObject = getObject;
981
985
  module.exports.setObject = setObject;
982
986
  module.exports.setOptions = setOptions;
987
+ module.exports.initialize = initialize;
983
988
  }