Socket
Socket
Sign inDemoInstall

nx

Package Overview
Dependencies
Maintainers
8
Versions
1371
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nx - npm Package Compare versions

Comparing version 0.0.0-pr-27737-f2311b5 to 0.0.0-pr-27781-2677d5b

24

package.json
{
"name": "nx",
"version": "0.0.0-pr-27737-f2311b5",
"version": "0.0.0-pr-27781-2677d5b",
"private": false,

@@ -74,3 +74,3 @@ "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",

"ora": "5.3.0",
"@nrwl/tao": "0.0.0-pr-27737-f2311b5"
"@nrwl/tao": "0.0.0-pr-27781-2677d5b"
},

@@ -90,12 +90,12 @@ "peerDependencies": {

"optionalDependencies": {
"@nx/nx-darwin-x64": "0.0.0-pr-27737-f2311b5",
"@nx/nx-darwin-arm64": "0.0.0-pr-27737-f2311b5",
"@nx/nx-linux-x64-gnu": "0.0.0-pr-27737-f2311b5",
"@nx/nx-linux-x64-musl": "0.0.0-pr-27737-f2311b5",
"@nx/nx-win32-x64-msvc": "0.0.0-pr-27737-f2311b5",
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-27737-f2311b5",
"@nx/nx-linux-arm64-musl": "0.0.0-pr-27737-f2311b5",
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-27737-f2311b5",
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-27737-f2311b5",
"@nx/nx-freebsd-x64": "0.0.0-pr-27737-f2311b5"
"@nx/nx-darwin-x64": "0.0.0-pr-27781-2677d5b",
"@nx/nx-darwin-arm64": "0.0.0-pr-27781-2677d5b",
"@nx/nx-linux-x64-gnu": "0.0.0-pr-27781-2677d5b",
"@nx/nx-linux-x64-musl": "0.0.0-pr-27781-2677d5b",
"@nx/nx-win32-x64-msvc": "0.0.0-pr-27781-2677d5b",
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-27781-2677d5b",
"@nx/nx-linux-arm64-musl": "0.0.0-pr-27781-2677d5b",
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-27781-2677d5b",
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-27781-2677d5b",
"@nx/nx-freebsd-x64": "0.0.0-pr-27781-2677d5b"
},

@@ -102,0 +102,0 @@ "nx-migrations": {

@@ -7,3 +7,3 @@ "use strict";

command: 'login [nxCloudUrl]',
describe: 'Login to Nx Cloud',
describe: false,
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs.positional('nxCloudUrl', {

@@ -10,0 +10,0 @@ describe: 'The Nx Cloud URL of the instance you are trying to connect to. If no positional argument is provided, this command will connect to https://cloud.nx.app.',

@@ -7,3 +7,3 @@ "use strict";

command: 'logout',
describe: 'Logout from Nx Cloud',
describe: false,
builder: (yargs) => (0, shared_options_1.withVerbose)(yargs),

@@ -10,0 +10,0 @@ handler: async (args) => {

@@ -6,3 +6,3 @@ import { ChildProcess } from 'child_process';

import { ConfigurationSourceMaps } from '../../project-graph/utils/project-configuration-utils';
import { NxWorkspaceFiles, TaskRun } from '../../native';
import { NxWorkspaceFiles, TaskRun, TaskTarget } from '../../native';
import type { SyncGeneratorChangesResult } from '../../utils/sync-generators';

@@ -55,2 +55,3 @@ export type UnregisterCallback = () => void;

getFlakyTasks(hashes: string[]): Promise<string[]>;
getEstimatedTaskTimings(targets: TaskTarget[]): Promise<any>;
recordTaskRuns(taskRuns: TaskRun[]): Promise<void>;

@@ -57,0 +58,0 @@ getSyncGeneratorChanges(generators: string[]): Promise<SyncGeneratorChangesResult[]>;

@@ -248,2 +248,9 @@ "use strict";

}
async getEstimatedTaskTimings(targets) {
const message = {
type: task_history_1.GET_ESTIMATED_TASK_TIMINGS,
targets,
};
return this.sendToDaemonViaQueue(message);
}
recordTaskRuns(taskRuns) {

@@ -250,0 +257,0 @@ const message = {

@@ -1,3 +0,4 @@

import type { TaskRun } from '../../native';
import { TaskRun, TaskTarget } from '../../native';
export declare const GET_FLAKY_TASKS: "GET_FLAKY_TASKS";
export declare const GET_ESTIMATED_TASK_TIMINGS: "GET_ESTIMATED_TASK_TIMINGS";
export type HandleGetFlakyTasks = {

@@ -7,2 +8,6 @@ type: typeof GET_FLAKY_TASKS;

};
export type HandleGetEstimatedTaskTimings = {
type: typeof GET_ESTIMATED_TASK_TIMINGS;
targets: TaskTarget[];
};
export declare function isHandleGetFlakyTasksMessage(message: unknown): message is HandleGetFlakyTasks;

@@ -9,0 +14,0 @@ export declare const RECORD_TASK_RUNS: "RECORD_TASK_RUNS";

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RECORD_TASK_RUNS = exports.GET_FLAKY_TASKS = void 0;
exports.RECORD_TASK_RUNS = exports.GET_ESTIMATED_TASK_TIMINGS = exports.GET_FLAKY_TASKS = void 0;
exports.isHandleGetFlakyTasksMessage = isHandleGetFlakyTasksMessage;
exports.isHandleWriteTaskRunsToHistoryMessage = isHandleWriteTaskRunsToHistoryMessage;
exports.GET_FLAKY_TASKS = 'GET_FLAKY_TASKS';
exports.GET_ESTIMATED_TASK_TIMINGS = 'GET_ESTIMATED_TASK_TIMINGS';
function isHandleGetFlakyTasksMessage(message) {

@@ -8,0 +9,0 @@ return (typeof message === 'object' &&

@@ -44,2 +44,3 @@ /* auto-generated by NAPI-RS */

getFlakyTasks(hashes: Array<string>): Array<string>
getEstimatedTaskTimings(targets: Array<TaskTarget>): Record<string, number>
}

@@ -46,0 +47,0 @@

@@ -45,2 +45,14 @@ "use strict";

}
async function createNxCloudWorkspaceV1(workspaceName, installationSource, nxInitDate) {
const apiUrl = (0, get_cloud_options_1.getCloudUrl)();
const response = await require('axios').post(`${apiUrl}/nx-cloud/create-org-and-workspace`, {
workspaceName,
installationSource,
nxInitDate,
});
if (response.data.message) {
throw new Error(response.data.message);
}
return response.data;
}
async function createNxCloudWorkspaceV2(workspaceName, installationSource, nxInitDate) {

@@ -73,2 +85,15 @@ const apiUrl = (0, get_cloud_options_1.getCloudUrl)();

}
function addNxCloudOptionsToNxJson(tree, token, directory = '') {
const nxJsonPath = (0, path_1.join)(directory, 'nx.json');
if (tree.exists(nxJsonPath)) {
(0, json_1.updateJson)(tree, (0, path_1.join)(directory, 'nx.json'), (nxJson) => {
const overrideUrl = process.env.NX_CLOUD_API || process.env.NRWL_API;
if (overrideUrl) {
nxJson.nxCloudUrl = overrideUrl;
}
nxJson.nxCloudAccessToken = token;
return nxJson;
});
}
}
function addNxCloudIdToNxJson(tree, nxCloudId, directory = '') {

@@ -94,2 +119,3 @@ const nxJsonPath = (0, path_1.join)(directory, 'nx.json');

const isGitHubDetected = schema.github ?? (await (0, url_shorten_1.repoUsesGithub)(schema.github));
let responseFromCreateNxCloudWorkspaceV1;
let responseFromCreateNxCloudWorkspaceV2;

@@ -104,8 +130,18 @@ /**

return null;
responseFromCreateNxCloudWorkspaceV2 = await createNxCloudWorkspaceV2(getRootPackageName(tree), schema.installationSource, getNxInitDate());
addNxCloudIdToNxJson(tree, responseFromCreateNxCloudWorkspaceV2?.nxCloudId, schema.directory);
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
silent: schema.hideFormatLogs,
});
return responseFromCreateNxCloudWorkspaceV2.nxCloudId;
if (process.env.NX_ENABLE_LOGIN === 'true') {
responseFromCreateNxCloudWorkspaceV2 = await createNxCloudWorkspaceV2(getRootPackageName(tree), schema.installationSource, getNxInitDate());
addNxCloudIdToNxJson(tree, responseFromCreateNxCloudWorkspaceV2?.nxCloudId, schema.directory);
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
silent: schema.hideFormatLogs,
});
return responseFromCreateNxCloudWorkspaceV2.nxCloudId;
}
else {
responseFromCreateNxCloudWorkspaceV1 = await createNxCloudWorkspaceV1(getRootPackageName(tree), schema.installationSource, getNxInitDate());
addNxCloudOptionsToNxJson(tree, responseFromCreateNxCloudWorkspaceV1?.token, schema.directory);
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree, {
silent: schema.hideFormatLogs,
});
return responseFromCreateNxCloudWorkspaceV1.token;
}
}

@@ -112,0 +148,0 @@ async function connectToNxCloudGenerator(tree, options) {

@@ -40,3 +40,3 @@ "use strict";

this.forkedProcessTaskRunner = new forked_process_task_runner_1.ForkedProcessTaskRunner(this.options);
this.tasksSchedule = new tasks_schedule_1.TasksSchedule(this.projectGraph, this.taskGraph, this.options);
this.tasksSchedule = new tasks_schedule_1.TasksSchedule(this.projectGraph, this.taskGraph, null, this.options);
// region internal state

@@ -54,3 +54,6 @@ this.batchEnv = (0, task_env_1.getEnvVariablesForBatchProcess)(this.options.skipNxCache, this.options.captureStderr);

// Init the ForkedProcessTaskRunner
await this.forkedProcessTaskRunner.init();
await Promise.all([
this.forkedProcessTaskRunner.init(),
this.tasksSchedule.init(),
]);
// initial scheduling

@@ -57,0 +60,0 @@ await this.scheduleNextTasks();

import { DefaultTasksRunnerOptions } from './default-tasks-runner';
import { Task, TaskGraph } from '../config/task-graph';
import { ProjectGraph } from '../config/project-graph';
import { TaskHistory } from '../utils/task-history';
export interface Batch {

@@ -11,2 +12,3 @@ executorName: string;

private readonly taskGraph;
private readonly taskHistory;
private readonly options;

@@ -21,3 +23,5 @@ private notScheduledTaskGraph;

private scheduleRequestsExecutionChain;
constructor(projectGraph: ProjectGraph, taskGraph: TaskGraph, options: DefaultTasksRunnerOptions);
private estimatedTaskTimings;
constructor(projectGraph: ProjectGraph, taskGraph: TaskGraph, taskHistory: TaskHistory, options: DefaultTasksRunnerOptions);
init(): Promise<void>;
scheduleNextTasks(): Promise<void>;

@@ -24,0 +28,0 @@ hasTasks(): boolean;

@@ -8,5 +8,6 @@ "use strict";

class TasksSchedule {
constructor(projectGraph, taskGraph, options) {
constructor(projectGraph, taskGraph, taskHistory, options) {
this.projectGraph = projectGraph;
this.taskGraph = taskGraph;
this.taskHistory = taskHistory;
this.options = options;

@@ -22,2 +23,5 @@ this.notScheduledTaskGraph = this.taskGraph;

}
async init() {
this.estimatedTaskTimings = await this.taskHistory.getEstimatedTaskTimings(Object.values(this.taskGraph.tasks).map((t) => t.target));
}
async scheduleNextTasks() {

@@ -24,0 +28,0 @@ this.scheduleRequestsExecutionChain =

@@ -1,6 +0,7 @@

import { NxTaskHistory, TaskRun } from '../native';
import { NxTaskHistory, TaskRun, TaskTarget } from '../native';
export declare class TaskHistory {
taskHistory: NxTaskHistory;
getEstimatedTaskTimings(targets: TaskTarget[]): Promise<any>;
getFlakyTasks(hashes: string[]): Promise<string[]>;
recordTaskRuns(taskRuns: TaskRun[]): Promise<void>;
}

@@ -12,2 +12,8 @@ "use strict";

}
async getEstimatedTaskTimings(targets) {
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
return this.taskHistory.getEstimatedTaskTimings(targets);
}
return await client_1.daemonClient.getEstimatedTaskTimings(targets);
}
async getFlakyTasks(hashes) {

@@ -14,0 +20,0 @@ if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {

Sorry, the diff of this file is not supported yet

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