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-27640-2822b72 to 0.0.0-pr-27652-a405076

24

package.json
{
"name": "nx",
"version": "0.0.0-pr-27640-2822b72",
"version": "0.0.0-pr-27652-a405076",
"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-27640-2822b72"
"@nrwl/tao": "0.0.0-pr-27652-a405076"
},

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

"optionalDependencies": {
"@nx/nx-darwin-x64": "0.0.0-pr-27640-2822b72",
"@nx/nx-darwin-arm64": "0.0.0-pr-27640-2822b72",
"@nx/nx-linux-x64-gnu": "0.0.0-pr-27640-2822b72",
"@nx/nx-linux-x64-musl": "0.0.0-pr-27640-2822b72",
"@nx/nx-win32-x64-msvc": "0.0.0-pr-27640-2822b72",
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-27640-2822b72",
"@nx/nx-linux-arm64-musl": "0.0.0-pr-27640-2822b72",
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-27640-2822b72",
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-27640-2822b72",
"@nx/nx-freebsd-x64": "0.0.0-pr-27640-2822b72"
"@nx/nx-darwin-x64": "0.0.0-pr-27652-a405076",
"@nx/nx-darwin-arm64": "0.0.0-pr-27652-a405076",
"@nx/nx-linux-x64-gnu": "0.0.0-pr-27652-a405076",
"@nx/nx-linux-x64-musl": "0.0.0-pr-27652-a405076",
"@nx/nx-win32-x64-msvc": "0.0.0-pr-27652-a405076",
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-27652-a405076",
"@nx/nx-linux-arm64-musl": "0.0.0-pr-27652-a405076",
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-27652-a405076",
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-27652-a405076",
"@nx/nx-freebsd-x64": "0.0.0-pr-27652-a405076"
},

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

@@ -63,7 +63,5 @@ "use strict";

if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
const token = process.env.NX_CLOUD_ACCESS_TOKEN ||
nxJson.nxCloudAccessToken ||
nxJson.nxCloudId;
const token = process.env.NX_CLOUD_ACCESS_TOKEN || nxJson.nxCloudAccessToken;
if (!token) {
throw new Error(`Unable to authenticate. If you are connecting to Nx Cloud locally, set Nx Cloud ID in nx.json. If you are connecting in a CI context, either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable.`);
throw new Error(`Unable to authenticate. Either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable.`);
}

@@ -74,5 +72,6 @@ const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token);

bodyLines: [
'If you have not done so already, connect your workspace to your Nx Cloud account with the following URL:',
'',
`${connectCloudUrl}`,
'If you have not done so already, connect your workspace to your Nx Cloud account:',
`- Connect with Nx Cloud at:
${connectCloudUrl}`,
],

@@ -79,0 +78,0 @@ });

@@ -27,2 +27,6 @@ "use strict";

})
.option('depth', {
type: 'number',
description: 'The depth to clone the source repository (limit this for faster git clone)',
})
.option('interactive', {

@@ -29,0 +33,0 @@ type: 'boolean',

@@ -18,2 +18,6 @@ export interface ImportOptions {

destination: string;
/**
* The depth to clone the source repository (limit this for faster clone times)
*/
depth: number;
verbose: boolean;

@@ -20,0 +24,0 @@ interactive: boolean;

@@ -67,2 +67,3 @@ "use strict";

originName: importRemoteName,
depth: options.depth,
});

@@ -108,2 +109,3 @@ }

required: true,
initial: source ? source : undefined,
},

@@ -110,0 +112,0 @@ ])).destination;

@@ -19,83 +19,43 @@ "use strict";

const relativeSourceDir = (0, path_1.relative)(gitClient.root, (0, path_1.join)(gitClient.root, source));
if (relativeSourceDir !== '') {
spinner.start(`Filtering git history to only include files in ${relativeSourceDir}`);
await gitClient.filterBranch(relativeSourceDir, tempImportBranch);
spinner.succeed(`Filtered git history to only include files in ${relativeSourceDir}`);
}
const destinationInSource = (0, path_1.join)(gitClient.root, relativeDestination);
spinner.start(`Moving files and git history to ${destinationInSource}`);
if (relativeSourceDir === '') {
const files = await gitClient.getGitFiles('.');
try {
await (0, promises_1.rm)(destinationInSource, {
recursive: true,
});
}
catch { }
await (0, promises_1.mkdir)(destinationInSource, { recursive: true });
const gitignores = new Set();
for (const file of files) {
if ((0, path_1.basename)(file) === '.gitignore') {
gitignores.add(file);
continue;
}
spinner.start(`Moving files and git history to ${destinationInSource}: ${file}`);
const newPath = (0, path_1.join)(destinationInSource, file);
await (0, promises_1.mkdir)((0, path_1.dirname)(newPath), { recursive: true });
try {
await gitClient.move(file, newPath);
}
catch {
await wait(100);
await gitClient.move(file, newPath);
}
}
await gitClient.commit(`chore(repo): move ${source} to ${relativeDestination} to prepare to be imported`);
for (const gitignore of gitignores) {
await gitClient.move(gitignore, (0, path_1.join)(destinationInSource, gitignore));
}
await gitClient.amendCommit();
for (const gitignore of gitignores) {
await (0, promises_1.copyFile)((0, path_1.join)(destinationInSource, gitignore), (0, path_1.join)(gitClient.root, gitignore));
}
// The result of filter-branch will contain only the files in the subdirectory at its root.
const files = await gitClient.getGitFiles('.');
try {
await (0, promises_1.rm)(destinationInSource, {
recursive: true,
});
}
else {
let needsSquash = false;
const needsMove = destinationInSource !== (0, path_1.join)(gitClient.root, source);
if (needsMove) {
try {
await (0, promises_1.rm)(destinationInSource, {
recursive: true,
});
await gitClient.commit(`chore(repo): move ${source} to ${relativeDestination} to prepare to be imported`);
needsSquash = true;
}
catch { }
await (0, promises_1.mkdir)(destinationInSource, { recursive: true });
catch { }
await (0, promises_1.mkdir)(destinationInSource, { recursive: true });
const gitignores = new Set();
for (const file of files) {
if ((0, path_1.basename)(file) === '.gitignore') {
gitignores.add(file);
continue;
}
const files = await gitClient.getGitFiles('.');
for (const file of files) {
if (file === '.gitignore') {
continue;
}
spinner.start(`Moving files and git history to ${destinationInSource}: ${file}`);
if (!(0, path_1.relative)(source, file).startsWith('..')) {
if (needsMove) {
const newPath = (0, path_1.join)(destinationInSource, file);
await (0, promises_1.mkdir)((0, path_1.dirname)(newPath), { recursive: true });
try {
await gitClient.move(file, newPath);
}
catch {
await wait(100);
await gitClient.move(file, newPath);
}
}
}
else {
await (0, promises_1.rm)((0, path_1.join)(gitClient.root, file), {
recursive: true,
});
}
spinner.start(`Moving files and git history to ${destinationInSource}: ${file}`);
const newPath = (0, path_1.join)(destinationInSource, file);
await (0, promises_1.mkdir)((0, path_1.dirname)(newPath), { recursive: true });
try {
await gitClient.move(file, newPath);
}
await gitClient.commit(`chore(repo): move ${source} to ${relativeDestination} to prepare to be imported`);
if (needsSquash) {
await gitClient.squashLastTwoCommits();
catch {
await wait(100);
await gitClient.move(file, newPath);
}
}
await gitClient.commit(`chore(repo): move ${source} to ${relativeDestination} to prepare to be imported`);
for (const gitignore of gitignores) {
await gitClient.move(gitignore, (0, path_1.join)(destinationInSource, gitignore));
}
await gitClient.amendCommit();
for (const gitignore of gitignores) {
await (0, promises_1.copyFile)((0, path_1.join)(destinationInSource, gitignore), (0, path_1.join)(gitClient.root, gitignore));
}
spinner.succeed(`${sourceRemoteUrl} has been prepared to be imported into this workspace on a temporary branch: ${tempImportBranch} in ${gitClient.root}`);

@@ -102,0 +62,0 @@ }

@@ -27,6 +27,4 @@ "use strict";

const command_object_21 = require("./add/command-object");
const command_object_22 = require("./login/command-object");
const command_object_23 = require("./logout/command-object");
const command_objects_1 = require("./deprecated/command-objects");
const command_object_24 = require("./sync/command-object");
const command_object_22 = require("./sync/command-object");
// Ensure that the output takes up the available width of the terminal.

@@ -76,9 +74,7 @@ yargs.wrap(yargs.terminalWidth());

.command(command_object_17.yargsShowCommand)
.command(command_object_24.yargsSyncCommand)
.command(command_object_24.yargsSyncCheckCommand)
.command(command_object_22.yargsSyncCommand)
.command(command_object_22.yargsSyncCheckCommand)
.command(command_object_2.yargsViewLogsCommand)
.command(command_object_18.yargsWatchCommand)
.command(command_object_15.yargsNxInfixCommand)
.command(command_object_22.yargsLoginCommand)
.command(command_object_23.yargsLogoutCommand)
.scriptName('nx')

@@ -85,0 +81,0 @@ .help()

@@ -14,3 +14,8 @@ "use strict";

if (!accessToken && !nxCloudId) {
throw new Error(`Unable to authenticate. If you are connecting to Nx Cloud locally, set an Nx Cloud ID in your nx.json with "nx connect". If you are in a CI context, please set the NX_CLOUD_ACCESS_TOKEN environment variable or define an access token in your nx.json.`);
if (process.env.NX_ENABLE_LOGIN === 'true' && !nxCloudId) {
throw new Error(`Unable to authenticate. Please connect your workspace to Nx Cloud to define a valid Nx Cloud Id. If you are in a CI context, please set the NX_CLOUD_ACCESS_TOKEN environment variable or define an access token in your nx.json.`);
}
else {
throw new Error(`Unable to authenticate. Either define accessToken in nx.json or set the NX_CLOUD_ACCESS_TOKEN env variable. If you do not want to use Nx Cloud for this command, either set NX_NO_CLOUD=true, or pass the --no-cloud flag.`);
}
}

@@ -17,0 +22,0 @@ if (options.customProxyConfigPath) {

import { NxArgs } from '../utils/command-line-utils';
import { Task, TaskGraph } from '../config/task-graph';
import { TaskResult } from './life-cycle';
export declare function initTasksRunner(nxArgs: NxArgs): Promise<{

@@ -11,4 +10,3 @@ invoke: (opts: {

taskGraph: TaskGraph;
taskResults: Record<string, TaskResult>;
}>;
}>;

@@ -55,3 +55,2 @@ "use strict";

taskGraph,
taskResults: lifeCycle.getTaskResults(),
};

@@ -58,0 +57,0 @@ },

import { TaskStatus } from '../tasks-runner';
import type { LifeCycle, TaskResult } from '../life-cycle';
import type { LifeCycle } from '../life-cycle';
import { Task } from '../../config/task-graph';

@@ -8,9 +8,11 @@ export declare class InvokeRunnerTerminalOutputLifeCycle implements LifeCycle {

cachedTasks: Task[];
private taskResults;
constructor(tasks: Task[]);
startCommand(): void;
endCommand(): void;
endTasks(taskResults: TaskResult[]): void;
endTasks(taskResults: {
task: Task;
status: TaskStatus;
code: number;
}[]): void;
printTaskTerminalOutput(task: Task, cacheStatus: TaskStatus, terminalOutput: string): void;
getTaskResults(): Record<string, TaskResult>;
}

@@ -11,3 +11,2 @@ "use strict";

this.cachedTasks = [];
this.taskResults = {};
}

@@ -50,3 +49,2 @@ startCommand() {

for (let t of taskResults) {
this.taskResults[t.task.id] = t;
if (t.status === 'failure') {

@@ -70,6 +68,3 @@ this.failedTasks.push(t.task);

}
getTaskResults() {
return this.taskResults;
}
}
exports.InvokeRunnerTerminalOutputLifeCycle = InvokeRunnerTerminalOutputLifeCycle;

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

process.env.NX_CLOUD_ACCESS_TOKEN ||
// Nx Cloud ID specified in nxJson
// Nx Cloud Id specified in nxJson
nxJson.nxCloudId;

@@ -447,0 +447,0 @@ return isCloudRunner ? 'nx-cloud' : require.resolve('./default-tasks-runner');

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

import { ExecSyncOptions } from 'child_process';
export declare function cloneFromUpstream(url: string, destination: string, { originName }?: {
export declare function cloneFromUpstream(url: string, destination: string, { originName, depth }?: {
originName: string;
depth?: number;
}): Promise<GitRepository>;

@@ -16,3 +16,2 @@ export declare class GitRepository {

reset(ref: string): Promise<string>;
squashLastTwoCommits(): Promise<string>;
mergeUnrelatedHistories(ref: string, message: string): Promise<string>;

@@ -29,4 +28,4 @@ fetch(remote: string, ref?: string): Promise<string>;

deleteGitRemote(name: string): Promise<string>;
deleteBranch(branch: string): Promise<string>;
addGitRemote(name: string, url: string): Promise<string>;
filterBranch(subdirectory: string, branchName: string): Promise<string>;
}

@@ -37,3 +36,2 @@ /**

export declare function updateRebaseFile(contents: string): string;
export declare function fetchGitRemote(name: string, branch: string, execOptions: ExecSyncOptions): string | Buffer;
/**

@@ -40,0 +38,0 @@ * This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.

@@ -6,3 +6,2 @@ "use strict";

exports.updateRebaseFile = updateRebaseFile;
exports.fetchGitRemote = fetchGitRemote;
exports.getGithubSlugOrNull = getGithubSlugOrNull;

@@ -15,3 +14,2 @@ exports.extractUserAndRepoFromGitHubUrl = extractUserAndRepoFromGitHubUrl;

const path_1 = require("path");
const SQUASH_EDITOR = (0, path_1.join)(__dirname, 'squash.js');
function execAsync(command, execOptions) {

@@ -27,4 +25,6 @@ return new Promise((res, rej) => {

}
async function cloneFromUpstream(url, destination, { originName } = { originName: 'origin' }) {
await execAsync(`git clone ${url} ${destination} --depth 1 --origin ${originName}`, {
async function cloneFromUpstream(url, destination, { originName, depth } = {
originName: 'origin',
}) {
await execAsync(`git clone ${url} ${destination} ${depth ? `--depth ${depth}` : ''} --origin ${originName}`, {
cwd: (0, path_1.dirname)(destination),

@@ -46,4 +46,4 @@ });

}
addFetchRemote(remoteName, branch) {
return this.execAsync(`git config --add remote.${remoteName}.fetch "+refs/heads/${branch}:refs/remotes/${remoteName}/${branch}"`);
async addFetchRemote(remoteName, branch) {
return await this.execAsync(`git config --add remote.${remoteName}.fetch "+refs/heads/${branch}:refs/remotes/${remoteName}/${branch}"`);
}

@@ -75,36 +75,35 @@ execAsync(command) {

async reset(ref) {
return this.execAsync(`git reset ${ref} --hard`);
return await this.execAsync(`git reset ${ref} --hard`);
}
async squashLastTwoCommits() {
return this.execAsync(`git -c core.editor="node ${SQUASH_EDITOR}" rebase --interactive --no-autosquash HEAD~2`);
}
async mergeUnrelatedHistories(ref, message) {
return this.execAsync(`git merge ${ref} -X ours --allow-unrelated-histories -m "${message}"`);
return await this.execAsync(`git merge ${ref} -X ours --allow-unrelated-histories -m "${message}"`);
}
async fetch(remote, ref) {
return this.execAsync(`git fetch ${remote}${ref ? ` ${ref}` : ''}`);
return await this.execAsync(`git fetch ${remote}${ref ? ` ${ref}` : ''}`);
}
async checkout(branch, opts) {
return this.execAsync(`git checkout ${opts.new ? '-b ' : ' '}${branch}${opts.base ? ' ' + opts.base : ''}`);
return await this.execAsync(`git checkout ${opts.new ? '-b ' : ' '}${branch}${opts.base ? ' ' + opts.base : ''}`);
}
async move(path, destination) {
return this.execAsync(`git mv "${path}" "${destination}"`);
return await this.execAsync(`git mv "${path}" "${destination}"`);
}
async push(ref, remoteName) {
return this.execAsync(`git push -u -f ${remoteName} ${ref}`);
return await this.execAsync(`git push -u -f ${remoteName} ${ref}`);
}
async commit(message) {
return this.execAsync(`git commit -am "${message}"`);
return await this.execAsync(`git commit -am "${message}"`);
}
async amendCommit() {
return this.execAsync(`git commit --amend -a --no-edit`);
return await this.execAsync(`git commit --amend -a --no-edit`);
}
deleteGitRemote(name) {
return this.execAsync(`git remote rm ${name}`);
async deleteGitRemote(name) {
return await this.execAsync(`git remote rm ${name}`);
}
deleteBranch(branch) {
return this.execAsync(`git branch -D ${branch}`);
async addGitRemote(name, url) {
return await this.execAsync(`git remote add ${name} ${url}`);
}
addGitRemote(name, url) {
return this.execAsync(`git remote add ${name} ${url}`);
async filterBranch(subdirectory, branchName) {
// We need non-ASCII file names to not be quoted, or else filter-branch will exclude them.
await this.execAsync(`git config core.quotepath false`);
return await this.execAsync(`git filter-branch --subdirectory-filter ${subdirectory} -- ${branchName}`);
}

@@ -122,5 +121,2 @@ }

}
function fetchGitRemote(name, branch, execOptions) {
return (0, child_process_1.execSync)(`git fetch ${name} ${branch} --depth 1`, execOptions);
}
/**

@@ -127,0 +123,0 @@ * This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.

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