Monodon
A collection of utilities and plugins for the Nx ecosystem
Hello! As the title says, add --no-default-features
as an option to the executors, especially test
.
Hi Cammisuli,
I want to thank you first of all for this project, it is exactly what I was searching for and the only thing I was missing in NX!
When generating a new library or binary with the example command:
nx generate @monodon/rust:library my-rust-node-lib --napi
or the VSCode generation UI in the NX plugin the same error is returned.
Macbook Pro 2021 - M1 Pro
MacOS Ventura 13.0
(0 , project_configuration_1.shouldDefaultToUsingStandaloneConfigs) is not a function
TypeError: (0 , project_configuration_1.shouldDefaultToUsingStandaloneConfigs) is not a function
at getWorkspaceLayout (/Users/USER/Documents/PROJECT/node_modules/@monodon/rust/node_modules/@nrwl/devkit/src/utils/get-workspace-layout.js:25:96)
at normalizeOptions (/Users/USER/Documents/PROJECT/node_modules/@monodon/rust/src/generators/init/generator.js:7:66)
at init (/Users/USER/Documents/PROJECT/node_modules/@monodon/rust/src/generators/init/generator.js:33:31)
at libraryGenerator (/Users/USER/Documents/PROJECT/node_modules/@monodon/rust/src/generators/library/generator.js:22:35)
at Object.<anonymous> (/Users/USER/Documents/PROJECT/node_modules/nx/src/command-line/generate.js:250:36)
at Generator.next (<anonymous>)
at fulfilled (/Users/USER/Documents/PROJECT/node_modules/tslib/tslib.js:164:62)
Of course if you need any more info, I am glad to help!
I have been evaluating both this and the @nxrs/cargo plugins and I liked the idea of this because of the integration with napi out of the box.
Unfortunately whereas I can get the other lib to work quite seamlessly I am struggling in multiple ways with this one.
For a start if I try to integrate into an existing repository then I can create a new library, but no nx build/test/lint/graph command will work for ANY project (including the non-rust based ones in the project before the addition).
I have found that if I comment out the following in the nx.json then the builds start to work again but this seems like the wrong thing to do
{
...
// "plugins": ["@monodon/rust"],
...
}
Otherwise each command fails instantly like so:
> NX Daemon process terminated and closed the connection
Please rerun the command, which will restart the daemon.
Alternatively I tried a completely fresh project like so:
npx create-nx-workspace --preset=@monodon/rust
nx generate @monodon/rust:library my-rust-node-lib --napi
but trying to run project specific commands from the monorepo root fail with the error
> nx run my_rust_node_lib:build
Type Error: No package.name field in Cargo.toml
you HAVE to change the current directly to the libs/my_rust_node_lib for the command to work which is not how any other NX command normally works.
Any ideas how can it be done? I've seen that you are using nvim and maybe you could figure it out! I tried with no luck! (newbie to nvim). Thanks!
{
"targetDefaults": {
"build": {
"cache": true,
"dependsOn": [
"^build"
]
},
"lint": {
"cache": true
},
"test": {
"cache": true
},
"e2e": {
"cache": true
}
},
"installation": {
"version": "17.1.3"
},
"plugins": [
"@monodon/rust"
]
}
{
"$schema": "../.nx/installation/node_modules/nx/schemas/project-schema.json",
"name": "b3-local-server",
"projectType": "library",
"targets": {
"build": {
"executor": "@monodon/rust:build",
"outputs": [
"{options.target-dir}"
],
"options": {
"target-dir": "dist/target/b3-local-server"
},
"configurations": {
"production": {
"release": true
}
}
},
"test": {
"executor": "@monodon/rust:test",
"outputs": [
"{options.target-dir}"
],
"options": {
"target-dir": "dist/target/b3-local-server"
},
"configurations": {
"production": {
"release": true
}
}
},
"lint": {
"executor": "@monodon/rust:lint",
"outputs": [
"{options.target-dir}"
],
"options": {
"target-dir": "dist/target/b3-local-server"
}
}
}
}
I wanted to customize the generator. My customized generator works perfectly, but when I would like to run tests, get the error: ReferenceError: TextDecoder is not defined
https://github.com/KalinaMatysiak/bug-reproduction-monodon-rust
pnpm install
pnpm nx test my-plugin
packages/my-plugin/src/generators/rust-app/generator.spec.ts
โ Test suite failed to run
ReferenceError: TextDecoder is not defined
2 | import type { Tree } from '@nx/devkit';
3 |
> 4 | import generator from '@monodon/rust/src/generators/binary/generator';
| ^
5 | import { formatFiles, generateFiles } from '@nx/devkit';
6 |
7 | import * as path from 'path';
at ../../node_modules/.pnpm/@[email protected]/node_modules/@ltd/j-toml/index.js:1138:23
at ../../node_modules/.pnpm/@[email protected]/node_modules/@ltd/j-toml/index.js:2:81
at Object.<anonymous> (../../node_modules/.pnpm/@[email protected]/node_modules/@ltd/j-toml/index.js:5:3)
at Object.<anonymous> (../../node_modules/.pnpm/@[email protected]_q5uzlubyxbop7sm5usegwh6nuq/packages/rust/src/utils/toml.ts:1:1)
at Object.<anonymous> (../../node_modules/.pnpm/@[email protected]_q5uzlubyxbop7sm5usegwh6nuq/packages/rust/src/utils/add-to-workspace.ts:2:1)
at Object.<anonymous> (../../node_modules/.pnpm/@[email protected]_q5uzlubyxbop7sm5usegwh6nuq/packages/rust/src/generators/binary/generator.ts:16:1)
Hey @Cammisuli, how is it going?
I just found out that the generator for new libraries is removing all comments on Cargo.toml
. This is a bit bothersome because I find it very useful when running a monorepo to explain some dependencies and group them, for instance:
[workspace.dependencies]
# log/tracing
tracing = "0.1"
tracing-subscriber = "0.3"
# datetime
chrono = { version = "0.4", features = ["serde"] }
# database
sqlx = { version = "0.7", features = [ "runtime-tokio", "postgres", "macros", "chrono" ] }
# testing
approx = "0.5"
ntest = "0.9"
axum-test= "13.1.1"
This has been extremely helpful for new Rust developers who still need to learn the ecosystem.
To reproduce, paste the above dependencies on root Cargo.toml
with comments and run a generator:
yarn nx g @monodon/rust:lib my-lib
I need to dig more, but it's probably related to LongTengDao/j-toml#19 ?
It would be nice to be able to have live updates particularly for web servers.
I am very new to rust but cargo-watch
seems to be the go to for this.
Would love to see some solution for live reload added.
Hi everyone,
After adding a dependencie from github to my project, I have the next error when executing targets any targets in the project:
> NX Failed to process project dependencies with "@monodon/rust".
Source file "/home/maxim/.cargo/git/checkouts/prisma-engines-8e1416dd0e571d11/c4aeef8/psl/builtin-connectors/Cargo.toml" does not exist in the workspace.
Because of the error the Nx daemon process has exited. The next Nx command is going to restart the daemon process.
If the error persists, please run "nx reset".
I am using [email protected], and here is the dependencie that causes problems:
[package]
name = "prisma-cli"
version = "0.1.0"
edition = "2021"
[dependencies]
prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.11", default-features = false, features = [ "postgresql"] }
From what I understand, it happens because the plugin reads the Cargo file of the github dependencie, which is outside of the monorepo.
The cargo files are tracked as inputs for the nx cache, am I right ? Is there a way to ignore the cargo files of these kind of dependencies without messing with the cache too much ?
Tell me if there is anything I can do help =)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.