Skip to content

Commit

Permalink
added primitive build size reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
inlife committed Feb 8, 2019
1 parent 2d20c14 commit b3544e5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
24 changes: 24 additions & 0 deletions misc/reduce.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const fs = require('fs')
const path = require('path')

/**
* Remove directory recursively
*/
const rm = (target) => {
if (!fs.existsSync(target)) return;

fs.readdirSync(target).map(entry => {
const entryPath = path.join(target, entry);
const result = fs.lstatSync(entryPath).isDirectory()
? rm(entryPath)
: fs.unlinkSync(entryPath)
})

fs.rmdirSync(target)
}


const bin = path.join(__dirname, '..', 'packages', 'nexrender-action-encode', 'node_modules', 'ffmpeg-static', 'bin')

rm(path.join(bin, 'linux'))
rm(path.join(bin, 'win32', 'ia32'))
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"pkg-worker": "NEXRENDER_REQUIRE_PLUGINS=1 pkg packages/nexrender-worker/package.json --out-path bin/",
"pkg-server": "pkg packages/nexrender-server/package.json --out-path bin/",
"pkg-prelink": "lerna exec --scope @nexrender/core 'npm run pkg-prelink'",
"pkg": "npm run pkg-prelink && npm run pkg-cli && npm run pkg-server && npm run pkg-worker && npm run pkg-rename",
"pkg-reduce": "node misc/reduce.js",
"pkg": "npm run pkg-prelink && npm run pkg-reduce && npm run pkg-cli && npm run pkg-server && npm run pkg-worker && npm run pkg-rename",
"test": "lerna bootstrap && node test.js"
},
"devDependencies": {
Expand Down

0 comments on commit b3544e5

Please sign in to comment.