A command-line tool for installing utility tools that work with the RWSDK (Redwood SDK).
npm install -g rwsdk-tools
# or for local development
npm link
Run the command-line tool to install utilities:
# Install all available tools
npx rwsdk-tools
# Install specific tools
npx rwsdk-tools routes
npx rwsdk-tools component
npx rwsdk-tools tailwind
npx rwsdk-tools seedtosql
npx rwsdk-tools merge
npx rwsdk-tools email
npx rwsdk-tools windsurf
npx rwsdk-tools addon generate
npx rwsdk-tools addon install
# Show help
npx rwsdk-tools help
This package provides a simple command-line interface to install utility tools for RWSDK projects. When you run a command, it:
- Copies the necessary files to your project
- Adds appropriate scripts to your package.json
- Sets up everything so you can use the tools immediately
The generateRoutes
tool helps generate routes for your RWSDK project.
npx rwsdk-tools routes
This command:
- Copies the
generateRoutes.ts
script to your project'ssrc/scripts
directory - Adds a
routes
script to your project's package.json file that runs:npx tsx src/scripts/generateRoutes.ts
After installation, you can generate routes by running:
npm run routes
The component
tool helps generate and restructure React components for your RWSDK project using Plop.
npx rwsdk-tools component
This command:
- Copies the
plopfile.mjs
file to your project's root directory - Copies component templates to a
plop-templates
directory - Adds the following scripts to your project's package.json:
-
plop
: Run the plop CLI -
component
: Generate a new component -
restructure
: Restructure an existing component -
restructure-all
: Restructure all components in a directory
-
- Automatically installs plop as a dev dependency if it's not already installed
After installation, you can use the component generator by running:
# Generate a new component
npm run component
# Restructure an existing component
npm run restructure
# Restructure all components
npm run restructure-all
The tailwind
tool sets up Tailwind CSS for your RWSDK project.
npx rwsdk-tools tailwind
This command:
- Creates a
src/app/styles.css
file with the Tailwind import - Updates the
vite.config.mts
file to:- Import the Tailwind plugin
- Add the environments config if needed
- Add Tailwind to the plugins array
- Updates the
src/app/Document.tsx
file to:- Import the styles
- Add a link tag to the head
- Prompts you to install the required dependencies
The command will automatically install the required dependencies for you:
pnpm install tailwindcss @tailwindcss/vite
The shadcn
tool sets up shadcn UI components for your RWSDK project.
npx rwsdk-tools shadcn
This command:
- Copies a pre-configured
components.json
file to your project's root directory - Installs all necessary dependencies for shadcn UI:
- class-variance-authority
- clsx
- tailwind-merge
- lucide-react
- @radix-ui/react-slot
- tw-animate-css
- Sets up the required configuration:
- Updates
tsconfig.json
with the baseUrl setting - Adds path aliases to
vite.config.ts
for the "@" import
- Updates
- Creates the necessary files:
- Adds a
src/app/lib/utils.ts
file with thecn
utility function - Sets up
src/app/styles.css
with shadcn theme variables
- Adds a
- Updates the
src/app/Document.tsx
file to:- Import the styles
- Add a link tag to the head
After installation, you can add shadcn components to your project by installing the specific Radix UI components you need and copying the component code from the shadcn website.
The seedToSql
tool converts Redwood.js seed files to raw SQL statements that can be executed directly against your database.
npx rwsdk-tools seedtosql
This command:
- Copies the
seedToSql.mjs
script to your project'ssrc/scripts
directory - Makes the script executable
- Adds a
seedtosql
script to your project's package.json file that runs:node src/scripts/seedToSql.mjs
After installation, you can convert seed files to SQL by running:
# Convert the default seed file (or specify a custom one)
pnpm run seedtosql
# Convert a specific seed file
pnpm run seedtosql -- --input <path-to-seed-file> [--output <path-to-output-sql>]
Features:
- Converts Prisma
create
operations toINSERT
statements - Converts Prisma
createMany
operations to multipleINSERT
statements - Preserves raw SQL commands from
$executeRawUnsafe
- Handles nested relations and connections
- Supports TypeScript and JavaScript seed files
- No external dependencies required
The merge
tool combines multiple Prisma schema files into a single schema.prisma file.
npx rwsdk-tools merge
This command:
- Copies the
mergePrismaSchema.mjs
script to your project'ssrc/scripts
directory - Adds a
merge
script to your project's package.json file that runs:node src/scripts/mergePrismaSchema.mjs
After installation, you can merge your Prisma schemas by running:
pnpm merge
The addon generate
tool helps generate configuration files for RedwoodSDK addons.
npx rwsdk-tools addon generate
This command:
- Copies the
generateAddonConfig.mjs
script to your project'ssrc/scripts
directory - Adds an
addon:generate
script to your project's package.json file that runs:node src/scripts/generateAddonConfig.mjs
After installation, you can generate addon configuration by running:
pnpm addon:generate <addonName>
The script analyzes an add-on's content and dynamically generates the addon.jsonc file by scanning imports, environment variables, CSS files, and other components.
The addon install
tool helps install RedwoodSDK addons into your project.
npx rwsdk-tools addon install
This command:
- Copies the
installAddon.mjs
script to your project'ssrc/scripts
directory - Adds an
addon:install
script to your project's package.json file that runs:node src/scripts/installAddon.mjs
After installation, you can install addons by running:
pnpm addon:install install <addonName> [options]
Options:
-
--repo <url>
: Install from a GitHub repository -
--source <path>
: Full path to the addon directory -
--dest <path>
: Destination directory (defaults to src/app/addons)
The script handles all aspects of installing an addon, including copying files, installing dependencies, setting up environment variables, injecting CSS styles, adding routes, and setting up Prisma schema.
Features:
- Automatically finds and merges all .prisma files from specified directories
- Backs up existing schema.prisma file to schema.prisma.bak before overwriting it
- Includes the backup file content in the merge process to preserve existing schema
- Uses .bak extension to avoid Prisma validation errors with duplicate models
- Intelligently merges models with the same name, preserving unique fields
- Handles generators, datasources, models, and enums
- Supports commented model additions with special syntax
- Sorts models alphabetically for better readability
The email
tool sets up email functionality for your RWSDK project using Resend.
npx rwsdk-tools email
This command:
- Installs the
resend
package using pnpm - Adds a
RESEND_API
variable to your project's.env
file - Creates an
email.ts
file in thesrc/app/lib
directory - Asks if you want to install React Email for creating email templates
After installation, you can use the Resend client in your application:
import { resend } from 'src/app/lib/email';
// Send an email
await resend.emails.send({
from: 'onboarding@resend.dev',
to: 'user@example.com',
subject: 'Hello World',
html: '<p>Hello world!</p>',
});
Features:
- Seamless integration with Resend's email API
- Environment variable setup for secure API key storage
- Optional React Email integration for beautiful, responsive email templates
- Works with Cloudflare Workers environment variables
- Simple, clean API for sending emails from your application
The windsurf
tool sets up configuration for code quality checks and workflows in your RWSDK project.
npx rwsdk-tools windsurf
This command:
- Creates a
.windsurf
directory in your project root (if it doesn't already exist) - Copies default rules to the
.windsurf/rules
directory - Copies workflow templates to the
.windsurf/workflows
directory
After installation, you can customize the Windsurf configuration by editing the files in the .windsurf
directory.
Features:
- Pre-configured code quality rules
- Workflow templates for pre-commit and PR checks
- Non-destructive installation that preserves existing configurations
- Custom rule definitions for project-specific requirements
- Integrated workflow templates that work with common package managers
- Node.js 14+
- RWSDK