Skip to content

Commit 1d9d610

Browse files
authored
Merge pull request #808 from olafurpg/docusaurus
Migrate website to docusaurus
2 parents 247c781 + 445dfe1 commit 1d9d610

File tree

79 files changed

+1675
-1596
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1675
-1596
lines changed

.gitignore

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
*.class
22
*.log
33

4-
gh-pages/
5-
64
# sbt specific
7-
.cache*
5+
.cache
86
.history
97
.lib/
108
dist/*
@@ -17,12 +15,24 @@ project/plugins/project/
1715
# Scala-IDE specific
1816
.scala_dependencies
1917
.worksheet
20-
.project
21-
.settings
22-
.classpath
2318

2419
.idea
2520

2621
# ENSIME specific
2722
.ensime_cache/
2823
.ensime
24+
25+
26+
node_modules
27+
28+
lib/core/metadata.js
29+
lib/core/MetadataBlog.js
30+
31+
website/translated_docs
32+
website/build/
33+
website/yarn.lock
34+
website/node_modules
35+
website/i18n/*
36+
!website/i18n/en.json
37+
38+
out/

.travis.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
language: scala
2-
script:
3-
- "./bin/runci.sh $CI_TEST"
42
jdk:
53
- oraclejdk8
64
stages:
75
- name: test
86
- name: release
97
if: (branch = master AND type = push) OR (tag IS present)
8+
before_install:
9+
- if [ "$TRAVIS_BUILD_STAGE_NAME" = 'Release' ]; then
10+
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.9.4;
11+
export PATH=$HOME/.yarn/bin:$PATH;
12+
fi
1013
jobs:
1114
include:
1215
- env: TEST="scalafmt"
@@ -28,9 +31,10 @@ jobs:
2831

2932
cache:
3033
directories:
31-
- "$HOME/.sbt"
32-
- "$HOME/.ivy2/cache"
33-
- "$HOME/.coursier"
34+
- "$HOME/.sbt"
35+
- "$HOME/.ivy2/cache"
36+
- "$HOME/.coursier"
37+
yarn: true
3438

3539
before_cache:
3640
- du -h -d 1 $HOME/.ivy2/cache

CONTRIBUTING.md

Lines changed: 57 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Contributing
2-
===========
1+
# Contributing
32

43
## Modules
54

@@ -11,14 +10,14 @@ Contributing
1110

1211
## Setting up an IDE
1312

14-
I use IntelliJ myself but run all tests from the SBT console.
15-
I've tried to make the project compile from IntelliJ IDEA.
16-
If you experience any issues, don't hesitate to ask on Gitter.
13+
I use IntelliJ myself but run all tests from the SBT console. I've tried to make
14+
the project compile from IntelliJ IDEA. If you experience any issues, don't
15+
hesitate to ask on Gitter.
1716

1817
## Testing
1918

20-
Start an sbt shell with `$ sbt`.
21-
The commands below assume you have a running sbt shell.
19+
Start an sbt shell with `$ sbt`. The commands below assume you have a running
20+
sbt shell.
2221

2322
```sh
2423
> unit/test # Fast unit tests for rules, cli, core. Contains a lot
@@ -28,8 +27,8 @@ The commands below assume you have a running sbt shell.
2827
> unit/testOnly scalafix.tests.cli.* # Only run tests for the command line interface.
2928
```
3029

31-
Unit tests for rules are written using scalafix-testkit, read more about
32-
it here:
30+
Unit tests for rules are written using scalafix-testkit, read more about it
31+
here:
3332
https://scalacenter.github.io/scalafix/docs/rule-authors/setup#scalafix-testkit
3433

3534
```
@@ -45,88 +44,62 @@ scalafix-tests
4544

4645
## Formatting
4746

48-
Be sure to run `scalafmt` (available in the root folder) to ensure code formatting.
49-
`./scalafmt --diff` formats only the files that have changed from the master branch.
50-
You can read more about it at http://scalafmt.org
47+
Be sure to run `scalafmt` (available in the root folder) to ensure code
48+
formatting. `./scalafmt --diff` formats only the files that have changed from
49+
the master branch. You can read more about it at http://scalafmt.org
5150

5251
## Documentation
5352

54-
The scalafix documentation website uses [sbt-microsite](https://47deg.github.io/sbt-microsites/).
53+
The scalafix documentation website uses [Docusaurus](https://docusaurus.io/) and
54+
[mdoc](https://github.com/olafurpg/mdoc).
5555

56-
You'll need Jekyll to build the website. You can follow the installation instructions
57-
[here](https://jekyllrb.com/docs/installation/).
56+
First, make sure you have the [yarn](https://yarnpkg.com/en/) package manager
57+
installed installed.
5858

59-
Once you have Jekyll, build the website with:
59+
Next, start sbt and compile the markdown documentation. The documentation will
60+
re-generate on file save.
6061

6162
```sh
62-
sbt website/makeMicrosite
63+
$ sbt
64+
> docs/run -w
6365
```
6466

65-
To view the website in your browser:
67+
To view the website in your browser, start the Docusaurus live reload server
6668

6769
```sh
68-
cd website/target/site
69-
jekyll serve
70-
open http://localhost:4000/scalafix/
70+
cd website
71+
yarn install
72+
yarn start
7173
```
7274

73-
All documentation is written in markdown, using [Liquid templates](https://jekyllrb.com/docs/templates/).
74-
75-
### Side menu
76-
If you add/remove/move a docs (sub)section, you may want to edit the side menu. You'll find it [here](https://github.com/gabro/scalafix/blob/microsite/website/src/main/resources/microsite/data/menu.yml).
77-
78-
### Custom tags
79-
We also have a few custom Liquid tags that you can use.
80-
81-
If you need to link to a page in the docs, you can use the `doc_ref` tag, for example:
82-
83-
```c
84-
{% doc_ref Before your begin %}
85-
// Expands to: /scalafix/docs/creating-your-own-rule/before-you-begin.html
86-
```
87-
88-
You can also link to a specific section of the page:
89-
90-
```c
91-
{% doc_ref Before your begin, What diff do you want to make %}
92-
// Expands to: /scalafix/docs/creating-your-own-rule/before-you-begin.html#what-diff-you-want-to-make
93-
```
94-
95-
If you need to link to a vocabulary term you can use the `glossary_ref` tag, for example:
96-
97-
```md
98-
{% glossary_ref Patch %}
99-
// Expands to: /scalafix/docs/creating-your-own-rule/vocabulary.html#patch
100-
```
101-
102-
If you need to link to a page in the apidocs you can use the `apidocs_ref` tag, for example:
103-
104-
```md
105-
{% apidocs_ref scalafix.patch.PatchOps %}
106-
// Expands to: /scalafix/docs/api/scalafix/patch/PatchOps.scala
107-
```
75+
Consult the Docusaurus website for instructions on how to customize the sidebar
76+
or tweak the landing page.
10877

10978
## Binary Compatibility
11079

111-
To avoid breaking binary compatiblity we use the Migration Manage for Scala or [Mima](https://github.com/lightbend/migration-manager) for short.
80+
To avoid breaking binary compatiblity we use the Migration Manage for Scala or
81+
[Mima](https://github.com/lightbend/migration-manager) for short.
11282

113-
Anything under the package `scalafix.internal._` does not have compatibility restrictions.
83+
Anything under the package `scalafix.internal._` does not have compatibility
84+
restrictions.
11485

11586
Run `sbt mimaReportBinaryIssues` to check for any compatibility issues.
11687

11788
## Publish setup
11889

119-
Scalafix is setup to publish automatically when we publish a tag on GitHub. You should not have to worry
120-
about this part. For completeness, this is how it was set up:
90+
Scalafix is setup to publish automatically when we publish a tag on GitHub. You
91+
should not have to worry about this part. For completeness, this is how it was
92+
set up:
12193

12294
### Register on Sonatype
12395

124-
Follow https://github.com/scalacenter/sbt-release-early/wiki/How-to-release-with-Sonatype#release-with-sonatype
96+
Follow
97+
https://github.com/scalacenter/sbt-release-early/wiki/How-to-release-with-Sonatype#release-with-sonatype
12598

12699
You now have:
127100

128-
* SONATYPE_PASSWORD
129-
* SONATYPE_USERNAME
101+
- SONATYPE_PASSWORD
102+
- SONATYPE_USERNAME
130103

131104
Ask us to be added to the ch.epfl.scala group
132105

@@ -154,16 +127,13 @@ gpg --keyserver hkp://pool.sks-keyservers.net --send-keys <YOUR KEY ID>
154127

155128
Setup the project at https://travis-ci.org/scalacenter/scalafix/settings with
156129

157-
SONATYPE_PASSWORD
158-
SONATYPE_USERNAME
159-
PGP_PASSPHRASE (empty)
160-
PGP_SECRET
130+
SONATYPE_PASSWORD SONATYPE_USERNAME PGP_PASSPHRASE (empty) PGP_SECRET
161131

162132
### AppVeyor
163133

164-
The cache is limited to 1GB.
165-
It's not possible to delete the cache via the ui: https://github.com/appveyor/ci/issues/985
166-
To delete via curl, get your token at https://ci.appveyor.com/api-token
134+
The cache is limited to 1GB. It's not possible to delete the cache via the ui:
135+
https://github.com/appveyor/ci/issues/985 To delete via curl, get your token at
136+
https://ci.appveyor.com/api-token
167137

168138
```bash
169139
export APPVEYOR_TOKEN="<your-api-token>"
@@ -175,25 +145,28 @@ curl -vvv -H "Authorization: Bearer $APPVEYOR_TOKEN" -XDELETE https://ci.appveyo
175145
- [ ] Releases > "Draft a new release"
176146
- [ ] Write changelog, linking to each merged PR and attributing contributor,
177147
following a similar format as previous release notes.
178-
- [ ] "Publish release", this pushes a tag and triggers the CI to release to sonatype.
179-
- [ ] after CI releases, double check the end of logs of the entry where CI_PUBLISH=true.
180-
You have to expand the after_success section.
181-
- [ ] after sonatype release is completed, double check after ~30 minutes that the artifacts
182-
have synced to maven by running this command:
148+
- [ ] "Publish release", this pushes a tag and triggers the CI to release to
149+
sonatype.
150+
- [ ] after CI releases, double check the end of logs of the entry where
151+
CI_PUBLISH=true. You have to expand the after_success section.
152+
- [ ] after sonatype release is completed, double check after ~30 minutes that
153+
the artifacts have synced to maven by running this command:
183154

184155
coursier fetch ch.epfl.scala:scalafix-core_2.12:VERSION
185156

186-
- [ ] once the artifacts are synced to maven, go to the scalafix repo and update the `scalafix` binary
187-
with the following command and open a PR to the scalafix repo.
157+
- [ ] once the artifacts are synced to maven, go to the scalafix repo and update
158+
the `scalafix` binary with the following command and open a PR to the
159+
scalafix repo.
188160

189161
 coursier bootstrap ch.epfl.scala:scalafix-cli_2.12.4:VERSION -f --main scalafix.cli.Cli -o scalafix -f
190162

191-
- [ ] update the scalafix version in this build [project/plugins.sbt](project/plugins.sbt)
163+
- [ ] update the scalafix version in this build
164+
[project/plugins.sbt](project/plugins.sbt)
192165

193166
If everything went smoothly, congrats!
194167

195-
If something goes wrong for any reason making the artifacts not reach maven, delete the pushed tag with
196-
the following command
168+
If something goes wrong for any reason making the artifacts not reach maven,
169+
delete the pushed tag with the following command
197170

198171
```sh
199172
TAG=??? # for example "v0.5.3"
@@ -202,8 +175,10 @@ git push origin :refs/tags/$TAG
202175
```
203176

204177
It's important that the latest tag always has an accompanying release on Maven.
205-
If there is no release matching the latest tag then the docs will point to scalafix artifacts that cannot be resolved.
178+
If there is no release matching the latest tag then the docs will point to
179+
scalafix artifacts that cannot be resolved.
206180

207181
## TL;DR
208182

209-
If you are unsure about anything, don't hesitate to ask in the [gitter channel](https://gitter.im/scalacenter/scalafix).
183+
If you are unsure about anything, don't hesitate to ask in the
184+
[gitter channel](https://gitter.im/scalacenter/scalafix).

bin/runci.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

build.sbt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ lazy val testsOutputDotty = project
117117
SettingKey[Boolean]("ide-skip-project") := true,
118118
scalaVersion := dotty,
119119
crossScalaVersions := List(dotty),
120-
libraryDependencies := libraryDependencies.value.map(
121-
_.withDottyCompat(scalaVersion.value)),
120+
libraryDependencies := libraryDependencies.value
121+
.map(_.withDottyCompat(scalaVersion.value)),
122122
scalacOptions := Nil,
123123
coverageEnabled := false
124124
)
@@ -219,18 +219,17 @@ lazy val unit = project
219219
testkit
220220
)
221221

222-
lazy val website = project
223-
.enablePlugins(MicrositesPlugin)
224-
.enablePlugins(ScalaUnidocPlugin)
222+
lazy val docs = project
223+
.in(file("scalafix-docs"))
225224
.settings(
225+
noMima,
226+
skip in publish := true,
227+
moduleName := "scalafix-docs",
228+
mainClass.in(Compile) := Some("docs.Main"),
226229
scalaVersion := scala212,
227-
noPublish,
228-
websiteSettings,
229-
unidocSettings,
230-
libraryDependencies += "com.geirsson" %% "metaconfig-docs" % metaconfigV,
231-
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(
232-
testkit,
233-
core
230+
libraryDependencies ++= List(
231+
"com.geirsson" %% "metaconfig-docs" % metaconfigV
234232
)
235233
)
236234
.dependsOn(testkit, core, cli)
235+
.enablePlugins(DocusaurusPlugin)

0 commit comments

Comments
 (0)