Skip to content

Commit

Permalink
Switch to Vite (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
silviogutierrez authored Feb 17, 2024
1 parent 1559bb2 commit 07321c7
Show file tree
Hide file tree
Showing 58 changed files with 3,451 additions and 1,469 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
nix-shell --command "python manage.py generate_client_assets"
nix-shell --command "python manage.py build"
nix-shell --command "scripts/test.sh"
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
website_tests:
name: Website tests
runs-on: ubuntu-22.04
Expand All @@ -56,6 +59,7 @@ jobs:
- uses: ./.github/actions/setup
- name: Run tests
run: |
sed -i '/export {};/d' packages/reactivated/dist/eslintrc.cjs
cd website
nix-shell --command "python manage.py generate_client_assets"
nix-shell --command "scripts/test.sh --all"
Expand Down
2 changes: 1 addition & 1 deletion development/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": ["../node_modules/reactivated/dist/eslintrc.js"]
"extends": ["../node_modules/reactivated/dist/eslintrc.cjs"]
}
10 changes: 0 additions & 10 deletions development/client/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ export const Layout = (props: Props) => {
type="text/css"
href={`${context.STATIC_URL}admin/css/fonts.css`}
/>
<link
rel="stylesheet"
type="text/css"
href={`${context.STATIC_URL}dist/index.css`}
/>
<script
defer
crossOrigin="anonymous"
src={`${context.STATIC_URL}dist/index.js`}
/>
</Helmet>
<header className={styles.header}>
<a href="/" rel="noopener">
Expand Down
3 changes: 1 addition & 2 deletions development/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {HelmetProvider} from "react-helmet-async";
import {createRoot} from "react-dom/client";

const {props, context} = getServerData();

const Template = getTemplate(context);
const Template = await getTemplate(context);

const root = createRoot(document.getElementById("root")!);
root.render(
Expand Down
2 changes: 1 addition & 1 deletion development/client/templates/DjangoDefault.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {classNames} from "@reactivated";
import {Layout} from "@client/components/Layout";
import * as styles from "@client/styles.css";

export default () => (
export const Template = () => (
<Layout
title="The install worked successfully! Congratulations!"
className={classNames(
Expand Down
2 changes: 1 addition & 1 deletion development/client/templates/EditPoll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Layout} from "@client/components/Layout";
import * as forms from "@client/forms";
import * as styles from "@client/styles.css";

export default (props: templates.EditPoll) => {
export const Template = (props: templates.EditPoll) => {
const formSet = useFormSet({formSet: props.choice_form_set});
const title = props.existing_poll == null ? "Create poll" : "Update poll";

Expand Down
2 changes: 1 addition & 1 deletion development/client/templates/FormPlayground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {CSRFToken, Form, FormSet, templates} from "@reactivated";

import {Layout} from "@client/components/Layout";

export default (props: templates.FormPlayground) => (
export const Template = (props: templates.FormPlayground) => (
<Layout title="Forms">
<h1>Forms</h1>
<form method="POST" action="">
Expand Down
2 changes: 1 addition & 1 deletion development/client/templates/PollComments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Layout} from "@client/components/Layout";
import * as forms from "@client/forms";
import * as styles from "@client/styles.css";

export default (props: templates.PollComments) => {
export const Template = (props: templates.PollComments) => {
const {question} = props;
const {request} = React.useContext(Context);
const [comments, setComments] = React.useState(question.comments);
Expand Down
2 changes: 1 addition & 1 deletion development/client/templates/PollDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Layout} from "@client/components/Layout";
import * as forms from "@client/forms";
import * as styles from "@client/styles.css";

export default ({error_message, question}: templates.PollDetail) => (
export const Template = ({error_message, question}: templates.PollDetail) => (
<Layout title={question.question_text}>
<form
action={reverse("vote", {question_id: question.id})}
Expand Down
2 changes: 1 addition & 1 deletion development/client/templates/PollsIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Layout} from "@client/components/Layout";
import * as forms from "@client/forms";
import * as styles from "@client/styles.css";

export default (props: templates.PollsIndex) => (
export const Template = (props: templates.PollsIndex) => (
<Layout
title="Polls"
className={styles.sprinkles({
Expand Down
2 changes: 1 addition & 1 deletion development/client/templates/Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {reverse, templates} from "@reactivated";

import {Layout} from "@client/components/Layout";

export default ({question}: templates.Results) => (
export const Template = ({question}: templates.Results) => (
<Layout title={question.question_text}>
<h1>{question.question_text}</h1>
<ul>
Expand Down
1 change: 1 addition & 0 deletions development/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "development",
"type": "module",
"version": "1.0.0",
"main": "index.js",
"author": "Silvio J. Gutierrez <[email protected]>",
Expand Down
5 changes: 3 additions & 2 deletions development/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"strict": true,
"sourceMap": true,
"noEmit": true,
"module": "commonjs",
"target": "es6",
"module": "esnext",
"moduleResolution": "node",
"target": "es2017",
"esModuleInterop": true,
"allowJs": true,
"jsx": "react",
Expand Down
Loading

0 comments on commit 07321c7

Please sign in to comment.