Skip to content

Commit

Permalink
feat: migrate Verdaccio.org to Docusaurus v2 and new design (verdacci…
Browse files Browse the repository at this point in the history
…o#2343)

Co-authored-by: Juan Picado <[email protected]>
  • Loading branch information
Sergio Moreno and juanpicado authored Jul 27, 2021
1 parent b8c7b77 commit a6b0d63
Show file tree
Hide file tree
Showing 1,670 changed files with 9,857 additions and 127,938 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
node-version: 14
- name: Install pnpm
run: npm i pnpm@latest -g
run: npm i pnpm@6.10.3 -g
- name: set store
run: |
mkdir ~/.pnpm-store
Expand All @@ -54,7 +54,7 @@ jobs:
with:
node-version: 16
- name: Install pnpm
run: npm i pnpm@latest -g
run: npm i pnpm@6.10.3 -g
- uses: actions/cache@v2
with:
path: ~/.pnpm-store
Expand All @@ -74,7 +74,7 @@ jobs:
with:
node-version: 16
- name: Install pnpm
run: npm i pnpm@latest -g
run: npm i pnpm@6.10.3 -g
- uses: actions/cache@v2
with:
path: ~/.pnpm-store
Expand All @@ -94,7 +94,7 @@ jobs:
with:
node-version: 16
- name: Install pnpm
run: npm i pnpm@latest -g
run: npm i pnpm@6.10.3 -g
- uses: actions/cache@v2
with:
path: ~/.pnpm-store
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
- name: untar packages
run: tar -xzvf pkg.tar.gz -C ${{ github.workspace }}/packages
- name: Install pnpm
run: npm i pnpm@latest -g
run: npm i pnpm@6.10.3 -g
- uses: actions/cache@v2
with:
path: ~/.pnpm-store
Expand All @@ -155,7 +155,7 @@ jobs:
- name: untar packages
run: tar -xzvf pkg.tar.gz -C ${{ github.workspace }}/packages
- name: Install pnpm
run: npm i pnpm@latest -g
run: npm i pnpm@6.10.3 -g
- uses: actions/cache@v2
with:
path: ~/.pnpm-store
Expand All @@ -182,7 +182,7 @@ jobs:
- name: untar packages
run: tar -xzvf pkg.tar.gz -C ${{ github.workspace }}/packages
- name: Install pnpm
run: npm i pnpm@latest -g
run: npm i pnpm@6.10.3 -g
- uses: actions/cache@v2
with:
path: ~/.pnpm-store
Expand All @@ -203,7 +203,7 @@ jobs:
with:
node-version: 14
- name: Install pnpm
run: npm i pnpm@latest -g
run: npm i pnpm@6.10.3 -g
# pnpm cache is not working for windows (we need a solution)
- uses: actions/cache@v2
with:
Expand Down
144 changes: 144 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Verdaccio Website CI

on:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
paths:
- 'website/**'
- 'package.json'
- './github/workflows/website.yml'
push:
branches:
- 'master'
paths:
- 'website/**'
- 'package.json'
- './github/workflows/website.yml'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- name: Use Node 14
uses: actions/setup-node@v2
with:
node-version: 14

- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- uses: pnpm/[email protected]
with:
version: 6.10.2
run_install: |
- recursive: true
args: [--frozen-lockfile]
- name: Lint And Pretty
run: |
pnpm eslint:check --filter ...@verdaccio/website
pnpm prettier:check --filter ...@verdaccio/website
- name: Cache Docusaurus Build
uses: actions/cache@v2
with:
path: website/node_modules/.cache/webpack
key: cache/webpack-${{github.ref}}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: cache/webpack-${{github.ref}}

# Will deploy to production on:
# 1st: When a push occurs on master branch
# 2nd: When we force the worflow dispatch through the UI
- name: Build Production
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
env:
CONTEXT: production
run: pnpm netlify:build:production --filter ...@verdaccio/website

- name: 🔥 Deploy Production Netlify
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'workflow_dispatch'
uses: semoal/action-netlify-deploy@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
build-dir: './website/build'

# Will deploy to Preview URL, only when a pull request is open with changes on the website
- name: Build Deployment Preview
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/master'
env:
CONTEXT: deploy-preview
run: pnpm netlify:build:deployPreview --filter ...@verdaccio/website

- name: 🤖 Deploy Preview Netlify
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/master'
uses: semoal/action-netlify-deploy@master
id: netlify_preview
with:
draft: true
comment-on-pull-request: true
github-deployment-is-production: false
github-deployment-is-transient: true
github-token: ${{ secrets.GITHUB_TOKEN }}
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
build-dir: './website/build'

- name: Audit preview URL with Lighthouse
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/master'
id: lighthouse_audit
uses: treosh/lighthouse-ci-action@v3
with:
urls: |
${{ steps.netlify_preview.outputs.preview-url }}
uploadArtifacts: true
temporaryPublicStorage: true

- name: Format lighthouse score
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/master'
id: format_lighthouse_score
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const result = ${{ steps.lighthouse_audit.outputs.manifest }}[0].summary
const links = ${{ steps.lighthouse_audit.outputs.links }}
const formatResult = (res) => Math.round((res * 100))
Object.keys(result).forEach(key => result[key] = formatResult(result[key]))
const score = res => res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'
const comment = [
`⚡️ [Lighthouse report](${Object.values(links)[0]}) for the changes in this PR:`,
'| Category | Score |',
'| --- | --- |',
`| ${score(result.performance)} Performance | ${result.performance} |`,
`| ${score(result.accessibility)} Accessibility | ${result.accessibility} |`,
`| ${score(result['best-practices'])} Best practices | ${result['best-practices']} |`,
`| ${score(result.seo)} SEO | ${result.seo} |`,
' ',
`*Lighthouse ran on [${Object.keys(links)[0]}](${Object.keys(links)[0]})*`
].join('\n')
core.setOutput("comment", comment);
- name: Add comment to PR
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/master'
id: comment_to_pr
uses: marocchino/sticky-pull-request-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.issue.number }}
header: lighthouse
message: |
${{ steps.format_lighthouse_score.outputs.comment }}
67 changes: 13 additions & 54 deletions crowdin.yaml
Original file line number Diff line number Diff line change
@@ -1,57 +1,16 @@
project_identifier_env: CROWDIN_VERDACCIO_PROJECT_ID
api_key_env: CROWDIN_VERDACCIO_API_KEY
base_path: './'
project_id_env: CROWDIN_VERDACCIO_PROJECT_ID
api_token_env: CROWDIN_VERDACCIO_API_KEY

preserve_hierarchy: true
commit_message: 'docs(website): new translation for %original_file_name% in %language%'
append_commit_message: false

files:
-
source: '/docs/website/*.md'
translation: '/website/translated_docs/%locale%/%original_file_name%'
languages_mapping: &anchor
locale:
'af': 'af'
'ar': 'ar'
'bs-BA': 'bs-BA'
'ca': 'ca'
'cs': 'cs'
'da': 'da'
'de': 'de'
'el': 'el'
'es-ES': 'es-ES'
'fa': 'fa-IR'
'fi': 'fi'
'fr': 'fr-FR'
'he': 'he'
'hu': 'hu'
'id': 'id-ID'
'it': 'it-IT'
'ja': 'ja'
'ko': 'ko'
'mr': 'mr-IN'
'nl': 'nl'
'no': 'no-NO'
'pl': 'pl-PL'
'pt-BR': 'pt-BR'
'pt-PT': 'pt-PT'
'ro': 'ro'
'ru': 'ru-RU'
'sk': 'sk-SK'
'sr-SP': 'sr-SP'
'sr-CS': 'sr-CS'
'sv-SE': 'sv-SE'
'tr': 'tr'
'uk': 'uk'
'vi': 'vi-VN'
'yo-NG': 'yo-NG'
'zh-CN': 'zh-CN'
'zh-TW': 'zh-TW'
-
source: '/website/versioned_docs/**/*.md'
translation: '/website/translated_docs/%locale%/**/%original_file_name%'
languages_mapping: *anchor
-
source: '/website/i18n/en.json'
translation: '/website/i18n/%locale%.json'
languages_mapping: *anchor
[
{
source: '/website/i18n/en/**/*',
translation: '/website/i18n/%locale%/**/%original_file_name%',
},
{
source: '/website/docs/**/*',
translation: '/website/i18n/%locale%/docusaurus-plugin-content-docs/current/**/%original_file_name%',
}
]
54 changes: 0 additions & 54 deletions docs/website/amazon.md

This file was deleted.

21 changes: 0 additions & 21 deletions docs/website/ansible.md

This file was deleted.

Loading

0 comments on commit a6b0d63

Please sign in to comment.