use npm and grunt for getting js packages

This commit is contained in:
Uwe Steinmann 2020-08-26 19:07:17 +02:00
parent ead75ceea9
commit e962a33133
2 changed files with 230 additions and 0 deletions

202
Gruntfile.js Normal file
View File

@ -0,0 +1,202 @@
module.exports = function (grunt) {
'use strict';
var vendorDir = 'views/bootstrap/vendors',
nodeDir = 'node_modules';
grunt.initConfig({
clean: {
vendors: [ vendorDir ]
},
copy: {
'jquery': {
files: [{
expand: true,
src: [
nodeDir + '/jquery/dist/*'
],
dest: vendorDir + '/jquery',
flatten: true
}]
},
'chartjs': {
files: [{
expand: true,
src: [
nodeDir + '/chartjs/chart.js',
nodeDir + '/chartjs/README.md',
nodeDir + '/chartjs/LICENSE'
],
dest: vendorDir + '/chartjs',
flatten: true
}]
},
'jqtree': {
files: [{
expand: true,
src: [
nodeDir + '/jqtree/tree.jquery.js',
nodeDir + '/jqtree/jqtree.css'
],
dest: vendorDir + '/jqtree',
flatten: true
}]
},
'noty': {
files: [{
expand: true,
src: [
nodeDir + '/noty/js/noty/jquery.noty.js'
],
dest: vendorDir + '/noty',
flatten: true
},{
expand: true,
src: [
nodeDir + '/noty/js/noty/themes/*'
],
dest: vendorDir + '/noty/themes',
flatten: true
},{
expand: true,
src: [
nodeDir + '/noty/js/noty/layouts/*'
],
dest: vendorDir + '/noty/layouts',
flatten: true
}]
},
'select2': {
files: [{
expand: true,
src: [
nodeDir + '/select2/dist/js/*'
],
dest: vendorDir + '/select2/js',
flatten: true
},{
expand: true,
src: [
nodeDir + '/select2/dist/css/*'
],
dest: vendorDir + '/select2/css',
flatten: true
}]
},
'fine-uploader': {
files: [{
expand: true,
src: [
nodeDir + '/fine-uploader/jquery.fine-uploader/*'
],
dest: vendorDir + '/fine-uploader',
flatten: true
}]
},
'jquery-validation': {
files: [{
expand: true,
src: [
nodeDir + '/jquery-validation/dist/*'
],
dest: vendorDir + '/jquery-validation',
flatten: true
}]
},
'fullcalendar': {
files: [{
expand: true,
src: [
nodeDir + '/fullcalendar/LICENSE.txt',
nodeDir + '/fullcalendar/dist/*'
],
dest: vendorDir + '/fullcalendar',
flatten: true
},{
expand: true,
src: [
nodeDir + '/fullcalendar/dist/locale/*'
],
dest: vendorDir + '/fullcalendar/locale',
flatten: true
}]
},
'moment': {
files: [{
expand: true,
src: [
nodeDir + '/moment/LICENSE.txt',
nodeDir + '/moment/min/*'
],
dest: vendorDir + '/moment',
flatten: true
},{
expand: true,
src: [
nodeDir + '/moment/dist/locale/*'
],
dest: vendorDir + '/moment/locale',
flatten: true
}]
},
'bootstrap-datepicker': {
files: [{
expand: true,
src: [
nodeDir + '/bootstrap-datepicker/dist/js/*'
],
dest: vendorDir + '/bootstrap-datepicker/js',
flatten: true
},{
expand: true,
src: [
nodeDir + '/bootstrap-datepicker/dist/css/*'
],
dest: vendorDir + '/bootstrap-datepicker/css',
flatten: true
},{
expand: true,
src: [
nodeDir + '/bootstrap-datepicker/dist/locales/*'
],
dest: vendorDir + '/bootstrap-datepicker/locales',
flatten: true
}]
},
'coreui': {
files: [{
expand: true,
src: [
nodeDir + '/@coreui/coreui/dist/js/*'
],
dest: vendorDir + '/coreui/js',
flatten: true
},{
expand: true,
src: [
nodeDir + '/@coreui/coreui/dist/css/*'
],
dest: vendorDir + '/coreui/css',
flatten: true
}]
}
}
});
grunt.registerTask('createVendorDir', 'Creates the necessary vendor directory', function() {
// Create the vendorDir when it doesn't exists.
if (!grunt.file.isDir(vendorDir)) {
grunt.file.mkdir(vendorDir);
// Output a success message
grunt.log.oklns(grunt.template.process(
'Directory "<%= directory %>" was created successfully.',
{ data: { directory: vendorDir } }
));
}
});
grunt.registerTask('default', [ 'clean', 'createVendorDir', 'copy' ]);
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
};

28
package.json Normal file
View File

@ -0,0 +1,28 @@
{
"name": "seeddms",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Uwe Steinmann",
"license": "ISC",
"dependencies": {
"@coreui/coreui": "^3.2.2",
"bootstrap-datepicker": "^1.9.0",
"chartjs": "^0.3.24",
"cytoscape": "^3.15.2",
"fine-uploader": "^5.16.2",
"fullcalendar": "^3.*",
"grunt": "^1.3.0",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-copy": "^1.0.0",
"jqtree": "^1.4.12",
"jquery": "^1.12.4",
"jquery-validation": "^1.19.2",
"moment": "^2.17.1",
"noty": "^2.4.1",
"select2": "^4.0.13"
}
}