mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-31 05:15:08 +00:00
Merge pull request #2540 from eikek/redocly-tailwind-setup
Redocly tailwind setup
This commit is contained in:
commit
fd927fa1e7
12
build.sbt
12
build.sbt
@ -677,7 +677,11 @@ val restapi = project
|
|||||||
openapiTargetLanguage := Language.Scala,
|
openapiTargetLanguage := Language.Scala,
|
||||||
openapiPackage := Pkg("docspell.restapi.model"),
|
openapiPackage := Pkg("docspell.restapi.model"),
|
||||||
openapiSpec := (Compile / resourceDirectory).value / "docspell-openapi.yml",
|
openapiSpec := (Compile / resourceDirectory).value / "docspell-openapi.yml",
|
||||||
openapiStaticGen := OpenApiDocGenerator.Redoc
|
openapiStaticGen := OpenApiDocGenerator.Redoc,
|
||||||
|
openapiRedoclyCmd := Seq("redocly-cli"),
|
||||||
|
openapiRedoclyConfig := Some(
|
||||||
|
(LocalRootProject / baseDirectory).value / "project" / "redocly.yml"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
.dependsOn(common, query.jvm, notificationApi, jsonminiq, addonlib)
|
.dependsOn(common, query.jvm, notificationApi, jsonminiq, addonlib)
|
||||||
|
|
||||||
@ -697,7 +701,11 @@ val joexapi = project
|
|||||||
openapiTargetLanguage := Language.Scala,
|
openapiTargetLanguage := Language.Scala,
|
||||||
openapiPackage := Pkg("docspell.joexapi.model"),
|
openapiPackage := Pkg("docspell.joexapi.model"),
|
||||||
openapiSpec := (Compile / resourceDirectory).value / "joex-openapi.yml",
|
openapiSpec := (Compile / resourceDirectory).value / "joex-openapi.yml",
|
||||||
openapiStaticGen := OpenApiDocGenerator.Redoc
|
openapiStaticGen := OpenApiDocGenerator.Redoc,
|
||||||
|
openapiRedoclyCmd := Seq("redocly-cli"),
|
||||||
|
openapiRedoclyConfig := Some(
|
||||||
|
(LocalRootProject / baseDirectory).value / "project" / "redocly.yml"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
.dependsOn(common, loggingScribe, addonlib)
|
.dependsOn(common, loggingScribe, addonlib)
|
||||||
|
|
||||||
|
6
flake.lock
generated
6
flake.lock
generated
@ -6,11 +6,11 @@
|
|||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1710025500,
|
"lastModified": 1710099997,
|
||||||
"narHash": "sha256-niJf4WZ4GHQ+RaP+Qj4+6P/2SWN1Z4co36/ETvIg0Qg=",
|
"narHash": "sha256-WmBKTLdth6I/D+0//9enbIXohGsBjepbjIAm9pCYj0U=",
|
||||||
"owner": "eikek",
|
"owner": "eikek",
|
||||||
"repo": "devshell-tools",
|
"repo": "devshell-tools",
|
||||||
"rev": "57d7d292571e291fe8213a1655529f739cfa174d",
|
"rev": "e82faf976d318b3829f6f7f6785db6f3c7b65267",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
28
flake.nix
28
flake.nix
@ -15,7 +15,7 @@
|
|||||||
}:
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (system: let
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
sbt17 = pkgs.sbt.override { jre = pkgs.jdk17; };
|
sbt17 = pkgs.sbt.override {jre = pkgs.jdk17;};
|
||||||
ciPkgs = with pkgs; [
|
ciPkgs = with pkgs; [
|
||||||
sbt17
|
sbt17
|
||||||
jdk17
|
jdk17
|
||||||
@ -25,15 +25,19 @@
|
|||||||
zola
|
zola
|
||||||
yarn
|
yarn
|
||||||
nodejs
|
nodejs
|
||||||
|
redocly-cli
|
||||||
|
tailwindcss
|
||||||
];
|
];
|
||||||
devshellPkgs = ciPkgs ++ (with pkgs; [
|
devshellPkgs =
|
||||||
jq
|
ciPkgs
|
||||||
scala-cli
|
++ (with pkgs; [
|
||||||
netcat
|
jq
|
||||||
wget
|
scala-cli
|
||||||
which
|
netcat
|
||||||
inotifyTools
|
wget
|
||||||
]);
|
which
|
||||||
|
inotifyTools
|
||||||
|
]);
|
||||||
docspellPkgs = pkgs.callPackage (import ./nix/pkg.nix) {};
|
docspellPkgs = pkgs.callPackage (import ./nix/pkg.nix) {};
|
||||||
dockerAmd64 = pkgs.pkgsCross.gnu64.callPackage (import ./nix/docker.nix) {
|
dockerAmd64 = pkgs.pkgsCross.gnu64.callPackage (import ./nix/docker.nix) {
|
||||||
inherit (docspellPkgs) docspell-restserver docspell-joex;
|
inherit (docspellPkgs) docspell-restserver docspell-joex;
|
||||||
@ -159,6 +163,9 @@
|
|||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
{
|
{
|
||||||
|
networking.hostName = "dev-vm";
|
||||||
|
virtualisation.memorySize = 2048;
|
||||||
|
|
||||||
services.dev-postgres = {
|
services.dev-postgres = {
|
||||||
enable = true;
|
enable = true;
|
||||||
databases = ["docspell"];
|
databases = ["docspell"];
|
||||||
@ -168,8 +175,8 @@
|
|||||||
services.dev-solr = {
|
services.dev-solr = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cores = ["docspell"];
|
cores = ["docspell"];
|
||||||
|
heap = 512;
|
||||||
};
|
};
|
||||||
|
|
||||||
port-forward.ssh = 10022;
|
port-forward.ssh = 10022;
|
||||||
port-forward.dev-postgres = 6534;
|
port-forward.dev-postgres = 6534;
|
||||||
port-forward.dev-smtp = 10025;
|
port-forward.dev-smtp = 10025;
|
||||||
@ -178,7 +185,6 @@
|
|||||||
port-forward.dev-minio-api = 9000;
|
port-forward.dev-minio-api = 9000;
|
||||||
port-forward.dev-minio-console = 9001;
|
port-forward.dev-minio-console = 9001;
|
||||||
port-forward.dev-solr = 8983;
|
port-forward.dev-solr = 8983;
|
||||||
networking.hostName = "dev-vm";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -18,6 +18,8 @@ servers:
|
|||||||
- url: /api/v1
|
- url: /api/v1
|
||||||
description: Current host
|
description: Current host
|
||||||
|
|
||||||
|
security: []
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
/api/info/version:
|
/api/info/version:
|
||||||
get:
|
get:
|
||||||
|
@ -27,6 +27,8 @@ servers:
|
|||||||
- url: /api/v1
|
- url: /api/v1
|
||||||
description: Current host
|
description: Current host
|
||||||
|
|
||||||
|
security: []
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
/api/info/version:
|
/api/info/version:
|
||||||
get:
|
get:
|
||||||
|
3639
modules/webapp/package-lock.json
generated
3639
modules/webapp/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -5,13 +5,6 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@fortawesome/fontawesome-free": "^6.0.0",
|
"@fortawesome/fontawesome-free": "^6.0.0",
|
||||||
"@tailwindcss/forms": "^0.5.0",
|
"@tailwindcss/forms": "^0.5.0",
|
||||||
"autoprefixer": "^10.4.2",
|
"flag-icons": "^7.2.0"
|
||||||
"cssnano": "^6.0.0",
|
|
||||||
"flag-icon-css": "^3.5.0",
|
|
||||||
"postcss": "^8.4.7",
|
|
||||||
"postcss-cli": "^11.0.0",
|
|
||||||
"postcss-import": "^16.0.0",
|
|
||||||
"postcss-purgecss": "^5.0.0",
|
|
||||||
"tailwindcss": "^3.0.23"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ gb tz =
|
|||||||
, timeZone = tz
|
, timeZone = tz
|
||||||
, iso2 = "gb"
|
, iso2 = "gb"
|
||||||
, label = "English"
|
, label = "English"
|
||||||
, flagIcon = "flag-icon flag-icon-gb"
|
, flagIcon = "fi fi-gb"
|
||||||
, app = Messages.App.gb
|
, app = Messages.App.gb
|
||||||
, collectiveSettings = Messages.Page.CollectiveSettings.gb tz
|
, collectiveSettings = Messages.Page.CollectiveSettings.gb tz
|
||||||
, login = Messages.Page.Login.gb
|
, login = Messages.Page.Login.gb
|
||||||
@ -133,7 +133,7 @@ de tz =
|
|||||||
, timeZone = tz
|
, timeZone = tz
|
||||||
, iso2 = "de"
|
, iso2 = "de"
|
||||||
, label = "Deutsch"
|
, label = "Deutsch"
|
||||||
, flagIcon = "flag-icon flag-icon-de"
|
, flagIcon = "fi fi-de"
|
||||||
, app = Messages.App.de
|
, app = Messages.App.de
|
||||||
, collectiveSettings = Messages.Page.CollectiveSettings.de tz
|
, collectiveSettings = Messages.Page.CollectiveSettings.de tz
|
||||||
, login = Messages.Page.Login.de
|
, login = Messages.Page.Login.de
|
||||||
@ -157,7 +157,7 @@ fr tz =
|
|||||||
, timeZone = tz
|
, timeZone = tz
|
||||||
, iso2 = "fr"
|
, iso2 = "fr"
|
||||||
, label = "Français"
|
, label = "Français"
|
||||||
, flagIcon = "flag-icon flag-icon-fr"
|
, flagIcon = "fi fi-fr"
|
||||||
, app = Messages.App.fr
|
, app = Messages.App.fr
|
||||||
, collectiveSettings = Messages.Page.CollectiveSettings.fr tz
|
, collectiveSettings = Messages.Page.CollectiveSettings.fr tz
|
||||||
, login = Messages.Page.Login.fr
|
, login = Messages.Page.Login.fr
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
@import "@fortawesome/fontawesome-free/css/all";
|
@import "@fortawesome/fontawesome-free/css/all";
|
||||||
@import "flag-icon-css/css/flag-icon.min";
|
@import "flag-icons/css/flag-icons.min";
|
||||||
|
|
||||||
@import "tailwindcss/base";
|
@import "tailwindcss/base";
|
||||||
@import "tailwindcss/components";
|
@import "tailwindcss/components";
|
||||||
|
@ -28,5 +28,4 @@ module.exports = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
require('@tailwindcss/forms')
|
require('@tailwindcss/forms')
|
||||||
]
|
]
|
||||||
// prefix: 'tw-'
|
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ in {
|
|||||||
services.dev-solr = {
|
services.dev-solr = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cores = ["docspell"];
|
cores = ["docspell"];
|
||||||
|
heap = 512;
|
||||||
};
|
};
|
||||||
|
|
||||||
port-forward.dev-webmail = 8080;
|
port-forward.dev-webmail = 8080;
|
||||||
@ -39,7 +40,8 @@ in {
|
|||||||
firewall.allowedTCPPorts = [7880];
|
firewall.allowedTCPPorts = [7880];
|
||||||
};
|
};
|
||||||
|
|
||||||
virtualisation.memorySize = 6144;
|
virtualisation.memorySize = 2048;
|
||||||
|
virtualisation.cores = 2;
|
||||||
|
|
||||||
virtualisation.forwardPorts = [
|
virtualisation.forwardPorts = [
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ object StylesPlugin extends AutoPlugin {
|
|||||||
val stylesDirectory = settingKey[File]("The directory containing source styles")
|
val stylesDirectory = settingKey[File]("The directory containing source styles")
|
||||||
val stylesOutputDir = settingKey[File]("The directory to put the final outcome")
|
val stylesOutputDir = settingKey[File]("The directory to put the final outcome")
|
||||||
val stylesMode = settingKey[StylesMode]("The compile mode, dev or production")
|
val stylesMode = settingKey[StylesMode]("The compile mode, dev or production")
|
||||||
val stylesNpxCommand = settingKey[String]("The npx executable")
|
val stylesTwCommand = settingKey[String]("The tailwindcss executable")
|
||||||
val stylesNpmCommand =
|
val stylesNpmCommand =
|
||||||
settingKey[String]("The npm executable for installing dependencies")
|
settingKey[String]("The npm executable for installing dependencies")
|
||||||
|
|
||||||
@ -40,19 +40,19 @@ object StylesPlugin extends AutoPlugin {
|
|||||||
stylesDirectory := (Compile / sourceDirectory).value / "styles",
|
stylesDirectory := (Compile / sourceDirectory).value / "styles",
|
||||||
stylesOutputDir := (Compile / resourceManaged).value /
|
stylesOutputDir := (Compile / resourceManaged).value /
|
||||||
"META-INF" / "resources" / "webjars" / name.value / version.value,
|
"META-INF" / "resources" / "webjars" / name.value / version.value,
|
||||||
stylesNpxCommand := "npx",
|
stylesTwCommand := "tailwindcss",
|
||||||
stylesNpmCommand := "npm",
|
stylesNpmCommand := "npm",
|
||||||
stylesMode := StylesMode.Dev,
|
stylesMode := StylesMode.Dev,
|
||||||
stylesBuild := {
|
stylesBuild := {
|
||||||
val logger = streams.value.log
|
val logger = streams.value.log
|
||||||
val npx = stylesNpxCommand.value
|
val tw = stylesTwCommand.value
|
||||||
val npm = stylesNpmCommand.value
|
val npm = stylesNpmCommand.value
|
||||||
val inDir = stylesDirectory.value
|
val inDir = stylesDirectory.value
|
||||||
val outDir = stylesOutputDir.value
|
val outDir = stylesOutputDir.value
|
||||||
val wd = (Compile / baseDirectory).value
|
val wd = (Compile / baseDirectory).value
|
||||||
val mode = stylesMode.value
|
val mode = stylesMode.value
|
||||||
npmInstall(npm, wd, logger)
|
npmInstall(npm, wd, logger)
|
||||||
val files = postCss(npx, inDir, outDir, wd, mode, logger) ++
|
val files = runTailwind(tw, inDir, outDir, wd, mode, logger) ++
|
||||||
copyWebfonts(wd, outDir, logger) ++
|
copyWebfonts(wd, outDir, logger) ++
|
||||||
copyFlags(wd, outDir, logger)
|
copyFlags(wd, outDir, logger)
|
||||||
logger.info(s"Styles built at $outDir")
|
logger.info(s"Styles built at $outDir")
|
||||||
@ -77,8 +77,8 @@ object StylesPlugin extends AutoPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def postCss(
|
def runTailwind(
|
||||||
npx: String,
|
tailwind: String,
|
||||||
inDir: File,
|
inDir: File,
|
||||||
outDir: File,
|
outDir: File,
|
||||||
wd: File,
|
wd: File,
|
||||||
@ -86,25 +86,20 @@ object StylesPlugin extends AutoPlugin {
|
|||||||
logger: Logger
|
logger: Logger
|
||||||
): Seq[File] = {
|
): Seq[File] = {
|
||||||
val env = mode match {
|
val env = mode match {
|
||||||
case StylesMode.Dev => "development"
|
case StylesMode.Dev => Seq.empty
|
||||||
case StylesMode.Prod => "production"
|
case StylesMode.Prod => Seq("--minify")
|
||||||
}
|
}
|
||||||
val target = outDir / "css" / "styles.css"
|
val target = outDir / "css" / "styles.css"
|
||||||
IO.createDirectory(target.getParentFile)
|
IO.createDirectory(target.getParentFile)
|
||||||
logger.info("Compiling css stylesheets…")
|
logger.info("Compiling css stylesheets…")
|
||||||
Cmd.run(
|
val cmd = Seq(
|
||||||
Seq(
|
tailwind,
|
||||||
npx,
|
"--input",
|
||||||
"postcss",
|
s"$inDir/index.css",
|
||||||
s"$inDir/index.css",
|
"-o",
|
||||||
"-o",
|
target.absolutePath
|
||||||
target.absolutePath,
|
) ++ env
|
||||||
"--env",
|
Cmd.run(cmd, wd, logger)
|
||||||
env
|
|
||||||
),
|
|
||||||
wd,
|
|
||||||
logger
|
|
||||||
)
|
|
||||||
val gz = file(target.toString + ".gz")
|
val gz = file(target.toString + ".gz")
|
||||||
IO.gzip(target, gz)
|
IO.gzip(target, gz)
|
||||||
Seq(target, gz)
|
Seq(target, gz)
|
||||||
@ -121,7 +116,7 @@ object StylesPlugin extends AutoPlugin {
|
|||||||
|
|
||||||
def copyFlags(baseDir: File, outDir: File, logger: Logger): Seq[File] = {
|
def copyFlags(baseDir: File, outDir: File, logger: Logger): Seq[File] = {
|
||||||
val flagDir =
|
val flagDir =
|
||||||
baseDir / "node_modules" / "flag-icon-css" / "flags"
|
baseDir / "node_modules" / "flag-icons" / "flags"
|
||||||
val targetDir = outDir / "flags"
|
val targetDir = outDir / "flags"
|
||||||
IO.createDirectory(targetDir)
|
IO.createDirectory(targetDir)
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ compile_css() {
|
|||||||
echo "Building css …"
|
echo "Building css …"
|
||||||
local srcs="$wdir/modules/webapp/src/main/styles/index.css"
|
local srcs="$wdir/modules/webapp/src/main/styles/index.css"
|
||||||
local target="$targetbase/css/styles.css"
|
local target="$targetbase/css/styles.css"
|
||||||
cd $wdir/modules/webapp && npx tailwindcss --input "$srcs" -o "$target" --config ./tailwind.config.js --postcss ./postcss.config.js --env development && cd -
|
cd $wdir/modules/webapp && tailwindcss --input "$srcs" -o "$target" --config ./tailwind.config.js --postcss ./postcss.config.js --env development && cd -
|
||||||
cat "$target" | gzip > "$targetbase/css/styles.css.gz"
|
cat "$target" | gzip > "$targetbase/css/styles.css.gz"
|
||||||
cp "$targetbase/css/styles.css" "$resourcebase/css/"
|
cp "$targetbase/css/styles.css" "$resourcebase/css/"
|
||||||
cp "$targetbase/css/styles.css.gz" "$resourcebase/css/"
|
cp "$targetbase/css/styles.css.gz" "$resourcebase/css/"
|
||||||
@ -47,7 +47,7 @@ watch_css() {
|
|||||||
local srcs="$wdir/modules/webapp/src/main/styles/index.css"
|
local srcs="$wdir/modules/webapp/src/main/styles/index.css"
|
||||||
local target="$targetbase/css/styles.css"
|
local target="$targetbase/css/styles.css"
|
||||||
cd $wdir/modules/webapp && \
|
cd $wdir/modules/webapp && \
|
||||||
npx tailwindcss --input "$srcs" \
|
tailwindcss --input "$srcs" \
|
||||||
-o "$target" -m \
|
-o "$target" -m \
|
||||||
--config ./tailwind.config.js \
|
--config ./tailwind.config.js \
|
||||||
--postcss ./postcss.config.js --watch
|
--postcss ./postcss.config.js --watch
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0")
|
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0")
|
||||||
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
|
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
|
||||||
addSbtPlugin("com.github.eikek" % "sbt-openapi-schema" % "0.11.0")
|
addSbtPlugin("com.github.eikek" % "sbt-openapi-schema" % "0.13.1")
|
||||||
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
|
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
|
||||||
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")
|
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")
|
||||||
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1")
|
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1")
|
||||||
|
2
project/redocly.yml
Normal file
2
project/redocly.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
extends:
|
||||||
|
- recommended
|
Loading…
x
Reference in New Issue
Block a user