-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp-package-plugin.js
62 lines (54 loc) · 1.35 KB
/
wp-package-plugin.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
const fs = require('fs')
const archiver = require('archiver')
const filename = 'vo-html-sitemap'
const output = fs.createWriteStream(process.cwd() + '/' + filename + '.zip')
const archive = archiver('zip', {
zlib: { level: 9 } // Compression level.
})
output.on('close', function () {
console.log(archive.pointer() + ' total bytes')
console.log('archiver has been finalized and the output file descriptor has closed.')
})
output.on('end', function () {
console.log('Data has been drained')
})
archive.on('warning', function (err) {
if (err.code === 'ENOENT') {
} else {
throw err
}
})
archive.on('error', function (err) {
throw err
})
archive.pipe(output)
archive.glob('**',
{
ignore: [
'.idea',
'.babelrc',
'.git',
'.gitignore',
'.github',
'.editorconfig',
'.npmrc',
'.nvmrc',
'.prettierrc',
'webpack.config.js',
'wp-package-plugin.js',
'node_modules/**',
'assets/**',
'docker/**',
'package.json',
'package-lock.json',
'docker-compose.yml',
'Dockerfile',
'docker-compose-override.yml',
filename + '.zip'
]
},
{
prefix: filename
}
)
archive.finalize()