feat(core): include target architecture in nx report (#27094)
This commit is contained in:
parent
173ea84d92
commit
40d39d40a8
@ -64,16 +64,23 @@ export async function reportHandler() {
|
|||||||
packageVersionsWeCareAbout,
|
packageVersionsWeCareAbout,
|
||||||
outOfSyncPackageGroup,
|
outOfSyncPackageGroup,
|
||||||
projectGraphError,
|
projectGraphError,
|
||||||
|
nativeTarget,
|
||||||
} = await getReportData();
|
} = await getReportData();
|
||||||
|
|
||||||
const bodyLines = [
|
const fields = [
|
||||||
`Node : ${process.versions.node}`,
|
['Node', process.versions.node],
|
||||||
`OS : ${process.platform}-${process.arch}`,
|
['OS', `${process.platform}-${process.arch}`],
|
||||||
`${pm.padEnd(7)}: ${pmVersion}`,
|
['Native Target', nativeTarget ?? 'Unavailable'],
|
||||||
``,
|
[pm, pmVersion],
|
||||||
];
|
];
|
||||||
|
let padding = Math.max(...fields.map((f) => f[0].length));
|
||||||
|
const bodyLines = fields.map(
|
||||||
|
([field, value]) => `${field.padEnd(padding)} : ${value}`
|
||||||
|
);
|
||||||
|
|
||||||
let padding =
|
bodyLines.push('');
|
||||||
|
|
||||||
|
padding =
|
||||||
Math.max(...packageVersionsWeCareAbout.map((x) => x.package.length)) + 1;
|
Math.max(...packageVersionsWeCareAbout.map((x) => x.package.length)) + 1;
|
||||||
packageVersionsWeCareAbout.forEach((p) => {
|
packageVersionsWeCareAbout.forEach((p) => {
|
||||||
bodyLines.push(
|
bodyLines.push(
|
||||||
@ -156,6 +163,7 @@ export interface ReportData {
|
|||||||
migrateTarget: string;
|
migrateTarget: string;
|
||||||
};
|
};
|
||||||
projectGraphError?: Error | null;
|
projectGraphError?: Error | null;
|
||||||
|
nativeTarget: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getReportData(): Promise<ReportData> {
|
export async function getReportData(): Promise<ReportData> {
|
||||||
@ -183,6 +191,8 @@ export async function getReportData(): Promise<ReportData> {
|
|||||||
|
|
||||||
const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
|
const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
|
||||||
|
|
||||||
|
const native = isNativeAvailable();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
pm,
|
pm,
|
||||||
pmVersion,
|
pmVersion,
|
||||||
@ -192,6 +202,7 @@ export async function getReportData(): Promise<ReportData> {
|
|||||||
packageVersionsWeCareAbout,
|
packageVersionsWeCareAbout,
|
||||||
outOfSyncPackageGroup,
|
outOfSyncPackageGroup,
|
||||||
projectGraphError,
|
projectGraphError,
|
||||||
|
nativeTarget: native ? native.getBinaryTarget() : null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,10 +362,9 @@ export function findInstalledPackagesWeCareAbout() {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNativeAvailable() {
|
function isNativeAvailable(): typeof import('../../native') | false {
|
||||||
try {
|
try {
|
||||||
require('../../native');
|
return require('../../native');
|
||||||
return true;
|
|
||||||
} catch {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
2
packages/nx/src/native/index.d.ts
vendored
2
packages/nx/src/native/index.d.ts
vendored
@ -116,6 +116,8 @@ export interface FileSetInput {
|
|||||||
|
|
||||||
export declare export function findImports(projectFileMap: Record<string, Array<string>>): Array<ImportResult>
|
export declare export function findImports(projectFileMap: Record<string, Array<string>>): Array<ImportResult>
|
||||||
|
|
||||||
|
export declare export function getBinaryTarget(): string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expands the given outputs into a list of existing files.
|
* Expands the given outputs into a list of existing files.
|
||||||
* This is used when hashing outputs
|
* This is used when hashing outputs
|
||||||
|
|||||||
30
packages/nx/src/native/metadata.rs
Normal file
30
packages/nx/src/native/metadata.rs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#[napi]
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
pub const IS_WASM: bool = true;
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
pub const IS_WASM: bool = false;
|
||||||
|
|
||||||
|
use std::env::consts;
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
pub fn get_binary_target() -> String {
|
||||||
|
let arch = consts::ARCH;
|
||||||
|
let os = consts::OS;
|
||||||
|
|
||||||
|
let mut binary_target = String::new();
|
||||||
|
|
||||||
|
if !arch.is_empty() {
|
||||||
|
binary_target.push_str(&arch);
|
||||||
|
}
|
||||||
|
|
||||||
|
if !os.is_empty() {
|
||||||
|
if !binary_target.is_empty() {
|
||||||
|
binary_target.push('-');
|
||||||
|
}
|
||||||
|
binary_target.push_str(&os);
|
||||||
|
}
|
||||||
|
|
||||||
|
binary_target
|
||||||
|
}
|
||||||
@ -2,16 +2,16 @@ pub mod cache;
|
|||||||
pub mod glob;
|
pub mod glob;
|
||||||
pub mod hasher;
|
pub mod hasher;
|
||||||
mod logger;
|
mod logger;
|
||||||
|
pub mod metadata;
|
||||||
pub mod plugins;
|
pub mod plugins;
|
||||||
pub mod project_graph;
|
pub mod project_graph;
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
pub mod pseudo_terminal;
|
|
||||||
pub mod tasks;
|
pub mod tasks;
|
||||||
mod types;
|
mod types;
|
||||||
mod utils;
|
mod utils;
|
||||||
mod walker;
|
mod walker;
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
pub mod watch;
|
|
||||||
pub mod workspace;
|
pub mod workspace;
|
||||||
|
|
||||||
pub mod wasm;
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
pub mod pseudo_terminal;
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
pub mod watch;
|
||||||
|
|||||||
@ -372,6 +372,7 @@ module.exports.copy = nativeBinding.copy
|
|||||||
module.exports.EventType = nativeBinding.EventType
|
module.exports.EventType = nativeBinding.EventType
|
||||||
module.exports.expandOutputs = nativeBinding.expandOutputs
|
module.exports.expandOutputs = nativeBinding.expandOutputs
|
||||||
module.exports.findImports = nativeBinding.findImports
|
module.exports.findImports = nativeBinding.findImports
|
||||||
|
module.exports.getBinaryTarget = nativeBinding.getBinaryTarget
|
||||||
module.exports.getFilesForOutputs = nativeBinding.getFilesForOutputs
|
module.exports.getFilesForOutputs = nativeBinding.getFilesForOutputs
|
||||||
module.exports.hashArray = nativeBinding.hashArray
|
module.exports.hashArray = nativeBinding.hashArray
|
||||||
module.exports.hashFile = nativeBinding.hashFile
|
module.exports.hashFile = nativeBinding.hashFile
|
||||||
|
|||||||
@ -7,7 +7,6 @@ pub use find_matching_projects::*;
|
|||||||
pub use get_mod_time::*;
|
pub use get_mod_time::*;
|
||||||
pub use normalize_trait::Normalize;
|
pub use normalize_trait::Normalize;
|
||||||
|
|
||||||
|
|
||||||
#[cfg_attr(not(target_arch = "wasm32"), path = "atomics/default.rs")]
|
#[cfg_attr(not(target_arch = "wasm32"), path = "atomics/default.rs")]
|
||||||
#[cfg_attr(target_arch = "wasm32", path = "atomics/wasm.rs")]
|
#[cfg_attr(target_arch = "wasm32", path = "atomics/wasm.rs")]
|
||||||
pub mod atomics;
|
pub mod atomics;
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
#[napi]
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
|
||||||
pub const IS_WASM: bool = true;
|
|
||||||
|
|
||||||
#[napi]
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
pub const IS_WASM: bool = false;
|
|
||||||
Loading…
x
Reference in New Issue
Block a user