Socket
Socket
Sign inDemoInstall

@nrwl/nx-cloud

Package Overview
Dependencies
Maintainers
1
Versions
343
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nrwl/nx-cloud - npm Package Compare versions

Comparing version 8.12.4 to 8.12.5

54

lib/nx-cloud-task-runner.js

@@ -72,3 +72,4 @@ "use strict";

class CloudRemoteCache {
constructor(api) {
constructor(errors, api) {
this.errors = errors;
this.api = api;

@@ -90,3 +91,3 @@ }

else {
this.printErrorMessage(e);
this.addErrorMessage(e);
}

@@ -107,3 +108,3 @@ return false;

catch (e) {
this.printErrorMessage(e);
this.addErrorMessage(e);
return false;

@@ -117,13 +118,13 @@ }

}
printErrorMessage(e) {
addErrorMessage(e) {
if (e.code === 'ECONNREFUSED' ||
e.code === 'EAI_AGAIN' ||
e.code === 'ENOTFOUND') {
console.error(`Error: Cannot connect to remote cache.`);
this.errors.cacheError = `Cannot connect to remote cache.`;
}
else if (e.response.status === 401) {
console.error(`Error: Invalid Nx Cloud access token.`);
this.errors.cacheError = `Invalid Nx Cloud access token.`;
}
else {
console.error(e.message);
this.errors.cacheError = e.message;
}

@@ -179,6 +180,7 @@ }

const api = createApi(options);
const lifeCycle = new TaskRunnerLifeCycle(api);
const remoteCache = new CloudRemoteCache(api);
const errors = new ErrorReporter();
const lifeCycle = new TaskRunnerLifeCycle(errors, api);
const remoteCache = new CloudRemoteCache(errors, api);
const res = tasks_runner_v2_1.tasksRunnerV2(tasks, Object.assign({}, options, { remoteCache, lifeCycle }), context);
return lifeCycle.complete().pipe(operators_1.concatMap(() => res));
return lifeCycle.complete().pipe(operators_1.tap(() => errors.printErrors()), operators_1.concatMap(() => res));
}

@@ -190,6 +192,6 @@ else {

class TaskRunnerLifeCycle {
constructor(api) {
constructor(errors, api) {
this.errors = errors;
this.api = api;
this.promises = {};
this.errors = [];
}

@@ -199,3 +201,3 @@ startTask(task) {

this.promises[`${task.id}-start`] = this.api.startTask(task).catch(e => {
this.errors.push(e.message);
this.errors.lifeCycleError = e.message;
});

@@ -211,3 +213,3 @@ }

.catch((e) => {
this.errors.push(e.message);
this.errors.lifeCycleError = e.message;
});

@@ -218,16 +220,20 @@ this.promises[`${task.id}-end`] = endPromise;

complete() {
return rxjs_1.from(Promise.all(Object.values(this.promises)).then(() => {
if (this.errors.length > 0) {
this.printNxCloudStatus();
}
}));
return rxjs_1.from(Promise.all(Object.values(this.promises)));
}
printNxCloudStatus() {
console.warn(`We were unable to send the data to Nx Cloud:`);
console.error(`Errors:`);
console.error(this.errors[0]);
}
class ErrorReporter {
constructor() {
this.cacheError = null;
this.lifeCycleError = null;
}
printErrors() {
if (this.cacheError || this.lifeCycleError) {
console.warn(`Nx Cloud Errors:`);
console.error(`- ${this.cacheError}`);
console.error(`- ${this.lifeCycleError}`);
}
}
}
function createApi(options) {
const baseUrl = options.url || 'https://nrwl.api.io';
const baseUrl = options.url || 'https://api.nrwl.io';
if (process.env.NX_CLOUD_AUTH_TOKEN) {

@@ -234,0 +240,0 @@ return new CloudApi(baseUrl, process.env.NX_CLOUD_AUTH_TOKEN);

{
"name": "@nrwl/nx-cloud",
"version": "8.12.4",
"version": "8.12.5",
"description": "Nx Cloud plugin for Nx",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc