reader/web(refactor): replace cuid with uuid
Closes #41
Change-Id: I95c4327c880b85367f327d6e5a722c9829747625
diff --git a/web/Makefile b/web/Makefile
index 7b4f623..e32d7f8 100644
--- a/web/Makefile
+++ b/web/Makefile
@@ -17,7 +17,7 @@
port ?= 8080
syncbase_port ?= 4000
cloudsync_port ?= 8000
-id ?= $(shell if test -e tmp/id; then cat tmp/id; else PATH=$(PATH) bin/cuid; fi)
+id ?= $(shell if test -e tmp/id; then cat tmp/id; else PATH=$(PATH) bin/uuid; fi)
all: public/bundle.js node_modules
@true # silences watch
diff --git a/web/bin/cuid b/web/bin/uuid
similarity index 80%
rename from web/bin/cuid
rename to web/bin/uuid
index f6b3abb..d6259ca 100755
--- a/web/bin/cuid
+++ b/web/bin/uuid
@@ -3,7 +3,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-var cuid = require('cuid');
-var value = cuid();
+var uuid = require('uuid').v4;
+var value = uuid();
console.log(value);
diff --git a/web/browser/components/device-set/index.js b/web/browser/components/device-set/index.js
index 829048e..5b60ea5 100644
--- a/web/browser/components/device-set/index.js
+++ b/web/browser/components/device-set/index.js
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-var cuid = require('cuid');
var debug = require('debug')('reader:device-set');
var device = require('../device');
var extend = require('xtend');
var file = require('../file');
var hg = require('mercury');
var read = require('../../dom/read-blob');
+var uuid = require('uuid').v4;
module.exports = {
render: require('./render'),
@@ -20,7 +20,7 @@
function state(options, key) {
options = extend({
- id: key || cuid(),
+ id: key || uuid(),
devices: {},
pages: {}
}, options);
diff --git a/web/browser/components/device/index.js b/web/browser/components/device/index.js
index efd7de8..0d3b036 100644
--- a/web/browser/components/device/index.js
+++ b/web/browser/components/device/index.js
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-var cuid = require('cuid');
var debug = require('debug')('reader:device');
var event = require('synthetic-dom-events');
var extend = require('xtend');
var hg = require('mercury');
var raf = require('raf');
+var uuid = require('uuid').v4;
var window = require('global/window');
module.exports = {
@@ -16,7 +16,7 @@
function state(options, key) {
options = extend({
- id: key || cuid(),
+ id: key || uuid(),
screen: {}
}, options);
debug('init: %o', options);
diff --git a/web/browser/components/file/index.js b/web/browser/components/file/index.js
index 28cb027..6f1903d 100644
--- a/web/browser/components/file/index.js
+++ b/web/browser/components/file/index.js
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-var cuid = require('cuid');
var db = require('../../dom/blob-store');
var debug = require('debug')('reader:file');
var extend = require('xtend');
var hash = require('./hash-blob');
var hg = require('mercury');
+var uuid = require('uuid').v4;
var window = require('global/window');
module.exports = {
@@ -16,7 +16,7 @@
function state(options, key) {
options = extend({
- id: key || cuid()
+ id: key || uuid()
}, options);
debug('init: %o', options);
diff --git a/web/package.json b/web/package.json
index 5f59a84..e8a8c4a 100644
--- a/web/package.json
+++ b/web/package.json
@@ -30,7 +30,6 @@
"envify": "~3.4.0"
},
"dependencies": {
- "cuid": "^1.3.8",
"debug": "^2.2.0",
"domready": "^1.0.8",
"format": "~0.2.1",
@@ -45,6 +44,7 @@
"raf": "^3.1.0",
"readable-blob-stream": "^1.1.0",
"thunky": "^0.1.0",
+ "uuid": "^2.0.1",
"xtend": "^4.0.0"
}
}