Version: 1.0.1
S-kit is a command-line interface (CLI) tool designed to streamline the process of creating components, routes, layouts, error pages, server routes, and stores for SvelteKit projects.
npm install -g @n3-rd/s-kit
s-kit <command> <name> [options]
- Add components
- Create routes (with optional server-side logic)
- Generate layouts
- Add error pages
- Create server routes
- Set up stores
Command: s-kit add <component-name>
Example: s-kit add Button
This creates a new Svelte component file at src/lib/components/Button.svelte
with basic content.
Command: s-kit route add <route-name> [--no-server]
Example: s-kit route add about
This creates a new route at src/routes/about/+page.svelte
and src/routes/about/+page.server.ts
.
Use --no-server
flag to skip creating the server file and create a client-side +page.ts
instead.
For nested routes, use slashes:
Example: s-kit route add blog/post
For route groups, use parentheses:
Example: s-kit route add (auth)/login
Command: s-kit layout <layout-name>
Example: s-kit layout /
This creates a new layout file at src/routes/+layout.svelte
.
For nested layouts, specify the path:
Example: s-kit layout /blog
Command: s-kit error <error-name>
Example: s-kit error 404
This creates a new error page at src/routes/404/+error.svelte
.
Command: s-kit server <server-route-name>
Example: s-kit server api/users
This creates a new server route file at src/routes/api/users/+server.ts
with a basic GET handler.
Command: s-kit store <store-name>
Example: s-kit store counter
This creates a new store file at src/lib/stores/counter.js
with a basic writable store and utility functions.
You can also add a .ts
file extension to generate a typescript store.
- All commands create necessary directories if they don't exist.
- The tool assumes a standard SvelteKit project structure.
- Files are created with basic boilerplate content which you can then customize.
- Node.js
- commander.js
ISC
For more information, updates, or to report issues, please visit the project repository.
Happy coding with s-kit!