Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Create assets/ folder inside public/
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminaaron committed May 23, 2024
1 parent 8649653 commit 662c943
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"choices.js": "^10.2.0"
},
"scripts": {
"clean": "find public -mindepth 1 ! -name 'index.html' -delete",
"cloneRepo": "git clone https://github.com/Citizen-Knowledge-Graph/requirement-profiles public/requirement-profiles",
"extractCommit": "cd public/requirement-profiles && git rev-parse HEAD > ../latest-rps-repo-commit.txt",
"cleanRepo": "rm -rf public/requirement-profiles/.git*",
"copyBundle": "cp ./node_modules/@foerderfunke/matching-engine/dist/bundle.js public/",
"copyDependencies": "cp ./node_modules/choices.js/public/assets/styles/choices.min.css public/ && cp ./node_modules/choices.js/public/assets/scripts/choices.min.js public/",
"listShaclFiles": "ls public/requirement-profiles/shacl > public/shacl-files.txt",
"clean": "rm -rf public/assets/",
"cloneRepo": "git clone https://github.com/Citizen-Knowledge-Graph/requirement-profiles public/assets/requirement-profiles",
"extractCommit": "cd public/assets/requirement-profiles && git rev-parse HEAD > ../latest-rps-repo-commit.txt",
"cleanRepo": "rm -rf public/assets/requirement-profiles/.git*",
"copyBundle": "cp ./node_modules/@foerderfunke/matching-engine/dist/bundle.js public/assets/",
"copyDependencies": "cp ./node_modules/choices.js/public/assets/styles/choices.min.css public/assets/ && cp ./node_modules/choices.js/public/assets/scripts/choices.min.js public/assets/",
"listShaclFiles": "ls public/assets/requirement-profiles/shacl > public/assets/shacl-files.txt",
"collectAssets": "npm run clean && npm run cloneRepo && npm run extractCommit && npm run cleanRepo && npm run copyBundle && npm run copyDependencies && npm run listShaclFiles"
}
}
22 changes: 11 additions & 11 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<head>
<meta charset="UTF-8">
<title>FörderFunke</title>
<script src="./bundle.js"></script>
<link rel="stylesheet" href="./choices.min.css" />
<script src="./choices.min.js"></script>
<script src="./assets/bundle.js"></script>
<link rel="stylesheet" href="./assets/choices.min.css" />
<script src="./assets/choices.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
Expand Down Expand Up @@ -73,14 +73,14 @@ <h3>Report</h3>

async function parseTurtleFiles() {
turtleMap = {
"datafields": await fetchTextFile("requirement-profiles/datafields.ttl"),
"materialization": await fetchTextFile("requirement-profiles/materialization.ttl"),
"datafields": await fetchAsset("requirement-profiles/datafields.ttl"),
"materialization": await fetchAsset("requirement-profiles/materialization.ttl"),
"shacl": {}
}
let shaclFiles = await fetchTextFile("shacl-files.txt")
let shaclFiles = await fetchAsset("shacl-files.txt")
for (let filename of shaclFiles.split("\n")) {
if (!filename) continue
turtleMap.shacl[filename] = await fetchTextFile("requirement-profiles/shacl/" + filename)
turtleMap.shacl[filename] = await fetchAsset("requirement-profiles/shacl/" + filename)
}
metadata = {
df: await MatchingEngine.extractDatafieldsMetadata(turtleMap.datafields),
Expand Down Expand Up @@ -407,7 +407,7 @@ <h3>Report</h3>
localStorage.setItem("userProfile", JSON.stringify(EMPTY_PROFILE))
}
userProfile = JSON.parse(localStorage.getItem("userProfile"))
latestRPsRepoCommit = await fetchTextFile("latest-rps-repo-commit.txt")
latestRPsRepoCommit = await fetchAsset("latest-rps-repo-commit.txt")
await parseTurtleFiles()
await update()
setInterval(checkForNewRepoCommits, 60 * 1000)
Expand All @@ -419,7 +419,7 @@ <h3>Report</h3>

async function checkForNewRepoCommits() {
console.log("Checking for updates, old commit:", latestRPsRepoCommit)
let checkLatestRPsRepoCommit = await fetchTextFile("latest-rps-repo-commit.txt")
let checkLatestRPsRepoCommit = await fetchAsset("latest-rps-repo-commit.txt")
// TODO also check foerderfunke-webapp latest commit
if (checkLatestRPsRepoCommit === latestRPsRepoCommit) return
console.log("Update available, new commit:", checkLatestRPsRepoCommit)
Expand Down Expand Up @@ -463,8 +463,8 @@ <h3>Report</h3>
return metadata.rp[rpUri]?.title ?? rpUri
}

async function fetchTextFile(relPath) {
const response = await fetch(relPath, {
async function fetchAsset(relPath) {
const response = await fetch("assets/" + relPath, {
method: "GET",
cache: "reload"
})
Expand Down

0 comments on commit 662c943

Please sign in to comment.