Skip to content

Commit

Permalink
Merge pull request #92 from Fueled/refactor/update-docs
Browse files Browse the repository at this point in the history
Use Swift Docc Plugin to generate the products documentation
  • Loading branch information
hadiidbouk authored Nov 5, 2024
2 parents 789c508 + 3209d9a commit f719584
Show file tree
Hide file tree
Showing 604 changed files with 1,166 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"originHash" : "ede22b050768f52791700f5180a4aa61895bb35c736831fcd8e92b47ed2b2418",
"pins" : [
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-docc-plugin",
"state" : {
"revision" : "85e4bb4e1cd62cec64a4b8e769dcefdf0c5b9d64",
"version" : "1.4.3"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-docc-symbolkit",
"state" : {
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
}
],
"version" : 3
}
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
108 changes: 108 additions & 0 deletions docs-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/bash

# Define color codes for terminal output
GREEN='\033[0;32m'
NC='\033[0m' # No Color

get_products() {
# Get all products from Package.swift
PRODUCTS=$(swift package dump-package | jq -r '
. as $data |
$data.targets[]
| select(.type == "regular" and
any($data.products[]; .targets | index(.)))
| .name
')

if [ -z "$PRODUCTS" ]; then
echo -e "${RED}Error: No products found in Package.swift${NC}"
exit 1
fi

echo "$PRODUCTS"
}

generate_index_file() {
echo -e "${BLUE}Generating index.html file...${NC}"

# Create the HTML file and write the initial content
cat > ./docs/index.html << EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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;
background-color: #f9f9f9;
color: #333;
}
h1 {
color: #333;
border-bottom: 2px solid #0366d6;
padding-bottom: 10px;
}
ul {
list-style-type: none;
padding: 0;
}
li {
margin: 15px 0;
transition: background-color 0.3s;
}
li:hover {
background-color: #e6f7ff;
}
a {
color: #0366d6;
text-decoration: none;
font-size: 18px;
display: block; /* Makes the entire area clickable */
padding: 10px;
border-radius: 4px;
}
a:hover {
text-decoration: underline;
background-color: #e6f7ff; /* Highlights the link on hover */
}
</style>
</head>
<body>
<h1>Available Documentation</h1>
<ul>
EOF

# Get the products and loop through them to create links
PRODUCTS=$(get_products)
for PRODUCT in $PRODUCTS; do
LOWERCASE_PRODUCT=$(echo "$PRODUCT" | tr '[:upper:]' '[:lower:]')
echo " <li><a href='./documentation/$LOWERCASE_PRODUCT/'>$PRODUCT</a></li>" >> ./docs/index.html
done

# Closing the HTML tags
cat >> ./docs/index.html << EOF
</ul>
</body>
</html>
EOF
}

# This script is used to generate the documentation for the project.
swift package --allow-writing-to-directory ./docs \
generate-documentation \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path ios-utilities \
--output-path ./docs \
--enable-experimental-combined-documentation

# Write the index.html file to navigate between the products
generate_index_file

# Notify user of completion
echo -e "${GREEN}Documentation generated in ./docs directory${NC}"
9 changes: 9 additions & 0 deletions docs/css/866.60f074fd.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions docs/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/css/documentation-topic.91c07ba9.css

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/data/documentation/fueledutilscombine.json

Large diffs are not rendered by default.

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

0 comments on commit f719584

Please sign in to comment.