Comparing version 19.5.3 to 19.5.4
{ | ||
"name": "nx", | ||
"version": "19.5.3", | ||
"version": "19.5.4", | ||
"private": false, | ||
@@ -44,3 +44,3 @@ "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.", | ||
"@zkochan/js-yaml": "0.0.7", | ||
"axios": "^1.6.0", | ||
"axios": "^1.7.2", | ||
"chalk": "^4.1.0", | ||
@@ -75,3 +75,3 @@ "cli-cursor": "3.1.0", | ||
"ora": "5.3.0", | ||
"@nrwl/tao": "19.5.3" | ||
"@nrwl/tao": "19.5.4" | ||
}, | ||
@@ -91,12 +91,12 @@ "peerDependencies": { | ||
"optionalDependencies": { | ||
"@nx/nx-darwin-x64": "19.5.3", | ||
"@nx/nx-darwin-arm64": "19.5.3", | ||
"@nx/nx-linux-x64-gnu": "19.5.3", | ||
"@nx/nx-linux-x64-musl": "19.5.3", | ||
"@nx/nx-win32-x64-msvc": "19.5.3", | ||
"@nx/nx-linux-arm64-gnu": "19.5.3", | ||
"@nx/nx-linux-arm64-musl": "19.5.3", | ||
"@nx/nx-linux-arm-gnueabihf": "19.5.3", | ||
"@nx/nx-win32-arm64-msvc": "19.5.3", | ||
"@nx/nx-freebsd-x64": "19.5.3" | ||
"@nx/nx-darwin-x64": "19.5.4", | ||
"@nx/nx-darwin-arm64": "19.5.4", | ||
"@nx/nx-linux-x64-gnu": "19.5.4", | ||
"@nx/nx-linux-x64-musl": "19.5.4", | ||
"@nx/nx-win32-x64-msvc": "19.5.4", | ||
"@nx/nx-linux-arm64-gnu": "19.5.4", | ||
"@nx/nx-linux-arm64-musl": "19.5.4", | ||
"@nx/nx-linux-arm-gnueabihf": "19.5.4", | ||
"@nx/nx-win32-arm64-msvc": "19.5.4", | ||
"@nx/nx-freebsd-x64": "19.5.4" | ||
}, | ||
@@ -103,0 +103,0 @@ "nx-migrations": { |
@@ -28,6 +28,7 @@ "use strict"; | ||
} | ||
let relevantChanges = changes; | ||
// workspace root level changelog | ||
if (project === null) { | ||
// No changes for the workspace | ||
if (changes.length === 0) { | ||
if (relevantChanges.length === 0) { | ||
if (dependencyBumps?.length) { | ||
@@ -46,3 +47,3 @@ applyAdditionalDependencyBumps({ | ||
} | ||
const typeGroups = groupBy(changes, 'type'); | ||
const typeGroups = groupBy(relevantChanges, 'type'); | ||
markdownLines.push('', createVersionTitle(releaseVersion, changelogRenderOptions), ''); | ||
@@ -80,3 +81,3 @@ for (const type of Object.keys(changeTypes)) { | ||
// project level changelog | ||
const relevantChanges = changes.filter((c) => c.affectedProjects && | ||
relevantChanges = relevantChanges.filter((c) => c.affectedProjects && | ||
(c.affectedProjects === '*' || c.affectedProjects.includes(project))); | ||
@@ -134,3 +135,3 @@ // Generating for a named project, but that project has no relevant changes in the current set of commits, exit early | ||
const _authors = new Map(); | ||
for (const change of changes) { | ||
for (const change of relevantChanges) { | ||
if (!change.author) { | ||
@@ -137,0 +138,0 @@ continue; |
@@ -0,1 +1,2 @@ | ||
import { ConnectToNxCloudOptions } from '../../nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud'; | ||
import { NxJsonConfiguration } from '../../config/nx-json'; | ||
@@ -6,4 +7,5 @@ import { NxArgs } from '../../utils/command-line-utils'; | ||
export declare function connectToNxCloudIfExplicitlyAsked(opts: NxArgs): Promise<void>; | ||
export declare function connectWorkspaceToCloud(options: ConnectToNxCloudOptions): Promise<string>; | ||
export declare function connectToNxCloudCommand(command?: string): Promise<boolean>; | ||
export declare function connectExistingRepoToNxCloudPrompt(command?: string, key?: MessageKey): Promise<boolean>; | ||
export declare function connectToNxCloudWithPrompt(command: string): Promise<void>; |
@@ -5,2 +5,3 @@ "use strict"; | ||
exports.connectToNxCloudIfExplicitlyAsked = connectToNxCloudIfExplicitlyAsked; | ||
exports.connectWorkspaceToCloud = connectWorkspaceToCloud; | ||
exports.connectToNxCloudCommand = connectToNxCloudCommand; | ||
@@ -20,2 +21,4 @@ exports.connectExistingRepoToNxCloudPrompt = connectExistingRepoToNxCloudPrompt; | ||
const chalk = require("chalk"); | ||
const ora = require("ora"); | ||
const open = require("open"); | ||
function onlyDefaultRunnerIsUsed(nxJson) { | ||
@@ -48,2 +51,9 @@ const defaultRunner = nxJson.tasksRunnerOptions?.default?.runner; | ||
} | ||
async function connectWorkspaceToCloud(options) { | ||
const tree = new tree_1.FsTree(workspace_root_1.workspaceRoot, false, 'connect-to-nx-cloud'); | ||
const accessToken = await (0, connect_to_nx_cloud_1.connectToNxCloud)(tree, options); | ||
tree.lock(); | ||
(0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, tree.listChanges()); | ||
return accessToken; | ||
} | ||
async function connectToNxCloudCommand(command) { | ||
@@ -56,3 +66,3 @@ const nxJson = (0, configuration_1.readNxJson)(); | ||
} | ||
const connectCloudUrl = await (0, url_shorten_1.shortenedCloudUrl)('nx-connect', token); | ||
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-connect', token); | ||
output_1.output.log({ | ||
@@ -69,11 +79,28 @@ title: '✔ This workspace already has Nx Cloud set up', | ||
} | ||
const tree = new tree_1.FsTree(workspace_root_1.workspaceRoot, false, 'connect-to-nx-cloud'); | ||
const callback = await (0, connect_to_nx_cloud_1.connectToNxCloud)(tree, { | ||
const token = await connectWorkspaceToCloud({ | ||
installationSource: command ?? 'nx-connect', | ||
}); | ||
tree.lock(); | ||
(0, tree_1.flushChanges)(workspace_root_1.workspaceRoot, tree.listChanges()); | ||
await callback(); | ||
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)('nx-connect', token); | ||
try { | ||
const cloudConnectSpinner = ora(`Opening Nx Cloud ${connectCloudUrl} in your browser to connect your workspace.`).start(); | ||
await sleep(2000); | ||
await open(connectCloudUrl); | ||
cloudConnectSpinner.succeed(); | ||
} | ||
catch (e) { | ||
output_1.output.note({ | ||
title: `Your Nx Cloud workspace is ready.`, | ||
bodyLines: [ | ||
`To claim it, connect it to your Nx Cloud account:`, | ||
`- Go to the following URL to connect your workspace to Nx Cloud:`, | ||
'', | ||
`${connectCloudUrl}`, | ||
], | ||
}); | ||
} | ||
return true; | ||
} | ||
function sleep(ms) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
} | ||
async function connectExistingRepoToNxCloudPrompt(command = 'init', key = 'setupNxCloud') { | ||
@@ -80,0 +107,0 @@ const res = await nxCloudPrompt(key).then((value) => value === 'yes'); |
@@ -8,5 +8,6 @@ "use strict"; | ||
const output_1 = require("../../utils/output"); | ||
const child_process_2 = require("../../utils/child-process"); | ||
const nx_json_1 = require("../../config/nx-json"); | ||
const connect_to_nx_cloud_1 = require("./connect-to-nx-cloud"); | ||
const connect_to_nx_cloud_2 = require("../../nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud"); | ||
const url_shorten_1 = require("../../nx-cloud/utilities/url-shorten"); | ||
async function viewLogs() { | ||
@@ -31,5 +32,6 @@ const cloudUsed = (0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)()); | ||
}); | ||
(0, child_process_2.runNxSync)(`g nx:connect-to-nx-cloud --installation-source=view-logs --quiet --no-interactive`, { | ||
stdio: 'ignore', | ||
const token = await (0, connect_to_nx_cloud_1.connectWorkspaceToCloud)({ | ||
installationSource: 'view-logs', | ||
}); | ||
await (0, connect_to_nx_cloud_2.printSuccessMessage)(token, 'view-logs', await (0, url_shorten_1.repoUsesGithub)()); | ||
} | ||
@@ -36,0 +38,0 @@ catch (e) { |
@@ -315,2 +315,6 @@ "use strict"; | ||
{ | ||
command: 'show projects --projects tag:ui-*', | ||
description: 'Show all projects with a tag starting with "ui-". The "projects" option is useful to see which projects would be selected by run-many', | ||
}, | ||
{ | ||
command: 'show projects --with-target serve', | ||
@@ -317,0 +321,0 @@ description: 'Show all projects with a serve target', |
@@ -77,3 +77,3 @@ "use strict"; | ||
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' }); | ||
(0, utils_1.initCloud)(repoRoot, 'nx-init-monorepo'); | ||
await (0, utils_1.initCloud)('nx-init-monorepo'); | ||
} | ||
@@ -80,0 +80,0 @@ } |
@@ -96,3 +96,3 @@ "use strict"; | ||
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' }); | ||
(0, utils_1.initCloud)(repoRoot, 'nx-init-nest'); | ||
await (0, utils_1.initCloud)('nx-init-nest'); | ||
} | ||
@@ -99,0 +99,0 @@ } |
@@ -70,4 +70,4 @@ "use strict"; | ||
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' }); | ||
(0, utils_1.initCloud)(repoRoot, 'nx-init-npm-repo'); | ||
await (0, utils_1.initCloud)('nx-init-npm-repo'); | ||
} | ||
} |
@@ -47,3 +47,3 @@ "use strict"; | ||
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' }); | ||
(0, utils_1.initCloud)(repoRoot, 'nx-init-angular'); | ||
await (0, utils_1.initCloud)('nx-init-angular'); | ||
} | ||
@@ -50,0 +50,0 @@ } |
@@ -88,3 +88,3 @@ "use strict"; | ||
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' }); | ||
(0, utils_1.initCloud)(repoRoot, 'nx-init-angular'); | ||
await (0, utils_1.initCloud)('nx-init-angular'); | ||
} | ||
@@ -91,0 +91,0 @@ }; |
@@ -9,3 +9,3 @@ import { PackageJson } from '../../../utils/package-json'; | ||
export declare function runInstall(repoRoot: string, pmc?: PackageManagerCommands): void; | ||
export declare function initCloud(repoRoot: string, installationSource: 'nx-init-angular' | 'nx-init-cra' | 'nx-init-monorepo' | 'nx-init-nest' | 'nx-init-npm-repo'): void; | ||
export declare function initCloud(installationSource: 'nx-init' | 'nx-init-angular' | 'nx-init-cra' | 'nx-init-monorepo' | 'nx-init-nest' | 'nx-init-npm-repo'): Promise<void>; | ||
export declare function addVsCodeRecommendedExtensions(repoRoot: string, extensions: string[]): void; | ||
@@ -12,0 +12,0 @@ export declare function markRootPackageJsonAsNxProjectLegacy(repoRoot: string, cacheableScripts: string[], pmc: PackageManagerCommands): void; |
@@ -15,3 +15,2 @@ "use strict"; | ||
const path_1 = require("path"); | ||
const child_process_2 = require("../../../utils/child-process"); | ||
const fileutils_1 = require("../../../utils/fileutils"); | ||
@@ -23,2 +22,5 @@ const output_1 = require("../../../utils/output"); | ||
const fs_1 = require("fs"); | ||
const connect_to_nx_cloud_1 = require("../../../nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud"); | ||
const url_shorten_1 = require("../../../nx-cloud/utilities/url-shorten"); | ||
const connect_to_nx_cloud_2 = require("../../connect/connect-to-nx-cloud"); | ||
function createNxJsonFile(repoRoot, topologicalTargets, cacheableOperations, scriptOutputs) { | ||
@@ -133,7 +135,7 @@ const nxJsonPath = (0, path_2.joinPathFragments)(repoRoot, 'nx.json'); | ||
} | ||
function initCloud(repoRoot, installationSource) { | ||
(0, child_process_2.runNxSync)(`g nx:connect-to-nx-cloud --installationSource=${installationSource} --quiet --no-interactive`, { | ||
stdio: [0, 1, 2], | ||
cwd: repoRoot, | ||
async function initCloud(installationSource) { | ||
const token = await (0, connect_to_nx_cloud_2.connectWorkspaceToCloud)({ | ||
installationSource, | ||
}); | ||
await (0, connect_to_nx_cloud_1.printSuccessMessage)(token, installationSource, await (0, url_shorten_1.repoUsesGithub)()); | ||
} | ||
@@ -140,0 +142,0 @@ function addVsCodeRecommendedExtensions(repoRoot, extensions) { |
@@ -93,6 +93,3 @@ "use strict"; | ||
output_1.output.log({ title: '🛠️ Setting up Nx Cloud' }); | ||
(0, child_process_2.execSync)(`${pmc.exec} nx g nx:connect-to-nx-cloud --installationSource=nx-init --quiet --hideFormatLogs --no-interactive`, { | ||
stdio: [0, 1, 2], | ||
cwd: repoRoot, | ||
}); | ||
await (0, utils_1.initCloud)('nx-init'); | ||
} | ||
@@ -99,0 +96,0 @@ (0, utils_1.printFinalMessage)({ |
@@ -33,2 +33,3 @@ "use strict"; | ||
const project_graph_1 = require("../../project-graph/project-graph"); | ||
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available"); | ||
const execAsync = (0, util_1.promisify)(child_process_1.exec); | ||
@@ -673,6 +674,6 @@ function normalizeVersion(version) { | ||
} | ||
function createMigrationsFile(root, migrations) { | ||
(0, fileutils_1.writeJsonFile)((0, path_1.join)(root, 'migrations.json'), { migrations }); | ||
async function createMigrationsFile(root, migrations) { | ||
await writeFormattedJsonFile((0, path_1.join)(root, 'migrations.json'), { migrations }); | ||
} | ||
function updatePackageJson(root, updatedPackages) { | ||
async function updatePackageJson(root, updatedPackages) { | ||
const packageJsonPath = (0, path_1.join)(root, 'package.json'); | ||
@@ -699,3 +700,3 @@ if (!(0, fs_1.existsSync)(packageJsonPath)) { | ||
}); | ||
(0, fileutils_1.writeJsonFile)(packageJsonPath, json, { | ||
await writeFormattedJsonFile(packageJsonPath, json, { | ||
appendNewLine: parseOptions.endsWithNewline, | ||
@@ -725,3 +726,3 @@ }); | ||
} | ||
(0, fileutils_1.writeJsonFile)(nxJsonPath, nxJson, { | ||
await writeFormattedJsonFile(nxJsonPath, nxJson, { | ||
appendNewLine: parseOptions.endsWithNewline, | ||
@@ -772,6 +773,6 @@ }); | ||
const { migrations, packageUpdates, minVersionWithSkippedUpdates } = await migrator.migrate(opts.targetPackage, opts.targetVersion); | ||
updatePackageJson(root, packageUpdates); | ||
await updatePackageJson(root, packageUpdates); | ||
await updateInstallationDetails(root, packageUpdates); | ||
if (migrations.length > 0) { | ||
createMigrationsFile(root, [ | ||
await createMigrationsFile(root, [ | ||
...addSplitConfigurationMigrationIfAvailable(from, packageUpdates), | ||
@@ -843,2 +844,13 @@ ...migrations, | ||
} | ||
async function writeFormattedJsonFile(filePath, content, options) { | ||
const formattedContent = await (0, format_changed_files_with_prettier_if_available_1.formatFilesWithPrettierIfAvailable)([{ path: filePath, content: JSON.stringify(content) }], workspace_root_1.workspaceRoot, { silent: true }); | ||
if (formattedContent.has(filePath)) { | ||
(0, fs_1.writeFileSync)(filePath, formattedContent.get(filePath), { | ||
encoding: 'utf-8', | ||
}); | ||
} | ||
else { | ||
(0, fileutils_1.writeJsonFile)(filePath, content, options); | ||
} | ||
} | ||
function addSplitConfigurationMigrationIfAvailable(from, packageJson) { | ||
@@ -845,0 +857,0 @@ if (!packageJson['@nrwl/workspace']) |
@@ -299,2 +299,3 @@ "use strict"; | ||
projectName: project.name, | ||
releaseGroupName: releaseGroup.name, | ||
}))?.tag; | ||
@@ -301,0 +302,0 @@ if (!fromRef && useAutomaticFromRef) { |
@@ -76,2 +76,6 @@ "use strict"; | ||
const defaultFixedReleaseTagPattern = 'v{version}'; | ||
/** | ||
* TODO: in v20, make it so that this pattern is used by default when any custom groups are used | ||
*/ | ||
const defaultFixedGroupReleaseTagPattern = '{releaseGroupName}-v{version}'; | ||
const defaultIndependentReleaseTagPattern = '{projectName}@{version}'; | ||
@@ -78,0 +82,0 @@ const workspaceProjectsRelationship = userConfig.projectsRelationship || 'fixed'; |
@@ -17,2 +17,3 @@ "use strict"; | ||
const version_plans_1 = require("./config/version-plans"); | ||
const generate_version_plan_content_1 = require("./utils/generate-version-plan-content"); | ||
const git_1 = require("./utils/git"); | ||
@@ -98,3 +99,3 @@ const print_changes_1 = require("./utils/print-changes"); | ||
const versionPlanMessage = args.message || (await promptForMessage()); | ||
const versionPlanFileContent = getVersionPlanFileContent(versionPlanBumps, versionPlanMessage); | ||
const versionPlanFileContent = (0, generate_version_plan_content_1.generateVersionPlanContent)(versionPlanBumps, versionPlanMessage); | ||
const versionPlanFileName = `version-plan-${new Date().getTime()}.md`; | ||
@@ -176,12 +177,1 @@ if (args.dryRun) { | ||
} | ||
function getVersionPlanFileContent(bumps, message) { | ||
return `--- | ||
${Object.entries(bumps) | ||
.filter(([_, version]) => version !== 'none') | ||
.map(([projectOrGroup, version]) => `${projectOrGroup}: ${version}`) | ||
.join('\n')} | ||
--- | ||
${message} | ||
`; | ||
} |
@@ -131,7 +131,9 @@ "use strict"; | ||
const projectVersionData = versionData[releaseGroupProjectNames[0]]; // all at the same version, so we can just pick the first one | ||
const releaseVersion = new ReleaseVersion({ | ||
version: projectVersionData.newVersion, | ||
releaseTagPattern: releaseGroup.releaseTagPattern, | ||
}); | ||
commitMessageValues.push(`- release-group: ${releaseGroup.name} ${releaseVersion.rawVersion}`); | ||
if (projectVersionData.newVersion !== null) { | ||
const releaseVersion = new ReleaseVersion({ | ||
version: projectVersionData.newVersion, | ||
releaseTagPattern: releaseGroup.releaseTagPattern, | ||
}); | ||
commitMessageValues.push(`- release-group: ${releaseGroup.name} ${releaseVersion.rawVersion}`); | ||
} | ||
} | ||
@@ -173,2 +175,3 @@ return commitMessageValues; | ||
version: projectVersionData.newVersion, | ||
releaseGroupName: releaseGroup.name, | ||
})); | ||
@@ -175,0 +178,0 @@ } |
@@ -143,4 +143,5 @@ "use strict"; | ||
]; | ||
const deletedFiles = Array.from(additionalDeletedFiles); | ||
// No further actions are necessary in this scenario (e.g. if conventional commits detected no changes) | ||
if (!changedFiles.length) { | ||
if (!changedFiles.length && !deletedFiles.length) { | ||
return { | ||
@@ -155,3 +156,3 @@ // An overall workspace version cannot be relevant when filtering to independent projects | ||
changedFiles, | ||
deletedFiles: Array.from(additionalDeletedFiles), | ||
deletedFiles, | ||
isDryRun: !!args.dryRun, | ||
@@ -167,2 +168,3 @@ isVerbose: !!args.verbose, | ||
changedFiles, | ||
deletedFiles, | ||
dryRun: args.dryRun, | ||
@@ -169,0 +171,0 @@ verbose: args.verbose, |
@@ -34,2 +34,3 @@ import { PackageManager } from '../../utils/package-manager'; | ||
projectGraphError?: Error | null; | ||
nativeTarget: string | null; | ||
} | ||
@@ -36,0 +37,0 @@ export declare function getReportData(): Promise<ReportData>; |
@@ -46,10 +46,14 @@ "use strict"; | ||
async function reportHandler() { | ||
const { pm, pmVersion, localPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, } = await getReportData(); | ||
const bodyLines = [ | ||
`Node : ${process.versions.node}`, | ||
`OS : ${process.platform}-${process.arch}`, | ||
`${pm.padEnd(7)}: ${pmVersion}`, | ||
``, | ||
const { pm, pmVersion, localPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, } = await getReportData(); | ||
const fields = [ | ||
['Node', process.versions.node], | ||
['OS', `${process.platform}-${process.arch}`], | ||
['Native Target', nativeTarget ?? 'Unavailable'], | ||
[pm, pmVersion], | ||
]; | ||
let padding = Math.max(...packageVersionsWeCareAbout.map((x) => x.package.length)) + 1; | ||
let padding = Math.max(...fields.map((f) => f[0].length)); | ||
const bodyLines = fields.map(([field, value]) => `${field.padEnd(padding)} : ${value}`); | ||
bodyLines.push(''); | ||
padding = | ||
Math.max(...packageVersionsWeCareAbout.map((x) => x.package.length)) + 1; | ||
packageVersionsWeCareAbout.forEach((p) => { | ||
@@ -120,2 +124,3 @@ bodyLines.push(`${chalk.green(p.package.padEnd(padding))} : ${chalk.bold(p.version)}`); | ||
const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson); | ||
const native = isNativeAvailable(); | ||
return { | ||
@@ -130,2 +135,3 @@ pm, | ||
projectGraphError, | ||
nativeTarget: native ? native.getBinaryTarget() : null, | ||
}; | ||
@@ -254,4 +260,3 @@ } | ||
try { | ||
require('../../native'); | ||
return true; | ||
return require('../../native'); | ||
} | ||
@@ -258,0 +263,0 @@ catch { |
@@ -9,1 +9,7 @@ import type { Tree } from '../tree'; | ||
}): Promise<void>; | ||
export declare function formatFilesWithPrettierIfAvailable(files: { | ||
path: string; | ||
content: string | Buffer; | ||
}[], root: string, options?: { | ||
silent?: boolean; | ||
}): Promise<Map<string, string>>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.formatChangedFilesWithPrettierIfAvailable = formatChangedFilesWithPrettierIfAvailable; | ||
exports.formatFilesWithPrettierIfAvailable = formatFilesWithPrettierIfAvailable; | ||
const path = require("path"); | ||
@@ -10,2 +11,10 @@ /** | ||
async function formatChangedFilesWithPrettierIfAvailable(tree, options) { | ||
const files = new Set(tree.listChanges().filter((file) => file.type !== 'DELETE')); | ||
const results = await formatFilesWithPrettierIfAvailable(Array.from(files), tree.root, options); | ||
for (const [path, content] of results) { | ||
tree.write(path, content); | ||
} | ||
} | ||
async function formatFilesWithPrettierIfAvailable(files, root, options) { | ||
const results = new Map(); | ||
let prettier; | ||
@@ -16,8 +25,8 @@ try { | ||
catch { } | ||
if (!prettier) | ||
return; | ||
const files = new Set(tree.listChanges().filter((file) => file.type !== 'DELETE')); | ||
if (!prettier) { | ||
return results; | ||
} | ||
await Promise.all(Array.from(files).map(async (file) => { | ||
try { | ||
const systemPath = path.join(tree.root, file.path); | ||
const systemPath = path.join(root, file.path); | ||
let options = { | ||
@@ -40,3 +49,3 @@ filepath: systemPath, | ||
} | ||
tree.write(file.path, | ||
results.set(file.path, | ||
// In prettier v3 the format result is a promise | ||
@@ -51,2 +60,3 @@ await prettier.format(file.content.toString('utf-8'), options)); | ||
})); | ||
return results; | ||
} |
@@ -119,2 +119,4 @@ /* auto-generated by NAPI-RS */ | ||
export declare export function getBinaryTarget(): string | ||
/** | ||
@@ -121,0 +123,0 @@ * Expands the given outputs into a list of existing files. |
@@ -375,2 +375,3 @@ // prettier-ignore | ||
module.exports.findImports = nativeBinding.findImports | ||
module.exports.getBinaryTarget = nativeBinding.getBinaryTarget | ||
module.exports.getFilesForOutputs = nativeBinding.getFilesForOutputs | ||
@@ -377,0 +378,0 @@ module.exports.hashArray = nativeBinding.hashArray |
import { Tree } from '../../../generators/tree'; | ||
interface ConnectToNxCloudOptions { | ||
export declare function printSuccessMessage(token: string | undefined, installationSource: string, usesGithub: boolean): Promise<string>; | ||
export interface ConnectToNxCloudOptions { | ||
analytics?: boolean; | ||
@@ -9,3 +10,3 @@ installationSource?: string; | ||
} | ||
export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions): Promise<() => void>; | ||
export declare function connectToNxCloud(tree: Tree, schema: ConnectToNxCloudOptions): Promise<string>; | ||
export default connectToNxCloud; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.printSuccessMessage = printSuccessMessage; | ||
exports.connectToNxCloud = connectToNxCloud; | ||
@@ -11,4 +12,2 @@ const child_process_1 = require("child_process"); | ||
const get_cloud_options_1 = require("../../utilities/get-cloud-options"); | ||
const ora = require("ora"); | ||
const open = require("open"); | ||
function printCloudConnectionDisabledMessage() { | ||
@@ -59,49 +58,15 @@ output_1.output.error({ | ||
async function printSuccessMessage(token, installationSource, usesGithub) { | ||
const connectCloudUrl = await (0, url_shorten_1.shortenedCloudUrl)(installationSource, token, usesGithub); | ||
if (installationSource === 'nx-connect' && usesGithub) { | ||
try { | ||
const cloudConnectSpinner = ora(`Opening Nx Cloud ${connectCloudUrl} in your browser to connect your workspace.`).start(); | ||
await sleep(2000); | ||
open(connectCloudUrl); | ||
cloudConnectSpinner.succeed(); | ||
} | ||
catch (e) { | ||
output_1.output.note({ | ||
title: `Your Nx Cloud workspace is ready.`, | ||
bodyLines: [ | ||
`To claim it, connect it to your Nx Cloud account:`, | ||
`- Go to the following URL to connect your workspace to Nx Cloud:`, | ||
'', | ||
`${connectCloudUrl}`, | ||
], | ||
}); | ||
} | ||
} | ||
else { | ||
if (installationSource === 'create-nx-workspace') { | ||
output_1.output.note({ | ||
title: `Your Nx Cloud workspace is ready.`, | ||
bodyLines: [ | ||
`To claim it, connect it to your Nx Cloud account:`, | ||
`- Push your repository to your git hosting provider.`, | ||
`- Go to the following URL to connect your workspace to Nx Cloud:`, | ||
'', | ||
`${connectCloudUrl}`, | ||
], | ||
}); | ||
} | ||
else { | ||
output_1.output.note({ | ||
title: `Your Nx Cloud workspace is ready.`, | ||
bodyLines: [ | ||
`To claim it, connect it to your Nx Cloud account:`, | ||
`- Commit and push your changes.`, | ||
`- Create a pull request for the changes.`, | ||
`- Go to the following URL to connect your workspace to Nx Cloud:`, | ||
'', | ||
`${connectCloudUrl}`, | ||
], | ||
}); | ||
} | ||
} | ||
const connectCloudUrl = await (0, url_shorten_1.createNxCloudOnboardingURL)(installationSource, token, usesGithub); | ||
output_1.output.note({ | ||
title: `Your Nx Cloud workspace is ready.`, | ||
bodyLines: [ | ||
`To claim it, connect it to your Nx Cloud account:`, | ||
`- Commit and push your changes.`, | ||
`- Create a pull request for the changes.`, | ||
`- Go to the following URL to connect your workspace to Nx Cloud:`, | ||
'', | ||
`${connectCloudUrl}`, | ||
], | ||
}); | ||
return connectCloudUrl; | ||
} | ||
@@ -123,8 +88,7 @@ function addNxCloudOptionsToNxJson(tree, nxJson, token) { | ||
if (nxJson?.neverConnectToCloud) { | ||
return () => { | ||
printCloudConnectionDisabledMessage(); | ||
}; | ||
printCloudConnectionDisabledMessage(); | ||
return null; | ||
} | ||
else { | ||
const usesGithub = await (0, url_shorten_1.repoUsesGithub)(schema.github); | ||
const usesGithub = schema.github ?? (await (0, url_shorten_1.repoUsesGithub)(schema.github)); | ||
let responseFromCreateNxCloudWorkspace; | ||
@@ -139,9 +103,6 @@ // do NOT create Nx Cloud token (createNxCloudWorkspace) | ||
}); | ||
return responseFromCreateNxCloudWorkspace.token; | ||
} | ||
return async () => await printSuccessMessage(responseFromCreateNxCloudWorkspace?.token, schema.installationSource, usesGithub); | ||
} | ||
} | ||
function sleep(ms) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
} | ||
exports.default = connectToNxCloud; |
@@ -1,2 +0,2 @@ | ||
export declare function shortenedCloudUrl(installationSource: string, accessToken?: string, usesGithub?: boolean): Promise<string>; | ||
export declare function createNxCloudOnboardingURL(onboardingSource: string, accessToken?: string, usesGithub?: boolean, meta?: string): Promise<string>; | ||
export declare function repoUsesGithub(github?: boolean, githubSlug?: string, apiUrl?: string): Promise<boolean>; | ||
@@ -3,0 +3,0 @@ export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: string | null, apiUrl: string, source: string, accessToken?: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.shortenedCloudUrl = shortenedCloudUrl; | ||
exports.createNxCloudOnboardingURL = createNxCloudOnboardingURL; | ||
exports.repoUsesGithub = repoUsesGithub; | ||
@@ -13,3 +13,3 @@ exports.getURLifShortenFailed = getURLifShortenFailed; | ||
const get_cloud_options_1 = require("./get-cloud-options"); | ||
async function shortenedCloudUrl(installationSource, accessToken, usesGithub) { | ||
async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGithub, meta) { | ||
const githubSlug = (0, git_utils_1.getGithubSlugOrNull)(); | ||
@@ -32,3 +32,3 @@ const apiUrl = (0, get_cloud_options_1.getCloudUrl)(); | ||
} | ||
const source = getSource(installationSource); | ||
const source = getSource(onboardingSource); | ||
try { | ||
@@ -40,2 +40,3 @@ const response = await require('axios').post(`${apiUrl}/nx-cloud/onboarding`, { | ||
selectedRepositoryName: githubSlug === 'github' ? null : githubSlug, | ||
meta, | ||
}); | ||
@@ -73,7 +74,4 @@ if (!response?.data || response.data.message) { | ||
} | ||
else if (installationSource.includes('create-nx-workspace')) { | ||
return 'create-nx-workspace'; | ||
} | ||
else { | ||
return 'other'; | ||
return installationSource; | ||
} | ||
@@ -80,0 +78,0 @@ } |
@@ -16,2 +16,3 @@ "use strict"; | ||
const native_1 = require("../../native"); | ||
const os_1 = require("os"); | ||
class LoadedNxPlugin { | ||
@@ -78,3 +79,5 @@ constructor(plugin, pluginDefinition) { | ||
const loadingMethod = process.env.NX_ISOLATE_PLUGINS === 'true' || | ||
(!native_1.IS_WASM && process.env.NX_ISOLATE_PLUGINS !== 'false') | ||
(!native_1.IS_WASM && | ||
(0, os_1.platform)() !== 'win32' && | ||
process.env.NX_ISOLATE_PLUGINS !== 'false') | ||
? isolation_1.loadNxPluginInIsolation | ||
@@ -81,0 +84,0 @@ : loader_1.loadNxPlugin; |
@@ -11,2 +11,3 @@ "use strict"; | ||
const workspace_root_1 = require("../utils/workspace-root"); | ||
const node_path_1 = require("node:path"); | ||
function getEnvVariablesForBatchProcess(skipNxCache, captureStderr) { | ||
@@ -162,3 +163,3 @@ return { | ||
for (const file of dotEnvFiles) { | ||
loadAndExpandDotEnvFile(file, environmentVariables); | ||
loadAndExpandDotEnvFile((0, node_path_1.join)(workspace_root_1.workspaceRoot, file), environmentVariables); | ||
} | ||
@@ -169,5 +170,5 @@ return environmentVariables; | ||
for (const file of ['.env', '.local.env', '.env.local']) { | ||
unloadDotEnvFile(file, environmentVariables); | ||
unloadDotEnvFile((0, node_path_1.join)(workspace_root_1.workspaceRoot, file), environmentVariables); | ||
} | ||
return environmentVariables; | ||
} |
@@ -69,3 +69,3 @@ "use strict"; | ||
`Please enable Nx Cloud or use the slower ${nonAtomizedTasks.join(',')} task${nonAtomizedTasks.length > 1 ? 's' : ''}.`, | ||
'Learn more at https://nx.dev/ci/features/split-e2e-tasks#use-atomizer-only-with-nx-cloud-distribution', | ||
'Learn more at https://nx.dev/ci/features/split-e2e-tasks#nx-cloud-is-required-to-run-atomized-tasks', | ||
]; | ||
@@ -72,0 +72,0 @@ if (atomizedRootTasks.length === 1) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7174967
744
49109
+ Added@nrwl/tao@19.5.4(transitive)
+ Added@nx/nx-darwin-arm64@19.5.4(transitive)
+ Added@nx/nx-darwin-x64@19.5.4(transitive)
+ Added@nx/nx-freebsd-x64@19.5.4(transitive)
+ Added@nx/nx-linux-arm-gnueabihf@19.5.4(transitive)
+ Added@nx/nx-linux-arm64-gnu@19.5.4(transitive)
+ Added@nx/nx-linux-arm64-musl@19.5.4(transitive)
+ Added@nx/nx-linux-x64-gnu@19.5.4(transitive)
+ Added@nx/nx-linux-x64-musl@19.5.4(transitive)
+ Added@nx/nx-win32-arm64-msvc@19.5.4(transitive)
+ Added@nx/nx-win32-x64-msvc@19.5.4(transitive)
- Removed@nrwl/tao@19.5.3(transitive)
- Removed@nx/nx-darwin-arm64@19.5.3(transitive)
- Removed@nx/nx-darwin-x64@19.5.3(transitive)
- Removed@nx/nx-freebsd-x64@19.5.3(transitive)
- Removed@nx/nx-linux-arm-gnueabihf@19.5.3(transitive)
- Removed@nx/nx-linux-arm64-gnu@19.5.3(transitive)
- Removed@nx/nx-linux-arm64-musl@19.5.3(transitive)
- Removed@nx/nx-linux-x64-gnu@19.5.3(transitive)
- Removed@nx/nx-linux-x64-musl@19.5.3(transitive)
- Removed@nx/nx-win32-arm64-msvc@19.5.3(transitive)
- Removed@nx/nx-win32-x64-msvc@19.5.3(transitive)
Updated@nrwl/tao@19.5.4
Updatedaxios@^1.7.2