This markdown file explains a bash script that sets up a project using Wails, Svelte, and shadcn-svelte. The script automates the process of creating a new project with these technologies and configuring it with specified components.
The script performs the following main tasks:
- Initializes a Wails project with Svelte
- Sets up a new Svelte app
- Configures TailwindCSS
- Installs and configures shadcn-svelte
- Sets up static adapter for Svelte
- Configures the project for development
./script_name.sh <package_manager> <project_name> <components> [brand]
<package_manager>
: The package manager to use (e.g., npm, yarn, bun)<project_name>
: The name of your project<components>
: A comma-separated list of shadcn components to add[brand]
: Optional. If specified, sets up additional branding configurations
Example:
./script_name.sh bun my_project 'button,card,input' mybrand
-
Argument Checking
- The script checks if at least 3 arguments are provided.
- If not, it displays usage instructions and exits.
-
Wails Project Initialization
- Initializes a new Wails project with Svelte template.
- Updates
wails.json
to use the specified package manager and set the Wails JS directory. - Modifies
main.go
to point to the correct build directory.
-
Branding Setup (Optional)
- If a brand is specified, it moves and renames some files for branding purposes.
-
Svelte App Setup
- Removes the old frontend and creates a new Svelte app.
- Moves branding files if applicable.
-
Dependency Installation and Configuration
- Installs dependencies in the frontend directory.
- Replaces
@sveltejs/adapter-auto
with@sveltejs/adapter-static
.
-
TailwindCSS Setup
- Adds TailwindCSS to the project using
svelte-add
.
- Adds TailwindCSS to the project using
-
shadcn-svelte Setup
- Installs and initializes shadcn-svelte.
- Adds specified shadcn components.
-
Svelte Configuration
- Creates a
+layout.ts
file to enable prerendering and disable SSR. - Updates
svelte.config.js
to use the static adapter and set up aliases.
- Creates a
-
Development Server
- Returns to the project root.
- Starts the Wails development server.
- The script uses sed commands which may need to be adjusted for different operating systems.
- It assumes that the specified package manager and required tools (like Wails CLI) are already installed.
- The script automatically starts the Wails development server after setup.
This script provides a quick and automated way to set up a project with Wails, Svelte, and shadcn-svelte, saving time on manual configuration and setup.