mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Reduced bundle size compressing code
parent
90dfd60a06
commit
0cab779c8e
|
@ -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
|
@ -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,32 +51,34 @@
|
|||
"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",
|
||||
"private": true,
|
||||
},
|
||||
"name": "openvidu-components-testapp",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "ng build openvidu-components-testapp --configuration production",
|
||||
"bundle-report": "ng build openvidu-webcomponent --stats-json --configuration production && webpack-bundle-analyzer dist/openvidu-webcomponent/stats.json",
|
||||
"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: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",
|
||||
"lib:serve": "ng build openvidu-angular --watch",
|
||||
"lib:test": "ng test openvidu-angular --no-watch --code-coverage",
|
||||
"lint": "ng lint",
|
||||
"start": "ng serve --configuration development",
|
||||
"start-prod": "npx http-server ./dist/openvidu-components-testapp/ --port 4200",
|
||||
"start:ssl": "ng serve --ssl --configuration development --host 0.0.0.0 --port 4200 --ssl-cert /path/to/cert.pem --ssl-key /path/to/key.pem",
|
||||
"webcomponent:build": "./node_modules/@angular/cli/bin/ng.js build openvidu-webcomponent --configuration production && node ./openvidu-webcomponent-build.js",
|
||||
"webcomponent:e2e": "tsc --project ./e2e && npx mocha --recursive --timeout 30000 ./e2e/dist/webcomponent.test.js",
|
||||
"webcomponent:e2e-ci": "cross-env LAUNCH_MODE=CI npm run webcomponent:e2e",
|
||||
"webcomponent:e2e-pro": "tsc --project ./e2e && npx mocha --recursive --timeout 30000 ./e2e/dist/webcomponent.pro.test.js",
|
||||
"webcomponent:e2e-pro-ci": "cross-env LAUNCH_MODE=CI npm run webcomponent:e2e-pro",
|
||||
"build": "ng build openvidu-components-testapp --configuration production",
|
||||
"bundle-report": "ng build openvidu-webcomponent --stats-json --configuration production && webpack-bundle-analyzer dist/openvidu-webcomponent/stats.json",
|
||||
"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 && 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",
|
||||
"lib:serve": "ng build openvidu-angular --watch",
|
||||
"lib:test": "ng test openvidu-angular --no-watch --code-coverage",
|
||||
"lint": "ng lint",
|
||||
"start": "ng serve --configuration development",
|
||||
"start-prod": "npx http-server ./dist/openvidu-components-testapp/ --port 4200",
|
||||
"start:ssl": "ng serve --ssl --configuration development --host 0.0.0.0 --port 4200 --ssl-cert /path/to/cert.pem --ssl-key /path/to/key.pem",
|
||||
"webcomponent:build": "./node_modules/@angular/cli/bin/ng.js build openvidu-webcomponent --configuration production && node ./openvidu-webcomponent-build.js",
|
||||
"webcomponent:e2e": "tsc --project ./e2e && npx mocha --recursive --timeout 30000 ./e2e/dist/webcomponent.test.js",
|
||||
"webcomponent:e2e-ci": "cross-env LAUNCH_MODE=CI npm run webcomponent:e2e",
|
||||
"webcomponent:e2e-pro": "tsc --project ./e2e && npx mocha --recursive --timeout 30000 ./e2e/dist/webcomponent.pro.test.js",
|
||||
"webcomponent:e2e-pro-ci": "cross-env LAUNCH_MODE=CI npm run webcomponent:e2e-pro",
|
||||
"webcomponent:serve-testapp": "npx http-server ./e2e/webcomponent-app/ && echo http://localhost:8080/?OV_URL=https://localhost:4443&OV_SECRET=MY_SECRET&prejoin=false"
|
||||
},
|
||||
},
|
||||
"version": "2.25.0"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue