1010## Prerequisites
1111
1212In order to make use of ` gulp-exist ` you will need to have
13- [ gulp] ( https://gulpjs.com/docs/en/getting-started/quick-start ) installed (in version 4 or later).
13+ [ gulp] ( https://gulpjs.com/docs/en/getting-started/quick-start ) installed (in version 5 or later).
1414
15- And a running [ existdb] ( https://exist-db.org ) instance, of course (version 4.7 .1 or higher recommended).
15+ And a running [ existdb] ( https://exist-db.org ) instance, of course (version 4.11 .1 or higher recommended).
1616
1717## Installation
1818
@@ -27,8 +27,8 @@ npm install --save-dev gulp @existdb/gulp-exist
2727Then create a file with the name ` gulpfile.js ` in the root of your project with the following contents
2828
2929``` js
30- const {src } = require (' gulp' ),
31- {createClient} = require (' @existdb/gulp-exist' )
30+ const { src } = require (' gulp' ),
31+ { createClient } = require (' @existdb/gulp-exist' )
3232
3333// authenticate against local eXist instance for development
3434const connectionOptions = {
@@ -42,8 +42,8 @@ const exClient = createClient(connectionOptions)
4242
4343// deploy all
4444function deploy () {
45- return src (' **/*' , {cwd: ' build' })
46- .pipe (exClient .dest ({target: ' /db/apps/myapp/' }))
45+ return src (' **/*' , { cwd: ' build' , encoding : false })
46+ .pipe (exClient .dest ({ target: ' /db/apps/myapp/' }))
4747}
4848
4949exports .default = deploy
@@ -77,14 +77,14 @@ With the below setup the connection is then controlled by the variables
7777in the environment.
7878
7979``` js
80- const {src } = require (' gulp' )
81- const {createClient , readOptionsFromEnv } = require (' @existdb/gulp-exist' )
80+ const { src } = require (' gulp' )
81+ const { createClient , readOptionsFromEnv } = require (' @existdb/gulp-exist' )
8282const exClient = createClient (readOptionsFromEnv ())
8383
8484// deploy all
8585function deploy () {
86- return src (' **/*' , {cwd: ' build' })
87- .pipe (exClient .dest ({target: ' /db/apps/myapp/' }))
86+ return src (' **/*' , { cwd: ' build' , encoding : false })
87+ .pipe (exClient .dest ({ target: ' /db/apps/myapp/' }))
8888}
8989
9090exports .default = deploy
@@ -175,19 +175,22 @@ Default: `true`
175175Connecting to a remote server using a secure connection.
176176
177177``` js
178- const {createClient } = require (' @existdb/gulp-exist' )
178+ const { createClient } = require (' @existdb/gulp-exist' )
179179const exClient = createClient ({
180180 host: " my-server.tld" ,
181181 secure: true ,
182182 port: 443 ,
183- basic_auth: { user: " app" , pass: " 1 handmade eclectic eclaire" }
183+ basic_auth: {
184+ user: " app" ,
185+ pass: " 1 handmade eclectic eclaire"
186+ }
184187})
185188```
186189
187190Connecting to localhost server using a insecure connection.
188191
189192``` js
190- const {createClient } = require (' @existdb/gulp-exist' )
193+ const { createClient } = require (' @existdb/gulp-exist' )
191194const exClient = createClient ({
192195 host: " localhost" ,
193196 secure: false ,
@@ -250,7 +253,7 @@ const exist = createClient({
250253})
251254
252255function deployWithPermissions () {
253- return src (' **/*' , {cwd: ' .' })
256+ return src (' **/*' , { cwd: ' .' , encoding : false })
254257 .pipe (exist .dest ({
255258 target: ' /db/apps/myapp/' ,
256259 permissions: { ' controller.xql' : ' rwxr-xr-x' }
@@ -290,7 +293,7 @@ const exist = createClient({
290293})
291294
292295function install () {
293- return src (' spec/files/test-app.xar' )
296+ return src (' spec/files/test-app.xar' , { encoding : false } )
294297 .pipe (exist .install ())
295298}
296299```
@@ -326,9 +329,9 @@ const html5AsBinary = true // upload HTML5 templates as binary
326329
327330
328331function deployNewer () {
329- return src (' **/*' , {cwd: ' .' })
330- .pipe (exist .newer ({target}))
331- .pipe (exist .dest ({target, html5AsBinary}));
332+ return src (' **/*' , { cwd: ' .' , encoding : false })
333+ .pipe (exist .newer ({ target }))
334+ .pipe (exist .dest ({ target, html5AsBinary }));
332335}
333336
334337exports .default = deployNewer
@@ -405,14 +408,14 @@ const queryConfig = {
405408}
406409
407410function deployCollectionXConf () {
408- return src (' collection.xconf' , {cwd: ' .' })
411+ return src (' collection.xconf' , { cwd: ' .' })
409412 .pipe (exist .dest ({
410413 target: ` /db/system/config${ queryConfig .target } `
411414 }))
412415}
413416
414417function reindex () {
415- return src (' scripts/reindex.xq' , {cwd: ' .' })
418+ return src (' scripts/reindex.xq' , { cwd: ' .' })
416419 .pipe (exist .query (queryConfig))
417420 .pipe (dest (' logs' ))
418421}
@@ -457,7 +460,7 @@ const queryConfig = {
457460}
458461
459462function runQueryWithVariable () {
460- return src (' scripts/var.xq' , {cwd: ' .' })
463+ return src (' scripts/var.xq' , { cwd: ' .' })
461464 .pipe (exist .query (queryConfig))
462465 .pipe (dest (' logs' ))
463466}
@@ -514,7 +517,8 @@ const exist = createClient(connectionOptions)
514517function deployBuild () {
515518 return src (' build/**/*' , {
516519 base: ' build' ,
517- since: lastRun (deployBuild)
520+ since: lastRun (deployBuild),
521+ encoding: false
518522 })
519523 .pipe (exist .dest ({target}))
520524}
@@ -550,14 +554,14 @@ function build {
550554}
551555
552556function xar () {
553- return src (' build/**/*' , {base: ' build' })
557+ return src (' build/**/*' , { base: ' build' , encoding : false })
554558 .pipe (zip (` ${ pkg .abbrev } -${ pkg .version } .xar` ))
555559 .pipe (dest (" ." ));
556560}
557561
558562function install () {
559- return src (` ${ pkg .abbrev } -${ pkg .version } .xar` )
560- .pipe (exist .install ({packageUri: " http://myapp" }))
563+ return src (` ${ pkg .abbrev } -${ pkg .version } .xar` , { encoding : false } )
564+ .pipe (exist .install ({ packageUri: " http://myapp" }))
561565}
562566
563567exports .default = series (build, xar, install)
0 commit comments