Skip to content

Hugos68/capkit

Repository files navigation


MIT License GitHub last commit npm npm

CapKit

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.

Table of Contents

Installation

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 init

pnpm:

pnpm dlx capkit init

yarn:

yarn dlx capkit init

bun:

bunx capkit init

Upon 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.

Usage

Development

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:cap

pnpm:

pnpm dev:cap

yarn:

yarn dev:cap

bun:

bun dev:cap

If you are solely focusing on creating a progressive web app you can run:

npm:

npm run dev

pnpm:

pnpm dev

yarn:

yarn dev

bun:

bun dev

Build

When building to native platforms you can use:

npm:

npm run build:cap

pnpm:

pnpm build:cap

yarn:

yarn build:cap

bun:

bun build:cap

If you are solely focusing on building a progressive web app you can run:

npm:

npm run build

pnpm:

pnpm build

yarn:

yarn build

bun:

bun build

API

CapKit 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);

Capacitor

For further questions about Capacitor you can refer to the Capacitor Docs.

Examples

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

Issues

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.