npm run publish
task publishes assets from local ./dist
folder to spFolder
(defined in ./config/app.json
). If you really need to change the publishing path destination from _catalogs/masterpage
to something else, e.g. SiteAssets
or Style Library
it can be done by editing ./config/app.json/spFolder
, but I recommend the defaults. When running publish task all the files from the dist folder are uploaded with spsave to SharePoint (2013 is supported as well). Then you link assets in CEWP or script link user custom action, etc.
const { sppull } = require("sppull");
const context = {
siteUrl: "xxx",
creds: {
username: "xxx",
password: "xxx"
}
};
const options = {
spRootFolder: "Shared%20Documents/SSC%20Projection/ZIP",
dlRootFolder: "W:\SCM\RawData\SSC_Proj"
};
sppull(context, options)
.then((downloadResults) => {
console.log("Files are downloaded");
console.log("For more, please check the results", JSON.stringify(downloadResults));
})
.catch((err) => {
console.log("Core error has happened", err);
});
.Folders
in sppull code base in node_mosules and logging the response.spr.post('${SCURL}/_api/web/GetFolderByServerRelativeUrl('${FolderServerRelativeUrl}')/Files/add(url='${FileName}',overwrite=true)',{
headers: {
'X-RequestDigest': digest,
'content-length':new Buffer(content).byteLength
},
body:content
})