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.
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.
Creates files, see below al the commands available and documentation.
By default all paths created by this command will be created under the folder src/routes
Arguments | ||
---|---|---|
Argument | Description | Valid Values |
name | Name or names of the path to be created | name | path/name | path/"("group")/name" | path/[slug]/name | if no value is provided will ask for a name |
Flags | ||
---|---|---|
Flag | Description | |
--layout | -l | Adds to the route a layout file inside of it | |
--layout-only | -lo | Creates the route only with the layout file, useful when you want to create a route with a layout and inside of it a route with all the files: blog/+layout.svelte and after that blog/post/+page.svelte | |
--layout-server | -ls | Adds to the route a layout server file with a load function |
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
$ 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 |
By default all paths created by this command will be created under the folder src/api
Arguments | ||
---|---|---|
Argument | Description | Valid Values |
name | Name or path of the path to be created | name | path/name | path/"("group")/name" | path/[slug]/name | if no value is provided will ask for a name |
Flags | ||
---|---|---|
Flag | Description | |
--crud | -c | Generates the server file with crud operations | |
--get | -g | Adds to the file a GET operation | |
--post | -p | Adds to the file a POST operation | |
--put | -pt | Adds to the file a PUT operation | |
--patch | -pa | Adds to the file a PUT operation | |
--delete | -d | Adds to the file a DELETE operation | |
Combine all this flags to create the server file you need, see examples below |
$ ssc create api name
$ ssc create api name -c
$ 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