forked from MetaMask/metamask-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'v2/main'
- Loading branch information
Showing
94 changed files
with
23,731 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/build | ||
/.yarn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"browser": true, | ||
"commonjs": true, | ||
"es6": true | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": "**/*.js", | ||
"rules": { | ||
"@typescript-eslint/no-var-requires": "off" | ||
} | ||
} | ||
], | ||
"extends": [ | ||
"plugin:@docusaurus/recommended", | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"plugins": [ | ||
"@docusaurus", | ||
"react", | ||
"@typescript-eslint", | ||
"eslint-plugin-unused-imports" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
2 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"double" | ||
], | ||
"jsx-quotes": [ | ||
"error", | ||
"prefer-double" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"react/react-in-jsx-scope": 0, | ||
"object-curly-spacing": ["error", "always"], | ||
"comma-dangle": ["error", "always-multiline"], | ||
"no-unused-vars": "off", | ||
"unused-imports/no-unused-imports": "error", | ||
"unused-imports/no-unused-vars": [ | ||
"error", | ||
{ | ||
"vars": "all", | ||
"varsIgnorePattern": "^_", | ||
"args": "after-used", | ||
"argsIgnorePattern": "^_" | ||
} | ||
], | ||
"object-shorthand": ["error", "properties"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
* text=auto | ||
|
||
yarn.lock linguist-generated=false | ||
|
||
# yarn v3 | ||
# See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored | ||
/.yarn/releases/** binary | ||
/.yarn/plugins/** binary |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/snaps/ @MetaMask/tech-writers @MetaMask/snaps | ||
/wallet/ @MetaMask/tech-writers @MetaMask/dev-ex @ziad-saab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Build and lint | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
prepare: | ||
name: Prepare | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
- name: Install Yarn dependencies | ||
run: yarn --immutable | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
needs: | ||
- prepare | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
- run: yarn --immutable --immutable-cache | ||
- run: yarn build | ||
- name: Require clean working directory | ||
shell: bash | ||
run: | | ||
if ! git diff --exit-code; then | ||
echo "Working tree dirty at end of job" | ||
exit 1 | ||
fi | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
needs: | ||
- prepare | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
- run: yarn --immutable --immutable-cache | ||
- run: yarn lint | ||
- name: Require clean working directory | ||
shell: bash | ||
run: | | ||
if ! git diff --exit-code; then | ||
echo "Working tree dirty at end of job" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
check-workflows: | ||
name: Check workflows | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Download actionlint | ||
id: download-actionlint | ||
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.22 | ||
shell: bash | ||
- name: Check workflow files | ||
run: ${{ steps.download-actionlint.outputs.executable }} -color | ||
shell: bash | ||
|
||
build-lint: | ||
name: Build and lint | ||
uses: ./.github/workflows/build-lint.yml | ||
|
||
all-jobs-completed: | ||
name: All jobs completed | ||
runs-on: ubuntu-latest | ||
needs: | ||
- check-workflows | ||
- build-lint | ||
outputs: | ||
PASSED: ${{ steps.set-output.outputs.PASSED }} | ||
steps: | ||
- name: Set PASSED output | ||
id: set-output | ||
run: echo "PASSED=true" >> "$GITHUB_OUTPUT" | ||
|
||
all-jobs-pass: | ||
name: All jobs pass | ||
if: ${{ always() }} | ||
runs-on: ubuntu-latest | ||
needs: all-jobs-completed | ||
steps: | ||
- name: Check that all jobs have passed | ||
run: | | ||
passed="${{ needs.all-jobs-completed.outputs.PASSED }}" | ||
if [[ $passed != "true" ]]; then | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Publish docs to GitHub Pages | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
destination_dir: | ||
type: string | ||
ref: | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
publish-docs-to-gh-pages: | ||
name: Publish docs to GitHub Pages | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
- name: Install npm dependencies | ||
run: yarn --immutable | ||
- name: Run build script | ||
run: DEST="/${{ inputs.destination_dir }}" yarn build | ||
- name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch | ||
uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./build | ||
destination_dir: ${{ inputs.destination_dir }} | ||
keep_files: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Publish main branch docs to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
publish-to-gh-pages: | ||
name: Publish docs to `./` directory of `gh-pages` branch | ||
permissions: | ||
contents: write | ||
uses: ./.github/workflows/publish-docs.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Publish a preview build | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
is-fork-pull-request: | ||
name: Determine whether this pull request is from a fork | ||
runs-on: ubuntu-latest | ||
outputs: | ||
IS_FORK: ${{ steps.is-fork.outputs.IS_FORK }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Determine whether this PR is from a fork | ||
id: is-fork | ||
run: echo "IS_FORK=$(gh pr view --json isCrossRepository --jq '.isCrossRepository' "${PR_NUMBER}" )" >> "$GITHUB_OUTPUT" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||
|
||
get-commit-hash: | ||
name: Get the commit hash for the commit being previewed | ||
needs: is-fork-pull-request | ||
# This ensures we don't publish on forks. We can't trust forks to publish on our domain. | ||
if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'false' }} | ||
runs-on: ubuntu-latest | ||
outputs: | ||
COMMIT_SHA: ${{ steps.commit-sha.outputs.COMMIT_SHA }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Checkout pull request | ||
run: gh pr checkout "${PR_NUMBER}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||
- name: Get commit SHA | ||
id: commit-sha | ||
run: echo "COMMIT_SHA=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | ||
- name: Ensure commit hash is not empty | ||
if: ${{ steps.commit-sha.outputs.COMMIT_SHA == '' }} | ||
run: exit 1 | ||
|
||
publish-to-gh-pages: | ||
name: Publish docs to commit hash directory of `gh-pages` branch | ||
needs: get-commit-hash | ||
permissions: | ||
contents: write | ||
uses: ./.github/workflows/publish-docs.yml | ||
with: | ||
destination_dir: ${{ github.head_ref }} | ||
ref: ${{ needs.get-commit-hash.outputs.COMMIT_SHA }} | ||
|
||
post-preview-comment: | ||
name: Post preview in comment | ||
needs: | ||
- get-commit-hash | ||
- publish-to-gh-pages | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Post preview in comment | ||
run: gh pr comment "${PR_NUMBER}" --body "${COMMENT_BODY}" | ||
env: | ||
COMMENT_BODY: "Preview published: [${{ github.head_ref }}](https://docs.metamask.io/${{ github.head_ref }}/)" | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PR_NUMBER: ${{ github.event.pull_request.number }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
.idea | ||
|
||
# yarn v3 (w/o zero-install) | ||
# See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"eslint.format.enable": true, | ||
"eslint.packageManager": "yarn", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
}, | ||
"eslint.codeActionsOnSave.mode": "all", | ||
"editor.tabSize": 2, | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"typescript.preferences.importModuleSpecifier": "non-relative" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* eslint-disable */ | ||
//prettier-ignore | ||
module.exports = { | ||
name: "@yarnpkg/plugin-allow-scripts", | ||
factory: function (require) { | ||
var plugin=(()=>{var a=Object.create,l=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var u=e=>l(e,"__esModule",{value:!0});var f=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var g=(e,o)=>{for(var r in o)l(e,r,{get:o[r],enumerable:!0})},m=(e,o,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of s(o))!c.call(e,t)&&t!=="default"&&l(e,t,{get:()=>o[t],enumerable:!(r=i(o,t))||r.enumerable});return e},x=e=>m(u(l(e!=null?a(p(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var k={};g(k,{default:()=>d});var n=x(f("@yarnpkg/shell")),y={hooks:{afterAllInstalled:async()=>{let e=await(0,n.execute)("yarn run allow-scripts");e!==0&&process.exit(e)}}},d=y;return k;})(); | ||
return plugin; | ||
} | ||
}; |
Oops, something went wrong.