quarkiverse / quarkus-quinoa

Quinoa is a Quarkus extension which eases the development, the build and serving of single page apps (built with NodeJS: React, Angular, …) alongside Quarkus . It is possible to use it with a Quarkus backend in a single project
Apache License 2.0
84 stars 41 forks source link

Seems does't support yaml config #807

Closed whp98 closed 1 day ago

whp98 commented 2 days ago

Describe the bug

when i use yaml config like this application.yml is not work

quarkus:
  quinoa:
    enabled: false
    package-manager: npm
    package-manager-command:
      dev: dev
    dev-server:
      port: 5173
    build-dir: ../webui/dist
    package-manager-install: true
#      node-version: 16.17.0
    ui-root-path: quinoa
    node-version: 20.10.0

Quinoa version

2.5.0

Quarkus version

3.16.2

Build / Runtime

Vite

Package Manager

NPM

Steps to reproduce the behavior

1.create a project with

application.yml

quarkus:
  quinoa:
    enabled: false
    package-manager: npm
    package-manager-command:
      dev: dev
    dev-server:
      port: 5173
    build-dir: ../webui/dist
    package-manager-install: true
#      node-version: 16.17.0
    ui-root-path: quinoa
  1. start project
  2. see error failed to start quarkus: java.lang.runtimeexception: io.quarkus.builder.buildexception: build failure: build failed due to errors [error]: build step io.quarkiverse.quinoa.deployment.quinoaprocessor#install threw an exception: java.lang.runtimeexception: error in quinoa while running package manager install command: npm install at io.quarkiverse.quinoa.deployment.packagemanager.packagemanagerrunner.install(packagemanagerrunner.java:84)

4.then i try use this

application.properties

############QUINOA##################
quarkus.quinoa.enabled=false
quarkus.quinoa.ui-root-path=/
quarkus.quinoa.package-manager-install=true
quarkus.quinoa.package-manager-install.node-version=20.10.0
quarkus.quinoa.package-manager=npm
quarkus.quinoa.package-manager-command.dev=run dev
quarkus.quinoa.dev-server.port=5173
#quarkus.quinoa.build-dir=../webui/dist
quarkus.quinoa.package-manager-install.enabled=true

it works fine .

so this project only support properties config ?

it seems the problem is on

quarkus.quinoa.package-manager-install=true
quarkus.quinoa.package-manager-install.node-version=20.10.0

yaml don‘t support this config

Expected behavior

i expect its works both on yaml and properties

melloware commented 2 days ago

According to the docs https://quarkus.io/guides/config-yaml its application.yaml not application.yml. Can you rename to .yaml and try again?

whp98 commented 2 days ago

I tried

quarkus:
  quinoa:
    package-manager: npm
    dev-server:
      port: '5173'
    package-manager-install:
      node-version: 20.10.0
      enabled: 'true'
      nodeValue: 'true'
    enable-spa-routing: 'true'
    enabled: 'false'
    ui-root-path: /
    package-manager-command:
      dev: run dev

log is


2024-11-21 10:23:59,637 INFO  [io.qua.qui.dep.fra.FrameworkType] (build-54) Quinoa detected 'VITE' frameworkType from package.json file.
2024-11-21 10:23:59,841 WARN  [io.qua.config] (build-24) Unrecognized configuration file file:/home/xxxx/MY_CODE/xxx/target/classes/application.yaml found; Please, check if your are providing the proper extension to load the file
2024-11-21 10:23:59,841 WARN  [io.qua.config] (build-24) Unrecognized configuration file file:/home/xxxx/MY_CODE/xxx/target/classes/application.bak found; Please, check if your are providing the proper extension to load the file
2024-11-21 10:24:00,247 INFO  [io.qua.qui.dep.pac.PackageManagerRunner] (build-7) Running Quinoa package manager live coding as a dev service: npm run dev
2024-11-21 10:24:00,646 INFO  [io.qua.dat.dep.dev.DevServicesDatasourceProcessor] (build-48) Dev Services for default datasource (h2) started

--
Quinoa package manager live coding dev service starting: sh: 1: npm: not found
Tests paused
melloware commented 1 day ago

Looks like you missed a step: https://quarkus.io/guides/config-yaml

Here is a working reproducer just unzip and run mvn quarkus:dev

quinoa-yaml.zip

whp98 commented 1 day ago

i use your file the fail log is

ening for transport dt_socket at address: 39773
2024-11-22 10:00:07,006 INFO  [io.qua.qui.dep.fra.FrameworkType] (build-17) Quinoa detected 'VITE' frameworkType from package.json file.
2024-11-22 10:00:07,462 INFO  [io.qua.qui.dep.QuinoaProcessor] (build-22) Quinoa didn't detect a node_modules directory, let's install packages...
2024-11-22 10:00:07,466 INFO  [io.qua.qui.dep.pac.PackageManagerRunner] (build-22) Running Quinoa package manager install command: npm install
2024-11-22 10:00:07,536 INFO  [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2024-11-22 10:00:07,974 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkiverse.quinoa.deployment.QuinoaProcessor#install threw an exception: java.lang.RuntimeException: Error in Quinoa while running package manager install command: npm install
        at io.quarkiverse.quinoa.deployment.packagemanager.PackageManagerRunner.install(PackageManagerRunner.java:84)
        at io.quarkiverse.quinoa.deployment.QuinoaProcessor.install(QuinoaProcessor.java:147)
        at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
        at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
        at java.base/java.lang.Thread.run(Thread.java:1575)
        at org.jboss.threads.JBossThread.run(JBossThread.java:499)

        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:355)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:272)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:62)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:89)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:428)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:55)
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
        at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
        at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
        at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkiverse.quinoa.deployment.QuinoaProcessor#install threw an exception: java.lang.RuntimeException: Error in Quinoa while running package manager install command: npm install
        at io.quarkiverse.quinoa.deployment.packagemanager.PackageManagerRunner.install(PackageManagerRunner.java:84)
        at io.quarkiverse.quinoa.deployment.QuinoaProcessor.install(QuinoaProcessor.java:147)
        at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
        at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
        at java.base/java.lang.Thread.run(Thread.java:1575)
        at org.jboss.threads.JBossThread.run(JBossThread.java:499)

        at io.quarkus.builder.Execution.run(Execution.java:124)
        at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
        at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:161)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:351)
        ... 9 more
Caused by: java.lang.RuntimeException: Error in Quinoa while running package manager install command: npm install
        at io.quarkiverse.quinoa.deployment.packagemanager.PackageManagerRunner.install(PackageManagerRunner.java:84)
        at io.quarkiverse.quinoa.deployment.QuinoaProcessor.install(QuinoaProcessor.java:147)
        at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
        at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
        at java.base/java.lang.Thread.run(Thread.java:1575)
        at org.jboss.threads.JBossThread.run(JBossThread.java:499)

--
whp98 commented 1 day ago

is this a bug , or what i missed ?

melloware commented 1 day ago

No that's doesn't work I just threw a quick example showing that it picks up the YAML file fine. But it was not meant to be accurate I just copied and pasted your file above even though it's not correct for the runner I sent you. It was purely pointing out YAML works fine.

melloware commented 1 day ago

Closed this as we have proved YAMl works fine if you configure your Pom.xml correctly.

whp98 commented 23 hours ago

I don't understand why you shut it down. I tried the small project you gave me, but it gave an error after running it. I didn't see the node and npm downloads I expected, but it gave an npm install error directly. If I convert the same yaml file into a proprites and fix file and run it again,

# i changed this line
quarkus.quinoa.package-manager-install=true

the program will not give an error.

whp98 commented 23 hours ago

https://mageddo.com/tools/yaml-converter

whp98 commented 23 hours ago

quarkus.quinoa.package-manager-install.node-version=20.10.0 quarkus.quinoa.package-manager-install=true

proprites can write this

but in yaml quarkus.quinoa.package-manager-install can't be boolean and object

whp98 commented 23 hours ago
quarkus:
  quinoa:
      # package-manager-install: true  this place whill Syntax Error
      package-manager-install:
        node-version: 20.10.0
whp98 commented 23 hours ago

Finally found it

quarkus:
  quinoa:
    package-manager: npm
    dev-server:
      port: 5173
    package-manager-install:
      node-version: 20.10.0
      ~: true

i found this config in repo https://github.com/quarkiverse/quarkus-quinoa/blob/72443fd5e4be780f41ef3fd89f253f75e7877534/runtime/src/main/codestarts/quarkus/quinoa-codestart/base/src/main/resources/application.yml#L4

      ~: true

so my problem solved but this config is really hard to know .it should be a example in document

@melloware

melloware commented 23 hours ago

That just how Quarkus YAML works and is not Quinoa specific...