Skip to content

Commit

Permalink
Merge branch 'main' into feat/shiki
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jan 26, 2024
2 parents 87f990a + 8fbffca commit 114721e
Show file tree
Hide file tree
Showing 29 changed files with 2,026 additions and 736 deletions.
37 changes: 37 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Contributing Guide

Thanks for lending a hand 👋

Here are a few ways to contribute:

- [Add a theme](../docs/themes.md#adding-theme)
- [Add a language grammar](../docs/languages.md#adding-grammar)
- Fix a bug

## Development

This repository contains a [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to `vscode-textmate`. By default `git clone` does not clone submodules. To clone this repository and its submodules, use:

```bash
git clone --recursive https://github.com/shikijs/shiki
```

Or if you have already cloned it, use:

```bash
git submodule update --init --recursive
```

Learn more at this [StackOverflow thread](https://stackoverflow.com/a/4438292).

## Coding conventions

- We use ESLint to lint and format the codebase. Before you commit, all files will be formatted automatically.
- We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). Please use a prefix. If your PR has multiple commits and some of them don't follow the Conventional Commits rule, we'll do a squash merge.
- If adding a language, use `feat(lang)`
- If adding a theme, use `feat(theme)`

## Fix a bug

- Reference the bug you are fixing in the PR
- Add a test if possible
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: [antfu]
github: [antfu, octref]
16 changes: 16 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- [ ] Add a test if possible
- [ ] Format all commit messages with [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)

<!-- If fixing a bug -->

- [ ] This PR fixes #

<!-- If adding a theme -->

- [ ] I have read docs for [adding a theme](https://github.com/shikijs/shiki/blob/main/docs/themes.md#adding-theme).

<!-- If adding a language -->

- [ ] I have read docs for [adding a language](https://github.com/shikijs/shiki/blob/main/docs/languages.md#adding-grammar).
- [ ] I have searched around and this is the most up-to-date, actively maintained version of the language grammar.
- [ ] I have added a sample file that includes a variety of language syntaxes and succinctly captures the idiosyncrasy of a language. See [docs](https://github.com/shikijs/shiki/blob/main/docs/languages.md#adding-grammar) for requirement.
105 changes: 25 additions & 80 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,106 +1,51 @@
name: CI

on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Setup
run: npm i -g @antfu/ni

- name: Install
run: nci

- name: Lint
run: nr lint

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Setup
run: npm i -g @antfu/ni

- name: Install
run: nci

- name: Build
run: nr build

- name: Typecheck
run: nr typecheck

test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
node: [lts/*]
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- node: 16.x
os: ubuntu-latest
- node: 18.x
os: ubuntu-latest
fail-fast: false
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
submodules: recursive
node-version: lts/*

- name: Install pnpm
- name: pnpm setup
uses: pnpm/action-setup@v2

- name: Set node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: pnpm install

- name: Setup
run: npm i -g @antfu/ni
- run: pnpm run update
- run: pnpm run build
- run: pnpm run gen
working-directory: ./packages/site

- name: Install
run: nci
- run: pnpm run test

- name: Build
run: nr build
- name: Install E2E test browsers
if: runner.os != 'Windows'
run: pnpm exec playwright install --with-deps chromium

- name: Test
run: nr test --coverage
- name: Run E2E tests
if: runner.os != 'Windows'
run: pnpm run test:e2e

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload E2E results
uses: actions/upload-artifact@v3
if: runner.os != 'Windows'
with:
name: playwright-report
path: playwright-report/
retention-days: 30
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ lib-cov
logs
node_modules
temp
tmp
packages/shiki/src/assets/langs
packages/shiki/src/assets/themes
packages/shiki/src/assets/*.json
Expand Down
Loading

0 comments on commit 114721e

Please sign in to comment.