-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (41 loc) · 1.28 KB
/
gulpfile.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
const gulp = require( "gulp" );
const gulpZip = import( "gulp-zip" );
const gulpFreemius = require( "gulp-freemius-deploy" );
const rm = require( "node:fs/promises" ).rm;
const pkg = require( "./package.json" );
const freemiusConfig = require( "./fs-config.json" );
// register the freemius-deploy task
gulpFreemius( gulp, {
...freemiusConfig,
zip_name: `${ pkg.name }.v${ pkg.version }.zip`,
zip_path: "./dist/",
add_contributor: true
} );
// clean up the files created by the tasks
function clean() {
return rm( `./dist/${ pkg.name }.v${ pkg.version }.zip`, { force: true } );
}
const files = [
"**/*",
"!{dist,dist/**,dist/**/*}",
"!{node_modules,node_modules/**,node_modules/**/*}",
"!{src,src/**,src/**/*}",
"!.gitignore",
"!fs-config.json",
"!gulpfile.js",
"!make-pot.mjs",
"!copy-media.mjs",
"!package.json",
"!package-lock.json",
"!webpack.config.js"
];
// create a .zip containing just the production code for the plugin
function zip() {
return gulpZip.then( module => {
// file list is in the package.json
return gulp.src( files )
.pipe( module?.default(`${ pkg.name }.v${ pkg.version }.zip`) )
.pipe( gulp.dest( "./dist" ) );
} );
}
exports.default = gulp.series( clean, zip );