nx-extensions

repository·main·Indexed 19 days ago

https://github.com/nxext/nx-extensions

A collection of Nx plugins providing integration for mobile and web frameworks within an Nx monorepo, including Capacitor, Ionic (Angular and React), Svelte, SvelteKit, SolidJS, Preact, and Stencil.

Tokens
32.9K
Snippets
147
Records
192
Agent score
66%

What's inside nxext

  1. Overview of Nxext tools and integrations

    main

    Nxext provides a collection of extensions and tools designed to bring various UI frameworks and mobile runtimes into the Nx ecosystem. It enables seamless integration for building and managing projects using the following technologies:

    • Stencil: For building reusable, scalable Web Components.
    • Svelte & SvelteKit: For building high-performance user interfaces using the Svelte compiler.
    • SolidJS: For building UIs with simple and performant reactivity.
    • Preact: A fast, lightweight (3kB) alternative to React.
    • Ionic (Angular & React): For building and shipping mobile applications.
    • Capacitor: A cross-platform native runtime for web applications.
  2. Overview of @nxext plugins

    main

    @nxext provides a collection of Nx plugins designed to integrate various mobile and web frameworks into the Nx monorepo ecosystem.

    Supported frameworks include:

    • Capacitor: For mobile app development.
    • Ionic: Support for both Angular and React implementations.
    • Stencil: For building web components.
    • Svelte and SvelteKit: For Svelte-based web applications.
    • SolidJS: For SolidJS applications.
    • Preact: For Preact applications.
  3. Introduction to Nxext Sveltekit

    main

    The @nxext/sveltekit plugin integrates SvelteKit into an Nx workspace.

    ::: warning This plugin is currently in alpha state. It is not feature complete and is not recommended for production use. :::

    It allows developers to leverage the SvelteKit framework within the Nx monorepo ecosystem, benefiting from Nx's task orchestration and dependency management.

  4. Manage Capacitor plugin dependencies

    main

    Capacitor plugin dependencies must be added to the project-level package.json (e.g., ./apps/my-app/package.json) using relative paths to the workspace node_modules.

    // ./apps/my-app/package.json
    {
      "name": "my-app",
      "dependencies": {
        "@capacitor/android": "../../node_modules/@capacitor/android",
        "@capacitor/ios": "../../node_modules/@capacitor/ios",
        // Example plugin
        "@capacitor-community/apple-sign-in": "../../node_modules/@capacitor-community/apple-sign-in"
      }
    }
  5. Configure Capacitor plugin dependencies

    main

    When adding Capacitor plugin dependencies, they must be added to the project-level package.json using relative paths to the workspace's node_modules to ensure they are correctly resolved within the Nx structure.

    // ./apps/my-app/package.json
    {
      "name": "my-app",
      "dependencies": {
        "@capacitor/android": "../../node_modules/@capacitor/android",
        "@capacitor/ios": "../../node_modules/@capacitor/ios",
        "@capacitor-community/apple-sign-in": "../../node_modules/@capacitor-community/apple-sign-in"
      }
    }
  6. Ensure version compatibility between Nx and @nxext

    main

    When using @nxext, you must ensure that the version of the @nxext package matches the version of Nx you are running.

    Example Compatibility Rule:

    • If you are using version 17.0 of an @nxext package, you must use Nx version 16.2.
    • Note that @nxext packages with version 16.7 are not compatible with Nx 16.8.

    Always verify that your Nx version and @nxext package version are aligned according to the specific compatibility requirements of the package you are installing.

  7. Generate a Preact application

    main

    Use the @nxext/preact:application schematic to generate a new Preact application within your Nx workspace. You can use the shorthand app or specify the collection explicitly if it is not set as the default in your nx.json.

    # Using the explicit collection
    nx g @nxext/preact:application --name=my-app --directory=apps/my-app
    
    # Using shorthand if collection is default
    nx g app my-app --directory=apps/my-app
    
    # Preview changes without writing to disk
    nx g application my-app --directory=apps/my-app --dry-run