Added admin bundle to grunt build
This commit is contained in:
parent
9119fe57f3
commit
795ca1b682
114
Gruntfile.js
114
Gruntfile.js
@ -1,20 +1,23 @@
|
|||||||
module.exports = function (grunt) {
|
module.exports = function (grunt) {
|
||||||
|
|
||||||
// Project configuration.
|
// Project configuration.
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
pkg: grunt.file.readJSON('package.json'),
|
pkg: grunt.file.readJSON("package.json"),
|
||||||
terser: {
|
terser: {
|
||||||
options: {
|
options: {
|
||||||
// Task-specific options go here.
|
// Task-specific options go here.
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
// Target-specific file lists and/or options go here.
|
// Target-specific file lists and/or options go here.
|
||||||
src: 'src/main/resources/static/js/bundle.js',
|
src: "src/main/resources/static/js/bundle.js",
|
||||||
dest: 'src/main/resources/static/js/bundle.min.js'
|
dest: "src/main/resources/static/js/bundle.min.js",
|
||||||
},
|
},
|
||||||
chat_worker: {
|
chat_worker: {
|
||||||
src: 'src/main/resources/static/js/worker.js',
|
src: "src/main/resources/static/js/worker.js",
|
||||||
dest: 'src/main/resources/static/js/worker.js'
|
dest: "src/main/resources/static/js/worker.js",
|
||||||
|
},
|
||||||
|
admin_bundle: {
|
||||||
|
src: "src/main/resources/static/js/adminBundle.js",
|
||||||
|
dest: "src/main/resources/static/js/adminBundle.min.js",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
banner: `
|
banner: `
|
||||||
@ -28,70 +31,107 @@ module.exports = function (grunt) {
|
|||||||
usebanner: {
|
usebanner: {
|
||||||
dist: {
|
dist: {
|
||||||
options: {
|
options: {
|
||||||
position: 'top',
|
position: "top",
|
||||||
banner: '/*! <%= banner %> */ '
|
banner: "/*! <%= banner %> */ ",
|
||||||
},
|
},
|
||||||
files: {
|
files: {
|
||||||
src: ['src/main/resources/static/js/bundle.min.js', 'src/main/resources/static/js/worker.js']
|
src: [
|
||||||
}
|
"src/main/resources/static/js/bundle.min.js",
|
||||||
}
|
"src/main/resources/static/js/adminBundle.min.js",
|
||||||
|
"src/main/resources/static/js/worker.js",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
browserify: {
|
browserify: {
|
||||||
chat_worker_dev: {
|
chat_worker_dev: {
|
||||||
src: 'src/main/frontend/workers/encryption-worker/main.ts',
|
src: "src/main/frontend/workers/encryption-worker/main.ts",
|
||||||
dest: 'src/main/resources/static/js/worker.js',
|
dest: "src/main/resources/static/js/worker.js",
|
||||||
options: {
|
options: {
|
||||||
browserifyOptions: {
|
browserifyOptions: {
|
||||||
debug: true
|
debug: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
dev: {
|
dev: {
|
||||||
src: 'src/main/frontend/chat/main.ts',
|
src: "src/main/frontend/chat/main.ts",
|
||||||
dest: 'src/main/resources/static/js/bundle.js',
|
dest: "src/main/resources/static/js/bundle.js",
|
||||||
options: {
|
options: {
|
||||||
browserifyOptions: {
|
browserifyOptions: {
|
||||||
debug: true
|
debug: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
prod: {
|
prod: {
|
||||||
src: 'src/main/frontend/chat/main.ts',
|
src: "src/main/frontend/chat/main.ts",
|
||||||
dest: 'src/main/resources/static/js/bundle.js',
|
dest: "src/main/resources/static/js/bundle.js",
|
||||||
banner: '/*! Chat.js <%= grunt.template.today("yyyy-mm-dd") %> */ ',
|
banner: '/*! Chat.js <%= grunt.template.today("yyyy-mm-dd") %> */ ',
|
||||||
options: {
|
options: {
|
||||||
browserifyOptions: {
|
browserifyOptions: {
|
||||||
debug: false
|
debug: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
chat_worker_prod: {
|
chat_worker_prod: {
|
||||||
src: 'src/main/frontend/workers/encryption-worker/main.ts',
|
src: "src/main/frontend/workers/encryption-worker/main.ts",
|
||||||
dest: 'src/main/resources/static/js/worker.min.js',
|
dest: "src/main/resources/static/js/worker.min.js",
|
||||||
|
},
|
||||||
|
admin_bundle_dev: {
|
||||||
|
src: "src/main/frontend/admin/main.ts",
|
||||||
|
dest: "src/main/resources/static/js/adminBundle.js",
|
||||||
|
options: {
|
||||||
|
browserifyOptions: {
|
||||||
|
debug: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
admin_bundle_prod: {
|
||||||
|
src: "src/main/frontend/admin/main.ts",
|
||||||
|
dest: "src/main/resources/static/js/adminBundle.js",
|
||||||
|
banner: '/*! Chat.js <%= grunt.template.today("yyyy-mm-dd") %> */ ',
|
||||||
|
options: {
|
||||||
|
browserifyOptions: {
|
||||||
|
debug: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
plugin: [
|
plugin: [
|
||||||
['tsify', { target: 'ES6', noImplicitAny: true, esModuleInterop: true, allowSyntheticDefaultImports: true }], // register plugin by name
|
[
|
||||||
|
"tsify",
|
||||||
|
{
|
||||||
|
target: "ES6",
|
||||||
|
noImplicitAny: true,
|
||||||
|
esModuleInterop: true,
|
||||||
|
allowSyntheticDefaultImports: true,
|
||||||
|
},
|
||||||
|
], // register plugin by name
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
browserifyOptions: {},
|
browserifyOptions: {},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load the plugin that provides the "uglify" task.
|
// Load the plugin that provides the "uglify" task.
|
||||||
grunt.loadNpmTasks('grunt-terser');
|
grunt.loadNpmTasks("grunt-terser");
|
||||||
|
|
||||||
// // Default task(s).
|
// // Default task(s).
|
||||||
// grunt.registerTask('default', ['uglify']);
|
// grunt.registerTask('default', ['uglify']);
|
||||||
|
|
||||||
grunt.loadNpmTasks('grunt-browserify')
|
grunt.loadNpmTasks("grunt-browserify");
|
||||||
grunt.loadNpmTasks('grunt-banner');
|
grunt.loadNpmTasks("grunt-banner");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
grunt.registerTask('default', ['browserify:dev', 'browserify:chat_worker_dev'])
|
|
||||||
grunt.registerTask('prod', ["browserify:prod", 'browserify:chat_worker_dev', "terser", 'usebanner'])
|
|
||||||
|
|
||||||
|
grunt.registerTask("default", [
|
||||||
|
"browserify:dev",
|
||||||
|
"browserify:chat_worker_dev",
|
||||||
|
"browserify:admin_bundle_dev",
|
||||||
|
]);
|
||||||
|
grunt.registerTask("prod", [
|
||||||
|
"browserify:prod",
|
||||||
|
"browserify:chat_worker_dev",
|
||||||
|
"browserify:admin_bundle_prod",
|
||||||
|
"terser",
|
||||||
|
"usebanner",
|
||||||
|
]);
|
||||||
};
|
};
|
@ -6,4 +6,5 @@ logging.level.org.hibernate.type.descriptor.sql.BasicBinder=INFO
|
|||||||
spring.http.log-request-details=false
|
spring.http.log-request-details=false
|
||||||
logging.level.org.springframework.cache = INFO
|
logging.level.org.springframework.cache = INFO
|
||||||
chat-bundle=bundle.min.js
|
chat-bundle=bundle.min.js
|
||||||
|
admin-bundle=adminBundle.min.js
|
||||||
chatto.frontend.log-level=INFO
|
chatto.frontend.log-level=INFO
|
@ -3,7 +3,6 @@
|
|||||||
#spring.datasource.url = jdbc:mysql://localhost:3306/chatto_db?useSSL=false
|
#spring.datasource.url = jdbc:mysql://localhost:3306/chatto_db?useSSL=false
|
||||||
#spring.datasource.username = chatto_user
|
#spring.datasource.username = chatto_user
|
||||||
#spring.datasource.password = password
|
#spring.datasource.password = password
|
||||||
|
|
||||||
chatto.datasource.username=chatto_user
|
chatto.datasource.username=chatto_user
|
||||||
chatto.datasource.password=password
|
chatto.datasource.password=password
|
||||||
chatto.datasource.database-name=chatto_db2
|
chatto.datasource.database-name=chatto_db2
|
||||||
@ -29,6 +28,7 @@ spring.cache.jcache.config=classpath:ehcache.xml
|
|||||||
logging.level.org.springframework.cache=DEBUG
|
logging.level.org.springframework.cache=DEBUG
|
||||||
chatto.token.timeout-duration=30
|
chatto.token.timeout-duration=30
|
||||||
chat-bundle=bundle.js
|
chat-bundle=bundle.js
|
||||||
|
admin-bundle=adminBundle.js
|
||||||
# spring.devtools.add-properties=false
|
# spring.devtools.add-properties=false
|
||||||
chatto.frontend.log-level=TRACE
|
chatto.frontend.log-level=TRACE
|
||||||
chatto.frontend.chat-page-size=9
|
chatto.frontend.chat-page-size=9
|
@ -42,11 +42,9 @@
|
|||||||
crossorigin="anonymous" /> -->
|
crossorigin="anonymous" /> -->
|
||||||
|
|
||||||
|
|
||||||
<script th:src="@{/js/adminBundle.js}" src="../../static/js/adminBundle.js" defer="defer"></script>
|
|
||||||
<!-- <script th:src="@{/js/admin.js}" src="../../static/js/admin.js" defer="defer"></script> -->
|
<!-- <script th:src="@{/js/admin.js}" src="../../static/js/admin.js" defer="defer"></script> -->
|
||||||
<script th:src="@{/js/sb-admin-2.js}" src="../../static/js/sb-admin-2.js" defer="defer"></script>
|
<script th:src="@{/js/sb-admin-2.js}" src="../../static/js/sb-admin-2.js" defer="defer"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js" defer></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.js" defer></script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -73,6 +71,9 @@
|
|||||||
href="../../../resources/static/css/dataTables.bootstrap4.min.css">
|
href="../../../resources/static/css/dataTables.bootstrap4.min.css">
|
||||||
<link th:href="@{/css/admin-custom.css}" href="../../static/css/admin-custom.css" rel="stylesheet">
|
<link th:href="@{/css/admin-custom.css}" href="../../static/css/admin-custom.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<script th:src="@{'/js/' + ${@environment.getProperty('admin-bundle')}}" src="../../static/js/adminBundle.js"
|
||||||
|
defer="defer"></script>
|
||||||
|
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user