Architectural reference and boilerplate for Cap-Kit plugins.
npm install @cap-kit/test-plugin
src="https://raw.githubusercontent.com/cap-kit/capacitor-plugins/main/assets/logo.png"
alt="CapKit Logo"
width="128"
/>
@cap-kit/test-plugin
The architectural reference implementation for the Cap-Kit ecosystem.
This package serves as the definitive boilerplate and validation ground for creating new Capacitor plugins.
It demonstrates the enforced monorepo structure, build configuration, and native bridges (Swift/Kotlin) required by our standards.
Note: This is an internal reference package, primarily used for CI verification and scaffolding.
``bash
pnpm add @cap-kit/test-plugin
npx cap sync
`
Configuration options for the Test plugin.
| Prop | Type | Description | Default | Since |
| -------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- | ----- |
| customMessage | string | Custom message appended to the echoed value. This option exists mainly as an example showing how to pass static configuration data from JavaScript to native platforms. | " (from config)" | 0.0.1 |
| verboseLogging | boolean | Enables verbose native logging. When enabled, additional debug information is printed to the native console (Logcat on Android, Xcode on iOS). This option affects native logging behavior only and has no impact on the JavaScript API. | false | 1.0.0 |
In capacitor.config.json:
`json`
{
"plugins": {
"Test": {
"customMessage": " - Hello from Config!",
"verboseLogging": true
}
}
}
In capacitor.config.ts:
`ts
///
import { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
plugins: {
Test: {
customMessage: ' - Hello from Config!',
verboseLogging: true,
},
},
};
export default config;
`
* echo(...)
* openAppSettings()
* getPluginVersion()
* Interfaces
Public JavaScript API for the Test Capacitor plugin.
This interface defines a stable, platform-agnostic API.
All methods behave consistently across Android, iOS, and Web.
`typescript`
echo(options: EchoOptions) => Promise
Echoes the provided value.
If the plugin is configured with a customMessage, that value
will be appended to the returned string.
This method is primarily intended as an example demonstrating
native ↔ JavaScript communication.
| Param | Type | Description |
| ------------- | --------------------------------------------------- | ------------------------------------ |
| options | EchoOptions | Object containing the value to echo. |
Returns: Promise<EchoResult>
Since: 0.0.1
#### Example
`ts`
const { value } = await Test.echo({ value: 'Hello' });
console.log(value);
--------------------
`typescript`
openAppSettings() => Promise
Opens the operating system's application settings page.
Since: 1.0.0
--------------------
`typescript`
getPluginVersion() => Promise
Returns the native plugin version.
The returned version corresponds to the native implementation
bundled with the application.
Returns: Promise<PluginVersionResult>
Since: 0.0.1
#### Example
`ts`
const { version } = await Test.getPluginVersion();
--------------------
#### EchoResult
Result object returned by the echo method.
This object represents the resolved value of the echo operation
after native processing has completed.
| Prop | Type | Description |
| ----------- | ------------------- | ------------------------------------------------------------------------------------------------------------- |
| value | string | The echoed string value. If a customMessage is configured, it will be appended to the original input value. |
#### EchoOptions
Options object for the echo method.
This object defines the input payload sent from JavaScript
to the native plugin implementation.
| Prop | Type | Description |
| ----------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| value | string | The string value to be echoed back by the plugin. This value is passed to the native layer and returned unchanged, optionally with a configuration-based suffix. |
#### PluginVersionResult
Result object returned by the getPluginVersion() method.
| Prop | Type | Description |
| ------------- | ------------------- | --------------------------------- |
| version` | string | The native plugin version string. |
Contributions are welcome! Please read the contributing guide before submitting a pull request.
---
MIT