Skip to content

Commit 1a49bcf

Browse files
committed
📚 Improve documentation
- Add missing comments - Add script to generate docs
1 parent f4b149e commit 1a49bcf

File tree

6 files changed

+37
-0
lines changed

6 files changed

+37
-0
lines changed

‎.generate-docs.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
set -e
3+
4+
MODULE_VERSION=$1
5+
OUTPUT=$2
6+
SWIFT_VERSION="4.0"
7+
AUTHOR="Alexis Aubry"
8+
AUTHOR_URL="https://twitter.com/_alexaubry"
9+
MODULE_NAME="JavaScriptKit"
10+
COPYRIGHT="Copyright © 2017 $AUTHOR. Available under the MIT License."
11+
GITHUB_URL="https://github.com/alexaubry/JavaScriptKit"
12+
GH_PAGES_URL="https://alexaubry.github.io/JavaScriptKit"
13+
14+
jazzy \
15+
--swift-version $SWIFT_VERSION \
16+
-a "$AUTHOR" \
17+
-u "$AUTHOR_URL" \
18+
-m "$MODULE_NAME" \
19+
--module-version "$MODULE_VERSION" \
20+
--copyright "$COPYRIGHT" \
21+
-g "$GITHUB_URL" \
22+
--github-file-prefix "$GITHUB_URL/tree/master" \
23+
-r "$GH_PAGES_URL" \
24+
-o "$OUTPUT"\
25+
--min-acl public \
26+
--use-safe-filenames

‎Sources/Expressions/JSFunction.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public final class JSFunction<T>: JSExpression where T: Decodable {
6363
self.arguments = arguments
6464
}
6565

66+
/// Creates the JavaScript text of the expression.
6667
public func makeExpressionString() throws -> String {
6768

6869
let encoder = JavaScriptEncoder()

‎Sources/Expressions/JSScript.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public final class JSScript<T>: JSExpression where T: Decodable {
6565
self.javaScriptString = javaScriptString
6666
}
6767

68+
/// Creates the JavaScript text of the expression.
6869
public func makeExpressionString() -> String {
6970
return javaScriptString
7071
}

‎Sources/Expressions/JSVariable.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public final class JSVariable<T>: JSExpression where T: Decodable {
5555
self.keyPath = keyPath
5656
}
5757

58+
/// Creates the JavaScript text of the expression.
5859
public func makeExpressionString() -> String {
5960
return "this.\(keyPath);"
6061
}

‎Sources/JSErrorDomain.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ public enum JSErrorDomain {
3030

3131
extension JSErrorDomain: LocalizedError {
3232

33+
/// The identifier of the error domain.
3334
public static var identifier = "fr.alexaubry.JavaScriptKit.JSErrorDomain"
3435

36+
/// The code of the error.
3537
public var code: Int {
3638

3739
switch self {
@@ -47,6 +49,7 @@ extension JSErrorDomain: LocalizedError {
4749

4850
}
4951

52+
/// The localized description of the error.
5053
public var localizedDescription: String {
5154

5255
switch self {
@@ -65,6 +68,7 @@ extension JSErrorDomain: LocalizedError {
6568

6669
}
6770

71+
/// The error that caused this error to be thrown.
6872
public var underlyingError: NSError? {
6973

7074
switch self {
@@ -89,6 +93,7 @@ extension JSErrorDomain: LocalizedError {
8993

9094
}
9195

96+
/// The localized description of the error.
9297
public var errorDescription: String {
9398
return localizedDescription
9499
}

‎Sources/JSTypes.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ import CoreGraphics
1111
///
1212

1313
public struct JSVoid: Equatable, Decodable {
14+
15+
/// Compares two Void values. Always evaluates to `true`.
1416
public static func == (lhs: JSVoid, rhs: JSVoid) -> Bool { return true }
17+
1518
}

0 commit comments

Comments
 (0)