The CapKit CLI is a command-line interface that simplifies the process of configuring Capacitor with SvelteKit. With CapKit, you can quickly set up Capacitor for your SvelteKit app, making it easy to build and deploy native mobile applications as well as progressive web apps.
Before installing CapKit, be aware that building native applications requires you to use Adapter Static because of the way Capacitor works. If you are only building a progressive web app you can use any adapter you want.
To get started with the CLI you can simply go into your existing sveltekit project and run:
npm:
npx capkit initpnpm:
pnpm dlx capkit inityarn:
yarn dlx capkit initbun:
bunx capkit initUpon doing this, you will be guided through a series of questions to help you configure your project optimally. These questions will allow you to tailor the setup to your specific requirements.
When working with native applications and using their respective IDE's (Android Studio or Xcode) you can enable hot reloading by running:
npm:
npm run dev:cappnpm:
pnpm dev:capyarn:
yarn dev:capbun:
bun dev:capIf you are solely focusing on creating a progressive web app you can run:
npm:
npm run devpnpm:
pnpm devyarn:
yarn devbun:
bun devWhen building to native platforms you can use:
npm:
npm run build:cappnpm:
pnpm build:capyarn:
yarn build:capbun:
bun build:capIf you are solely focusing on building a progressive web app you can run:
npm:
npm run buildpnpm:
pnpm buildyarn:
yarn buildbun:
bun buildCapKit also exposes an API to allow you to use it programmatically. This can be useful if you want to integrate CapKit into your own tooling or if you want to extend CapKit's functionality, you can use it like this:
import { initializeProject, type Options } from 'capkit';
const options: Options = {
appName: 'My App',
appId: 'com.myapp',
platforms: ['android', 'ios'],
plugins: ['clipboard', 'push-notifications'] // See a full list of plugins here: https://capacitorjs.com/docs/apis
};
initializeProject(options);For further questions about Capacitor you can refer to the Capacitor Docs.
Here is a example project of a SvelteKit app with Capacitor deployed to Vercel: https://capkit-vercel.vercel.app/ Repository: https://github.com/Hugos68/capkit-vercel
If you encounter any issues or have concerns, please take a moment to report them. Your feedback is greatly appreciated and improves the quality of CapKit.
This project is licensed under the MIT License - see the LICENSE file for details.