Skip to content

Commit

Permalink
fix(core): update package names, update code to be clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli authored and FrozenPandaz committed Jan 30, 2023
1 parent 944882f commit 9a496cf
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ packages/react/src/schematics/**/files/**/*.json
packages/jest/src/schematics/**/files/**/*.json
packages/**/schematics/**/files/**/*.html
packages/**/generators/**/files/**/*.html
packages/nx/src/native
packages/nx/src/native/
nx-dev/nx-dev/.next/
nx-dev/nx-dev/public/documentation
graph/client/src/assets/environment.js
Expand Down
3 changes: 2 additions & 1 deletion packages/nx/.npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
native-packages/
native-packages/
*.node
7 changes: 2 additions & 5 deletions packages/nx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"napi": {
"name": "nx",
"package": {
"name": "@nrwl/nx-native"
"name": "@nrwl/nx"
},
"triples": {
"additional": [
Expand All @@ -130,10 +130,7 @@
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"x86_64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc"
"x86_64-unknown-linux-musl"
]
}
}
Expand Down
28 changes: 14 additions & 14 deletions packages/nx/src/native/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.android-arm64.node')
} else {
nativeBinding = require('@nrwl/nx-native-android-arm64')
nativeBinding = require('@nrwl/nx-android-arm64')
}
} catch (e) {
loadError = e
Expand All @@ -43,7 +43,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.android-arm-eabi.node')
} else {
nativeBinding = require('@nrwl/nx-native-android-arm-eabi')
nativeBinding = require('@nrwl/nx-android-arm-eabi')
}
} catch (e) {
loadError = e
Expand All @@ -63,7 +63,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.win32-x64-msvc.node')
} else {
nativeBinding = require('@nrwl/nx-native-win32-x64-msvc')
nativeBinding = require('@nrwl/nx-win32-x64-msvc')
}
} catch (e) {
loadError = e
Expand All @@ -77,7 +77,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.win32-ia32-msvc.node')
} else {
nativeBinding = require('@nrwl/nx-native-win32-ia32-msvc')
nativeBinding = require('@nrwl/nx-win32-ia32-msvc')
}
} catch (e) {
loadError = e
Expand All @@ -91,7 +91,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.win32-arm64-msvc.node')
} else {
nativeBinding = require('@nrwl/nx-native-win32-arm64-msvc')
nativeBinding = require('@nrwl/nx-win32-arm64-msvc')
}
} catch (e) {
loadError = e
Expand All @@ -107,7 +107,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.darwin-universal.node')
} else {
nativeBinding = require('@nrwl/nx-native-darwin-universal')
nativeBinding = require('@nrwl/nx-darwin-universal')
}
break
} catch {}
Expand All @@ -118,7 +118,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.darwin-x64.node')
} else {
nativeBinding = require('@nrwl/nx-native-darwin-x64')
nativeBinding = require('@nrwl/nx-darwin-x64')
}
} catch (e) {
loadError = e
Expand All @@ -132,7 +132,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.darwin-arm64.node')
} else {
nativeBinding = require('@nrwl/nx-native-darwin-arm64')
nativeBinding = require('@nrwl/nx-darwin-arm64')
}
} catch (e) {
loadError = e
Expand All @@ -151,7 +151,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.freebsd-x64.node')
} else {
nativeBinding = require('@nrwl/nx-native-freebsd-x64')
nativeBinding = require('@nrwl/nx-freebsd-x64')
}
} catch (e) {
loadError = e
Expand All @@ -168,7 +168,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.linux-x64-musl.node')
} else {
nativeBinding = require('@nrwl/nx-native-linux-x64-musl')
nativeBinding = require('@nrwl/nx-linux-x64-musl')
}
} catch (e) {
loadError = e
Expand All @@ -181,7 +181,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.linux-x64-gnu.node')
} else {
nativeBinding = require('@nrwl/nx-native-linux-x64-gnu')
nativeBinding = require('@nrwl/nx-linux-x64-gnu')
}
} catch (e) {
loadError = e
Expand All @@ -197,7 +197,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.linux-arm64-musl.node')
} else {
nativeBinding = require('@nrwl/nx-native-linux-arm64-musl')
nativeBinding = require('@nrwl/nx-linux-arm64-musl')
}
} catch (e) {
loadError = e
Expand All @@ -210,7 +210,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.linux-arm64-gnu.node')
} else {
nativeBinding = require('@nrwl/nx-native-linux-arm64-gnu')
nativeBinding = require('@nrwl/nx-linux-arm64-gnu')
}
} catch (e) {
loadError = e
Expand All @@ -225,7 +225,7 @@ switch (platform) {
if (localFileExisted) {
nativeBinding = require('./nx.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('@nrwl/nx-native-linux-arm-gnueabihf')
nativeBinding = require('@nrwl/nx-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
Expand Down
22 changes: 14 additions & 8 deletions packages/nx/src/native/native_hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,21 @@ fn hash_files(workspace_root: String) -> HashMap<String, String> {
let workspace_root = workspace_root + "/";
walker.add_ignore(workspace_root.clone() + ".nxignore");

let starts_with = workspace_root.clone() + ".git";
walker.filter_entry(move |entry| !entry.path().starts_with(starts_with.clone()));
let git_folder = workspace_root.clone() + ".git";
// We should make sure to always ignore node_modules
let node_folder = workspace_root.clone() + "node_modules";
walker.filter_entry(move |entry| {
!(entry.path().starts_with(&git_folder) || entry.path().starts_with(&node_folder))
});

// dot files are hidden by default. We want to make sure we include those here
walker.hidden(false);

let (tx, rx) = unbounded::<(String, Vec<u8>)>();
let (sender, reciever) = unbounded::<(String, Vec<u8>)>();

let receiver = thread::spawn(move || {
let receiver_thread = thread::spawn(move || {
let mut hash: HashMap<String, String> = HashMap::new();
for (path, content) in rx {
for (path, content) in reciever {
hash.insert(path, xxh3::xxh3_64(&content).to_string());
}
hash
Expand All @@ -48,7 +54,7 @@ fn hash_files(workspace_root: String) -> HashMap<String, String> {
let cpus = available_parallelism().map_or(2, |n| n.get()) - 1;

walker.threads(cpus).build_parallel().run(|| {
let tx = tx.clone();
let tx = sender.clone();
let workspace_root = workspace_root.clone();
Box::new(move |entry| {
use ignore::WalkState::*;
Expand All @@ -73,6 +79,6 @@ fn hash_files(workspace_root: String) -> HashMap<String, String> {
})
});

drop(tx);
receiver.join().unwrap()
drop(sender);
receiver_thread.join().unwrap()
}
28 changes: 14 additions & 14 deletions scripts/depcheck/missing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,20 @@ const IGNORE_MATCHES_IN_PACKAGE = {
'@nrwl/angular',
'@nestjs/cli', // nx init nest makes use of nestjs cli (which should be available in NestJS CLI app) to parse the nest-cli.json file
'ts-node', // We *may* fall back on ts-node, but we want to encourage the use of @swc-node instead so we don't explicitly list ts-node as an optional dep
'@nrwl/nx-native-android-arm-eabi', // native optional deps
'@nrwl/nx-native-android-arm64', // native optional deps
'@nrwl/nx-native-darwin-arm64', // native optional deps
'@nrwl/nx-native-darwin-universal', // native optional deps
'@nrwl/nx-native-darwin-x64', // native optional deps
'@nrwl/nx-native-freebsd-x64', // native optional deps
'@nrwl/nx-native-linux-arm-gnueabihf', // native optional deps
'@nrwl/nx-native-linux-arm64-gnu', // native optional deps
'@nrwl/nx-native-linux-arm64-musl', // native optional deps
'@nrwl/nx-native-linux-x64-gnu', // native optional deps
'@nrwl/nx-native-linux-x64-musl', // native optional deps
'@nrwl/nx-native-win32-arm64-msvc', // native optional deps
'@nrwl/nx-native-win32-ia32-msvc', // native optional deps
'@nrwl/nx-native-win32-x64-msvc', // native optional deps
'@nrwl/nx-android-arm-eabi', // native optional deps
'@nrwl/nx-android-arm64', // native optional deps
'@nrwl/nx-darwin-arm64', // native optional deps
'@nrwl/nx-darwin-universal', // native optional deps
'@nrwl/nx-darwin-x64', // native optional deps
'@nrwl/nx-freebsd-x64', // native optional deps
'@nrwl/nx-linux-arm-gnueabihf', // native optional deps
'@nrwl/nx-linux-arm64-gnu', // native optional deps
'@nrwl/nx-linux-arm64-musl', // native optional deps
'@nrwl/nx-linux-x64-gnu', // native optional deps
'@nrwl/nx-linux-x64-musl', // native optional deps
'@nrwl/nx-win32-arm64-msvc', // native optional deps
'@nrwl/nx-win32-ia32-msvc', // native optional deps
'@nrwl/nx-win32-x64-msvc', // native optional deps
'memfs', // used in mock for handling .node files in tests
],
web: [
Expand Down

0 comments on commit 9a496cf

Please sign in to comment.