Skip to content
Merged
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
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,
"es2022": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module"
},
"extends": "eslint:recommended",
"rules": {
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"no-console": ["warn", { "allow": ["warn", "error"] }]
},
"ignorePatterns": ["node_modules/", "playwright-report/", "test-results/"]
}
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/add-repo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Add repository
about: Request that a repository is added to the RefactorFirst listing
title: "Add repository: owner/repo"
labels: repository-submission
---

<!-- Leave the title unchanged: `Add repository: <owner>/<repository>`. -->
<!-- Your GitHub user (the issue author) is recorded as the submitter and -->
<!-- must have write access to the repository. -->

The repository must already publish a `.refactorfirst/refactor-first.json`
report on its `main`, default or `master` branch — see the site's
**Getting Started** page for how to generate it with RefactorFirst.
36 changes: 36 additions & 0 deletions .github/workflows/add-repository.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Add Repository
on:
issues:
types: [opened]
# Manual re-run for an existing issue number (e.g. after a transient failure).
workflow_dispatch:
inputs:
issue_number:
description: 'Issue number to process'
required: true
type: string

# Serialize listing updates: concurrent runs would otherwise race at commit
# time and reject valid submissions with non-fast-forward errors.
concurrency:
group: add-repository
cancel-in-progress: false

permissions:
contents: write
issues: write

jobs:
add-repository:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Process submission issue
run: bash ci/process-submissions.sh github
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The submitter identity is github.event.issue.user.login, resolved
# from the issue number inside the script (never interpolated here).
ISSUE_NUMBER: ${{ github.event.issue.number || inputs.issue_number }}
52 changes: 52 additions & 0 deletions .github/workflows/redeploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Scheduled Redeploy
on:
schedule:
- cron: '*/10 * * * *' # Every 10 minutes
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
check-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check for repositories.txt changes
id: check-changes
run: |
LAST_COMMIT=$(git log -1 --format=%ct -- repositories.txt || echo 0)
CURRENT_TIME=$(date +%s)
TIME_DIFF=$((CURRENT_TIME - LAST_COMMIT))

echo "Last commit: $LAST_COMMIT"
echo "Current time: $CURRENT_TIME"
echo "Time difference: $TIME_DIFF seconds"

# Only deploy if changed in the last 15 minutes
if [ "$TIME_DIFF" -lt 900 ]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "repositories.txt has recent changes, deploying"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No recent changes, skipping deployment"
fi

- name: Setup Pages
if: steps.check-changes.outputs.changed == 'true'
uses: actions/configure-pages@v4

- name: Upload artifact
if: steps.check-changes.outputs.changed == 'true'
uses: actions/upload-pages-artifact@v3
with:
path: '.'

- name: Deploy to GitHub Pages
if: steps.check-changes.outputs.changed == 'true'
id: deployment
uses: actions/deploy-pages@v4
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test Suite
on: [pull_request]

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: bun install
- run: bun test tests/unit tests/integration
- run: bunx eslint "js/**/*.js" "tests/**/*.js"
- run: shellcheck ci/process-submissions.sh

e2e-tests:
# Matrix execution: one runner per browser so the suites run in parallel.
strategy:
fail-fast: false
matrix:
browser: [chromium, firefox, webkit]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: bun install
- run: bunx playwright install --with-deps ${{ matrix.browser }}
- run: bunx playwright test --project=${{ matrix.browser }}
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report-${{ matrix.browser }}
path: playwright-report/
retention-days: 7
56 changes: 56 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Dependencies
node_modules/
bun.lockb
package-lock.json
yarn.lock
pnpm-lock.yaml

# IDE
.idea/
.vscode/
*.iml
*.iws
*.ipr
.DS_Store

# Build and distribution
dist/
build/
out/
*.tsbuildinfo

# Test coverage and reports
coverage/
.nyc_output/
test-results/
playwright-report/
playwright/.cache/

# Environment files
.env
.env.local
.env.*.local
*.env

# Logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
bun-debug.log*

# OS files
Thumbs.db
*.swp
*.swo
*~

# Temporary files
tmp/
temp/
.cache/
.parcel-cache/

# Lock files (keep bun.lock, ignore others)
# Note: We keep bun.lock since this project uses Bun
49 changes: 49 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# GitLab CI configuration for this RefactorFirst Pages site.
#
# Deploys the static files to GitLab Pages. A copy of index.html is published as
# 404.html so client-side routes like /user/repo serve the application instead of
# GitLab's generic 404 page.

stages:
- test
- process
- deploy

validate-site:
stage: test
image: alpine:3.20
script:
- test -f index.html
- test -f repositories.txt
- sort -c repositories.txt
- '! grep -Ev "^[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*$" repositories.txt'
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

# Processes open "Add repository: owner/repo" issues: validates the issue
# author has write access to the project, checks the report file exists,
# commits repositories.txt and closes the issue with the outcome.
# GitLab has no issue-triggered pipelines, so create a pipeline schedule
# (e.g. every 10 minutes) in Settings -> CI/CD -> Schedules.
process-submissions:
stage: process
image: alpine:3.20
before_script:
- apk add --no-cache curl jq
script:
- sh ci/process-submissions.sh gitlab
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"

pages:
stage: deploy
image: alpine:3.20
script:
- mkdir -p public
- cp -r index.html repositories.txt css js templates assets public/
- cp index.html public/404.html # client-side routing for deep links
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
7 changes: 7 additions & 0 deletions .gitlab/issue_templates/Add repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- Leave the title unchanged: `Add repository: <group>/<project>`. -->
<!-- Your GitLab user (the issue author) is recorded as the submitter and -->
<!-- must have Developer access or higher on the project. -->

The project must already publish a `.refactorfirst/refactor-first.json`
report on its `main`, default or `master` branch — see the site's
**Getting Started** page for how to generate it with RefactorFirst.
Loading
Loading