added grunt and maven frontend tasks

This commit is contained in:
Rohan Sircar 2020-01-14 15:43:57 +05:30
parent 8f056149cc
commit 8edca9a847
7 changed files with 1213 additions and 176 deletions

1
chatto/.gitignore vendored
View File

@ -34,3 +34,4 @@ build/
src/main/javascript/node_modules src/main/javascript/node_modules
config/ config/
src/main/resources/static/js/bundle.js src/main/resources/static/js/bundle.js
src/main/javascript/node/

View File

@ -1,140 +1,196 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <modelVersion>4.0.0</modelVersion>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent>
<modelVersion>4.0.0</modelVersion> <groupId>org.springframework.boot</groupId>
<parent> <artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId> <version>2.1.8.RELEASE</version>
<artifactId>spring-boot-starter-parent</artifactId> <relativePath /> <!-- lookup parent from repository -->
<version>2.1.8.RELEASE</version> </parent>
<relativePath /> <!-- lookup parent from repository --> <groupId>org.ros</groupId>
</parent> <artifactId>Chatto</artifactId>
<groupId>org.ros</groupId> <version>0.0.1-SNAPSHOT</version>
<artifactId>Chatto</artifactId> <packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version> <name>chatto</name>
<packaging>jar</packaging> <description>Demo project for Spring Boot</description>
<name>chatto</name>
<description>Demo project for Spring Boot</description>
<properties> <properties>
<java.version>11</java.version> <java.version>11</java.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId> <artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId> <artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId> <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId> <artifactId>spring-boot-starter-security</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId> <artifactId>spring-security-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.ulisesbocchio</groupId> <groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId> <artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.1.2</version> <version>2.1.2</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok --> <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.modelmapper/modelmapper --> <!-- https://mvnrepository.com/artifact/org.modelmapper/modelmapper -->
<dependency> <dependency>
<groupId>org.modelmapper</groupId> <groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId> <artifactId>modelmapper</artifactId>
<version>2.3.5</version> <version>2.3.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId> <artifactId>spring-boot-starter-cache</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.ehcache/ehcache --> <!-- https://mvnrepository.com/artifact/org.ehcache/ehcache -->
<dependency> <dependency>
<groupId>org.ehcache</groupId> <groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId> <artifactId>ehcache</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/javax.cache/cache-api --> <!-- https://mvnrepository.com/artifact/javax.cache/cache-api -->
<dependency> <dependency>
<groupId>javax.cache</groupId> <groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId> <artifactId>cache-api</artifactId>
</dependency> </dependency>
<!-- <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <!-- <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId>
<version>2.2.11</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <version>2.2.11</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId> <version>2.2.11</version> </dependency> --> <artifactId>jaxb-core</artifactId> <version>2.2.11</version> </dependency> -->
<!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity5 --> <!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity5 -->
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api --> <!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
<dependency> <dependency>
<groupId>javax.xml.bind</groupId> <groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId> <artifactId>jaxb-api</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.glassfish.jaxb</groupId> <groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId> <artifactId>jaxb-runtime</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.thymeleaf.extras</groupId> <groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId> <artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/net.sf.ehcache/ehcache --> <!-- https://mvnrepository.com/artifact/net.sf.ehcache/ehcache -->
<!-- <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <!-- <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId>
</dependency> --> </dependency> -->
<!-- <dependency> <groupId>javax.cache</groupId> <artifactId>cache-api</artifactId> <!-- <dependency> <groupId>javax.cache</groupId> <artifactId>cache-api</artifactId>
<version>1.1.0</version> </dependency> --> <version>1.1.0</version> </dependency> -->
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
</plugins> <plugin>
</build> <groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<!-- Use the latest released version:
https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
<version>1.9.1</version>
<configuration>
<workingDirectory>src/main/javascript/</workingDirectory>
</configuration>
<executions>
<execution>
<id>install node and yarn</id>
<goals>
<goal>install-node-and-yarn</goal>
</goals>
<configuration>
<!-- See https://nodejs.org/en/download/ for latest node and npm (lts) versions -->
<nodeVersion>v12.10.0</nodeVersion>
<yarnVersion>v1.21.1</yarnVersion>
</configuration>
</execution>
<execution>
<id>yarn install</id>
<goals>
<goal>yarn</goal>
</goals>
</execution>
<execution>
<id>watch</id>
<goals>
<goal>yarn</goal>
</goals>
<phase>none</phase>
<configuration>
<arguments>run watch</arguments>
</configuration>
</execution>
<execution>
<id>grunt browserify</id>
<goals>
<goal>grunt</goal>
</goals>
<!-- optional: the default phase is "generate-resources" -->
<phase>generate-resources</phase>
<configuration>
<!-- optional: if not specified, it will run Grunt's default
task (and you can remove this whole <configuration> section.) -->
<arguments>browserify</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -0,0 +1,45 @@
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// uglify: {
// options: {
// banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
// },
// build: {
// src: 'src/<%= pkg.name %>.js',
// dest: 'build/<%= pkg.name %>.min.js'
// }
// },
browserify: {
main: {
src: 'ts/src/main.ts',
dest: '../resources/static/js/bundle.js'
},
options: {
plugin: [
['tsify', { target: 'es2017', noImplicitAny: true }], // register plugin by name
],
browserifyOptions: {
debug: true
},
}
}
});
// Load the plugin that provides the "uglify" task.
// grunt.loadNpmTasks('grunt-contrib-uglify');
// // Default task(s).
// grunt.registerTask('default', ['uglify']);
grunt.loadNpmTasks('grunt-browserify')
grunt.registerTask('default', ['browserify'])
};

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Webpack App</title>
</head>
<body>
<script type="text/javascript" src="bundle.js"></script></body>
</html>

View File

@ -16,14 +16,16 @@
"markdown-it": "^10.0.0", "markdown-it": "^10.0.0",
"promise-worker": "^2.0.1", "promise-worker": "^2.0.1",
"sjcl": "^1.0.8", "sjcl": "^1.0.8",
"sprintf-js": "^1.1.2", "sprintf-js": "^1.1.2"
"tsify": "^4.0.1",
"typescript": "^3.7.3"
}, },
"devDependencies": { "devDependencies": {
"browserify": "^16.5.0", "browserify": "^16.5.0",
"browserify-css": "^0.15.0", "browserify-css": "^0.15.0",
"browserify-shim": "^3.8.14" "browserify-shim": "^3.8.14",
"grunt": "^1.0.4",
"grunt-browserify": "^5.3.0",
"tsify": "^4.0.1",
"typescript": "^3.7.4"
}, },
"browserify": { "browserify": {
"transform": [ "transform": [
@ -39,5 +41,8 @@
"sjcl": "global:sjcl", "sjcl": "global:sjcl",
"sprintf-js": "global:sprintf", "sprintf-js": "global:sprintf",
"alertifyjs": "global:alertify" "alertifyjs": "global:alertify"
},
"scripts": {
"watch": "watchify ts/src/main.ts -p [ tsify --target es2017 --noImplicitAny ] --debug -o ../resources/static/js/bundle.js"
} }
} }

File diff suppressed because it is too large Load Diff