openvidu-components: Reduced bundle size compressing code

pull/780/head
Carlos Santos 2023-02-24 12:08:54 +01:00
parent 90dfd60a06
commit 0cab779c8e
3 changed files with 662 additions and 12630 deletions

View File

@ -0,0 +1,20 @@
const glob = require('glob');
const { readFileSync, writeFileSync } = require('fs');
const { minify } = require('uglify-js');
const options = {
mangle: true,
compress: true,
toplevel: false,
output: {
comments: false
}
};
glob('dist/openvidu-angular/**/*.mjs', {}, function (er, files) {
files.forEach(function (file) {
const code = readFileSync(file, 'utf8');
const result = minify(code, options);
writeFileSync(file, result.code, 'utf8');
});
});

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,7 @@
"codelyzer": "6.0.2",
"concat": "^1.0.3",
"cross-env": "^7.0.3",
"glob": "^8.1.0",
"http-server": "14.1.1",
"jasmine-core": "3.10.1",
"jasmine-spec-reporter": "7.0.0",
@ -50,6 +51,7 @@
"ts-node": "10.4.0",
"tslint": "6.1.3",
"typescript": "4.8.4",
"uglify-js": "^3.17.4",
"webpack-bundle-analyzer": "^4.5.0"
},
"name": "openvidu-components-testapp",
@ -60,7 +62,8 @@
"doc:build": "npx compodoc -c ./projects/openvidu-angular/doc/.compodocrc.json",
"doc:clean-copy": "rm -rf ../../openvidu.io-docs/docs/api/openvidu-angular && cp -r ./docs/openvidu-angular/ ../../openvidu.io-docs/docs/api/openvidu-angular",
"doc:serve": "npx compodoc --watch --serve -c ./projects/openvidu-angular/doc/.compodocrc.json",
"lib:build": "ng build openvidu-angular --configuration production && cd ./dist/openvidu-angular && npm pack",
"lib:build": "ng build openvidu-angular --configuration production && npm run lib:compress && cd ./dist/openvidu-angular && npm pack",
"lib:compress": "node ./openvidu-angular-compress.js",
"lib:copy": "cp dist/openvidu-angular/openvidu-angular-*.tgz ../../openvidu-tutorials/openvidu-call/openvidu-call-front",
"lib:e2e": "tsc --project ./e2e && npx mocha --recursive --timeout 30000 ./e2e/dist/angular.test.js",
"lib:e2e-ci": "cross-env LAUNCH_MODE=CI npm run lib:e2e",