super-sveltekit-cli
v0.3.0
Published
Super Sveltekit CLI is a command line tool for the Sveltekit framework. The idea behind this tool is to facilitate the creation of routes and integration of libraries and services.
Downloads
1
Maintainers
Readme
⚒️ Super SvelteKit CLI 🧰
What is Super Sveltekit CLI?
Super Sveltekit CLI is a command line tool for the Sveltekit framework. The idea behind this tool is to facilitate the creation of routes and integration of libraries and services.
The tool will expand by adding integrations with other libraries, creating examples or facilitating the whole process to start working with the different libraries.
The good thing is that you can start using it since it is not a dependency but a tool, so although it is in an early stage of development maybe it can be useful.
The command will automatically watch for typescript, so it will generate server.js or server.ts for example depending of your setup.
Things to see 👀
Features
- Routes with files generation: +page.server.js|ts(with load function and optional action), +page.svelte(with optional action form) and optional: +layout.svelte and +layout.server.ts
- Api endpoints and routes: generate api endpoints with routes and http operations inside of it: GET,POST,PUT,PATCH,DELETE.
Next steps
- Improve cli messages
- New command to generate actions
- Ask for sveltekit project scaffold when the command is used outside a sveltekit project.
- More commands...
Installation 🛬
npm i -g super-sveltekit-cli
PNPM
pnpm i -g super-sveltekit-cli
Is a command line tool! You dont have to install it as a dependency.
Commands
Create
Creates files, see below al the commands available and documentation.
Route
By default all paths created by this command will be created under the folder src/routes
Description
Creates a route under src/routes folder, by default the command will generate +page.svelte and +page.server.js|ts with a load function inside of it, you can extend the command with flags to add layout files, layout server files or only layout files
- Alias: c p
$ ssc create route name
This comand will create the next route ./src/routes/name with +page.svelte and +page.server.js files inside of it
You can create sub routes too:
$ ssc create route name/test/ssc
Create a route with a slug:
$ ssc create route name/[slug]/ssc
Grouping routes:
$ ssc create route name/"("group")"/test
And it will create the route: routes/name/(group)/test | :exclamation: Grouping routes | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | The command line has some limitation for example you cannot create a group of routes this way routes/(group)/route-name the command line will throw an error, you must scape the parenthesis with double quotes routes/"("group")"/route-name |
Api
By default all paths created by this command will be created under the folder src/api
Examples
- Create a empty server file:
$ ssc create api name
- Create a server file with crud operations:
$ ssc create api name -c
- Create a server file with different operations:
$ ssc create api name -g
Generates the file with a GET operation
$ ssc create api name -g -p -d
Generates the file with GET, POST and DELETE operations