2018-10-13 11:09:02 +00:00
|
|
|
module.exports = function (grunt) {
|
2019-10-23 10:12:24 +00:00
|
|
|
let version = grunt.file.readJSON('composer.json').version;
|
|
|
|
let releaseFilename = 'release-v' + version + '.zip';
|
2018-10-13 11:09:02 +00:00
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2018-06-02 20:32:14 +00:00
|
|
|
|
2018-10-13 11:09:02 +00:00
|
|
|
jshint: {
|
2019-10-23 10:12:24 +00:00
|
|
|
all: ['Gruntfile.js', 'src/js/app.js'],
|
|
|
|
options: {
|
|
|
|
'esversion': 6,
|
|
|
|
}
|
2018-10-13 11:09:02 +00:00
|
|
|
},
|
2018-06-02 20:32:14 +00:00
|
|
|
|
2018-10-13 11:09:02 +00:00
|
|
|
cssmin: {
|
|
|
|
build: {
|
|
|
|
files: {
|
|
|
|
'static/app/app.css': [
|
|
|
|
'src/css/app.css'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2018-06-02 20:32:14 +00:00
|
|
|
|
2018-10-13 11:09:02 +00:00
|
|
|
uglify: {
|
|
|
|
options: {
|
|
|
|
preserveComments: false,
|
|
|
|
compress: true
|
|
|
|
},
|
|
|
|
build: {
|
|
|
|
files: {
|
|
|
|
'static/app/app.js': [
|
|
|
|
'src/js/app.js'
|
|
|
|
],
|
2019-05-23 19:24:04 +00:00
|
|
|
'install/installer.js': [
|
|
|
|
'src/js/installer.js'
|
|
|
|
],
|
2018-10-13 11:09:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2018-06-02 20:32:14 +00:00
|
|
|
|
2018-10-13 11:09:02 +00:00
|
|
|
watch: {
|
|
|
|
css: {
|
|
|
|
files: [
|
|
|
|
'src/css/app.css'
|
|
|
|
],
|
2018-06-02 20:32:14 +00:00
|
|
|
|
2018-10-13 11:09:02 +00:00
|
|
|
tasks: ['cssmin']
|
|
|
|
},
|
|
|
|
scripts: {
|
|
|
|
files: [
|
|
|
|
'src/js/app.js',
|
2019-05-23 19:24:04 +00:00
|
|
|
'src/js/installer.js',
|
2018-10-13 11:09:02 +00:00
|
|
|
],
|
2018-06-02 20:32:14 +00:00
|
|
|
|
2018-10-13 11:09:02 +00:00
|
|
|
tasks: ['uglify']
|
|
|
|
}
|
|
|
|
},
|
2018-06-02 20:32:14 +00:00
|
|
|
|
2018-10-13 11:09:02 +00:00
|
|
|
copy: {
|
|
|
|
main: {
|
|
|
|
files: [
|
2019-01-31 10:48:39 +00:00
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'node_modules/@fortawesome/fontawesome-free',
|
2019-09-06 12:26:41 +00:00
|
|
|
src: ['css/all.min.css', 'webfonts/**/*'],
|
2019-01-31 10:48:39 +00:00
|
|
|
dest: 'static/fontawesome'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'node_modules/bootstrap/dist/css',
|
|
|
|
src: ['bootstrap.min.css'],
|
|
|
|
dest: 'static/bootstrap/css'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'node_modules/bootstrap/dist/js',
|
|
|
|
src: ['bootstrap.bundle.min.js'],
|
|
|
|
dest: 'static/bootstrap/js'
|
|
|
|
},
|
2019-02-06 21:34:56 +00:00
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'node_modules/clipboard/dist',
|
|
|
|
src: ['clipboard.min.js'],
|
|
|
|
dest: 'static/clipboardjs'
|
|
|
|
},
|
2019-01-31 10:48:39 +00:00
|
|
|
{
|
|
|
|
expand: true,
|
2019-11-13 12:53:45 +00:00
|
|
|
cwd: 'node_modules/plyr/dist',
|
|
|
|
src: ['plyr.min.js', 'plyr.css'],
|
|
|
|
dest: 'static/plyr'
|
2019-01-31 10:48:39 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'node_modules/highlightjs',
|
|
|
|
src: ['styles/**/*', 'highlight.pack.min.js'],
|
|
|
|
dest: 'static/highlightjs'
|
|
|
|
},
|
2019-11-13 15:23:10 +00:00
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
cwd: 'node_modules/dropzone/dist/min',
|
|
|
|
src: ['dropzone.min.css', 'dropzone.min.js'],
|
|
|
|
dest: 'static/dropzone'
|
|
|
|
},
|
2018-10-13 11:09:02 +00:00
|
|
|
{expand: true, cwd: 'node_modules/jquery/dist', src: ['jquery.min.js'], dest: 'static/jquery'}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
zip: {
|
2019-10-23 10:12:24 +00:00
|
|
|
[releaseFilename]: [
|
2018-10-13 23:18:02 +00:00
|
|
|
'app/**/*',
|
|
|
|
'bin/**/*',
|
|
|
|
'bootstrap/**/*',
|
2018-11-11 19:20:38 +00:00
|
|
|
'install/**/*',
|
2018-10-13 23:18:02 +00:00
|
|
|
'logs/**/',
|
|
|
|
'resources/cache',
|
|
|
|
'resources/sessions',
|
|
|
|
'resources/database',
|
2018-11-19 11:19:47 +00:00
|
|
|
'resources/lang/**/*',
|
2018-10-13 23:18:02 +00:00
|
|
|
'resources/templates/**/*',
|
|
|
|
'resources/schemas/**/*',
|
2018-11-25 15:16:43 +00:00
|
|
|
'resources/lang/**/*',
|
2018-10-13 23:18:02 +00:00
|
|
|
'static/**/*',
|
|
|
|
'vendor/**/*',
|
|
|
|
'.htaccess',
|
|
|
|
'config.example.php',
|
|
|
|
'index.php',
|
|
|
|
'composer.json',
|
2019-02-06 21:34:56 +00:00
|
|
|
'composer.lock',
|
|
|
|
'LICENSE',
|
2019-02-10 17:33:16 +00:00
|
|
|
'favicon.ico',
|
2018-10-13 23:18:02 +00:00
|
|
|
]
|
2019-05-09 10:51:33 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
shell: {
|
|
|
|
phpstan: {
|
|
|
|
command: '"./vendor/bin/phpstan" analyse app resources/lang bin install'
|
|
|
|
},
|
|
|
|
composer_no_dev: {
|
|
|
|
command: 'composer install --no-dev'
|
|
|
|
}
|
2018-10-13 11:09:02 +00:00
|
|
|
}
|
2019-05-09 10:51:33 +00:00
|
|
|
|
2018-10-13 11:09:02 +00:00
|
|
|
});
|
2018-06-02 20:32:14 +00:00
|
|
|
|
2018-10-13 11:09:02 +00:00
|
|
|
require('load-grunt-tasks')(grunt);
|
|
|
|
grunt.registerTask('default', ['jshint', 'cssmin', 'uglify', 'copy']);
|
|
|
|
grunt.registerTask('test', ['jshint']);
|
2019-05-09 10:51:33 +00:00
|
|
|
grunt.registerTask('phpstan', ['shell:phpstan']);
|
|
|
|
grunt.registerTask('composer_no_dev', ['shell:composer_no_dev']);
|
|
|
|
grunt.registerTask('build-release', ['default', 'composer_no_dev', 'zip']);
|
2018-06-02 20:32:14 +00:00
|
|
|
};
|