devsoap / ds-gradle-vaadin

Gradle plugin for building Vaadin Flow 10/11/12/13/14/15 apps
https://devsoap.com/gradle-vaadin-flow-plugin
Other
36 stars 13 forks source link

Production mode templates #222

Closed alabotski closed 5 years ago

alabotski commented 5 years ago

Standard templates are not loaded.

plugins {
    id 'com.devsoap.vaadin-flow' version '1.0.1'
)

repositories {
    vaadin.prereleases()
    vaadin.addons()
}

vaadin {
    // Enable production mode for production apps
    productionMode Boolean.parseBoolean(System.properties['productionMode'])
    submitStatistics false
    version '13.0.1'
}

dependencies {
    // Include BOM to stabilize Vaadin versions
    implementation vaadin.bom()
    // Include only open source Vaadin components
    implementation vaadin.platform()
    // Include a compatible servlet API version
    compileOnly vaadin.servletApi()
    // Include a compatible slf4j version
    runtime vaadin.slf4j()
    implementation vaadin.materialTheme()
}
image
alabotski commented 5 years ago

beverage-starter-flow-gradle

image
alabotski commented 5 years ago

My error. Html was not in the templates folder

But now I have another problem

brp-oskar commented 5 years ago

Try to run gradle with the --info flag. Issue https://github.com/devsoap/gradle-vaadin-flow/issues/193 might help you.

johndevs commented 5 years ago

The bevarage-starter-flow-gradle project's templates (https://github.com/devsoap/examples/blob/master/beverage-starter-flow-gradle/src/main/webapp/frontend/templates/reviews-list.html#L23) depend on the lumo theme.

If you switch the base theme to Material (as you've done above) then you will need to fix the style imports in the templates as well.

alabotski commented 5 years ago

I add such configuration

// In production mode we want to exclude the Lumo styles imported from all vaadin components
vaadinTranspileDependencies {
    importExcludes = [
            /.*[\\\/]theme[\\\/]lumo[\\\/].*/,
            /.*[\\\/]vaadin-lumo-styles[\\\/].*/,
    ]
}

// We don't want the Lumo style Maven dependencies in our project either
configurations.all {
    exclude group: 'com.vaadin', module: 'vaadin-lumo-theme'
    exclude group: 'org.webjars.bowergithub.vaadin', module: 'vaadin-lumo-styles'
}

And have such result with --info

Found 10 resource imports
Using Material as base theme...
Filtering 60 theme imports...
Found 60 theme imports
Creating vaadin-flow-bundle-78hwllwvplraduyoivgmuyshb.cache.html...
Creating polymer.json...
Creating vaadin-flow-bundle-manifest.json...
Starting process 'command '/Users/lesharb/workspace/test/.gradle/yarn/yarn-v1.12.3/bin/yarn''. Working directory: /Users/lesharb/workspace/test/build/frontend Command: /Users/lesharb/workspace/test/.gradle/yarn/yarn-v1.12.3/bin/yarn --prefer-offline --cwd /Users/lesharb/workspace/test/build/frontend run polymer-bundler --inline-scripts --manifest-out=/Users/lesharb/workspace/test/build/frontend/vaadin-flow-bundle-manifest.json vaadin-flow-bundle-78hwllwvplraduyoivgmuyshb.cache.html
Successfully started process 'command '/Users/lesharb/workspace/test/.gradle/yarn/yarn-v1.12.3/bin/yarn''
Transpiling...
Starting process 'command '/Users/lesharb/workspace/test/.gradle/yarn/yarn-v1.12.3/bin/yarn''. Working directory: /Users/lesharb/workspace/test/build/frontend Command: /Users/lesharb/workspace/test/.gradle/yarn/yarn-v1.12.3/bin/yarn --prefer-offline --cwd /Users/lesharb/workspace/test/build/frontend run polymer build --npm --module-resolution=node
Successfully started process 'command '/Users/lesharb/workspace/test/.gradle/yarn/yarn-v1.12.3/bin/yarn''
error Command failed with exit code 1.

> Task :vaadinTranspileDependencies FAILED
:vaadinTranspileDependencies (Thread[Execution worker for ':' Thread 6,5,main]) completed. Took 37.589 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':vaadinTranspileDependencies'.
> Process 'command '/Users/lesharb/workspace/test/.gradle/yarn/yarn-v1.12.3/bin/yarn'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.3/userguide/command_line_interface.html#sec:command_line_warnings
alabotski commented 5 years ago

@johndevs Unfortunately I can not give a project to share, it's commercial development

alabotski commented 5 years ago

I have such structure

image

With --debug

12:19:34.915 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :vaadinTranspileDependencies FAILED
12:19:43.935 [DEBUG] [com.devsoap.vaadinflow.util.LogUtils$LogOutputStream] error:    Promise rejection: Error: ENOENT: no such file or directory, open '/Users/lesharb/workspace/test/build/frontend/flowgraph/dist/vendors~main.bundle.js'

12:19:43.935 [DEBUG] [com.devsoap.vaadinflow.util.LogUtils$LogOutputStream] 
12:19:43.935 [DEBUG] [com.devsoap.vaadinflow.util.LogUtils$LogOutputStream] error:    Error: ENOENT: no such file or directory, open '/Users/lesharb/workspace/test/build/frontend/flowgraph/dist/vendors~main.bundle.js'

12:19:43.935 [DEBUG] [com.devsoap.vaadinflow.util.LogUtils$LogOutputStream] 
12:19:43.965 [INFO] [com.devsoap.vaadinflow.util.LogUtils$LogOutputStream] error Command failed with exit code 1.

12:19:43.965 [INFO] [com.devsoap.vaadinflow.util.LogUtils$LogOutputStream] 
12:19:43.965 [DEBUG] [com.devsoap.vaadinflow.util.LogUtils$LogOutputStream] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

12:19:43.965 [DEBUG] [com.devsoap.vaadinflow.util.LogUtils$LogOutputStream] 
12:19:43.972 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED

Where should JS files be located?

In production mode

Files from the styles and templates folders

The rest are simply ignored. How I can include them?

alabotski commented 5 years ago

I can't build production mode =(((

Try use lumo but some result

Screen Shot 2019-03-26 at 16 22 30-min