CLI scaffolding tool for elSapiens SDK projects
npm install @elsapiens/cliCLI scaffolding tool for creating and managing elSapiens SDK projects.
``bashUse directly with npx (recommended)
npx @elsapiens/cli init my-app
Features
- Create new projects with complete elSapiens SDK setup
- Full AppLayout with sidebar and topbar
- All providers pre-configured (Theme, Auth, Locale, Help)
- Services ready to use (Logger, ApiClient, ShortcutManager)
- Add pages with correct structure and patterns
- Add components with TypeScript templates
- Interactive prompts for configuration
- Cross-platform support (macOS, Linux, Windows)
Commands
$3
`bash
Interactive mode
el init my-appSkip prompts
el init my-app --yesSkip git initialization
el init my-app --no-git
`Generated Structure:
`
my-app/
├── package.json
├── vite.config.ts
├── tsconfig.json
├── tsconfig.node.json
├── tailwind.config.js
├── postcss.config.js
├── index.html
├── .env.example
├── .gitignore
└── src/
├── main.tsx # All providers configured
├── App.tsx # Full AppLayout with sidebar/topbar
├── index.css # Design system styles
├── help-topics.ts # Help system topics
├── services/
│ └── index.ts # Logger, ApiClient, ShortcutManager
├── translations/
│ └── common.ts # i18n translations
└── pages/
├── Dashboard.tsx
└── Settings.tsx
`Included Features:
| Feature | Description |
|---------|-------------|
| ThemeProvider | Dark/light mode with system detection |
| AuthProvider | Authentication context |
| LocaleProvider | Internationalization support |
| HelpProvider | Help system with keyboard shortcuts |
| AppLayout | Sidebar navigation + topbar |
| AuthGuard | Route protection |
| Services | Logger, ApiClient, ShortcutManager |
$3
`bash
Interactive mode
el add pageWith name
el add page UsersWith template
el add page Users --template list
el add page Dashboard --template dashboard
el add page Settings --template settingsCustom path
el add page Users --path src/features/users/pages
`Page Templates:
| Template | Description |
|----------|-------------|
|
dashboard | Overview page with stats, charts, and activity table |
| list | Data listing with search, filters, and table |
| settings | Configuration page with form sections and toggles |$3
`bash
Interactive mode
el add componentWith name
el add component UserCardWith template
el add component UserCard --template simple
el add component DataTable --template statefulCustom path
el add component UserCard --path src/features/users/components
`Component Templates:
| Template | Description |
|----------|-------------|
|
simple | Basic component with props and className |
| stateful | Component with useState and onChange callback |Usage Examples
$3
`bash
$ el init my-dashboard elSapiens CLI v0.1.0
? Project name: my-dashboard
? Initialize git repository? Yes
Creating project...
✓ package.json
✓ vite.config.ts
✓ tsconfig.json
✓ src/main.tsx
✓ src/App.tsx
✓ src/pages/Dashboard.tsx
✓ src/pages/Settings.tsx
✓ src/services/index.ts
✓ src/translations/common.ts
✓ src/help-topics.ts
Done! Run:
cd my-dashboard
pnpm install
pnpm dev
`$3
`bash
$ el add page Users --template list Add Page
? Page title: Users
? Description: Manage user accounts
✓ Created src/pages/Users.tsx
Add route to App.tsx:
import Users from './pages/Users';
} />
`$3
`bash
$ el add component UserCard --template stateful Add Component
✓ Created src/components/UserCard.tsx
Import and use:
import { UserCard } from './components/UserCard';
`CLI Reference
$3
Create a new elSapiens project.
| Option | Description |
|--------|-------------|
|
--no-git | Skip git initialization |
| -y, --yes | Skip prompts, use defaults |$3
Add a new page to the project.
| Option | Description |
|--------|-------------|
|
-t, --template | Page template (dashboard, list, settings) |
| -p, --path | Custom pages directory |$3
Add a new component to the project.
| Option | Description |
|--------|-------------|
|
-t, --template | Component template (simple, stateful) |
| -p, --path | Custom components directory |Aliases
The CLI supports multiple command aliases:
`bash
These are equivalent
el init my-app
elsapiens init my-appAdd command aliases
el add page Users
el generate page Users
`Requirements
- Node.js 18.0.0 or higher
- npm, pnpm, or yarn
Development
$3
`bash
Clone the repository
git clone https://github.com/elsapiens/sdk.git
cd sdkInstall all dependencies
pnpm installBuild all packages (required for CLI to work)
pnpm buildOr build just the CLI
cd packages/cli && pnpm build
`$3
You can use the CLI directly from a git checkout without publishing to npm:
`bash
Create a project using the local CLI build
node /path/to/sdk/packages/cli/dist/index.js init my-projectOr set up an alias for convenience
alias el-dev="node /path/to/sdk/packages/cli/dist/index.js"
el-dev init my-project
`$3
`bash
1. Make changes to templates
code packages/cli/src/templates/app/page-dashboard.ejs2. Rebuild the CLI
cd packages/cli && pnpm build3. Create a fresh test project
rm -rf /tmp/test-project
node dist/index.js init /tmp/test-project4. Test the changes
cd /tmp/test-project && pnpm install && pnpm dev
`$3
The easiest way to install the CLI globally from your local SDK:
`bash
cd packages/cliRun the setup script (builds and links globally)
pnpm setup:global
`After setup, use the
el command from anywhere:`bash
el init my-project
el add page Users
el add component UserCard
`$3
`bash
cd packages/cli
pnpm build
pnpm link --globalVerify
el --version
`$3
`bash
cd packages/cli
pnpm unlink:global
`$3
Add to
~/.zshrc or ~/.bashrc:`bash
export ELSDK_PATH="/path/to/elSDK"
alias el="node $ELSDK_PATH/packages/cli/dist/index.js"
`Publishing
`bash
Build and publish
pnpm build
npm publish --access public
``MIT