-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile-upload-to-sharepoint.js
38 lines (33 loc) · 1.36 KB
/
gulpfile-upload-to-sharepoint.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
'use strict';
const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');
const spsync = require('gulp-spsync-creds').sync;
const environmentInfo = {
"username": "[email protected]",
"password": "pass#123",
"tenant": "postennorgeorg",
"cdnSite": "sites/MyLinkV1",
"cdnLib": "CDN/Webpart"
}
build.task('upload-to-sharepoint', {
execute: (config) => {
environmentInfo.username = config.args['username'] || environmentInfo.username;
environmentInfo.password = config.args['password'] || environmentInfo.password;
environmentInfo.tenant = config.args['tenant'] || environmentInfo.tenant;
environmentInfo.cdnSite = config.args['cdnsite'] || environmentInfo.cdnSite;
environmentInfo.cdnLib = config.args['cdnlib'] || environmentInfo.cdnLib;
return new Promise((resolve, reject) => {
const deployFolder = require('./config/copy-assets.json');
const folderLocation = `./${deployFolder.deployCdnPath}/**/*.*`;
return gulp.src(folderLocation)
.pipe(spsync({
"username": environmentInfo.username,
"password": environmentInfo.password,
"site": `https://${environmentInfo.tenant}.sharepoint.com/${environmentInfo.cdnSite}`,
"libraryPath": environmentInfo.cdnLib,
"publish": true
}))
.on('finish', resolve);
});
}
});