Skip to content

Commit

Permalink
Fix quarkiverse#729: Simplify and fix Vite Code Start
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Jul 24, 2024
1 parent da39f2d commit 324e809
Show file tree
Hide file tree
Showing 14 changed files with 885 additions and 953 deletions.
2 changes: 1 addition & 1 deletion deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-server-spi-deployment</artifactId>
<artifactId>quarkus-rest-server-spi-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
<artifactId>quarkus-rest</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.quinoa</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@

import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest;

public class QuinoaCodestartTest {
public class QuinoaCodeStartTest {

@RegisterExtension
public static QuarkusCodestartTest codestartTest = QuarkusCodestartTest.builder()
public static QuarkusCodestartTest codeStartTest = QuarkusCodestartTest.builder()
.setupStandaloneExtensionTest("io.quarkiverse.quinoa:quarkus-quinoa")
.languages(JAVA)
.build();

@Test
void testContent() throws Throwable {
codestartTest.assertThatGeneratedFile(JAVA, "src/main/webui/package.json")
codeStartTest.assertThatGeneratedFile(JAVA, "src/main/webui/package.json")
.exists();
codestartTest.assertThatGeneratedTreeMatchSnapshots(JAVA, "src/main/webui");
codestartTest.assertThatGeneratedFile(JAVA, ".gitignore")
codeStartTest.assertThatGeneratedTreeMatchSnapshots(JAVA, "src/main/webui");
codeStartTest.assertThatGeneratedFile(JAVA, ".gitignore")
.satisfies(checkContains("node_modules/"));
}

@Test
void testBuild() throws Throwable {
codestartTest.buildAllProjects();
codeStartTest.buildAllProjects();
}

}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/
counter.js
index.html
main.js
package-lock.json
package.json
public/
public/javascript.svg
public/vite.svg
quinoa.css
quinoa.html
vite.config.js
style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function setupCounter(element) {
let counter = 0
const setCounter = (count) => {
counter = count
element.innerHTML = `count is ${counter}`
}
element.addEventListener('click', () => setCounter(counter + 1))
setCounter(0)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Quinoa App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/main.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import theaterJS from 'theaterjs';
import './style.css'
import javascriptLogo from '/javascript.svg'
import viteLogo from '/vite.svg'
import { setupCounter } from './counter.js'

const theater = theaterJS();
document.querySelector('#app').innerHTML = `
<div>
<a href="https://vitejs.dev" target="_blank">
<img src="${viteLogo}" class="logo" alt="Vite logo" />
</a>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript" target="_blank">
<img src="${javascriptLogo}" class="logo vanilla" alt="JavaScript logo" />
</a>
<h1>Hello Quinoa!</h1>
<div class="card">
<button id="counter" type="button"></button>
</div>
<p class="read-the-docs">
Click on the Vite logo to learn more
</p>
</div>
`

theater
.on('type:start, erase:start', function() { theater.getCurrentActor().$element.classList.add('actor-content--typing');})
.on('type:end, erase:end', function() {theater.getCurrentActor().$element.classList.remove('actor-content--typing');});

theater
.addActor('Quarkus', { speed: 1, accuracy: 0.7 })
.addActor('Me', { speed: 0.9, accuracy: 0.8 })
.addScene('Quarkus:Toc toc.', 1000)
.addScene('Me:What?', 500)
.addScene('Quarkus:You will eat Quinoa today!', 200)
.addScene('Me:Nooo...', -3, '!!! ', 150, 'No! ', 150)
.addScene('Me:Yuk! That\'s impossible!', 100)
.addScene('Quarkus:It is time!', 100)
.addScene('Quarkus:With your training and this power,', 100)
.addScene('Quarkus:You will create awesome web apps.', 100)
.addScene('Quarkus:It is your destiny!', 200)
.addScene('Quarkus:Meet Quarkus UI with NO hAssle!', 200)
.addScene('Me:Neat!', 200)
setupCounter(document.querySelector('#counter'))
Loading

0 comments on commit 324e809

Please sign in to comment.