Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to parcel.js 2 #76

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.cache
dist
.parcel-cache
4 changes: 4 additions & 0 deletions frontend/.parcelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@parcel/config-default",
"optimizers": { "*.html": [] }
}
2 changes: 1 addition & 1 deletion frontend/html/admin/clarifications.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
{{ else }}
<div class="text-center text-lg">No Clarifications</div>
{{ end }}
<script src="../../ts/admin_clarifications.ts"></script>
<script type="module" src="../../ts/admin_clarifications.ts"></script>
</div>

{{ end }}
2 changes: 1 addition & 1 deletion frontend/html/admin/contest_scoreboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
document.initialScoreboard = JSON.parse("{{ json .JSON }}");
document.scoreboardJSONLink = '/admin/contests/{{.Contest.ID}}/scoreboard/json';
</script>
<script src="../../ts/scoreboard/index.tsx"></script>
<script type="module" src="../../ts/scoreboard/index.tsx"></script>
{{ end }}
2 changes: 1 addition & 1 deletion frontend/html/admin/root.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
<div class="flex-grow overflow-auto border-l px-4 mb-2">
{{ block "admin-content" . }}{{ end }}
</div>
<script src="../../ts/admin.ts"></script>
<script type="module" src="../../ts/admin.ts"></script>
</div>
{{ end }}
2 changes: 1 addition & 1 deletion frontend/html/admin/submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<pre class="rounded-sm font-mono m-2 overflow-auto" style="max-height: 75vh;">
<code class="rounded-sm">{{- printf "%s" .Submission.Source -}}</code>
</pre>
<script src="../../ts/submission.ts"></script>
<script type="module" src="../../ts/submission.ts"></script>

{{ end }}

Expand Down
4 changes: 2 additions & 2 deletions frontend/html/admin/submission_inputs.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@
</tr>
</tfoot>
</table>
<script src="../../ts/admin_submissions.ts"></script>
<script src="../../ts/submission.ts"></script>
<script type="module" src="../../ts/admin_submissions.ts"></script>
<script type="module" src="../../ts/submission.ts"></script>
{{ end }}

{{ define "submission-verdict" }}
Expand Down
2 changes: 1 addition & 1 deletion frontend/html/admin/users.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@
{{ template "batch-add-users" . }}
</div>

<script src="../../ts/admin_users.ts"></script>
<script type="module" src="../../ts/admin_users.ts"></script>
{{ end }}
4 changes: 2 additions & 2 deletions frontend/html/contests/problem.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<div style="display: none;" class="tab" data-tab="submissions">{{ template "problem-submissions" . }}</div>
</div>

<script src="../../ts/problem.ts"></script>
<script type="module" src="../../ts/problem.ts"></script>
{{ end }}

{{ define "problem-statements" }}
Expand Down Expand Up @@ -141,7 +141,7 @@
{{ end }}
</tbody>
</table>
<script src="../../ts/submission.ts"></script>
<script type="module" src="../../ts/submission.ts"></script>
{{ end }}

{{ define "submission-verdict" }}
Expand Down
2 changes: 1 addition & 1 deletion frontend/html/contests/root.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div class="rounded-full bg-red-600 text-white font-bold px-2 hidden" id="messages-counter"></div>
</div>
</a>
<script src="../../ts/announcements.ts"></script>
<script type="module" src="../../ts/announcements.ts"></script>
<a href="{{$contest_link}}/scoreboard">
<div class="bg-gray-300 rounded-sm hover:bg-gray-400 m-2 py-2 pl-4">Scoreboard</div>
</a>
Expand Down
2 changes: 1 addition & 1 deletion frontend/html/contests/scoreboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
document.initialScoreboard = JSON.parse("{{ json .JSON }}");
document.scoreboardJSONLink = '/contests/{{.Contest.ID}}/scoreboard/json';
</script>
<script src="../../ts/scoreboard/index.tsx"></script>
<script type="module" src="../../ts/scoreboard/index.tsx"></script>
{{ end }}
2 changes: 1 addition & 1 deletion frontend/html/contests/scoreboard_wide.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
document.initialScoreboard = JSON.parse("{{ json .JSON }}");
document.scoreboardJSONLink = '{{.JSONLink}}';
</script>
<script src="../../ts/scoreboard/index.tsx"></script>
<script type="module" src="../../ts/scoreboard/index.tsx"></script>
{{ end }}
2 changes: 1 addition & 1 deletion frontend/html/contests/submission.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<pre class="rounded-sm font-mono m-2 overflow-auto" style="max-height: 75vh;">
<code class="rounded-sm">{{- printf "%s" .Submission.Source -}}</code>
</pre>
<script src="../../ts/submission.ts"></script>
<script type="module" src="../../ts/submission.ts"></script>

{{ end }}

Expand Down
2 changes: 1 addition & 1 deletion frontend/html/root.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="container mx-auto">
{{block "main" .}}{{end}}
</div>
<script src="../ts/index.ts"></script>
<script type="module" src="../ts/index.ts"></script>
</body>

{{/* Common components */}}
Expand Down
2 changes: 1 addition & 1 deletion frontend/html/user/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h2 class="text-4xl ml-4 mx-4" id="login-state">Login</h2>
</div>
</form>
</div>
<script src="../../ts/login.ts"></script>
<script type="module" src="../../ts/login.ts"></script>
{{ if .AllowRegistration }}
<script>
window.handleRegistration();
Expand Down
24 changes: 15 additions & 9 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,43 @@
"name": "kjudge-frontend",
"version": "0.7.0",
"description": "Templates and others for kjudge.",
"main": "index.js",
"repository": "https://github.com/natsukagami/kjudge",
"author": "Natsu Kagami",
"license": "AGPL-3.0",
"private": true,
"browserslist": "> 0.25%, not dead",
"targets": {
"default": {
"distDir": "../templates",
"publicUrl": "/static"
}
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^3.1.3",
"@tailwindcss/postcss7-compat": "^2.0.2",
"@types/humanize-duration": "^3.18.0",
"@types/node": "^14.14.14",
"@types/react": "^17.0.0",
"autoprefixer": "^9.7.5",
"fontsource-ibm-plex-mono": "^3.1.5",
"fontsource-muli": "^3.1.5",
"parcel-bundler": "^1.12.4",
"parcel": "^2.8.3",
"prettier": "2.2.1",
"tailwindcss": "npm:@tailwindcss/postcss7-compat",
"tailwindcss": "^2.2.19",
"typescript": "^4.1.3"
},
"scripts": {
"test": "echo No tests... yet",
"fmt": "prettier \"css/**/*\" \"ts/**/*\" \"*.json\" \"*.js\"",
"dev": "parcel watch -d ../templates \"html/**/*.html\"",
"build": "mkdir -p ../templates && rm -rf ../templates/* && parcel build --no-source-maps -d ../templates \"html/**/*.html\""
"dev": "parcel watch \"html/**/*.html\"",
"build": "mkdir -p ../templates && rm -rf ../templates/* && parcel build --no-source-maps --no-cache \"html/**/*.html\""
},
"alias": {
"react": "preact/compat",
"react-dom/test-utils": "preact/test-utils",
"react-dom": "preact/compat"
"react-dom": "preact/compat",
"preact/jsx-dev-runtime": "preact/jsx-runtime"
},
"dependencies": {
"fontsource-ibm-plex-mono": "^3.1.5",
"fontsource-muli": "^3.1.5",
"highlight.js": "^10.4.1",
"humanize-duration": "^3.22.0",
"preact": "^10.3.4",
Expand Down
4 changes: 3 additions & 1 deletion frontend/ts/announcements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ declare interface Window {
};
}

const notificationSound = new Audio(require("../sounds/notification.ogg"));
const notificationSound = new Audio(
new URL("../sounds/notification.ogg", import.meta.url),
);

// Stores the last announcement and clarification read.
interface Store {
Expand Down
Loading