Skip to content

Commit

Permalink
Merge pull request #2964 from edalex-ian/chore/move_frontend_toplevel
Browse files Browse the repository at this point in the history
Move the New UI / front-end into a stand-alone top-level directory
  • Loading branch information
edalex-ian authored May 7, 2021
2 parents 94550c8 + 3b6e76d commit 1ca8d8b
Show file tree
Hide file tree
Showing 279 changed files with 5,606 additions and 80 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
java-version: 8

- name: Install node dependencies (core)
working-directory: Source/Plugins/Core/com.equella.core/js
working-directory: react-front-end
run: |
npm ci
Expand All @@ -89,7 +89,12 @@ jobs:
./sbt test
- name: Run unit tests (javascript)
working-directory: Source/Plugins/Core/com.equella.core/js
working-directory: react-front-end
run: |
npm cit
- name: Run unit tests (javascript - legacy)
working-directory: Source/Plugins/Core/com.equella.core/test/javascript
run: |
npm cit
Expand Down Expand Up @@ -136,25 +141,25 @@ jobs:
node-version: "${{ steps.nvm.outputs.NVMRC }}"

- name: Install node dependencies (core)
working-directory: Source/Plugins/Core/com.equella.core/js
working-directory: react-front-end
run: |
npm ci
- name: Generate Static Storybook instance
working-directory: Source/Plugins/Core/com.equella.core/js
working-directory: react-front-end
run: |
npm run build-storybook
- name: Package Static Storybook instance
working-directory: Source/Plugins/Core/com.equella.core/js
working-directory: react-front-end
run: |
tar cvf storybook.tar storybook-static
- name: Save Static Storybook instance
uses: actions/[email protected]
with:
name: Storybook
path: Source/Plugins/Core/com.equella.core/js/storybook.tar
path: react-front-end/storybook.tar

build_import_export_tool:
runs-on: ubuntu-latest
Expand Down
56 changes: 22 additions & 34 deletions Source/Plugins/Core/com.equella.core/build.sbt
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import Path.rebase
import Path.flat

import Path.{flat, rebase}
import _root_.io.circe.parser._

langStrings := {
val langDir = (resourceDirectory in Compile).value / "com/tle/core/i18n/service/impl"
val baseJs = baseDirectory.value / "js"
Common.nodeScript("build:langbundle", baseJs)
val langDir = (Compile / resourceDirectory).value / "com/tle/core/i18n/service/impl"
val bundle =
decode[Map[String, String]](IO.read(baseJs / "target/resources/lang/jsbundle.json"))
decode[Map[String, String]](IO.read(reactFrontEndLanguageBundle.value))
.fold(throw _, identity)
val pluginLangStrings = langStrings.value
Seq(
Common.loadLangProperties(langDir / "i18n-resource-centre.properties", "", "resource-centre"),
Common.loadLangProperties(langDir / "i18n-admin-console.properties", "", "admin-console"),
LangStrings("newui", false, bundle)
LangStrings("newui", xml = false, bundle)
) ++ pluginLangStrings
}

Expand Down Expand Up @@ -46,7 +42,7 @@ lazy val jqc = Seq("jquery-migrate.js", "jquery.js")
lazy val others = Seq("css/themes/equella/jquery-ui.css")

yuiResources := {
val bd = (resourceDirectory in Compile).value / "web"
val bd = (Compile / resourceDirectory).value / "web"
val jqlDir = bd / "jquerylib"
val jqcDir = bd / "jquerycore"
val jqlcDir = bd / "css/jquerylib"
Expand All @@ -58,14 +54,14 @@ yuiResources := {
}

yuiResources ++= Seq("js/bootstrap.js", "css/bootstrap.css").map(p =>
(resourceDirectory in Compile).value / "web/bootstrap" / p)
(Compile / resourceDirectory).value / "web/bootstrap" / p)

enablePlugins(YUICompressPlugin)

import org.apache.axis2.wsdl.WSDL2Java

sourceGenerators in Compile += Def.task {
val gensrc = (sourceManaged in Compile).value
Compile / sourceGenerators += Def.task {
val gensrc = (Compile / sourceManaged).value
val equellaWSDL = baseDirectory.value / "EQUELLA.WS.wsdl"
val contextWSDL = baseDirectory.value / "Context.WS.wsdl"

Expand Down Expand Up @@ -98,47 +94,39 @@ sourceGenerators in Compile += Def.task {
(gensrc ** "*.java").get
}.taskValue

resourceGenerators in Compile += Def.task {
val base = (resourceManaged in Compile).value
Compile / resourceGenerators += Def.task {
val base = (Compile / resourceManaged).value
IO.copy(Some(versionProperties.value -> base / "web/version.properties")).toSeq
}.taskValue

lazy val inplaceEditorJar = project in file("jarsrc")

resourceGenerators in Compile += Def.task {
val outJar = (resourceManaged in Compile).value / "web/inplaceedit.jar"
val jarFile = (assembly in inplaceEditorJar).value
(jarSigner.value).apply(jarFile, outJar)
Compile / resourceGenerators += Def.task {
val outJar = (Compile / resourceManaged).value / "web/inplaceedit.jar"
val jarFile = (inplaceEditorJar / assembly).value
jarSigner.value.apply(jarFile, outJar)
Seq(outJar)
}.taskValue

resourceGenerators in Compile += Def.task {
Compile / resourceGenerators += Def.task {
val baseSwagger = baseDirectory.value / "swaggerui"
Common.nodeInstall(baseSwagger)
Common.nodeScript("build", baseSwagger)
val outDir = (resourceManaged in Compile).value / "web/apidocs"
val outDir = (Compile / resourceManaged).value / "web/apidocs"
val bundle = baseSwagger / "target/bundle.js"
val css = baseSwagger / "node_modules/swagger-ui/dist/swagger-ui.css"
IO.copy(Seq(bundle, css).pair(flat(outDir))).toSeq
}.taskValue

buildJS := {
val baseJs = baseDirectory.value / "js"
Common.nodeInstall(baseJs)
Common.nodeScript("build", baseJs)
val outDir = (resourceManaged in Compile).value
val baseJsTarget = baseJs / "target/resources"
IO.copy(
(baseJsTarget ** ("*.js" | "*.css" | "*.json" | "*.html")).pair(rebase(baseJsTarget, outDir)))
.toSeq
}

resourceGenerators in Compile += buildJS.taskValue
// Pull in the react-front-end
Compile / resourceGenerators += Def.task {
val outDir = (Compile / resourceManaged).value
val srcDir = buildReactFrontEnd.value
IO.copy((srcDir ** ("*.js" | "*.css" | "*.json" | "*.html")).pair(rebase(srcDir, outDir))).toSeq
}.taskValue

clean := {
clean.value
val baseSwagger = baseDirectory.value / "swaggerui"
val baseJs = baseDirectory.value / "js"
Common.nodeScript("clean", baseSwagger)
Common.nodeScript("clean", baseJs)
}
14 changes: 0 additions & 14 deletions Source/Plugins/Core/com.equella.core/js/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0, (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module.exports = {
preset: "ts-jest",
testMatch: ["**/?(*.)+(spec|test).[jt]s?(x)"],
};
Loading

0 comments on commit 1ca8d8b

Please sign in to comment.