forked from apify/apify-client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_api_reference.sh
More file actions
executable file
·39 lines (31 loc) · 1.48 KB
/
Copy pathbuild_api_reference.sh
File metadata and controls
executable file
·39 lines (31 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# On macOS, sed requires a space between -i and '' to specify no backup should be done
# On Linux, sed requires no space between -i and '' to specify no backup should be done
sed_no_backup() {
if [[ $(uname) = "Darwin" ]]; then
sed -i '' "$@"
else
sed -i'' "$@"
fi
}
# Create docspec dump of this package's source code through pydoc-markdown
pydoc-markdown --quiet --dump > docspec-dump.jsonl
sed_no_backup "s#${PWD}/..#REPO_ROOT_PLACEHOLDER#g" docspec-dump.jsonl
# Create docpec dump from the right version of the apify-shared package
apify_shared_version=$(python -c "import apify_shared; print(apify_shared.__version__)")
apify_shared_tempdir=$(realpath "$(mktemp -d)")
git clone --quiet https://github.com/apify/apify-shared-python.git "${apify_shared_tempdir}"
cp ./pydoc-markdown.yml "${apify_shared_tempdir}/pydoc-markdown.yml"
sed_no_backup "s#search_path: \[../src\]#search_path: \[./src\]#g" "${apify_shared_tempdir}/pydoc-markdown.yml"
(
cd "${apify_shared_tempdir}";
git checkout --quiet "v${apify_shared_version}";
pydoc-markdown --quiet --dump > ./apify-shared-docspec-dump.jsonl
)
cp "${apify_shared_tempdir}/apify-shared-docspec-dump.jsonl" .
sed_no_backup "s#${apify_shared_tempdir}#REPO_ROOT_PLACEHOLDER#g" apify-shared-docspec-dump.jsonl
rm -rf "${apify_shared_tempdir}"
# Generate import shortcuts from the modules
python generate_module_shortcuts.py
# Transform the docpec dumps into Typedoc-compatible docs tree
node transformDocs.js