GithubHelp home page GithubHelp logo

monodon's Introduction

Monodon

A collection of utilities and plugins for the Nx ecosystem

npm (scoped) npm (scoped)
npm (scoped) npm (scoped)

monodon's People

Contributors

agentender avatar cammisuli avatar mandarini avatar nbolton avatar pulasthibandara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

monodon's Issues

Error when attempting library generation

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!

Description

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.

Device

Macbook Pro 2021 - M1 Pro
MacOS Ventura 13.0

Error

(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!

Multiple plugin issues

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.

a bunch of errors

nx.json

{
  "targetDefaults": {
    "build": {
      "cache": true,
      "dependsOn": [
        "^build"
      ]
    },
    "lint": {
      "cache": true
    },
    "test": {
      "cache": true
    },
    "e2e": {
      "cache": true
    }
  },
  "installation": {
    "version": "17.1.3"
  },
  "plugins": [
    "@monodon/rust"
  ]
}

project.json

{
    "$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"
            }
        }
    }
}

image
image
image

ReferenceError: TextDecoder is not defined

Current Behavior

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

GitHub Repo

https://github.com/KalinaMatysiak/bug-reproduction-monodon-rust

Steps to Reproduce

  • Clone the Repo
  • Run pnpm install
  • Run pnpm nx test my-plugin

Failure Logs

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)

Operating system:

  • Linux

Library generator removes all comments on Cargo.toml

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 ?

`--watch` option for `@monodon/rust`

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.

Errors when using dependencies from github

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 =)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.