X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=blobdiff_plain;f=node_modules%2Fnode-pty%2Fscripts%2Fpost-install.js;fp=node_modules%2Fnode-pty%2Fscripts%2Fpost-install.js;h=2c026ee5d756c97ce3cddb897a66a76f70f17386;hp=0000000000000000000000000000000000000000;hb=e79e4a5a87f3e84f7c1777f10a954453a69bf540;hpb=4339da12467b75fb8b6ca831f4bf0081c485ed2c diff --git a/node_modules/node-pty/scripts/post-install.js b/node_modules/node-pty/scripts/post-install.js new file mode 100644 index 0000000..2c026ee --- /dev/null +++ b/node_modules/node-pty/scripts/post-install.js @@ -0,0 +1,41 @@ +var fs = require('fs'); +var path = require('path'); + +var RELEASE_DIR = path.join(__dirname, '..', 'build', 'Release'); +var BUILD_FILES = [ + path.join(RELEASE_DIR, 'conpty.node'), + path.join(RELEASE_DIR, 'conpty.pdb'), + path.join(RELEASE_DIR, 'conpty_console_list.node'), + path.join(RELEASE_DIR, 'conpty_console_list.pdb'), + path.join(RELEASE_DIR, 'pty.node'), + path.join(RELEASE_DIR, 'pty.pdb'), + path.join(RELEASE_DIR, 'winpty-agent.exe'), + path.join(RELEASE_DIR, 'winpty-agent.pdb'), + path.join(RELEASE_DIR, 'winpty.dll'), + path.join(RELEASE_DIR, 'winpty.pdb') +]; + +cleanFolderRecursive = function(folder) { + var files = []; + if( fs.existsSync(folder) ) { + files = fs.readdirSync(folder); + files.forEach(function(file,index) { + var curPath = path.join(folder, file); + if(fs.lstatSync(curPath).isDirectory()) { // recurse + cleanFolderRecursive(curPath); + fs.rmdirSync(curPath); + } else if (BUILD_FILES.indexOf(curPath) < 0){ // delete file + fs.unlinkSync(curPath); + } + }); + } +}; + +try { + cleanFolderRecursive(RELEASE_DIR); +} catch(e) { + console.log(e); + //process.exit(1); +} finally { + process.exit(0); +}