-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathGruntfile.js
88 lines (86 loc) · 2.92 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const path = require('path');
const pluginNodeResolve = require('@rollup/plugin-node-resolve');
const pluginEslint = require('@rollup/plugin-eslint');
const pluginJson = require('@rollup/plugin-json');
const pluginBuble = require('@rollup/plugin-buble');
const pluginReplace = require('@rollup/plugin-replace');
const pluginCommonjs = require('@rollup/plugin-commonjs');
const rollupTask = require('./src/grunt-rollup/tasks/rollup.js');
module.exports = function(grunt) {
grunt.initConfig({
watch: {
scripts: {
files: ['**/*.js'],
tasks: ['rollup'],
options: {
spawn: false,
},
},
},
copy: {
mocha: {
files: [
{
expand: true,
cwd: path.dirname(require.resolve('mocha/mocha')),
src: 'mocha.css',
dest: 'test/',
filter: 'isFile'
},
{
expand: true,
cwd: './dist',
src: 'humhub-editor.js',
dest: 'test/',
filter: 'isFile'
},
]
}
},
rollup: {
options: {
format: 'iife',
generatedCode: "es2015",
compact: true,
// sourcemap: true,
plugins: [
pluginEslint({
throwOnError: true,
throwOnWarning: false,
include: ['src/**/*.js'],
exclude: ['node_modules/**'],
}),
pluginNodeResolve({
preferBuiltins: false,
extensions: ['.js', '.json'],
}),
pluginJson(),
pluginCommonjs(),
pluginBuble({
objectAssign: 'Object.assign',
transforms: {
'forOf': false,
'generator': false
},
exclude: [
'node_modules/@lezer/**'
]
}),
pluginReplace({
'process.env.NODE_ENV': JSON.stringify( 'development' ),
'preventAssignment': true
})
]
},
pm: {
files: {
'dist/humhub-editor.js': ['src/editor/index.js']
}
}
}
});
rollupTask(grunt)
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', ['rollup', 'copy']);
};