Skip to content

Commit d6cf6cd

Browse files
docs: Incorporate docs into monorepo (#8304)
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please follow the template so that the reviewers can easily understand what the code changes affect. --> ## Summary More well-organized and sorted version of #8298 This PR adds docs as a part of monorepo ecosystem, and makes them use yarn v4. To-do: - [x] fix ymls - [x] check if docs publish CI needs to be updated - probably not as it worked locally, but needs to make sure react-native-reanimated is not needed to be build beforehand - [x] precommit - [x] linting CIs ## Test plan Run `yarn start` in both monorepos. **IMPORTANT!** Also run `yarn build && yarn serve` in reanimated - it won't work in worklets as worklet documentation is done using some special under the table tricks to make it possible for two docs to work in one monorepo. Take a look at CIs changes, as well as new build path of docs.
1 parent 9b6e009 commit d6cf6cd

File tree

13 files changed

+24733
-341332
lines changed

13 files changed

+24733
-341332
lines changed

.github/workflows/docs-reanimated-build-check.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,12 @@ jobs:
3232
- name: Install monorepo node dependencies
3333
working-directory: packages/react-native-reanimated
3434
run: yarn install
35-
- name: Install Reanimated docs node dependencies
36-
working-directory: ${{ env.REANIMATED_DOCS_DIR }}
37-
run: yarn install
3835
- name: Lint check Reanimated docs
3936
working-directory: ${{ env.REANIMATED_DOCS_DIR }}
4037
run: yarn lint
4138
- name: Build Reanimated docs
4239
working-directory: ${{ env.REANIMATED_DOCS_DIR }}
4340
run: yarn build
44-
- name: Install Worklets docs node dependencies
45-
working-directory: ${{ env.WORKLETS_DOCS_DIR }}
46-
run: yarn install
4741
- name: Lint check Worklets docs
4842
working-directory: ${{ env.WORKLETS_DOCS_DIR }}
4943
run: yarn lint

.github/workflows/docs-reanimated-publish.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ jobs:
2727
git config --local user.email "[email protected]"
2828
&& git config --local user.name "GitHub Action"
2929
30+
- name: Install monorepo node dependencies
31+
run: yarn install
32+
3033
- name: Build Reanimated docs
3134
working-directory: ${{ env.REANIMATED_DOCS_DIR }}
32-
run: yarn && yarn build
35+
run: yarn build
3336

3437
- name: Build Worklets docs
3538
working-directory: ${{ env.WORKLETS_DOCS_DIR }}
36-
run: yarn && yarn build
39+
run: yarn build
3740

3841
- name: Publish generated content to GitHub Pages
3942
uses: JamesIves/github-pages-deploy-action@releases/v3

.husky/pre-commit

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ check_and_lint_docs() {
99
local docs_path="$2"
1010
local docs_name="$3"
1111

12-
print "Checking for changes in $docs_name docs..."
12+
print "Checking for changes in $docs_name..."
1313
if echo "$staged_files" | grep "^$docs_path/" --silent; then
1414
print "Changes spotted. Running $docs_name docs lint..."
15-
try cd "$docs_path" && yarn install --frozen-lockfile && yarn lint
15+
try yarn workspace "$docs_name" lint
1616
print "Success."
1717
else
1818
print "No changes. Skipping $docs_name docs lint."
@@ -60,15 +60,10 @@ else
6060
fi
6161

6262
# Linting docs
63-
REANIMATED_DOCS_PATH="packages/docs-reanimated"
64-
if [ -d "$REANIMATED_DOCS_PATH/node_modules" ]; then
65-
check_and_lint_docs "$STAGED_FILES" "$REANIMATED_DOCS_PATH" "Reanimated"
66-
fi
67-
68-
WORKLETS_DOCS_PATH="packages/docs-worklets"
69-
if [ -d "$WORKLETS_DOCS_PATH/node_modules" ]; then
70-
check_and_lint_docs "$STAGED_FILES" "$WORKLETS_DOCS_PATH" "Worklets"
71-
fi
63+
for DOCS in docs-reanimated docs-worklets; do
64+
DOCS_PATH="packages/$DOCS"
65+
check_and_lint_docs "$STAGED_FILES" "$DOCS_PATH" "$DOCS"
66+
done
7267

7368
# This automatically builds Reanimated Babel plugin JavaScript files if their
7469
# TypeScript counterparts were changed. It also adds the output file to the commit

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"packages/eslint-plugin-reanimated",
99
"packages/react-native-worklets/plugin",
1010
"packages/react-native-worklets",
11+
"packages/docs-reanimated",
12+
"packages/docs-worklets",
1113
"apps/common-app",
1214
"apps/fabric-example",
1315
"apps/macos-example",

0 commit comments

Comments
 (0)