browserstack-cypress-cli 1.31.1 → 1.31.3

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.
@@ -18,7 +18,6 @@ const archiver = require("../helpers/archiver"),
18
18
  {initTimeComponents, instrumentEventTime, markBlockStart, markBlockEnd, getTimeComponents} = require('../helpers/timeComponents'),
19
19
  downloadBuildArtifacts = require('../helpers/buildArtifacts').downloadBuildArtifacts,
20
20
  downloadBuildStacktrace = require('../helpers/downloadBuildStacktrace').downloadBuildStacktrace,
21
- updateNotifier = require('update-notifier'),
22
21
  pkg = require('../../package.json'),
23
22
  packageDiff = require('../helpers/package-diff');
24
23
  const { getStackTraceUrl } = require('../helpers/sync/syncSpecsLogs');
@@ -531,23 +530,27 @@ module.exports = function run(args, rawArgs) {
531
530
  utils.sendUsageReport(bsJsonData, args, err.message, Constants.messageTypes.ERROR, utils.getErrorCodeFromErr(err), null, rawArgs);
532
531
  process.exitCode = Constants.ERROR_EXIT_CODE;
533
532
  }).finally(function(){
534
- const notifier = updateNotifier({
535
- pkg,
536
- updateCheckInterval: 1000 * 60 * 60 * 24 * 7,
537
- });
533
+ import('update-notifier').then(({ default: updateNotifier } ) => {
534
+ const notifier = updateNotifier({
535
+ pkg,
536
+ updateCheckInterval: 1000 * 60 * 60 * 24 * 7,
537
+ });
538
538
 
539
- // Checks for update on first run.
540
- // Set lastUpdateCheck to 0 to spawn the check update process as notifier sets this to Date.now() for preventing
541
- // the check untill one interval period. It runs once.
542
- if (!notifier.disabled && Date.now() - notifier.config.get('lastUpdateCheck') < 50) {
543
- notifier.config.set('lastUpdateCheck', 0);
544
- notifier.check();
545
- }
539
+ // Checks for update on first run.
540
+ // Set lastUpdateCheck to 0 to spawn the check update process as notifier sets this to Date.now() for preventing
541
+ // the check untill one interval period. It runs once.
542
+ if (!notifier.disabled && Date.now() - notifier.config.get('lastUpdateCheck') < 50) {
543
+ notifier.config.set('lastUpdateCheck', 0);
544
+ notifier.check();
545
+ }
546
546
 
547
- // Set the config update as notifier clears this after reading.
548
- if (notifier.update && notifier.update.current !== notifier.update.latest) {
549
- notifier.config.set('update', notifier.update);
550
- notifier.notify({isGlobal: true});
551
- }
547
+ // Set the config update as notifier clears this after reading.
548
+ if (notifier.update && notifier.update.current !== notifier.update.latest) {
549
+ notifier.config.set('update', notifier.update);
550
+ notifier.notify({isGlobal: true});
551
+ }
552
+ }).catch((error) => {
553
+ logger.debug('Got error loading update-notifier: ', error);
554
+ });
552
555
  });
553
556
  }
@@ -9,6 +9,7 @@
9
9
  { get_version } = require('./usageReporting'),
10
10
  process = require('process'),
11
11
  { spawn } = require('child_process'),
12
+ cliUtils = require("./utils"),
12
13
  util = require('util');
13
14
 
14
15
  let nodeProcess;
@@ -58,7 +59,7 @@ const setupPackageFolder = (runSettings, directoryPath) => {
58
59
  })
59
60
  };
60
61
 
61
- const packageInstall = (packageDir) => {
62
+ const packageInstall = (packageDir, bsConfig) => {
62
63
  return new Promise(function (resolve, reject) {
63
64
  const nodeProcessCloseCallback = (code) => {
64
65
  if(code == 0) {
@@ -74,6 +75,16 @@ const packageInstall = (packageDir) => {
74
75
  reject(`Packages were not installed successfully. Error Description ${util.format('%j', error)}`);
75
76
  };
76
77
 
78
+ // Moving .npmrc to tmpBstackPackages
79
+ try {
80
+ logger.debug(`Copying .npmrc file to temporary package directory`);
81
+ const npmrcRootPath = path.join(cliUtils.isNotUndefined(bsConfig.run_settings.home_directory) ? path.resolve(bsConfig.run_settings.home_directory) : './', '.npmrc');
82
+ const npmrcTmpPath = path.join(path.resolve(packageDir), '.npmrc');
83
+ fs.copyFileSync(npmrcRootPath, npmrcTmpPath);
84
+ } catch (error) {
85
+ logger.debug(`Failed copying .npmrc to ${packageDir}: ${error}`)
86
+ }
87
+
77
88
  let nodeProcess;
78
89
  logger.debug(`Fetching npm version and its major version`);
79
90
  const npm_version = get_version('npm')
@@ -147,7 +158,7 @@ const packageSetupAndInstaller = (bsConfig, packageDir, instrumentBlocks) => {
147
158
  instrumentBlocks.markBlockEnd("packageInstaller.folderSetup");
148
159
  instrumentBlocks.markBlockStart("packageInstaller.packageInstall");
149
160
  logger.debug("Started installing dependencies specified in browserstack.json");
150
- return packageInstall(packageDir);
161
+ return packageInstall(packageDir, bsConfig);
151
162
  }).then((_result) => {
152
163
  logger.debug("Completed installing dependencies");
153
164
  instrumentBlocks.markBlockEnd("packageInstaller.packageInstall");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserstack-cypress-cli",
3
- "version": "1.31.1",
3
+ "version": "1.31.3",
4
4
  "description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,7 +29,7 @@
29
29
  "request": "2.88.2",
30
30
  "requestretry": "7.1.0",
31
31
  "table": "5.4.6",
32
- "update-notifier": "5.1.0",
32
+ "update-notifier": "7.0.0",
33
33
  "uuid": "8.3.2",
34
34
  "windows-release": "^5.1.0",
35
35
  "winston": "2.4.4",