Add init project

This commit is contained in:
Sambo Chea 2021-06-24 14:04:28 +07:00
commit 45216e1e9b
15 changed files with 12147 additions and 0 deletions

38
.gitignore vendored Normal file
View File

@ -0,0 +1,38 @@
node_modules
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/

52
build.gradle.kts Normal file
View File

@ -0,0 +1,52 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
plugins {
id("org.springframework.boot") version "2.5.1"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
id("com.vaadin") version "0.14.6.0"
kotlin("jvm") version "1.5.10"
kotlin("plugin.spring") version "1.5.10"
id("org.springframework.experimental.aot") version "0.10.0"
id("org.graalvm.buildtools.native") version "0.9.0"
}
group = "com.example"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_11
repositories {
maven { url = uri("https://repo.spring.io/release") }
mavenCentral()
}
extra["vaadinVersion"] = "14.6.4"
dependencies {
implementation("com.vaadin:vaadin-spring-boot-starter")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
dependencyManagement {
imports {
mavenBom("com.vaadin:vaadin-bom:${property("vaadinVersion")}")
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<BootBuildImage> {
builder = "paketobuildpacks/builder:tiny"
environment = mapOf("BP_NATIVE_IMAGE" to "true")
}

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored Normal file
View File

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

11191
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

127
package.json Normal file
View File

@ -0,0 +1,127 @@
{
"dependencies": {
"@polymer/iron-icon": "3.0.1",
"@polymer/iron-list": "3.1.0",
"@polymer/polymer": "3.2.0",
"@vaadin/vaadin-accordion": "1.2.0",
"@vaadin/vaadin-app-layout": "2.2.0",
"@vaadin/vaadin-avatar": "1.0.4",
"@vaadin/vaadin-button": "2.4.0",
"@vaadin/vaadin-checkbox": "2.5.0",
"@vaadin/vaadin-combo-box": "5.4.7",
"@vaadin/vaadin-context-menu": "4.5.0",
"@vaadin/vaadin-core-shrinkwrap": "14.6.4",
"@vaadin/vaadin-custom-field": "1.3.0",
"@vaadin/vaadin-date-picker": "4.4.1",
"@vaadin/vaadin-date-time-picker": "1.4.0",
"@vaadin/vaadin-details": "1.2.0",
"@vaadin/vaadin-dialog": "2.5.2",
"@vaadin/vaadin-form-layout": "2.3.0",
"@vaadin/vaadin-grid": "5.7.13",
"@vaadin/vaadin-icons": "4.3.2",
"@vaadin/vaadin-item": "2.3.0",
"@vaadin/vaadin-list-box": "1.4.0",
"@vaadin/vaadin-login": "1.2.0",
"@vaadin/vaadin-lumo-styles": "1.6.0",
"@vaadin/vaadin-material-styles": "1.3.2",
"@vaadin/vaadin-menu-bar": "1.2.2",
"@vaadin/vaadin-notification": "1.6.1",
"@vaadin/vaadin-ordered-layout": "1.4.0",
"@vaadin/vaadin-progress-bar": "1.3.0",
"@vaadin/vaadin-radio-button": "1.5.1",
"@vaadin/vaadin-select": "2.4.0",
"@vaadin/vaadin-split-layout": "4.3.0",
"@vaadin/vaadin-tabs": "3.2.0",
"@vaadin/vaadin-text-field": "2.8.4",
"@vaadin/vaadin-time-picker": "2.4.0",
"@vaadin/vaadin-upload": "4.4.1",
"@webcomponents/webcomponentsjs": "^2.2.10",
"construct-style-sheets-polyfill": "2.4.16",
"lit-element": "2.5.1",
"lit-html": "1.4.1"
},
"devDependencies": {
"chokidar": "^3.5.0",
"compression-webpack-plugin": "4.0.1",
"construct-style-sheets-polyfill": "2.4.6",
"copy-webpack-plugin": "5.1.2",
"css-loader": "4.2.1",
"extra-watch-webpack-plugin": "1.0.3",
"extract-loader": "5.1.0",
"file-loader": "6.1.0",
"lit-css-loader": "0.0.4",
"raw-loader": "3.1.0",
"ts-loader": "8.0.12",
"typescript": "4.0.3",
"webpack": "4.42.0",
"webpack-babel-multi-target-plugin": "2.3.3",
"webpack-cli": "3.3.11",
"webpack-dev-server": "3.11.0",
"webpack-merge": "4.2.2"
},
"license": "UNLICENSED",
"name": "no-name",
"vaadin": {
"dependencies": {
"@polymer/iron-icon": "3.0.1",
"@polymer/iron-list": "3.1.0",
"@polymer/polymer": "3.2.0",
"@vaadin/vaadin-accordion": "1.2.0",
"@vaadin/vaadin-app-layout": "2.2.0",
"@vaadin/vaadin-avatar": "1.0.4",
"@vaadin/vaadin-button": "2.4.0",
"@vaadin/vaadin-checkbox": "2.5.0",
"@vaadin/vaadin-combo-box": "5.4.7",
"@vaadin/vaadin-context-menu": "4.5.0",
"@vaadin/vaadin-core-shrinkwrap": "14.6.4",
"@vaadin/vaadin-custom-field": "1.3.0",
"@vaadin/vaadin-date-picker": "4.4.1",
"@vaadin/vaadin-date-time-picker": "1.4.0",
"@vaadin/vaadin-details": "1.2.0",
"@vaadin/vaadin-dialog": "2.5.2",
"@vaadin/vaadin-form-layout": "2.3.0",
"@vaadin/vaadin-grid": "5.7.13",
"@vaadin/vaadin-icons": "4.3.2",
"@vaadin/vaadin-item": "2.3.0",
"@vaadin/vaadin-list-box": "1.4.0",
"@vaadin/vaadin-login": "1.2.0",
"@vaadin/vaadin-lumo-styles": "1.6.0",
"@vaadin/vaadin-material-styles": "1.3.2",
"@vaadin/vaadin-menu-bar": "1.2.2",
"@vaadin/vaadin-notification": "1.6.1",
"@vaadin/vaadin-ordered-layout": "1.4.0",
"@vaadin/vaadin-progress-bar": "1.3.0",
"@vaadin/vaadin-radio-button": "1.5.1",
"@vaadin/vaadin-select": "2.4.0",
"@vaadin/vaadin-split-layout": "4.3.0",
"@vaadin/vaadin-tabs": "3.2.0",
"@vaadin/vaadin-text-field": "2.8.4",
"@vaadin/vaadin-time-picker": "2.4.0",
"@vaadin/vaadin-upload": "4.4.1",
"@webcomponents/webcomponentsjs": "^2.2.10",
"construct-style-sheets-polyfill": "2.4.16",
"lit-element": "2.5.1",
"lit-html": "1.4.1"
},
"devDependencies": {
"chokidar": "^3.5.0",
"compression-webpack-plugin": "4.0.1",
"construct-style-sheets-polyfill": "2.4.6",
"copy-webpack-plugin": "5.1.2",
"css-loader": "4.2.1",
"extra-watch-webpack-plugin": "1.0.3",
"extract-loader": "5.1.0",
"file-loader": "6.1.0",
"lit-css-loader": "0.0.4",
"raw-loader": "3.1.0",
"ts-loader": "8.0.12",
"typescript": "4.0.3",
"webpack": "4.42.0",
"webpack-babel-multi-target-plugin": "2.3.3",
"webpack-cli": "3.3.11",
"webpack-dev-server": "3.11.0",
"webpack-merge": "4.2.2"
},
"hash": "ec400d520950bfc7ea2e9b0da81727faa0de2f166997447bba12056aaec4a428"
}
}

8
settings.gradle.kts Normal file
View File

@ -0,0 +1,8 @@
pluginManagement {
repositories {
maven { url = uri("https://repo.spring.io/release") }
mavenCentral()
gradlePluginPortal()
}
}
rootProject.name = "demo"

View File

@ -0,0 +1,11 @@
package com.example.demo
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
@SpringBootApplication
class DemoApplication
fun main(args: Array<String>) {
runApplication<DemoApplication>(*args)
}

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,13 @@
package com.example.demo
import org.junit.jupiter.api.Test
import org.springframework.boot.test.context.SpringBootTest
@SpringBootTest
class DemoApplicationTests {
@Test
fun contextLoads() {
}
}

View File

@ -0,0 +1,78 @@
const div = document.createElement('div');
div.innerHTML = '<custom-style><style include="lumo-color lumo-typography"></style></custom-style>';
document.head.insertBefore(div.firstElementChild, document.head.firstChild);
import '@polymer/iron-icon/iron-icon.js';
import '@polymer/iron-list/iron-list.js';
import '@vaadin/flow-frontend/comboBoxConnector-es6.js';
import '@vaadin/flow-frontend/contextMenuConnector-es6.js';
import '@vaadin/flow-frontend/datepickerConnector.js';
import '@vaadin/flow-frontend/dndConnector-es6.js';
import '@vaadin/flow-frontend/flow-component-renderer.js';
import '@vaadin/flow-frontend/gridConnector-es6.js';
import '@vaadin/flow-frontend/ironListConnector-es6.js';
import '@vaadin/flow-frontend/ironListStyles.js';
import '@vaadin/flow-frontend/menubarConnector.js';
import '@vaadin/flow-frontend/timepickerConnector.js';
import '@vaadin/flow-frontend/vaadin-big-decimal-field.js';
import '@vaadin/flow-frontend/vaadin-grid-flow-selection-column.js';
import '@vaadin/vaadin-accordion/theme/lumo/vaadin-accordion.js';
import '@vaadin/vaadin-app-layout/theme/lumo/vaadin-app-layout.js';
import '@vaadin/vaadin-app-layout/theme/lumo/vaadin-drawer-toggle.js';
import '@vaadin/vaadin-avatar/theme/lumo/vaadin-avatar-group.js';
import '@vaadin/vaadin-avatar/theme/lumo/vaadin-avatar.js';
import '@vaadin/vaadin-button/theme/lumo/vaadin-button.js';
import '@vaadin/vaadin-checkbox/theme/lumo/vaadin-checkbox-group.js';
import '@vaadin/vaadin-checkbox/theme/lumo/vaadin-checkbox.js';
import '@vaadin/vaadin-combo-box/theme/lumo/vaadin-combo-box.js';
import '@vaadin/vaadin-context-menu/theme/lumo/vaadin-context-menu.js';
import '@vaadin/vaadin-custom-field/theme/lumo/vaadin-custom-field.js';
import '@vaadin/vaadin-date-picker/theme/lumo/vaadin-date-picker.js';
import '@vaadin/vaadin-date-time-picker/theme/lumo/vaadin-date-time-picker.js';
import '@vaadin/vaadin-details/theme/lumo/vaadin-details.js';
import '@vaadin/vaadin-dialog/theme/lumo/vaadin-dialog.js';
import '@vaadin/vaadin-form-layout/theme/lumo/vaadin-form-item.js';
import '@vaadin/vaadin-form-layout/theme/lumo/vaadin-form-layout.js';
import '@vaadin/vaadin-grid/theme/lumo/vaadin-grid-column-group.js';
import '@vaadin/vaadin-grid/theme/lumo/vaadin-grid-column.js';
import '@vaadin/vaadin-grid/theme/lumo/vaadin-grid-sorter.js';
import '@vaadin/vaadin-grid/theme/lumo/vaadin-grid-tree-toggle.js';
import '@vaadin/vaadin-grid/theme/lumo/vaadin-grid.js';
import '@vaadin/vaadin-icons/vaadin-icons.js';
import '@vaadin/vaadin-item/theme/lumo/vaadin-item.js';
import '@vaadin/vaadin-list-box/theme/lumo/vaadin-list-box.js';
import '@vaadin/vaadin-login/theme/lumo/vaadin-login-form.js';
import '@vaadin/vaadin-login/theme/lumo/vaadin-login-overlay.js';
import '@vaadin/vaadin-lumo-styles/color.js';
import '@vaadin/vaadin-lumo-styles/icons.js';
import '@vaadin/vaadin-lumo-styles/sizing.js';
import '@vaadin/vaadin-lumo-styles/spacing.js';
import '@vaadin/vaadin-lumo-styles/style.js';
import '@vaadin/vaadin-lumo-styles/typography.js';
import '@vaadin/vaadin-menu-bar/theme/lumo/vaadin-menu-bar.js';
import '@vaadin/vaadin-notification/theme/lumo/vaadin-notification.js';
import '@vaadin/vaadin-ordered-layout/theme/lumo/vaadin-horizontal-layout.js';
import '@vaadin/vaadin-ordered-layout/theme/lumo/vaadin-vertical-layout.js';
import '@vaadin/vaadin-ordered-layout/vaadin-scroller.js';
import '@vaadin/vaadin-progress-bar/theme/lumo/vaadin-progress-bar.js';
import '@vaadin/vaadin-radio-button/theme/lumo/vaadin-radio-button.js';
import '@vaadin/vaadin-radio-button/theme/lumo/vaadin-radio-group.js';
import '@vaadin/vaadin-select/theme/lumo/vaadin-select.js';
import '@vaadin/vaadin-split-layout/theme/lumo/vaadin-split-layout.js';
import '@vaadin/vaadin-tabs/theme/lumo/vaadin-tab.js';
import '@vaadin/vaadin-tabs/theme/lumo/vaadin-tabs.js';
import '@vaadin/vaadin-text-field/theme/lumo/vaadin-email-field.js';
import '@vaadin/vaadin-text-field/theme/lumo/vaadin-integer-field.js';
import '@vaadin/vaadin-text-field/theme/lumo/vaadin-number-field.js';
import '@vaadin/vaadin-text-field/theme/lumo/vaadin-password-field.js';
import '@vaadin/vaadin-text-field/theme/lumo/vaadin-text-area.js';
import '@vaadin/vaadin-text-field/theme/lumo/vaadin-text-field.js';
import '@vaadin/vaadin-time-picker/theme/lumo/vaadin-time-picker.js';
import '@vaadin/vaadin-upload/src/vaadin-upload-file.js';
import '@vaadin/vaadin-upload/theme/lumo/vaadin-upload.js';
import '@vaadin/flow-frontend/comboBoxConnector.js';
import '@vaadin/flow-frontend/contextMenuConnector.js';
import '@vaadin/flow-frontend/dndConnector.js';
import '@vaadin/flow-frontend/gridConnector.js';
import '@vaadin/flow-frontend/ironListConnector.js';
import '@vaadin/flow-frontend/selectConnector.js';

37
webpack.config.js Normal file
View File

@ -0,0 +1,37 @@
/**
* This file has been autogenerated as it didn't exist or was made for an older incompatible version.
* This file can be used for manual configuration will not be modified if the flowDefaults constant exists.
*/
const merge = require('webpack-merge');
const flowDefaults = require('./webpack.generated.js');
module.exports = merge(flowDefaults, {
});
/**
* This file can be used to configure the flow plugin defaults.
* <code>
* // Add a custom plugin
* flowDefaults.plugins.push(new MyPlugin());
*
* // Update the rules to also transpile `.mjs` files
* if (!flowDefaults.module.rules[0].test) {
* throw "Unexpected structure in generated webpack config";
* }
* flowDefaults.module.rules[0].test = /\.m?js$/
*
* // Include a custom JS in the entry point in addition to generated-flow-imports.js
* if (typeof flowDefaults.entry.index != "string") {
* throw "Unexpected structure in generated webpack config";
* }
* flowDefaults.entry.index = [flowDefaults.entry.index, "myCustomFile.js"];
* </code>
* or add new configuration in the merge block.
* <code>
* module.exports = merge(flowDefaults, {
* mode: 'development',
* devtool: 'inline-source-map'
* });
* </code>
*/

312
webpack.generated.js Normal file
View File

@ -0,0 +1,312 @@
/**
* NOTICE: this is an auto-generated file
*
* This file has been generated by the `flow:prepare-frontend` maven goal.
* This file will be overwritten on every run. Any custom changes should be made to webpack.config.js
*/
const fs = require('fs');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const {BabelMultiTargetPlugin} = require('webpack-babel-multi-target-plugin');
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
// Flow plugins
const StatsPlugin = require('@vaadin/stats-plugin');
const ThemeLiveReloadPlugin = require('@vaadin/theme-live-reload-plugin');
const { ApplicationThemePlugin, processThemeResources, extractThemeName, findParentThemes } = require('@vaadin/application-theme-plugin');
const path = require('path');
const baseDir = path.resolve(__dirname);
// the folder of app resources (main.js and flow templates)
// this matches /themes/my-theme/ and is used to check css url handling and file path build.
const themePartRegex = /(\\|\/)themes\1[\s\S]*?\1/;
const frontendFolder = require('path').resolve(__dirname, 'frontend');
const fileNameOfTheFlowGeneratedMainEntryPoint = require('path').resolve(__dirname, 'target/frontend/generated-flow-imports.js');
const mavenOutputFolderForFlowBundledFiles = require('path').resolve(__dirname, '');
const devmodeGizmoJS = '@vaadin/flow-frontend/VaadinDevmodeGizmo.js'
// public path for resources, must match Flow VAADIN_BUILD
const build = 'build';
// public path for resources, must match the request used in flow to get the /build/stats.json file
const config = 'config';
// folder for outputting index.js bundle, etc.
const buildFolder = `${mavenOutputFolderForFlowBundledFiles}/${build}`;
// folder for outputting stats.json
const confFolder = `${mavenOutputFolderForFlowBundledFiles}/${config}`;
// file which is used by flow to read templates for server `@Id` binding
const statsFile = `${confFolder}/stats.json`;
// Folders in the project which can contain static assets.
const projectStaticAssetsFolders = [
path.resolve(__dirname, 'src', 'main', 'resources', 'META-INF', 'resources'),
path.resolve(__dirname, 'src', 'main', 'resources', 'static'),
frontendFolder
];
const projectStaticAssetsOutputFolder = require('path').resolve(__dirname, '../VAADIN/static');
// Folders in the project which can contain application themes
const themeProjectFolders = projectStaticAssetsFolders.map((folder) =>
path.resolve(folder, 'themes')
);
// Target flow-fronted auto generated to be the actual target folder
const flowFrontendFolder = require('path').resolve(__dirname, 'target/frontend');
// make sure that build folder exists before outputting anything
const mkdirp = require('mkdirp');
const devMode = process.argv.find(v => v.indexOf('webpack-dev-server') >= 0);
!devMode && mkdirp(buildFolder);
mkdirp(confFolder);
let stats;
const transpile = !devMode || process.argv.find(v => v.indexOf('--transpile-es5') >= 0);
const watchDogPrefix = '--watchDogPort=';
let watchDogPort = devMode && process.argv.find(v => v.indexOf(watchDogPrefix) >= 0);
let client;
if (watchDogPort) {
watchDogPort = watchDogPort.substr(watchDogPrefix.length);
const runWatchDog = () => {
client = new require('net').Socket();
client.setEncoding('utf8');
client.on('error', function () {
console.log("Watchdog connection error. Terminating webpack process...");
client.destroy();
process.exit(0);
});
client.on('close', function () {
client.destroy();
runWatchDog();
});
client.connect(watchDogPort, 'localhost');
}
runWatchDog();
}
const flowFrontendThemesFolder = path.resolve(flowFrontendFolder, 'themes');
const themeOptions = {
devMode: devMode,
// The following matches target/frontend/themes/theme-generated.js
// and for theme in JAR that is copied to target/frontend/themes/
themeResourceFolder: flowFrontendThemesFolder,
themeProjectFolders: themeProjectFolders,
projectStaticAssetsOutputFolder: projectStaticAssetsOutputFolder,
};
let themeName = undefined;
let themeWatchFolders = undefined;
if (devMode) {
// Current theme name is being extracted from theme-generated.js located in
// target/frontend/themes folder
themeName = extractThemeName(flowFrontendThemesFolder);
const parentThemePaths = findParentThemes(themeName, themeOptions);
const currentThemeFolders = [...projectStaticAssetsFolders
.map((folder) => path.resolve(folder, "themes", themeName)),
path.resolve(flowFrontendThemesFolder, themeName)];
// Watch the components folders for component styles update in both
// current theme and parent themes. Other folders or CSS files except
// 'styles.css' should be referenced from `styles.css` anyway, so no need
// to watch them.
themeWatchFolders = [...currentThemeFolders, ...parentThemePaths]
.map((themeFolder) => path.resolve(themeFolder, "components"));
}
const processThemeResourcesCallback = (logger) => processThemeResources(themeOptions, logger);
exports = {
frontendFolder: `${frontendFolder}`,
buildFolder: `${buildFolder}`,
confFolder: `${confFolder}`
};
module.exports = {
mode: 'production',
context: frontendFolder,
entry: {
bundle: fileNameOfTheFlowGeneratedMainEntryPoint,
...(devMode && { gizmo: devmodeGizmoJS })
},
output: {
filename: `${build}/vaadin-[name]-[contenthash].cache.js`,
path: mavenOutputFolderForFlowBundledFiles,
publicPath: 'VAADIN/',
},
resolve: {
// Search for import 'x/y' inside these folders, used at least for importing an application theme
modules: [
'node_modules',
flowFrontendFolder,
...projectStaticAssetsFolders,
],
extensions: ['.ts', '.js'],
alias: {
Frontend: frontendFolder
}
},
devServer: {
// webpack-dev-server serves ./ , webpack-generated, and java webapp
contentBase: [mavenOutputFolderForFlowBundledFiles, 'src/main/webapp'],
after: function(app, server) {
app.get(`/stats.json`, function(req, res) {
res.json(stats);
});
app.get(`/stats.hash`, function(req, res) {
res.json(stats.hash.toString());
});
app.get(`/assetsByChunkName`, function(req, res) {
res.json(stats.assetsByChunkName);
});
app.get(`/stop`, function(req, res) {
// eslint-disable-next-line no-console
console.log("Stopped 'webpack-dev-server'");
process.exit(0);
});
}
},
module: {
rules: [
{
test: /\.tsx?$/,
use: ['ts-loader']
},
...(transpile ? [{ // Files that Babel has to transpile
test: /\.js$/,
use: [BabelMultiTargetPlugin.loader()]
}] : []),
{
test: /\.css$/i,
use: [
{
loader: 'css-loader',
options: {
url: (url, resourcePath) => {
// Only translate files from node_modules
const resolve = resourcePath.match(/(\\|\/)node_modules\1/)
&& fs.existsSync(path.resolve(path.dirname(resourcePath), url));
const themeResource = resourcePath.match(themePartRegex) && url.match(/^themes\/[\s\S]*?\//);
return resolve || themeResource;
},
// use theme-loader to also handle any imports in css files
importLoaders: 1
},
},
{
// theme-loader will change any url starting with './' to start with 'VAADIN/static' instead
// NOTE! this loader should be here so it's run before css-loader as loaders are applied Right-To-Left
loader: '@vaadin/theme-loader',
options: {
devMode: devMode
}
}
],
},
{
// File-loader only copies files used as imports in .js files or handled by css-loader
test: /\.(png|gif|jpg|jpeg|svg|eot|woff|woff2|otf|ttf)$/,
use: [{
loader: 'file-loader',
options: {
outputPath: 'static/',
name(resourcePath, resourceQuery) {
if (resourcePath.match(/(\\|\/)node_modules\1/)) {
return /(\\|\/)node_modules\1(?!.*node_modules)([\S]+)/.exec(resourcePath)[2].replace(/\\/g, "/");
}
if (resourcePath.match(/(\\|\/)frontend\1/)) {
return /(\\|\/)frontend\1(?!.*frontend)([\S]+)/.exec(resourcePath)[2].replace(/\\/g, "/");
}
return '[path][name].[ext]';
}
}
}],
},
]
},
performance: {
maxEntrypointSize: 2097152, // 2MB
maxAssetSize: 2097152 // 2MB
},
plugins: [
// Generate compressed bundles when not devMode
...(devMode ? [] : [new CompressionPlugin()]),
// Transpile with babel, and produce different bundles per browser
...(transpile ? [new BabelMultiTargetPlugin({
babel: {
plugins: [
// workaround for Safari 10 scope issue (https://bugs.webkit.org/show_bug.cgi?id=159270)
"@babel/plugin-transform-block-scoping",
// Edge does not support spread '...' syntax in object literals (#7321)
"@babel/plugin-proposal-object-rest-spread"
],
presetOptions: {
useBuiltIns: false // polyfills are provided from webcomponents-loader.js
}
},
targets: {
'es6': { // Evergreen browsers
browsers: [
// It guarantees that babel outputs pure es6 in bundle and in stats.json
// In the case of browsers no supporting certain feature it will be
// covered by the webcomponents-loader.js
'last 1 Chrome major versions'
],
},
'es5': { // IE11
browsers: [
'ie 11'
],
tagAssetsWithKey: true, // append a suffix to the file name
}
}
})] : []),
new ApplicationThemePlugin(themeOptions),
...(devMode && themeName ? [new ExtraWatchWebpackPlugin({
files: [],
dirs: themeWatchFolders
}), new ThemeLiveReloadPlugin(processThemeResourcesCallback)] : []),
new StatsPlugin({
devMode: devMode,
statsFile: statsFile,
setResults: function (statsFile) {
stats = statsFile;
}
}),
// Generates the stats file for flow `@Id` binding.
function (compiler) {
compiler.hooks.done.tapAsync('FlowIdPlugin', (compilation, done) => {
// trigger live reload via server
if (client) {
client.write('reload\n');
}
done();
});
},
// Copy webcomponents polyfills. They are not bundled because they
// have its own loader based on browser quirks.
new CopyWebpackPlugin([{
from: `${baseDir}/node_modules/@webcomponents/webcomponentsjs`,
to: `${build}/webcomponentsjs/`
}]),
]
};