-
-
Notifications
You must be signed in to change notification settings - Fork 281
feat: add @metamask/platform-api-docs package #8012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9af5f7d
6f5169f
09b2c92
9396df8
b91a407
195a811
15006c5
17adacd
8ee4add
726937a
3c7be5e
5d791fa
82b3e45
196cd2c
c8e5285
e5a9c27
b4b841a
2726f4f
2b77320
808fd3c
0c0f5e3
8f51c7a
519826e
f439b61
e19d372
2a71f63
9999b19
b18ca18
3ca6451
b450618
d690a4f
925e551
2449194
f9a7d4b
e805340
b6a517f
325e1ab
5baf2a7
b0c93dd
0a1c767
4b5247d
6d28783
3dc5593
0c5d2c0
2e2a7a0
c904bee
cbae825
166e62f
b441b46
0e30615
170f9ea
b7921f1
e940db5
f95346b
985c43c
bda8e73
26e79fe
da27777
cba00c2
f27d25e
05f2902
96578b1
af38898
4ffd287
3923f7d
b831c27
fbb0797
187727a
5a6bf65
b6d3b4f
3d02e9f
f3adf53
baffffe
dea72a3
2b9ec1d
fbc0aed
b334965
ccdc8dc
e5cef32
89832b1
36158b5
b664468
c7cde64
66c8d81
a6585b0
9d2fbf7
40ad9c3
3f115e7
1b1b547
34c820f
c767ae0
671e21a
a85fa0f
13ccf66
f389539
f7c1b80
d590bde
f47b949
30fb5e2
79e76e7
d4160fd
1b05df4
1275d0f
eec9874
21f1876
ed8d9d8
0e3e537
bb3ea4d
e583465
0862ed5
6235c37
1cc9557
737f925
09190bf
1882f5c
5c7e0a6
4e8bb54
7bb1849
8b0482f
920602d
69c5355
1675c03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Deploy Platform API Docs | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build-docs: | ||
| name: Build Platform API docs | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout and setup environment | ||
| uses: MetaMask/action-checkout-and-setup@v3 | ||
| with: | ||
| is-high-risk-environment: true | ||
|
|
||
| - name: Generate and build Platform API docs | ||
| # The site is published under the `/platform-api/` subdirectory of | ||
| # the repo's GitHub Pages site so that other doc sites (e.g. | ||
| # package API docs) can be hosted alongside under sibling paths. | ||
| run: | | ||
| yarn docs:platform-api:build \ | ||
| --site-url "https://${{ github.repository_owner }}.github.io" \ | ||
| --site-base-url "/${{ github.event.repository.name }}/platform-api/" | ||
|
|
||
| - name: Upload build artifact (PR) | ||
| if: github.event_name == 'pull_request' | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: platform-api-docs | ||
| path: .platform-api-docs/build/ | ||
| retention-days: 7 | ||
|
|
||
| - name: Upload build artifact for deploy job | ||
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: platform-api-docs-build | ||
| path: .platform-api-docs/build/ | ||
| retention-days: 1 | ||
|
|
||
| deploy: | ||
| name: Deploy to GitHub Pages | ||
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
| needs: build-docs | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Download build artifact | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: platform-api-docs-build | ||
| path: build/ | ||
|
|
||
| - name: Deploy to GitHub Pages | ||
| uses: peaceiris/actions-gh-pages@v4.1.0 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: ./build | ||
| destination_dir: platform-api | ||
| # Preserve sibling subdirectories (e.g. /package-api/) so this | ||
| # deploy only overwrites /platform-api/. | ||
| keep_files: true |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -76,9 +76,11 @@ const config = createConfig([ | |||
| '**/dist/**', | ||||
| '**/docs/**', | ||||
| '**/coverage/**', | ||||
| '.platform-api-docs/**', | ||||
| 'merged-packages/**', | ||||
| '.yarn/**', | ||||
| 'scripts/create-package/package-template/**', | ||||
| 'packages/platform-api-docs/site/**', | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, why are we asking ESLint to ignore this directory? It seems like
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was getting OOM with eslint |
||||
| ], | ||||
| }, | ||||
| { | ||||
|
|
@@ -114,6 +116,7 @@ const config = createConfig([ | |||
| '**/tests/**/*.{js,ts}', | ||||
| 'scripts/*.ts', | ||||
| 'scripts/create-package/**/*.ts', | ||||
| 'packages/platform-api-docs/**/*.ts', | ||||
| ], | ||||
| extends: [nodejs], | ||||
| }, | ||||
|
|
@@ -207,7 +210,7 @@ const config = createConfig([ | |||
| }, | ||||
| }, | ||||
| { | ||||
| files: ['scripts/*.ts'], | ||||
| files: ['scripts/*.ts', 'packages/platform-api-docs/src/cli.ts'], | ||||
| rules: { | ||||
| // Scripts may be self-executable and thus have hashbangs. | ||||
| 'n/hashbang': 'off', | ||||
|
|
@@ -306,6 +309,14 @@ const config = createConfig([ | |||
| 'import-x/no-nodejs-modules': 'off', | ||||
| }, | ||||
| }, | ||||
| { | ||||
| files: ['packages/platform-api-docs/**/*.{js,ts}'], | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 I'm starting to wonder if we should have per-package ESLint files. Or if we should consolidate this config. It's getting a bit messy. Oh well, a problem for another day... |
||||
| rules: { | ||||
| 'import-x/no-nodejs-modules': 'off', | ||||
| 'n/no-process-env': 'off', | ||||
| 'n/no-sync': 'off', | ||||
| }, | ||||
| }, | ||||
| { | ||||
| files: [ | ||||
| 'packages/notification-services-controller/src/NotificationServicesPushController/services/push/*-web.ts', | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,10 +22,13 @@ | |
| "changelog:validate": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:validate", | ||
| "create-release-branch": "create-release-branch --formatter oxfmt", | ||
| "create-package": "tsx scripts/create-package", | ||
| "docs:platform-api:build": "yarn workspace @metamask/platform-api-docs cli ../.. --build --project-label Core", | ||
| "docs:platform-api:dev": "yarn workspace @metamask/platform-api-docs cli ../.. --dev --project-label Core", | ||
| "docs:platform-api:serve": "yarn workspace @metamask/platform-api-docs cli ../.. --serve --project-label Core", | ||
| "lint": "yarn lint:eslint && echo && yarn lint:misc --check && yarn constraints && yarn lint:dependencies && yarn lint:teams && yarn messenger-action-types:check && yarn readme-content:check", | ||
| "lint:dependencies": "depcheck && yarn dedupe --check", | ||
| "lint:dependencies:fix": "depcheck && yarn dedupe", | ||
| "lint:eslint": "yarn build:only-clean && NODE_OPTIONS='--max-old-space-size=6144' yarn eslint", | ||
| "lint:eslint": "yarn build:only-clean && NODE_OPTIONS='--max-old-space-size=8192' yarn eslint", | ||
| "lint:fix": "yarn lint:eslint --fix --prune-suppressions && echo && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies:fix && yarn messenger-action-types:generate && yarn readme-content:update", | ||
| "lint:misc": "oxfmt --ignore-path .gitignore", | ||
| "lint:misc:check": "yarn lint:misc --check", | ||
|
|
@@ -96,7 +99,11 @@ | |
| }, | ||
| "resolutions": { | ||
| "elliptic@6.5.4": "^6.5.7", | ||
| "eslint-import-resolver-typescript": "3.7.0", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need these resolutions?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did forget why I had to; let me revert and check again
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These four pins were carried over from #8014 — they're version locks for the root's lint tooling, not transitive-dep conflict resolutions. I tried dropping them locally to see whether they were stale. With the pins removed, the floating versions become:
That said, none of this is needed for this PR — these pins predate the docs work and could be dropped (or just the now-stale ones) as a separate cleanup once the new lint errors are addressed. Want me to open a follow-up issue for that, or leave them as-is for now?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| "eslint-plugin-import-x": "4.6.1", | ||
| "eslint-plugin-n": "17.15.1", | ||
| "fast-xml-parser@^4.3.4": "^4.4.1", | ||
| "prettier@npm:^3.3.3": "3.4.2", | ||
| "ws@7.4.6": "^7.5.10" | ||
| }, | ||
| "simple-git-hooks": { | ||
|
|
@@ -111,9 +118,10 @@ | |
| "@lavamoat/preinstall-always-fail": false, | ||
| "@keystonehq/bc-ur-registry-eth>hdkey>secp256k1": true, | ||
| "babel-runtime>core-js": false, | ||
| "eslint-import-resolver-typescript>unrs-resolver": false, | ||
| "eslint-plugin-import-x>unrs-resolver": false, | ||
| "simple-git-hooks": false, | ||
| "tsx>esbuild": false, | ||
| "eslint-plugin-import-x>unrs-resolver": false | ||
| "tsx>esbuild": false | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to this project will be documented in this file. | ||
|
|
||
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| ## [Unreleased] | ||
|
|
||
| ### Added | ||
|
|
||
| - Initial release of the platform-api-docs package ([#8012](https://github.com/MetaMask/core/pull/8012)) | ||
|
|
||
| [Unreleased]: https://github.com/MetaMask/core/ |
|
mcmire marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| This project is licensed under either of | ||
|
|
||
| * MIT license ([LICENSE.MIT](LICENSE.MIT)) | ||
| * Apache License, Version 2.0 ([LICENSE.APACHE2](LICENSE.APACHE2)) | ||
|
|
||
| at your option. |
Uh oh!
There was an error while loading. Please reload this page.