Permalink
Browse files

Add size control and reduce library size

  • Loading branch information...
ai committed Nov 21, 2016
1 parent cee48f4 commit 62b258e20e1818b23ae39b9c4cd49e2495781e91
Showing with 34 additions and 18 deletions.
  1. +3 −0 .gitignore
  2. +3 −0 .npmignore
  3. +2 −3 client.js
  4. +12 −7 package.json
  5. +0 −8 test/crypto.setup.js
  6. +14 −0 webpack.config.js
View
@@ -6,3 +6,6 @@ npm-debug.log
coverage/
docs/
*.gz
bundle-report.html
View
@@ -12,3 +12,6 @@ coverage/
docs/
.jsdocrc
.yaspellerrc
*.gz
bundle-report.html
View
@@ -2,7 +2,7 @@ var BrowserConnection = require('logux-sync/browser-connection')
var createTimer = require('logux-core/create-timer')
var ClientSync = require('logux-sync/client-sync')
var Reconnect = require('logux-sync/reconnect')
var shortUUID = require('short-uuid')
var shortid = require('shortid')
var Log = require('logux-core/log')
var isQuotaExceeded = require('./is-quota-exceeded')
@@ -67,8 +67,7 @@ function Client (options) {
this.options.prefix = 'logux'
}
if (typeof this.options.nodeId === 'undefined') {
var shortId = shortUUID()
this.options.nodeId = shortId.fromUUID(shortId.uuid())
this.options.nodeId = shortid.generate()
}
var timer = this.options.timer || createTimer(this.options.nodeId)
View
@@ -12,7 +12,7 @@
"dependencies": {
"logux-core": "logux/logux-core",
"logux-sync": "logux/logux-sync",
"short-uuid": "^2.1.1"
"shortid": "^2.2.6"
},
"devDependencies": {
"docdash": "^0.4.0",
@@ -23,30 +23,35 @@
"eslint-plugin-standard": "^2.0.1",
"jest": "^17.0.0",
"jsdoc": "^3.4.3",
"json-loader": "^0.5.4",
"lint-staged": "^3.2.1",
"mock-local-storage": "^1.0.2",
"pre-commit": "^1.1.3",
"rimraf": "^2.5.4",
"uglifyjs": "^2.4.10",
"webpack": "^2.1.0-beta.27",
"webpack-bundle-analyzer": "^1.5.3",
"yaspeller": "^3.0.0"
},
"scripts": {
"lint-staged": "lint-staged",
"spellcheck": "npm run cleandocs && yaspeller *.md docs/*.html",
"cleandocs": "npm run docs && rimraf docs/*.js.html",
"clean": "rimraf docs/ coverage/",
"clean": "rimraf docs/ coverage/ bundle-report.html",
"lint": "eslint *.js test/*.js",
"docs": "jsdoc --configure .jsdocrc *.js",
"test": "jest --coverage && npm run lint && npm run spellcheck"
"test": "jest --coverage && npm run lint && npm run spellcheck",
"pack": "webpack client.js all.js",
"compress": "uglifyjs all.js -o all.js && gzip -9 -f all.js",
"show": "ls -lh *.gz | awk '{print \"Size:\", $5\"B\"}'",
"size": "npm run pack && npm run compress && npm run show && rm *.gz"
},
"jest": {
"coverageThreshold": {
"global": {
"statements": 100
}
},
"setupFiles": [
"test/crypto.setup.js"
]
}
},
"eslintConfig": {
"extends": "eslint-config-logux"
View

This file was deleted.

Oops, something went wrong.
View
@@ -0,0 +1,14 @@
var Analyzer = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
module.exports = {
module: {
loaders: [
{ test: /\.json$/, loader: 'json-loader' }
]
},
plugins: [new Analyzer({
analyzerMode: 'static',
reportFilename: 'bundle-report.html',
openAnalyzer: false
})]
}

0 comments on commit 62b258e

Please sign in to comment.