Skip to content

Commit ef1aba9

Browse files
authored
Support for multiple API docs repos (#590)
Misc changes to support analyzing multiple repos/versions when generating API docs.
1 parent fd9b1a6 commit ef1aba9

File tree

14 files changed

+215
-101
lines changed

14 files changed

+215
-101
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ Dockerfile
33
**/node_modules
44
npm-debug.log
55
**/tsconfig.tsbuildinfo
6-
/packages/lit-dev-api/lit/
6+
/packages/lit-dev-api/api-data/*/repo/
77
/packages/lit-dev-tests/

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ packages/lit-dev-content/site/fonts
1111
packages/lit-dev-content/temp
1212
packages/lit-dev-content/samples/js
1313

14-
packages/lit-dev-api/lit/
14+
packages/lit-dev-api/api-data/*/repo/
1515

1616
# We only want to keep '-linux' screenshots which are tested by Github Actions.
1717
packages/lit-dev-tests/src/playwright/**/*.png

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,9 @@ code packages/lit-dev-api/lit/
7979

8080
The `lit` directory is a regular cloned git repo, so you can make changes
8181
directly here, and push PRs from it as normal. It's configured to track the
82-
`main` branch, but is pinned to a particular commit via the `lit.sha` file. To
83-
update the current commit, run:
84-
85-
```sh
86-
cd packages/lit-dev-tools
87-
npm run monorepo:update
88-
```
82+
`main` branch, but is pinned to a particular commit. To update the current
83+
commit, update the `sha` field in
84+
[`packages/lit-dev-tools-cjs/src/api-docs/configs/lit-2.ts`](https://github.com/lit/lit.dev/blob/main/packages/lit-dev-tools-cjs/src/api-docs/configs/lit-2.ts).
8985

9086
### Serve production mode
9187

packages/lit-dev-api/api-data/.gitkeep

Whitespace-only changes.

packages/lit-dev-api/api-data/pages.json renamed to packages/lit-dev-api/api-data/lit-2/pages.json

Lines changed: 41 additions & 41 deletions
Large diffs are not rendered by default.

packages/lit-dev-api/lit.sha

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/lit-dev-api/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,8 @@
66
"author": "Google LLC",
77
"license": "BSD-3-Clause",
88
"scripts": {
9-
"build": "(ls lit 2>/dev/null || npm run monorepo:init) && npm run build:generate",
10-
"build:generate": "node ../lit-dev-tools-cjs/lib/generate-api-docs-data.js",
11-
"build:watch": "chokidar 'lit/packages/*/src/**/*.ts' '../lit-dev-tools-cjs/lib/generate-api-docs-data.js' -c 'npm run monorepo:build && npm run build:generate' --initial",
12-
"monorepo:init": "npm run monorepo:clone && npm run monorepo:install && npm run monorepo:build",
13-
"monorepo:clone": "git clone https://github.com/lit/lit --branch main lit && cd lit && git checkout $(cat ../lit.sha)",
14-
"monorepo:update": "cd lit && git checkout main && git pull && git rev-parse HEAD > ../lit.sha && cd .. && npm run monorepo:install && npm run monorepo:build",
15-
"monorepo:install": "cd lit && npm ci && npm run bootstrap",
16-
"monorepo:build": "cd lit && npx lerna run build:ts --scope lit --include-dependencies"
9+
"build": "node ../lit-dev-tools-cjs/lib/api-docs/generate.js",
10+
"build:watch": "chokidar 'lit/packages/*/src/**/*.ts' '../lit-dev-tools-cjs/lib/api-docs/**/*.js' -c 'npm run build' --initial"
1711
},
1812
"dependencies": {
1913
"chokidar-cli": "^2.1.0",

packages/lit-dev-content/.eleventy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ module.exports = function (eleventyConfig) {
6969
}
7070
eleventyConfig.addPassthroughCopy('api/**/*');
7171

72-
eleventyConfig.addWatchTarget('../lit-dev-api/api-data');
72+
eleventyConfig.addWatchTarget('../lit-dev-api/api-data/*/*.json');
7373

7474
// Placeholder shortcode for TODOs
7575
// Formatting is intentional: outdenting the HTML causes the
@@ -246,7 +246,7 @@ ${content}
246246

247247
// Don't use require() because of Node caching in watch mode.
248248
const apiSymbolMap = JSON.parse(
249-
fsSync.readFileSync('../lit-dev-api/api-data/symbols.json', 'utf8')
249+
fsSync.readFileSync('../lit-dev-api/api-data/lit-2/symbols.json', 'utf8')
250250
);
251251

252252
/**

packages/lit-dev-content/site/_data/api-docs-pages.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports = async () =>
1818
'..',
1919
'lit-dev-api',
2020
'api-data',
21+
'lit-2',
2122
'pages.json'
2223
),
2324
'utf8'

0 commit comments

Comments
 (0)