@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.
- package/{CapKitTest.podspec → CapKitTestPlugin.podspec} +1 -1
- package/LICENSE +1 -1
- package/Package.swift +5 -9
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/capkit/test/TestPlugin.kt +8 -4
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/web.d.ts +1 -1
- package/ios/Sources/TestPlugin/TestConfig.swift +3 -5
- package/ios/Sources/TestPlugin/TestPlugin.swift +10 -8
- package/package.json +7 -7
- package/ios/Tests/TestPluginTests/TestPluginTests.swift +0 -21
package/LICENSE
CHANGED
package/Package.swift
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import PackageDescription
|
|
3
3
|
|
|
4
4
|
let package = Package(
|
|
5
|
-
name: "
|
|
5
|
+
name: "CapKitTestPlugin",
|
|
6
6
|
platforms: [.iOS(.v15)],
|
|
7
7
|
products: [
|
|
8
8
|
.library(
|
|
9
|
-
name: "
|
|
10
|
-
targets: ["
|
|
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: "
|
|
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
|
)
|
package/android/build.gradle
CHANGED
|
@@ -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
|
-
|
|
60
|
+
val jsValue = call.getString("value") ?: ""
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
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(
|
|
70
|
+
ret.put("value", implementation.echo(valueToEcho))
|
|
67
71
|
call.resolve(ret)
|
|
68
72
|
}
|
|
69
73
|
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
-
|
|
67
|
+
let jsValue = call.getString("value", "")
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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(
|
|
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": "
|
|
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
|
-
"
|
|
16
|
+
"CapKitTestPlugin.podspec",
|
|
17
17
|
"LICENSE"
|
|
18
18
|
],
|
|
19
|
-
"author": "
|
|
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.
|
|
50
|
-
"prettier": "^3.8.
|
|
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.
|
|
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
|
|
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
|
-
}
|