mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-28 09:45:07 +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,
|
||||
openapiPackage := Pkg("docspell.restapi.model"),
|
||||
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)
|
||||
|
||||
@ -697,7 +701,11 @@ val joexapi = project
|
||||
openapiTargetLanguage := Language.Scala,
|
||||
openapiPackage := Pkg("docspell.joexapi.model"),
|
||||
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)
|
||||
|
||||
|
6
flake.lock
generated
6
flake.lock
generated
@ -6,11 +6,11 @@
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710025500,
|
||||
"narHash": "sha256-niJf4WZ4GHQ+RaP+Qj4+6P/2SWN1Z4co36/ETvIg0Qg=",
|
||||
"lastModified": 1710099997,
|
||||
"narHash": "sha256-WmBKTLdth6I/D+0//9enbIXohGsBjepbjIAm9pCYj0U=",
|
||||
"owner": "eikek",
|
||||
"repo": "devshell-tools",
|
||||
"rev": "57d7d292571e291fe8213a1655529f739cfa174d",
|
||||
"rev": "e82faf976d318b3829f6f7f6785db6f3c7b65267",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
28
flake.nix
28
flake.nix
@ -15,7 +15,7 @@
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
sbt17 = pkgs.sbt.override { jre = pkgs.jdk17; };
|
||||
sbt17 = pkgs.sbt.override {jre = pkgs.jdk17;};
|
||||
ciPkgs = with pkgs; [
|
||||
sbt17
|
||||
jdk17
|
||||
@ -25,15 +25,19 @@
|
||||
zola
|
||||
yarn
|
||||
nodejs
|
||||
redocly-cli
|
||||
tailwindcss
|
||||
];
|
||||
devshellPkgs = ciPkgs ++ (with pkgs; [
|
||||
jq
|
||||
scala-cli
|
||||
netcat
|
||||
wget
|
||||
which
|
||||
inotifyTools
|
||||
]);
|
||||
devshellPkgs =
|
||||
ciPkgs
|
||||
++ (with pkgs; [
|
||||
jq
|
||||
scala-cli
|
||||
netcat
|
||||
wget
|
||||
which
|
||||
inotifyTools
|
||||
]);
|
||||
docspellPkgs = pkgs.callPackage (import ./nix/pkg.nix) {};
|
||||
dockerAmd64 = pkgs.pkgsCross.gnu64.callPackage (import ./nix/docker.nix) {
|
||||
inherit (docspellPkgs) docspell-restserver docspell-joex;
|
||||
@ -159,6 +163,9 @@
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
{
|
||||
networking.hostName = "dev-vm";
|
||||
virtualisation.memorySize = 2048;
|
||||
|
||||
services.dev-postgres = {
|
||||
enable = true;
|
||||
databases = ["docspell"];
|
||||
@ -168,8 +175,8 @@
|
||||
services.dev-solr = {
|
||||
enable = true;
|
||||
cores = ["docspell"];
|
||||
heap = 512;
|
||||
};
|
||||
|
||||
port-forward.ssh = 10022;
|
||||
port-forward.dev-postgres = 6534;
|
||||
port-forward.dev-smtp = 10025;
|
||||
@ -178,7 +185,6 @@
|
||||
port-forward.dev-minio-api = 9000;
|
||||
port-forward.dev-minio-console = 9001;
|
||||
port-forward.dev-solr = 8983;
|
||||
networking.hostName = "dev-vm";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
@ -18,6 +18,8 @@ servers:
|
||||
- url: /api/v1
|
||||
description: Current host
|
||||
|
||||
security: []
|
||||
|
||||
paths:
|
||||
/api/info/version:
|
||||
get:
|
||||
|
@ -27,6 +27,8 @@ servers:
|
||||
- url: /api/v1
|
||||
description: Current host
|
||||
|
||||
security: []
|
||||
|
||||
paths:
|
||||
/api/info/version:
|
||||
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": {
|
||||
"@fortawesome/fontawesome-free": "^6.0.0",
|
||||
"@tailwindcss/forms": "^0.5.0",
|
||||
"autoprefixer": "^10.4.2",
|
||||
"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"
|
||||
"flag-icons": "^7.2.0"
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ gb tz =
|
||||
, timeZone = tz
|
||||
, iso2 = "gb"
|
||||
, label = "English"
|
||||
, flagIcon = "flag-icon flag-icon-gb"
|
||||
, flagIcon = "fi fi-gb"
|
||||
, app = Messages.App.gb
|
||||
, collectiveSettings = Messages.Page.CollectiveSettings.gb tz
|
||||
, login = Messages.Page.Login.gb
|
||||
@ -133,7 +133,7 @@ de tz =
|
||||
, timeZone = tz
|
||||
, iso2 = "de"
|
||||
, label = "Deutsch"
|
||||
, flagIcon = "flag-icon flag-icon-de"
|
||||
, flagIcon = "fi fi-de"
|
||||
, app = Messages.App.de
|
||||
, collectiveSettings = Messages.Page.CollectiveSettings.de tz
|
||||
, login = Messages.Page.Login.de
|
||||
@ -157,7 +157,7 @@ fr tz =
|
||||
, timeZone = tz
|
||||
, iso2 = "fr"
|
||||
, label = "Français"
|
||||
, flagIcon = "flag-icon flag-icon-fr"
|
||||
, flagIcon = "fi fi-fr"
|
||||
, app = Messages.App.fr
|
||||
, collectiveSettings = Messages.Page.CollectiveSettings.fr tz
|
||||
, login = Messages.Page.Login.fr
|
||||
|
@ -1,5 +1,5 @@
|
||||
@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/components";
|
||||
|
@ -28,5 +28,4 @@ module.exports = {
|
||||
plugins: [
|
||||
require('@tailwindcss/forms')
|
||||
]
|
||||
// prefix: 'tw-'
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ in {
|
||||
services.dev-solr = {
|
||||
enable = true;
|
||||
cores = ["docspell"];
|
||||
heap = 512;
|
||||
};
|
||||
|
||||
port-forward.dev-webmail = 8080;
|
||||
@ -39,7 +40,8 @@ in {
|
||||
firewall.allowedTCPPorts = [7880];
|
||||
};
|
||||
|
||||
virtualisation.memorySize = 6144;
|
||||
virtualisation.memorySize = 2048;
|
||||
virtualisation.cores = 2;
|
||||
|
||||
virtualisation.forwardPorts = [
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ object StylesPlugin extends AutoPlugin {
|
||||
val stylesDirectory = settingKey[File]("The directory containing source styles")
|
||||
val stylesOutputDir = settingKey[File]("The directory to put the final outcome")
|
||||
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 =
|
||||
settingKey[String]("The npm executable for installing dependencies")
|
||||
|
||||
@ -40,19 +40,19 @@ object StylesPlugin extends AutoPlugin {
|
||||
stylesDirectory := (Compile / sourceDirectory).value / "styles",
|
||||
stylesOutputDir := (Compile / resourceManaged).value /
|
||||
"META-INF" / "resources" / "webjars" / name.value / version.value,
|
||||
stylesNpxCommand := "npx",
|
||||
stylesTwCommand := "tailwindcss",
|
||||
stylesNpmCommand := "npm",
|
||||
stylesMode := StylesMode.Dev,
|
||||
stylesBuild := {
|
||||
val logger = streams.value.log
|
||||
val npx = stylesNpxCommand.value
|
||||
val tw = stylesTwCommand.value
|
||||
val npm = stylesNpmCommand.value
|
||||
val inDir = stylesDirectory.value
|
||||
val outDir = stylesOutputDir.value
|
||||
val wd = (Compile / baseDirectory).value
|
||||
val mode = stylesMode.value
|
||||
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) ++
|
||||
copyFlags(wd, outDir, logger)
|
||||
logger.info(s"Styles built at $outDir")
|
||||
@ -77,8 +77,8 @@ object StylesPlugin extends AutoPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
def postCss(
|
||||
npx: String,
|
||||
def runTailwind(
|
||||
tailwind: String,
|
||||
inDir: File,
|
||||
outDir: File,
|
||||
wd: File,
|
||||
@ -86,25 +86,20 @@ object StylesPlugin extends AutoPlugin {
|
||||
logger: Logger
|
||||
): Seq[File] = {
|
||||
val env = mode match {
|
||||
case StylesMode.Dev => "development"
|
||||
case StylesMode.Prod => "production"
|
||||
case StylesMode.Dev => Seq.empty
|
||||
case StylesMode.Prod => Seq("--minify")
|
||||
}
|
||||
val target = outDir / "css" / "styles.css"
|
||||
IO.createDirectory(target.getParentFile)
|
||||
logger.info("Compiling css stylesheets…")
|
||||
Cmd.run(
|
||||
Seq(
|
||||
npx,
|
||||
"postcss",
|
||||
s"$inDir/index.css",
|
||||
"-o",
|
||||
target.absolutePath,
|
||||
"--env",
|
||||
env
|
||||
),
|
||||
wd,
|
||||
logger
|
||||
)
|
||||
val cmd = Seq(
|
||||
tailwind,
|
||||
"--input",
|
||||
s"$inDir/index.css",
|
||||
"-o",
|
||||
target.absolutePath
|
||||
) ++ env
|
||||
Cmd.run(cmd, wd, logger)
|
||||
val gz = file(target.toString + ".gz")
|
||||
IO.gzip(target, gz)
|
||||
Seq(target, gz)
|
||||
@ -121,7 +116,7 @@ object StylesPlugin extends AutoPlugin {
|
||||
|
||||
def copyFlags(baseDir: File, outDir: File, logger: Logger): Seq[File] = {
|
||||
val flagDir =
|
||||
baseDir / "node_modules" / "flag-icon-css" / "flags"
|
||||
baseDir / "node_modules" / "flag-icons" / "flags"
|
||||
val targetDir = outDir / "flags"
|
||||
IO.createDirectory(targetDir)
|
||||
|
||||
|
@ -23,7 +23,7 @@ compile_css() {
|
||||
echo "Building css …"
|
||||
local srcs="$wdir/modules/webapp/src/main/styles/index.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"
|
||||
cp "$targetbase/css/styles.css" "$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 target="$targetbase/css/styles.css"
|
||||
cd $wdir/modules/webapp && \
|
||||
npx tailwindcss --input "$srcs" \
|
||||
tailwindcss --input "$srcs" \
|
||||
-o "$target" -m \
|
||||
--config ./tailwind.config.js \
|
||||
--postcss ./postcss.config.js --watch
|
||||
|
@ -1,6 +1,6 @@
|
||||
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.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-release" % "1.4.0")
|
||||
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