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
config/
src/main/resources/static/js/bundle.js
src/main/javascript/node/

View File

@ -1,6 +1,4 @@
<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">
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
@ -134,6 +132,64 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<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>

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",
"promise-worker": "^2.0.1",
"sjcl": "^1.0.8",
"sprintf-js": "^1.1.2",
"tsify": "^4.0.1",
"typescript": "^3.7.3"
"sprintf-js": "^1.1.2"
},
"devDependencies": {
"browserify": "^16.5.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": {
"transform": [
@ -39,5 +41,8 @@
"sjcl": "global:sjcl",
"sprintf-js": "global:sprintf",
"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