@cap-kit/test-plugin 1.0.3 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ require 'json'
3
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
 
5
5
  Pod::Spec.new do |s|
6
- s.name = 'CapKitTest'
6
+ s.name = 'CapKitTestPlugin'
7
7
  s.version = package['version']
8
8
  s.summary = package['description']
9
9
  s.license = package['license']
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Fabio Martino
3
+ Copyright (c) 2026 CapKit Team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/Package.swift CHANGED
@@ -2,12 +2,12 @@
2
2
  import PackageDescription
3
3
 
4
4
  let package = Package(
5
- name: "CapKitTest",
5
+ name: "CapKitTestPlugin",
6
6
  platforms: [.iOS(.v15)],
7
7
  products: [
8
8
  .library(
9
- name: "CapKitTest",
10
- targets: ["TestPlugin"]
9
+ name: "CapKitTestPlugin",
10
+ targets: ["CapKitTestPlugin"]
11
11
  )
12
12
  ],
13
13
  dependencies: [
@@ -15,16 +15,12 @@ let package = Package(
15
15
  ],
16
16
  targets: [
17
17
  .target(
18
- name: "TestPlugin",
18
+ name: "CapKitTestPlugin",
19
19
  dependencies: [
20
20
  .product(name: "Capacitor", package: "capacitor-swift-pm"),
21
21
  .product(name: "Cordova", package: "capacitor-swift-pm")
22
22
  ],
23
23
  path: "ios/Sources/TestPlugin"
24
- ),
25
- .testTarget(
26
- name: "TestPluginTests",
27
- dependencies: ["TestPlugin"],
28
- path: "ios/Tests/TestPluginTests")
24
+ )
29
25
  ]
30
26
  )
@@ -71,7 +71,7 @@ android {
71
71
  buildTypes {
72
72
  release {
73
73
  minifyEnabled = false
74
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
74
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
75
75
  }
76
76
  }
77
77
  lint {
@@ -57,13 +57,17 @@ class TestPlugin : Plugin() {
57
57
  */
58
58
  @PluginMethod
59
59
  fun echo(call: PluginCall) {
60
- var value = call.getString("value") ?: ""
60
+ val jsValue = call.getString("value") ?: ""
61
61
 
62
- // Append the custom message from the configuration
63
- value += config.customMessage
62
+ val valueToEcho =
63
+ if (jsValue.isNotEmpty()) {
64
+ jsValue
65
+ } else {
66
+ config.customMessage ?: ""
67
+ }
64
68
 
65
69
  val ret = JSObject()
66
- ret.put("value", implementation.echo(value))
70
+ ret.put("value", implementation.echo(valueToEcho))
67
71
  call.resolve(ret)
68
72
  }
69
73
 
@@ -4,7 +4,7 @@
4
4
  * It acts as the main entry point for accessing the plugin's functionality
5
5
  * across different platforms, including web.
6
6
  */
7
- import type { TestPlugin } from './definitions';
7
+ import { TestPlugin } from './definitions';
8
8
  /**
9
9
  * Main entry point for the Test Capacitor plugin.
10
10
  *
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { TestPlugin, EchoOptions, EchoResult, PluginVersionResult } from './definitions';
2
+ import { TestPlugin, EchoOptions, EchoResult, PluginVersionResult } from './definitions';
3
3
  /**
4
4
  * Web implementation of the Test plugin.
5
5
  *
@@ -59,14 +59,12 @@ public struct TestConfig {
59
59
  - Parameter plugin: The CAPPlugin instance used to access typed configuration.
60
60
  */
61
61
  init(plugin: CAPPlugin) {
62
- let config = plugin.getConfig()
62
+ let pluginId = plugin.pluginId
63
63
 
64
64
  // Bool
65
- verboseLogging =
66
- (config.value(forKey: Keys.verboseLogging) as? Bool) ?? defaultVerboseLogging
65
+ verboseLogging = plugin.getConfigValue(Keys.verboseLogging) as? Bool ?? defaultVerboseLogging
67
66
 
68
67
  // String
69
- customMessage =
70
- (config.value(forKey: Keys.customMessage) as? String) ?? defaultCustomMessage
68
+ customMessage = plugin.getConfigValue(Keys.customMessage) as? String ?? defaultCustomMessage
71
69
  }
72
70
  }
@@ -64,18 +64,20 @@ public final class TestPlugin: CAPPlugin, CAPBridgedPlugin {
64
64
  and delegates the core logic to the native implementation.
65
65
  */
66
66
  @objc func echo(_ call: CAPPluginCall) {
67
- var value = call.getString("value", "")
67
+ let jsValue = call.getString("value", "")
68
68
 
69
- // Log input only if verbose logging is enabled
70
- TestLogger.debug("Echoing value:", value)
71
-
72
- // Append the custom message from the configuration
73
- if let configMessage = config?.customMessage {
74
- value += configMessage
69
+ let valueToEcho: String
70
+ if !jsValue.isEmpty {
71
+ valueToEcho = jsValue
72
+ } else {
73
+ valueToEcho = config?.customMessage ?? ""
75
74
  }
76
75
 
76
+ // Log input only if verbose logging is enabled
77
+ TestLogger.debug("Echoing value:", valueToEcho)
78
+
77
79
  call.resolve([
78
- "value": implementation.echo(value)
80
+ "value": implementation.echo(valueToEcho)
79
81
  ])
80
82
  }
81
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-kit/test-plugin",
3
- "version": "1.0.3",
3
+ "version": "5.0.0",
4
4
  "description": "Architectural reference and boilerplate for Cap-Kit plugins.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -13,10 +13,10 @@
13
13
  "ios/Sources",
14
14
  "ios/Tests",
15
15
  "Package.swift",
16
- "CapKitTest.podspec",
16
+ "CapKitTestPlugin.podspec",
17
17
  "LICENSE"
18
18
  ],
19
- "author": "Fabio Martino",
19
+ "author": "CapKit Team",
20
20
  "license": "MIT",
21
21
  "repository": {
22
22
  "type": "git",
@@ -46,11 +46,11 @@
46
46
  "@eslint/js": "^9.39.2",
47
47
  "eslint": "^9.39.2",
48
48
  "eslint-plugin-import": "^2.32.0",
49
- "globals": "^17.0.0",
50
- "prettier": "^3.8.0",
49
+ "globals": "^17.1.0",
50
+ "prettier": "^3.8.1",
51
51
  "prettier-plugin-java": "^2.8.1",
52
52
  "rimraf": "^6.1.2",
53
- "rollup": "^4.55.2",
53
+ "rollup": "^4.56.0",
54
54
  "swiftlint": "^2.0.0",
55
55
  "typescript": "^5.9.3",
56
56
  "typescript-eslint": "^8.53.1"
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "scripts": {
70
70
  "verify": "pnpm run verify:ios && pnpm run verify:android && pnpm run verify:web",
71
- "verify:ios": "xcodebuild -scheme CapKitTest -destination generic/platform=iOS",
71
+ "verify:ios": "xcodebuild -scheme CapKitTestPlugin -destination generic/platform=iOS",
72
72
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
73
73
  "verify:web": "pnpm run build",
74
74
  "lint:android": "cd android && ./gradlew ktlintCheck",
@@ -1,21 +0,0 @@
1
- import XCTest
2
- @testable import TestPlugin
3
-
4
- /**
5
- Basic functional tests for the Test plugin native implementation.
6
-
7
- These tests validate the core behavior of the implementation
8
- independently from the Capacitor bridge.
9
- */
10
- class TestTests: XCTestCase {
11
- func testEcho() {
12
- // This is an example of a functional test case for a plugin.
13
- // Use XCTAssert and related functions to verify your tests produce the correct results.
14
-
15
- let implementation = TestImpl()
16
- let value = "Hello, World!"
17
- let result = implementation.echo(value)
18
-
19
- XCTAssertEqual(value, result)
20
- }
21
- }