Skip to content

Commit

Permalink
feat(docs): generate new docs using swift-docc-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
hadiidbouk committed Nov 4, 2024
1 parent 0a0117e commit 776df14
Show file tree
Hide file tree
Showing 705 changed files with 1,967 additions and 0 deletions.
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.4.3"),
],
targets: [
.target(
Expand Down
105 changes: 105 additions & 0 deletions docs-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/bin/bash

# Colors for prettier output
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

# Function to check if jq is installed
check_dependencies() {
if ! command -v jq &> /dev/null; then
echo -e "${RED}Error: jq is not installed${NC}"
echo "Please install jq using one of the following commands:"
echo " Homebrew: brew install jq"
echo " MacPorts: sudo port install jq"
exit 1
fi
}

# Function to get all targets from Package.swift
get_targets() {
echo -e "${BLUE}Reading targets from Package.swift...${NC}"
TARGETS=$(swift package dump-package | jq -r '.products[].name')
if [ -z "$TARGETS" ]; then
echo -e "${RED}Error: No targets found in Package.swift${NC}"
exit 1
fi
echo -e "${GREEN}Found targets:${NC}"
echo "$TARGETS"
echo
}

# Function to generate static documentation
generate_docs() {
get_targets

# Create docs directory
mkdir -p ./docs

# Generate docs for each target
for TARGET in $TARGETS; do
# Building each target
echo -e "${BLUE}Building ${TARGET}...${NC}"
if ! swift build --target "$TARGET"; then
echo -e "${RED}Failed to build ${TARGET}${NC}"
continue
fi

echo -e "${BLUE}Generating documentation for ${TARGET}${NC}"
if swift package --allow-writing-to-directory ./docs \
generate-documentation --target "$TARGET" \
--output-path "./docs/$TARGET" \
--transform-for-static-hosting \
--hosting-base-path "ios-utilities"; then
echo -e "${GREEN}Successfully generated documentation for ${TARGET}${NC}"
else
echo -e "${RED}Failed to generate documentation for ${TARGET}${NC}"
fi
done

# Create index.html
echo -e "${BLUE}Creating index.html...${NC}"
cat > ./docs/index.html << EOF
<!DOCTYPE html>
<html>
<head>
<title>API Documentation</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
h1 { color: #333; }
ul { list-style-type: none; padding: 0; }
li { margin: 10px 0; }
a {
color: #0366d6;
text-decoration: none;
font-size: 18px;
}
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<h1>Available Documentation</h1>
<ul>
EOF

for TARGET in $TARGETS; do
echo " <li><a href='./$TARGET/'>$TARGET</a></li>" >> ./docs/index.html
done

cat >> ./docs/index.html << EOF
</ul>
</body>
</html>
EOF

echo -e "${GREEN}Documentation generated in ./docs directory${NC}"
}

check_dependencies
generate_docs
9 changes: 9 additions & 0 deletions docs/FueledUtilsCombine/css/866.60f074fd.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/FueledUtilsCombine/css/989.4f123103.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions docs/FueledUtilsCombine/css/documentation-topic.91c07ba9.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/FueledUtilsCombine/css/index.3a335429.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/FueledUtilsCombine/css/topic.4be8f56d.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/FueledUtilsCombine/css/tutorials-overview.7942d777.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"primaryContentSections":[{"declarations":[{"languages":["swift"],"platforms":["macOS"],"tokens":[{"text":"func","kind":"keyword"},{"kind":"text","text":" "},{"text":">>>","kind":"identifier"},{"text":" ","kind":"text"},{"text":"<","kind":"text"},{"kind":"genericParameter","text":"CancellableCollection"},{"text":">(","kind":"text"},{"kind":"internalParam","text":"lhs"},{"kind":"text","text":": "},{"preciseIdentifier":"s:7Combine14AnyCancellableC","kind":"typeIdentifier","text":"AnyCancellable"},{"kind":"text","text":"?, "},{"kind":"internalParam","text":"rhs"},{"text":": ","kind":"text"},{"text":"inout","kind":"keyword"},{"text":" ","kind":"text"},{"text":"CancellableCollection","kind":"typeIdentifier"},{"kind":"text","text":"?) "},{"kind":"keyword","text":"where"},{"kind":"text","text":" "},{"text":"CancellableCollection","kind":"typeIdentifier"},{"text":" : ","kind":"text"},{"text":"RangeReplaceableCollection","kind":"typeIdentifier","preciseIdentifier":"s:Sm"},{"text":", ","kind":"text"},{"text":"CancellableCollection","kind":"typeIdentifier"},{"kind":"text","text":"."},{"preciseIdentifier":"s:ST7ElementQa","text":"Element","kind":"typeIdentifier"},{"kind":"text","text":" == "},{"preciseIdentifier":"s:7Combine14AnyCancellableC","text":"AnyCancellable","kind":"typeIdentifier"}]}],"kind":"declarations"}],"schemaVersion":{"patch":0,"minor":3,"major":0},"sections":[],"metadata":{"externalID":"s:18FueledUtilsCombine3gggoiyy0C014AnyCancellableCSg_xSgztSmRzAE7ElementRtzlF","roleHeading":"Operator","fragments":[{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":">>>","kind":"identifier"},{"text":" ","kind":"text"},{"kind":"text","text":"<"},{"kind":"genericParameter","text":"CancellableCollection"},{"text":">(","kind":"text"},{"text":"AnyCancellable","preciseIdentifier":"s:7Combine14AnyCancellableC","kind":"typeIdentifier"},{"kind":"text","text":"?, "},{"kind":"keyword","text":"inout"},{"text":" ","kind":"text"},{"text":"CancellableCollection","kind":"typeIdentifier"},{"text":"?)","kind":"text"}],"symbolKind":"op","role":"symbol","modules":[{"name":"FueledUtilsCombine"}],"title":">>>(_:_:)"},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine\/___(_:_:)-13v1v"},"kind":"symbol","variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/fueledutilscombine\/___(_:_:)-13v1v"]}],"hierarchy":{"paths":[["doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine"]]},"references":{"doc://FueledUtilsCombine/documentation/FueledUtilsCombine":{"type":"topic","kind":"symbol","url":"\/documentation\/fueledutilscombine","abstract":[],"identifier":"doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine","role":"collection","title":"FueledUtilsCombine"},"doc://FueledUtilsCombine/documentation/FueledUtilsCombine/___(_:_:)-13v1v":{"identifier":"doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine\/___(_:_:)-13v1v","fragments":[{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":">>>","kind":"identifier"},{"text":" ","kind":"text"},{"text":"<","kind":"text"},{"kind":"genericParameter","text":"CancellableCollection"},{"text":">(","kind":"text"},{"preciseIdentifier":"s:7Combine14AnyCancellableC","kind":"typeIdentifier","text":"AnyCancellable"},{"text":"?, ","kind":"text"},{"text":"inout","kind":"keyword"},{"text":" ","kind":"text"},{"text":"CancellableCollection","kind":"typeIdentifier"},{"text":"?)","kind":"text"}],"type":"topic","url":"\/documentation\/fueledutilscombine\/___(_:_:)-13v1v","role":"symbol","kind":"symbol","abstract":[],"title":">>>(_:_:)"}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schemaVersion":{"major":0,"patch":0,"minor":3},"kind":"symbol","hierarchy":{"paths":[["doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine"]]},"primaryContentSections":[{"kind":"declarations","declarations":[{"languages":["swift"],"tokens":[{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":">>>","kind":"identifier"},{"kind":"text","text":" "},{"text":"(","kind":"text"},{"text":"lhs","kind":"internalParam"},{"kind":"text","text":": "},{"preciseIdentifier":"s:7Combine14AnyCancellableC","kind":"typeIdentifier","text":"AnyCancellable"},{"kind":"text","text":"?, "},{"text":"rhs","kind":"internalParam"},{"kind":"text","text":": "},{"text":"inout","kind":"keyword"},{"text":" ","kind":"text"},{"preciseIdentifier":"s:Sh","kind":"typeIdentifier","text":"Set"},{"kind":"text","text":"<"},{"text":"AnyCancellable","preciseIdentifier":"s:7Combine14AnyCancellableC","kind":"typeIdentifier"},{"text":">)","kind":"text"}],"platforms":["macOS"]}]}],"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/fueledutilscombine\/___(_:_:)-2vprt"]}],"identifier":{"url":"doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine\/___(_:_:)-2vprt","interfaceLanguage":"swift"},"metadata":{"modules":[{"name":"FueledUtilsCombine"}],"symbolKind":"op","role":"symbol","externalID":"s:18FueledUtilsCombine3gggoiyy0C014AnyCancellableCSg_ShyAEGztF","roleHeading":"Operator","fragments":[{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":">>>","kind":"identifier"},{"text":" ","kind":"text"},{"kind":"text","text":"("},{"text":"AnyCancellable","kind":"typeIdentifier","preciseIdentifier":"s:7Combine14AnyCancellableC"},{"text":"?, ","kind":"text"},{"text":"inout","kind":"keyword"},{"kind":"text","text":" "},{"text":"Set","kind":"typeIdentifier","preciseIdentifier":"s:Sh"},{"text":"<","kind":"text"},{"preciseIdentifier":"s:7Combine14AnyCancellableC","kind":"typeIdentifier","text":"AnyCancellable"},{"text":">)","kind":"text"}],"title":">>>(_:_:)"},"sections":[],"references":{"doc://FueledUtilsCombine/documentation/FueledUtilsCombine/___(_:_:)-2vprt":{"title":">>>(_:_:)","abstract":[],"kind":"symbol","identifier":"doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine\/___(_:_:)-2vprt","role":"symbol","fragments":[{"text":"func","kind":"keyword"},{"text":" ","kind":"text"},{"text":">>>","kind":"identifier"},{"text":" ","kind":"text"},{"text":"(","kind":"text"},{"preciseIdentifier":"s:7Combine14AnyCancellableC","kind":"typeIdentifier","text":"AnyCancellable"},{"kind":"text","text":"?, "},{"text":"inout","kind":"keyword"},{"kind":"text","text":" "},{"preciseIdentifier":"s:Sh","text":"Set","kind":"typeIdentifier"},{"text":"<","kind":"text"},{"text":"AnyCancellable","kind":"typeIdentifier","preciseIdentifier":"s:7Combine14AnyCancellableC"},{"text":">)","kind":"text"}],"url":"\/documentation\/fueledutilscombine\/___(_:_:)-2vprt","type":"topic"},"doc://FueledUtilsCombine/documentation/FueledUtilsCombine":{"type":"topic","kind":"symbol","url":"\/documentation\/fueledutilscombine","abstract":[],"identifier":"doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine","role":"collection","title":"FueledUtilsCombine"}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schemaVersion":{"patch":0,"major":0,"minor":3},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine\/___(_:_:)-3e0rd"},"kind":"symbol","primaryContentSections":[{"kind":"declarations","declarations":[{"languages":["swift"],"tokens":[{"kind":"keyword","text":"func"},{"text":" ","kind":"text"},{"text":">>>","kind":"identifier"},{"kind":"text","text":" "},{"kind":"text","text":"<"},{"text":"CancellableCollection","kind":"genericParameter"},{"kind":"text","text":">("},{"text":"lhs","kind":"internalParam"},{"kind":"text","text":": "},{"preciseIdentifier":"s:7Combine14AnyCancellableC","text":"AnyCancellable","kind":"typeIdentifier"},{"kind":"text","text":", "},{"text":"rhs","kind":"internalParam"},{"text":": ","kind":"text"},{"text":"inout","kind":"keyword"},{"kind":"text","text":" "},{"kind":"typeIdentifier","text":"CancellableCollection"},{"text":"?) ","kind":"text"},{"text":"where","kind":"keyword"},{"kind":"text","text":" "},{"kind":"typeIdentifier","text":"CancellableCollection"},{"kind":"text","text":" : "},{"text":"RangeReplaceableCollection","kind":"typeIdentifier","preciseIdentifier":"s:Sm"},{"text":", ","kind":"text"},{"text":"CancellableCollection","kind":"typeIdentifier"},{"text":".","kind":"text"},{"preciseIdentifier":"s:ST7ElementQa","text":"Element","kind":"typeIdentifier"},{"kind":"text","text":" == "},{"text":"AnyCancellable","kind":"typeIdentifier","preciseIdentifier":"s:7Combine14AnyCancellableC"}],"platforms":["macOS"]}]}],"sections":[],"hierarchy":{"paths":[["doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine"]]},"metadata":{"modules":[{"name":"FueledUtilsCombine"}],"symbolKind":"op","title":">>>(_:_:)","externalID":"s:18FueledUtilsCombine3gggoiyy0C014AnyCancellableC_xSgztSmRzAE7ElementRtzlF","fragments":[{"text":"func","kind":"keyword"},{"kind":"text","text":" "},{"text":">>>","kind":"identifier"},{"kind":"text","text":" "},{"text":"<","kind":"text"},{"text":"CancellableCollection","kind":"genericParameter"},{"text":">(","kind":"text"},{"text":"AnyCancellable","kind":"typeIdentifier","preciseIdentifier":"s:7Combine14AnyCancellableC"},{"text":", ","kind":"text"},{"kind":"keyword","text":"inout"},{"text":" ","kind":"text"},{"text":"CancellableCollection","kind":"typeIdentifier"},{"kind":"text","text":"?)"}],"roleHeading":"Operator","role":"symbol"},"variants":[{"paths":["\/documentation\/fueledutilscombine\/___(_:_:)-3e0rd"],"traits":[{"interfaceLanguage":"swift"}]}],"references":{"doc://FueledUtilsCombine/documentation/FueledUtilsCombine/___(_:_:)-3e0rd":{"type":"topic","identifier":"doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine\/___(_:_:)-3e0rd","url":"\/documentation\/fueledutilscombine\/___(_:_:)-3e0rd","title":">>>(_:_:)","fragments":[{"text":"func","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":">>>"},{"text":" ","kind":"text"},{"text":"<","kind":"text"},{"kind":"genericParameter","text":"CancellableCollection"},{"text":">(","kind":"text"},{"text":"AnyCancellable","kind":"typeIdentifier","preciseIdentifier":"s:7Combine14AnyCancellableC"},{"text":", ","kind":"text"},{"text":"inout","kind":"keyword"},{"kind":"text","text":" "},{"text":"CancellableCollection","kind":"typeIdentifier"},{"kind":"text","text":"?)"}],"kind":"symbol","abstract":[],"role":"symbol"},"doc://FueledUtilsCombine/documentation/FueledUtilsCombine":{"type":"topic","kind":"symbol","url":"\/documentation\/fueledutilscombine","abstract":[],"identifier":"doc:\/\/FueledUtilsCombine\/documentation\/FueledUtilsCombine","role":"collection","title":"FueledUtilsCombine"}}}
Loading

0 comments on commit 776df14

Please sign in to comment.