Skip to content
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Vercel Preview Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VTEX_GITHUB_BOT_TOKEN: ${{ secrets.DOC_GH_TOKEN }}
on:
push:
branches-ignore:
- main

jobs:
Deploy-Preview:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.VTEX_GITHUB_BOT_TOKEN }}
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.4.0

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

- name: Install Vercel CLI
run: npm install vercel -g

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
94 changes: 45 additions & 49 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,47 @@
{
"name": "@shoreline/docs",
"version": "1.0.7",
"private": true,
"type": "module",
"scripts": {
"dev": "npm run gen:examples && npm run gen:props && next dev",
"build-docs": "npm --prefix ../../ run build && npm run gen:contributors && npm run gen:examples && npm run gen:props && next build",
"start": "next start",
"gen:examples": "node ./scripts/build-examples.mjs",
"gen:props": "node ./scripts/build-props.mjs",
"gen:contributors": "node ./scripts/build-contributors.mjs"
},
"devDependencies": {
"@types/fs-extra": "11.0.4",
"@types/node": "20.14.9"
},
"dependencies": {
"@next/third-parties": "^15.0.0",
"@octokit/graphql": "^8.1.1",
"@sentry/nextjs": "^8.35.0",
"@tanstack/react-table": "8.17.3",
"@vtex/shoreline": "workspace:*",
"@vtex/shoreline-ts-table": "workspace:*",
"@vtex/shoreline-utils": "workspace:*",
"fs-extra": "11.2.0",
"google": "link:@next/third-parties/google",
"next": "^15.0.0",
"nextra": "^3.0.15",
"nextra-theme-docs": "^3.0.15",
"prettier": "^3.3.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-markdown": "^9.0.1",
"shiki": "^1.22.0",
"swr": "^2.2.5",
"ts-morph": "^24.0.0"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
"name": "@shoreline/docs",
"version": "1.0.7",
"private": true,
"type": "module",
"scripts": {
"dev": "npm run gen:examples && npm run gen:props && next dev",
"build-docs": "npm --prefix ../../ run build && npm run gen:contributors && npm run gen:examples && npm run gen:props && next build",
"start": "next start",
"gen:examples": "node ./scripts/build-examples.mjs",
"gen:props": "node ./scripts/build-props.mjs",
"gen:contributors": "node ./scripts/build-contributors.mjs"
},
"devDependencies": {
"@types/fs-extra": "11.0.4",
"@types/node": "20.14.9"
},
"dependencies": {
"@next/third-parties": "^15.0.0",
"@octokit/graphql": "^8.1.1",
"@sentry/nextjs": "^8.35.0",
"@tanstack/react-table": "8.17.3",
"@vtex/shoreline": "workspace:*",
"@vtex/shoreline-ts-table": "workspace:*",
"@vtex/shoreline-utils": "workspace:*",
"fs-extra": "11.2.0",
"google": "link:@next/third-parties/google",
"next": "^15.0.0",
"nextra": "^3.0.15",
"nextra-theme-docs": "^3.0.15",
"prettier": "^3.3.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-markdown": "^9.0.1",
"shiki": "^1.22.0",
"swr": "^2.2.5",
"ts-morph": "^24.0.0"
},
"browserslist": {
"production": [">0.5%", "not dead", "not op_mini all"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
21 changes: 20 additions & 1 deletion packages/docs/scripts/build-contributors.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const REPO_NAME = 'shoreline'
const token = process.env.VTEX_GITHUB_BOT_TOKEN
const startDate = new Date('2024-01-01T00:00:00Z').toISOString()

console.log(`${!token ? 'Invalid' : 'Valid'} Github token!`)

const graphqlWithAuth = graphql.defaults({
headers: {
authorization: `token ${token}`,
Expand Down Expand Up @@ -339,7 +341,24 @@ export interface Contributor {
export const contributors: Contributor[] = ${JSON.stringify(stats)}

export function getContributor(username: string) {
return contributors.find((contributor) => contributor.username === username)
const emptyContributor = {
username: "",
image: "",
stats: {
issues: 0,
assigns: 0,
comments: 0,
pulls: 0,
reviews: 0,
merged: 0,
rate: 0,
},
};

return (
contributors.find((contributor) => contributor.username === username) ??
emptyContributor
);
}

const maintainers = [
Expand Down