Skip to content

Commit 943c05d

Browse files
authored
Merge pull request #307 from ulitol97/master
Preparing for streams
2 parents 572b192 + 7d819c1 commit 943c05d

11 files changed

Lines changed: 3912 additions & 4251 deletions

File tree

.github/workflows/publish_gh_pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ jobs:
2525
uses: ts-graphviz/setup-graphviz@v1
2626

2727
- name: Build and publish docusaurus site, generating the scaladoc
28-
run: sbt '++2.13.6 docs/docusaurusPublishGhpages'
28+
run: sbt '++2.13.8 docs/docusaurusPublishGhpages'
2929
env:
3030
GIT_DEPLOY_KEY: ${{ secrets.RDFSHAPE_API_DEPLOY_KEY }}

build.sbt

Lines changed: 24 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ Global / cancelable := true
88
Global / apiURL := Some(url("https://github.com/weso/rdfshape-api"))
99
Global / scalaVersion := scala213
1010

11-
lazy val scala212 = "2.12.15"
12-
lazy val scala213 = "2.13.8"
13-
lazy val supportedScalaVersions = List(scala213)
14-
1511
// Lint-excluded keys
1612
Global / excludeLintKeys ++= Set(
1713
name,
@@ -85,7 +81,8 @@ lazy val scaladocSettings: Seq[Def.Setting[_]] = Seq(
8581
// Other settings
8682
"-diagrams",
8783
"-implicits",
88-
"-private"
84+
"-private",
85+
"-no-link-warnings"
8986
),
9087
// Need to generate docs to publish to oss
9188
Compile / packageDoc / publishArtifact := true
@@ -116,39 +113,16 @@ lazy val mdocSettings = Seq(
116113
.dependsOn(Compile / unidoc)
117114
.value
118115
)
119-
// Unidoc settings, mirroring scaladoc settings
116+
// Unidoc settings
120117
lazy val unidocSettings: Seq[Def.Setting[_]] = Seq(
121118
// Generate docs for the root project and the server module
122119
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(rdfshape, server),
123120
// Dump docs into the website static part, to link them with docusaurus
124121
ScalaUnidoc / unidoc / target := (LocalRootProject / baseDirectory).value / "website" / "static" / "api",
125122
// When cleaning, remove unidoc generated docs as well
126123
cleanFiles += (ScalaUnidoc / unidoc / target).value,
127-
// Scalac options
128-
ScalaUnidoc / unidoc / scalacOptions ++= Seq(
129-
// Base source path
130-
"-sourcepath",
131-
(LocalRootProject / baseDirectory).value.getAbsolutePath,
132-
// Link to GitHub source
133-
"-doc-source-url",
134-
scmInfo.value.get.browseUrl + "/tree/master€{FILE_PATH}.scala",
135-
// Page title
136-
"-doc-title",
137-
"RDFShape API - Docs",
138-
// Docs version
139-
"-doc-version",
140-
version.value,
141-
// Docs footer
142-
"-doc-footer",
143-
"WESO Research Group - University of Oviedo",
144-
// Skip unnecessary source
145-
"-skip-packages",
146-
"org:buildinfo",
147-
// Other settings
148-
"-diagrams",
149-
"-implicits",
150-
"-private"
151-
)
124+
// Scalac options, mirroring scaladoc settings
125+
ScalaUnidoc / unidoc / scalacOptions ++= (Compile / doc / scalacOptions).value
152126
)
153127
// Shared publish settings for all modules.
154128
lazy val publishSettings = Seq(
@@ -189,8 +163,9 @@ lazy val publishSettings = Seq(
189163
// Helper to resolve dependencies from GitHub packages
190164
lazy val resolverSettings = Seq(
191165
resolvers ++= Seq(
192-
Resolver.DefaultMavenRepository,
193-
Resolver.sonatypeRepo("snapshots")
166+
Resolver.DefaultMavenRepository, // maven
167+
Opts.resolver.sonatypeSnapshots, // sonatype
168+
Opts.resolver.sonatypeReleases
194169
)
195170
)
196171
// Shared settings for the BuildInfo Plugin
@@ -261,14 +236,14 @@ lazy val server = project
261236
moduleName := s"${(Global / packageName).value}-server",
262237
run / fork := false,
263238
testFrameworks += MUnitFramework,
264-
crossScalaVersions := supportedScalaVersions,
265239
libraryDependencies ++= Seq(
266240
http4sDsl,
267241
http4sBlazeServer,
268242
http4sBlazeClient,
269243
http4sEmberClient,
270244
http4sCirce,
271245
rho_swagger,
246+
comet,
272247
umlShaclex,
273248
shexs,
274249
shaclex,
@@ -287,10 +262,12 @@ lazy val server = project
287262
)
288263

289264
// "sbt-github-actions" plugin settings
290-
lazy val JavaCIVersion = "adopt@1.11"
291-
lazy val ScalaCIVersion = scala213
292-
ThisBuild / githubWorkflowJavaVersions := Seq(JavaCIVersion)
293-
ThisBuild / githubWorkflowScalaVersions := Seq(ScalaCIVersion)
265+
lazy val scala212 = "2.12.15"
266+
lazy val scala213 = "2.13.8"
267+
lazy val java11adopt = "adopt@1.11"
268+
269+
ThisBuild / githubWorkflowJavaVersions := Seq(java11adopt)
270+
ThisBuild / githubWorkflowScalaVersions := Seq(scala213)
294271

295272
/* ------------------------------------------------------------------------- */
296273
// Documentation project, for MDoc + Docusaurus documentation
@@ -312,10 +289,11 @@ lazy val MUnitFramework = new TestFramework("munit.Framework")
312289
lazy val http4sVersion = "1.0.0-M30"
313290
lazy val rhoVersion = "0.23.0-M1"
314291
lazy val catsVersion = "2.7.0"
292+
lazy val cometVersion = "0.1.1"
315293
/* ------------------------------------------------------------------------- */
316-
lazy val mongodbVersion = "4.5.1"
294+
lazy val mongodbVersion = "4.6.0"
317295
lazy val mongo4catsVersion = "0.4.7"
318-
lazy val any23Version = "2.6"
296+
lazy val any23Version = "2.7"
319297
lazy val rdf4jVersion = "3.7.6"
320298
lazy val graphvizJavaVersion = "0.18.1"
321299
lazy val logbackVersion = "1.2.11"
@@ -337,11 +315,12 @@ lazy val http4sBlazeClient =
337315
"org.http4s" %% "http4s-blaze-client" % http4sVersion
338316
lazy val http4sEmberClient =
339317
"org.http4s" %% "http4s-ember-client" % http4sVersion
340-
lazy val http4sCirce = "org.http4s" %% "http4s-circe" % http4sVersion
341-
lazy val rho_swagger = "org.http4s" %% "rho-swagger" % rhoVersion
342-
lazy val catsCore = "org.typelevel" %% "cats-core" % catsVersion
343-
lazy val catsKernel = "org.typelevel" %% "cats-kernel" % catsVersion
344-
lazy val mongodb = "org.mongodb.scala" %% "mongo-scala-driver" % mongodbVersion
318+
lazy val http4sCirce = "org.http4s" %% "http4s-circe" % http4sVersion
319+
lazy val rho_swagger = "org.http4s" %% "rho-swagger" % rhoVersion
320+
lazy val catsCore = "org.typelevel" %% "cats-core" % catsVersion
321+
lazy val catsKernel = "org.typelevel" %% "cats-kernel" % catsVersion
322+
lazy val comet = "io.github.ulitol97" %% "comet" % cometVersion
323+
lazy val mongodb = "org.mongodb.scala" %% "mongo-scala-driver" % mongodbVersion
345324
lazy val mongo4catsCore =
346325
"io.github.kirill5k" %% "mongo4cats-core" % mongo4catsVersion
347326
lazy val mongo4catsCirce =

docs/webpage/webpage_info.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ was followed. However, minor issues occurred:
4141

4242
1. The _package.json_ had to be modified to include the script `publish-gh-pages`.
4343
2. The [Docusaurus config file](https://github.com/weso/rdfshape-api/blob/master/website/docusaurus.config.js) had to be
44-
modified to indicate what the location of t2.
45-
The [Docusaurus config file](https://github.com/weso/rdfshape-api/blob/master/website/docusaurus.config.js) had to be
46-
modified to indicate what the location of the markdown files with the web docs is.he markdown files with the web docs
47-
is.
44+
modified to indicate what the location of the markdown files with the web docs is.
4845
3. The [sidebar configuration file](https://github.com/weso/rdfshape-api/blob/master/website/sidebars.js) was modified
4946
to customize the sidebar that is used as navigation when browsing the web docs.

modules/server/src/main/scala/es/weso/rdfshape/server/Server.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import org.http4s.client.Client
2323
import org.http4s.implicits.http4sKleisliResponseSyntaxOptionT
2424
import org.http4s.server.Router
2525
import org.http4s.server.middleware.{CORS, CORSPolicy, Logger}
26+
import org.http4s.server.websocket.WebSocketBuilder
2627
import org.http4s.{HttpApp, HttpRoutes}
2728

2829
import java.util.concurrent.TimeUnit
@@ -116,7 +117,11 @@ private class Server(
116117
.bindHttp(port, ip)
117118
.withIdleTimeout(idleTimeout.minutes)
118119
.withResponseHeaderTimeout(requestTimeout.minute)
119-
.withHttpApp(createApp(client))
120+
/* WebSocketBuilder was deprecated and must be obtained here, from the
121+
* server builder */
122+
.withHttpWebSocketApp((wsBuilder: WebSocketBuilder[IO]) =>
123+
createApp(client)
124+
)
120125

121126
sslContext match {
122127
case None => baseServer

version.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ThisBuild / version := "0.2.6"
1+
ThisBuild / version := "0.2.7"

website/docusaurus.config.js

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ const baseUrl = "/rdfshape-api/"
33
const scalaDocUrl = `${deployUrl}${baseUrl}api/es/weso/rdfshape/`
44
const apiDocsUrl = "https://app.swaggerhub.com/apis-docs/weso/RDFShape/"
55

6-
/** @type {import('@docusaurus/types').DocusaurusConfig} */
6+
const lightCodeTheme = require("prism-react-renderer/themes/github");
7+
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
8+
9+
/** @type {import("@docusaurus/types").DocusaurusConfig} */
710
module.exports = {
811
title: "RDFShape API",
912
tagline: "Processing and validation of RDF with ShEx, SHACL and more",
@@ -19,71 +22,71 @@ module.exports = {
1922
scalaDocUrl, apiDocsUrl
2023
},
2124
themeConfig: {
22-
image: "img/preview.png", hideableSidebar: false, colorMode: {
25+
image: "img/preview.png",
26+
colorMode: {
2327
defaultMode: "light",
2428
disableSwitch: false,
25-
respectPrefersColorScheme: true,
26-
switchConfig: {
27-
darkIcon: "🌙",
28-
lightIcon: "\u2600",
29-
darkIconStyle: {marginLeft: "2px"},
30-
lightIconStyle: {marginLeft: "1px"},
31-
},
32-
}, navbar: {
29+
respectPrefersColorScheme: true
30+
},
31+
navbar: {
3332
title: "RDFShape API", logo: {
34-
alt: "RDFShape API - WESO", src: "img/logo-weso.png",
33+
alt: "RDFShape API - WESO", src: "img/logo-weso.png"
3534
}, items: [// Web docs
3635
{
37-
to: "/docs", label: "Web docs", position: "left",
36+
to: "/docs", label: "Web docs", position: "left"
3837
}, // Scaladoc
3938
{
40-
to: scalaDocUrl, label: "Scaladoc", position: "left",
39+
href: scalaDocUrl, label: "Scaladoc", position: "left"
4140
}, // API Docs in SwaggerHub
4241
{
4342
href: "https://github.com/weso/rdfshape-api",
4443
label: "SwaggerHub",
45-
position: "right",
44+
position: "right"
4645
}, // Link to repo
4746
{
4847
href: "https://github.com/weso/rdfshape-api",
4948
label: "GitHub",
50-
position: "right",
51-
},],
49+
position: "right"
50+
}]
5251
}, footer: {
5352
style: "light",
5453
logo: {
5554
alt: "RDFShape API - WESO",
5655
src: "img/logo-weso-footer.png",
57-
href: "https://www.weso.es/",
56+
href: "https://www.weso.es/"
5857
},
5958
links: [{
6059
title: "About us", items: [{
61-
label: "WESO Research Group", to: "https://www.weso.es/",
60+
label: "WESO Research Group", to: "https://www.weso.es/"
6261
}, {
63-
label: "University of Oviedo", to: "https://www.uniovi.es/",
64-
},],
62+
label: "University of Oviedo", to: "https://www.uniovi.es/"
63+
}]
6564
}, {
6665
title: "Community", items: [{
67-
label: "GitHub", to: "https://github.com/weso",
66+
label: "GitHub", to: "https://github.com/weso"
6867
}, {
69-
label: "Twitter", to: "https://twitter.com/wesoviedo",
70-
},],
68+
label: "Twitter", to: "https://twitter.com/wesoviedo"
69+
}]
7170
}, {
7271
title: "Further work", items: [{
73-
label: "RDFShape project", to: "https://github.com/weso/rdfshape",
72+
label: "RDFShape project", to: "https://github.com/weso/rdfshape"
7473
}, {
75-
label: "More software by WESO", to: "https://www.weso.es/#software",
76-
},],
77-
},],
78-
copyright: `Copyright © ${new Date().getFullYear()} WESO Research Group`,
74+
label: "More software by WESO", to: "https://www.weso.es/#software"
75+
}]
76+
}],
77+
copyright: `Copyright © ${new Date().getFullYear()} WESO Research Group`
7978
},
79+
prism: {
80+
theme: lightCodeTheme,
81+
darkTheme: darkCodeTheme
82+
}
8083
},
8184
presets: [["@docusaurus/preset-classic", {
8285
docs: {
8386
path: "../rdfshape-docs/target/mdoc",
84-
sidebarPath: require.resolve("./sidebars.js"),
87+
sidebarPath: require.resolve("./sidebars.js")
8588
}, blog: false, theme: {
86-
customCss: require.resolve("./src/css/custom.css"),
87-
}, sitemap: {},
88-
},],],
89+
customCss: require.resolve("./src/css/custom.css")
90+
}, sitemap: {}
91+
}]]
8992
};

website/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
"write-heading-ids": "docusaurus write-heading-ids"
1616
},
1717
"dependencies": {
18-
"@docusaurus/core": "^2.0.0-beta.4",
19-
"@docusaurus/preset-classic": "^2.0.0-beta.4",
18+
"@docusaurus/core": "^2.0.0-beta.18",
19+
"@docusaurus/preset-classic": "^2.0.0-beta.18",
2020
"@mdx-js/react": "^1.6.21",
2121
"@svgr/webpack": "^5.5.0",
2222
"clsx": "^1.1.1",
2323
"file-loader": "^6.2.0",
24+
"prism-react-renderer": "^1.3.1",
2425
"react": "^17.0.1",
2526
"react-dom": "^17.0.1",
2627
"url-loader": "^4.1.1"

website/sidebars.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@ const apiDocsUrl = "https://app.swaggerhub.com/apis-docs/weso/RDFShape/"
55
module.exports = {
66
// Generate a sidebar from the docs folder structure
77
// sidebar: [{type: "autogenerated", dirName: "."}],
8-
8+
99
// Create a sidebar manually
1010
docsSidebar: [/* Home */
1111
{
12-
type: "doc", id: "home", label: "Welcome",
12+
type: "doc", id: "home", label: "Welcome"
1313
},
14-
14+
1515
/* Category: deployment */
1616
{
1717
type: "category",
1818
label: "API Deployment",
1919
items: ["api-deployment/deployment_overview", "api-deployment/deployment_manual", "api-deployment/deployment_docker"],
2020
collapsed: false
2121
},
22-
22+
2323
/* Category: usage */
2424
{
2525
type: "category",
2626
label: "API Usage",
2727
items: ["api-usage/usage_cli"],
2828
collapsed: false
2929
},
30-
30+
3131
/* Category: testing */
3232
{
3333
type: "category",
3434
label: "API Testing and Auditing",
3535
items: ["api-testing-auditing/testing-auditing_munit", "api-testing-auditing/testing-auditing_integration", "api-testing-auditing/testing-auditing_logs"],
3636
collapsed: true
3737
},
38-
38+
3939
/* Category: documentation */
4040
{
4141
type: "category", label: "Additional documentation", items: [{
@@ -44,10 +44,10 @@ module.exports = {
4444
type: "link", label: "API Docs (Swagger Hub)", href: apiDocsUrl
4545
}], collapsed: false
4646
},
47-
47+
4848
/* Webpage information */
4949
{
50-
type: "doc", id: "webpage/webpage_info", label: "About this webpage",
51-
},],
52-
50+
type: "doc", id: "webpage/webpage_info", label: "About this webpage"
51+
}]
52+
5353
};

website/src/css/custom.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
--ifm-code-font-size: 95%;
1818
}
1919

20+
/* noinspection ALL */
2021
.docusaurus-highlight-code-line {
2122
background-color: rgb(72, 77, 91);
2223
display: block;

0 commit comments

Comments
 (0)