UNPKG

trtc-electron-sdk

Version:

trtc electron sdk

32 lines (27 loc) 1.02 kB
const path = require('path'); const {copy, remove} = require('fs-sync'); const fs = require('fs'); const liteavPath = path.join(__dirname, '../liteav'); function deleteENFileNotToPublish(dir) { const files = fs.readdirSync(dir, {withFileTypes: true}); for (const file of files) { if (file.isFile()) { if (file.name.indexOf('_en.') !== -1) { const filePath = path.join(dir, file.name); console.log(`Remove en files not to be published: `, filePath); remove(filePath); } } else if (file.isDirectory()) { const childFilePath = path.join(dir, file.name); deleteENFileNotToPublish(childFilePath); } else { // do nothing } } } deleteENFileNotToPublish(liteavPath); remove('./npm'); copy(path.resolve('./liteav'), path.resolve('./npm/liteav')); copy(path.resolve('./scripts'), path.resolve('./npm/scripts')); copy(path.resolve('./package.json'), path.resolve('./npm/package.json')); copy(path.resolve('./README.md'), path.resolve('./npm/README.md'));