Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const purge = async (filePath: string): Promise => {
const configs: IGulpConfigs = global.gulpConfigs || await getConfigs(settings);
const sppurgeOptions: IPurgeOptions = {
folder: configs.appConfig.spFolder,
localFilePath: filePath,
localBasePath: configs.appConfig.distFolder
};
sppurge(configs.privateConf as any, sppurgeOptions)
// .then(res => {
// if (res.statusCode) {
// console.log('File has been deleted:', res.statusMessage);
// } else {
// console.log(res.statusCode, res.statusMessage);
// }
// })
.catch((err) => {
if ((err.error || { error: { code: '' } }).error.code.split(',')[0] === '-2146232832') {
console.log('File has not been removed as it was not there in SharePoint.');
} else {
console.log('Error:', err.message);
}
});
};
constructor (settings: IDeploySettings) {
this.settings = {
...settings,
dist: settings.dist || './dist'
};
this.sppurge = new Delete();
this.spr = createRequest(this.settings.creds);
}