-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathgruntfile.js
113 lines (102 loc) · 2.51 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
var path = require('path')
module.exports = function(grunt) {
var distfiles = [
'images/**',
'lib/**',
'styles/**',
'templates/**',
'themes/**',
'node_modules/codemirror-asciidoc/**',
'node_modules/@asciidoctor/core/dist/browser/asciidoctor.min.js',
'node_modules/@asciidoctor/core/dist/css/asciidoctor.css',
'CHANGELOG.adoc',
'LICENSE.txt',
'README.adoc',
'main.js',
'package.json',
'!**/Thumbs.db'
]
var pkg = grunt.file.readJSON('package.json')
// For development and Windows only:
// extensionDir is the directory where this extension is installed
// Just run 'grunt devdeploy' to copy the distribution files
// to the brackets extension directory.
//
// In Unix environments this is not necessary. We can just use a symbolic link from
// the extension directory to the source directory.
var devExtFiles = []
if (process.platform === 'win32') {
var extensionDir = process.env.APPDATA + '/Brackets/extensions/user/' + pkg.name + '/'
devExtFiles = [extensionDir + '*']
}
grunt.initConfig({
pkg: pkg,
clean: {
/*
* clean distribution directory
*/
dist: {
options: {
dot: true
},
src: ['dist/*']
},
/*
* clean external extension directory (Windows only)
*/
dev: {
options: {
dot: true,
force: true
},
src: devExtFiles
}
},
copy: {
/**
* Copy files to dist
*/
dist: {
files: [
{
expand: true,
src: distfiles,
dest: 'dist/'
}
]
},
/**
* Copy files to brackets extension directory (Windows only)
*/
dev: {
files: [
{
expand: true,
src: distfiles,
dest: extensionDir
}
]
}
},
/**
* Create distribution zip file
*/
compress: {
main: {
options: {
archive: '<%= pkg.name %>-<%= pkg.version %>.zip'
},
files: [{ expand: true, cwd: 'dist/', src: ['**'] }]
}
}
})
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-copy')
grunt.loadNpmTasks('grunt-contrib-compress')
grunt.registerTask('default', ['dist'])
grunt.registerTask('dist', ['clean:dist', 'copy:dist', 'compress'])
// Development under Windows only
if (extensionDir) {
grunt.registerTask('devdeploy', ['clean:dev', 'copy:dev'])
}
}