JSPM

  • Created
  • Published
  • Downloads 13508
  • Score
    100M100P100Q135252F
  • License MIT

A CLI for remix-run

Package Exports

  • rmx-cli
  • rmx-cli/dist/cli.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rmx-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rmx-cli

All Contributors

A CLI tool for Remix applications. Future versions will support adding external commands.

🛠 Installation

npm install -D rmx-cli

Commands

🪂 eject-ras

Eject your Remix project from Remix App Server to Express

npx rmx-cli eject-ras

📦 get-esm-packages

Scan for ESM package to add to remix.config.js serverDependenciesToBundle

npx rmx-cli get-esm-packages [package-name ...]

🚀 gen-remix

THis script will generate a remix.ts file which re-exports all exports from specified packages. This essentially works like the magic remix package from early Remix.

Why is this useful?

  1. Go back to importing from one file instead of adapter specific packages. If you ever switch adapters, just re-generate the remix.ts file.
  2. Adds support for overrides. Now you can override a standard Remix export with your own function. Like replacing json, useLoaderData, etc. with the remix-typedjson functions.
  3. Add "postinstall": "rmx gen-remix" to package.json to ensure the file is regenerated when upgrading Remix packages.

Usage

Usage:
    $ npx rmx gen-remix [options]

  Options:
    --config PATH       Config path (default: ./gen-remix.config.json)
    --packages PACKAGES List of packages to export
    --output PATH       Output path (default: ./app/remix.ts)

  Example:
    rmx gen-remix --packages @remix-run/node @remix-run/react

Config

You can also include an optional config (defaults to gen-remix.config.json) where you can specify overrides.

{
  "exports": ["packageA", "packageB"],
  "overrides": {
    "<source-package>": [
      "<original-package>": {
        "<original-export>": "<new-source-export>",
        ...
      },
      "<original-package>": {
        "<original-export>": "<new-source-export>",
        ...
      }
    ],
    ...
  }
}

Example config:

This config replaces the Remix json, redirect, useActionData, etc. with the versions for remix-typedjson.

{
  "exports": ["@remix-run/node", "@remix-run/react", "remix-typedjson"],
  "overrides": {
    "remix-typedjson": {
      "@remix-run/node": {
        "json": "typedjson",
        "redirect": "redirect"
      },
      "@remix-run/react": {
        "useActionData": "useTypedActionData",
        "useFetcher": "useTypedFetcher",
        "useLoaderData": "useTypedLoaderData"
      }
    }
  }
}

😍 Contributors

Thanks goes to these wonderful people (emoji key):


Kiliman

💻 📖

Roy Revelt

📖

Kent C. Dodds

📖

This project follows the all-contributors specification. Contributions of any kind welcome!