Skip to content
Closed

Dev #28

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build
node_modules
*.cjs

sidebars-*.js
docusaurus.config.js
17 changes: 17 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "prettier"],
"globals": {
"process": true
}
}
40 changes: 40 additions & 0 deletions .github/workflows/algolia-crawler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Algolia DocSearch Scraper

on:
push:
branches:
- main
- dev

jobs:
run-crawler:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set environment variables
run: |
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
echo "CONFIG_FILE=docsearch.config.json" >> $GITHUB_ENV
elif [ "${GITHUB_REF}" == "refs/heads/dev" ]; then
echo "CONFIG_FILE=docsearch.config.dev.json" >> $GITHUB_ENV
else
echo "Unknown branch: ${GITHUB_REF}"
exit 1
fi

- name: Run DocSearch scraper using Docker
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
CONFIG_FILE: ${{ env.CONFIG_FILE }}
working-directory: ./
run: |
docker run --rm \
-v $(pwd):/app \
-e "CONFIG=/app/${CONFIG_FILE}" \
-e "ALGOLIA_APP_ID=${ALGOLIA_APP_ID}" \
-e "ALGOLIA_API_KEY=${ALGOLIA_API_KEY}" \
algolia/docsearch-scraper
100 changes: 100 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- main
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout code
- name: Checkout code
uses: actions/checkout@v4

# Set up Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.14'

- name: Extract branch name
id: extract_branch
run: |
if [[ "${GITHUB_REF}" == "refs/heads/"* ]]; then
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
elif [[ "${GITHUB_REF}" == "refs/pull/"* ]]; then
echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
else
echo "BRANCH_NAME=unknown" >> $GITHUB_ENV
fi

# Navigate to the correct working directory and install dependencies
- name: Install dependencies
working-directory: ./
run: npm install

# Build the project
- name: Build project
working-directory: ./
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
BRANCH_NAME: ${{ env.BRANCH_NAME }}
TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
run: |
export NODE_OPTIONS="--max-old-space-size=4096"
npm run build

# Upload build files as artifact
- name: Upload artifact for deployment
uses: actions/upload-artifact@v4
with:
path: ./build
name: build_artifact

deploy-gh-pages:
needs: build
runs-on: ubuntu-latest

permissions:
contents: write
id-token: write

steps:
# Download the artifact
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build_artifact
path: ./artifact

deploy-s3:
needs: build
runs-on: ubuntu-latest

permissions:
contents: write
id-token: write

steps:
# Download the artifact
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build_artifact
path: ./artifact

- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.AWS_S3_REGION }}
run: |
tar -czf docs-${{ github.sha }}.tar.gz -C artifact .
if [ "${{ github.ref }}" == "refs/heads/dev" ]; then
aws s3 cp docs-${{ github.sha }}.tar.gz s3://devnet-build-artifacts/docs-website/${{ github.sha }}.tar.gz
elif [ "${{ github.ref }}" == "refs/heads/main" ]; then
aws s3 cp docs-${{ github.sha }}.tar.gz s3://mainnet-build-artifacts/docs-website/${{ github.sha }}.tar.gz
fi
144 changes: 127 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,135 @@
# Dependencies
/node_modules
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Production
/build
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Generated files
.docusaurus
.cache-loader
# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Misc
.DS_Store
.idea
.env.local
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Build files
build/

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
.lock
*.lock
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

*.swp
# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

.idea
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# autogenerated files
*.min.css
*.mdx

LICENSE
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
trailingComma: 'none',
singleQuote: true,
semi: true,
tabWidth: 2,
printWidth: 200,
};
1 change: 0 additions & 1 deletion CNAME

This file was deleted.

Loading