Skip to content

Commit 7441908

Browse files
make project ready for oss
1 parent d82d677 commit 7441908

File tree

8 files changed

+2347
-7
lines changed

8 files changed

+2347
-7
lines changed

.github/assets/example.png

34.4 KB
Loading

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Manual NPM Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseType:
7+
description: 'Release type - major, minor or patch'
8+
required: true
9+
default: 'patch'
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Clone Repository
16+
uses: actions/checkout@v2
17+
- name: Setup Node version
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: 12
21+
- name: Install dependencies
22+
run: npm ci
23+
- name: Run tests
24+
run: npm test
25+
- name: Build package
26+
run: npm run build
27+
- name: Setup Git
28+
run: |
29+
git config --global user.name "oss-sauce-bot"
30+
git config --global user.email "[email protected]"
31+
- name: Release
32+
run: npm run release -- ${{github.event.inputs.releaseType}}
33+
env:
34+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
35+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Test Changes
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Clone Repository
10+
uses: actions/checkout@v2
11+
- name: Setup Node version
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: 12
15+
- name: Install dependencies
16+
run: npm ci
17+
- run: npm run build
18+
- name: Run tests
19+
run: npm test

CONTRIBUTING.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Contributing to docusaurus-theme-github-codeblock
2+
3+
**Thank you for your interest in docusaurus-theme-github-codeblock. Your contributions are highly welcome.**
4+
5+
There are multiple ways of getting involved:
6+
7+
- [Report a bug](#report-a-bug)
8+
- [Suggest a feature](#suggest-a-feature)
9+
- [Contribute code](#contribute-code)
10+
11+
Below are a few guidelines we would like you to follow.
12+
If you need help, please reach out to us by opening an issue.
13+
14+
## Report a bug
15+
Reporting bugs is one of the best ways to contribute. Before creating a bug report, please check that an [issue](/issues) reporting the same problem does not already exist. If there is such an issue, you may add your information as a comment.
16+
17+
To report a new bug you should open an issue that summarizes the bug and set the label to "bug".
18+
19+
If you want to provide a fix along with your bug report: That is great! In this case please send us a pull request as described in section [Contribute Code](#contribute-code).
20+
21+
## Suggest a feature
22+
To request a new feature you should open an [issue](../../issues/new) and summarize the desired functionality and its use case. Set the issue label to "feature".
23+
24+
## Contribute code
25+
This is an outline of what the workflow for code contributions looks like
26+
27+
- Check the list of open [issues](../../issues). Either assign an existing issue to yourself, or
28+
create a new one that you would like work on and discuss your ideas and use cases.
29+
30+
It is always best to discuss your plans beforehand, to ensure that your contribution is in line with our goals.
31+
32+
- Fork the repository on GitHub
33+
- Create a topic branch from where you want to base your work. This is usually master.
34+
- Open a new pull request, label it `work in progress` and outline what you will be contributing
35+
- Make commits of logical units.
36+
- Make sure you sign-off on your commits `git commit -s -m "adding X to change Y"`
37+
- Write good commit messages (see below).
38+
- Push your changes to a topic branch in your fork of the repository.
39+
- As you push your changes, update the pull request with new infomation and tasks as you complete them
40+
- Project maintainers might comment on your work as you progress
41+
- When you are done, remove the `work in progess` label and ping the maintainers for a review
42+
- Your pull request must receive a :thumbsup: from two [maintainers](MAINTAINERS)
43+
44+
Thanks for your contributions!
45+
46+
### Commit messages
47+
Your commit messages ideally can answer two questions: what changed and why. The subject line should feature the “what” and the body of the commit should describe the “why”.
48+
49+
When creating a pull request, its description should reference the corresponding issue id.
50+
51+
### Sign your work / Developer certificate of origin
52+
All contributions (including pull requests) must agree to the Developer Certificate of Origin (DCO) version 1.1. This is exactly the same one created and used by the Linux kernel developers and posted on http://developercertificate.org/. This is a developer's certification that he or she has the right to submit the patch for inclusion into the project. Simply submitting a contribution implies this agreement, however, please include a "Signed-off-by" tag in every patch (this tag is a conventional way to confirm that you agree to the DCO) - you can automate this with a [Git hook](https://stackoverflow.com/questions/15015894/git-add-signed-off-by-line-using-format-signoff-not-working)
53+
54+
```
55+
git commit -s -m "adding X to change Y"
56+
```
57+
58+
**Have fun, and happy hacking!**

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1-
# docusaurus-code-references
1+
Docusaurus Theme GitHub Codeblock
2+
=================================
3+
24
A Docusaurus v2 plugin that supports referencing code examples from public GitHub repositories.
5+
6+
> Note: this theme plugin requires [Docusaurus v2](https://v2.docusaurus.io/)
7+
8+
## Install
9+
10+
First, add the theme plugin to your dependencies:
11+
12+
```sh
13+
npm install @saucelabs/theme-github-codeblock
14+
```
15+
16+
## Usage
17+
18+
In order to reference GitHub snippets in your markdown, create code blocks with a `reference` attached to the language meta string and put the link to your GitHub reference in the code block, e.g.:
19+
20+
```js reference
21+
https://github.com/saucelabs/docusaurus-theme-github-codeblock/blob/main/src/theme/ReferenceCodeBlock/index.tsx#L105-L108
22+
```
23+
24+
The plugin will download the code and display the desired lines:
25+
26+
![Plugin Example](./.github/assets/example.png 'Plugin Example')
27+
28+
---
29+
30+
If you are interested contributing to this project, see [CONTRIBUTING.md](CONTRIBUTING.md).

example/docs/doc1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ slug: /
88
This theme provides the following:
99

1010
```js reference
11-
https://github.com/saucelabs/performance-js-examples/blob/master/WebDriver.io/tests/jankiness.js#L47-L51
11+
https://github.com/saucelabs/docusaurus-theme-github-codeblock/blob/main/src/theme/ReferenceCodeBlock/index.tsx#L105-L108
1212
```
1313

1414
You can write content using [GitHub-flavored Markdown syntax](https://github.github.com/gfm/).

0 commit comments

Comments
 (0)