Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit ac4eccc

Browse files
authored
Merge pull request #277 from cloudant/prepare-2.0.2-release
Update require references to scoped package
2 parents de382c2 + d8a0d20 commit ac4eccc

File tree

6 files changed

+38
-36
lines changed

6 files changed

+38
-36
lines changed

CHANGES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# 2.0.2 (UNRELEASED)
1+
# 2.0.2 (2018-02-14)
2+
- [FIXED] Updated `require` references to use newly scoped package
3+
`@cloudant/cloudant`.
24

35
# 2.0.1 (2018-02-14)
46
- [NEW] Added API for upcoming IBM Cloud Identity and Access Management support

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ This is the official Cloudant library for Node.js.
3838

3939
The best way to use the Cloudant client is to begin with your own Node.js project, and define this work as your dependency. In other words, put me in your package.json dependencies. The `npm` tool can do this for you, from the command line:
4040

41-
$ npm install --save cloudant
41+
$ npm install --save @cloudant/cloudant
4242

4343
Notice that your package.json will now reflect this package. Everything is working if you can run this command with no errors:
4444

45-
$ node -e 'require("cloudant"); console.log("Cloudant works");'
45+
$ node -e 'require("@cloudant/cloudant"); console.log("Cloudant works");'
4646
Cloudant works
4747

4848
### Getting Started
@@ -53,7 +53,7 @@ Initialize your Cloudant connection by supplying your *account* and *password*,
5353

5454
~~~ js
5555
// Load the Cloudant library.
56-
var Cloudant = require('cloudant');
56+
var Cloudant = require('@cloudant/cloudant');
5757

5858
var me = 'nodejs'; // Set this to your own account
5959
var password = process.env.cloudant_password;
@@ -89,7 +89,7 @@ Here is simple but complete example of working with data:
8989
require('dotenv').load();
9090

9191
// Load the Cloudant library.
92-
var Cloudant = require('cloudant');
92+
var Cloudant = require('@cloudant/cloudant');
9393

9494
// Initialize Cloudant with settings from .env
9595
var username = process.env.cloudant_username || "nodejs";
@@ -129,7 +129,7 @@ You can find a further CRUD example in the [example](https://github.com/cloudant
129129

130130
### Initialization
131131

132-
To use Cloudant, add `require('cloudant')` in your code. In general, the common style is that `Cloudant` (upper-case) is the **package** you load; whereas `cloudant` (lower-case) is your connection to your database (i.e. the result of calling `Cloudant()`).
132+
To use Cloudant, add `require('@cloudant/cloudant')` in your code. In general, the common style is that `Cloudant` (upper-case) is the **package** you load; whereas `cloudant` (lower-case) is your connection to your database (i.e. the result of calling `Cloudant()`).
133133

134134
You can initialize your client in _one_ of the following ways:
135135

@@ -138,7 +138,7 @@ You can initialize your client in _one_ of the following ways:
138138
You can initialize Cloudant with a URL:
139139

140140
~~~ js
141-
var Cloudant = require('cloudant')
141+
var Cloudant = require('@cloudant/cloudant')
142142
var cloudant = Cloudant("http://MYUSERNAME:MYPASSWORD@localhost:5984");
143143
~~~
144144

@@ -149,14 +149,14 @@ var cloudant = Cloudant("http://MYUSERNAME:MYPASSWORD@localhost:5984");
149149
You can just pass your account name and password (see the [security note](#security-note) about placing your password into your source code).
150150

151151
~~~ js
152-
var Cloudant = require('cloudant');
152+
var Cloudant = require('@cloudant/cloudant');
153153
var cloudant = Cloudant({account:me, password:password});
154154
~~~
155155

156156
By default, when you connect to your cloudant account (i.e. "me.cloudant.com"), you authenticate as the account owner (i.e. "me"). However, you can use Cloudant with any username and password. Just provide an additional "username" option when you initialize Cloudant. This will connect to your account, but using the username as the authenticated user. (And of course, use the appropriate password.)
157157

158158
~~~ js
159-
var Cloudant = require('cloudant');
159+
var Cloudant = require('@cloudant/cloudant');
160160
var me = "nodejs"; // Substitute with your Cloudant user account.
161161
var otherUsername = "jhs"; // Substitute with some other Cloudant user account.
162162
var otherPassword = process.env.other_cloudant_password;
@@ -188,7 +188,7 @@ Cloudant({url:"companycloudant.local", username:"somebody", password:"somebody's
188188
You can initialize Cloudant directly from the `VCAP_SERVICES` environment variable. Just pass `vcapServices` and your `vcapInstanceName` (or alias `instanceName`) in the client configuration:
189189

190190
~~~ js
191-
var Cloudant = require('cloudant');
191+
var Cloudant = require('@cloudant/cloudant');
192192
var cloudant = Cloudant({ vcapInstanceName: 'foo', vcapServices: JSON.parse(process.env.VCAP_SERVICES) });
193193
~~~
194194

@@ -203,7 +203,7 @@ You can optionally provide a callback to the Cloudant initialization function. T
203203
Here is a simple example of initializing asynchronously, using its optional callback parameter:
204204

205205
~~~ js
206-
var Cloudant = require('cloudant');
206+
var Cloudant = require('@cloudant/cloudant');
207207
var me = 'nodejs'; // Replace with your account.
208208
var password = process.env.cloudant_password;
209209

@@ -391,7 +391,7 @@ Use the authorization feature to generate new API keys to access your data. An A
391391
### Generate an API key
392392
393393
~~~ js
394-
var Cloudant = require('cloudant');
394+
var Cloudant = require('@cloudant/cloudant');
395395
var me = 'nodejs'; // Replace with your account.
396396
var password = process.env.cloudant_password;
397397
var cloudant = Cloudant({account:me, password:password});
@@ -458,7 +458,7 @@ See the [Authorization] documentation for further details.
458458
To use an API key, initialize a new Cloudant connection, and provide an additional "key" option when you initialize Cloudant. This will connect to your account, but using the "key" as the authenticated user. (And of course, use the appropriate password associated with the API key.)
459459
460460
~~~ js
461-
var Cloudant = require('cloudant');
461+
var Cloudant = require('@cloudant/cloudant');
462462
var cloudant = Cloudant({account:"me", key:api.key, password:api.password});
463463
~~~
464464
@@ -804,7 +804,7 @@ var options =
804804
, "password" : "secret"
805805
, "requestDefaults": { "proxy": "http://localhost:8080" }
806806
}
807-
var cloudant = require('cloudant')(opts);
807+
var cloudant = require('@cloudant/cloudant')(opts);
808808
// Now using the HTTP proxy...
809809
810810
~~~
@@ -831,7 +831,7 @@ var myagent = new HttpsAgent({
831831
maxKeepAliveRequests: 0,
832832
maxKeepAliveTime: 30000
833833
});
834-
var cloudant = require('cloudant')({account:"me", password:"secret", requestDefaults:{agent:myagent}});
834+
var cloudant = require('@cloudant/cloudant')({account:"me", password:"secret", requestDefaults:{agent:myagent}});
835835
// Using Cloudant with myagent...
836836
~~~
837837
@@ -929,7 +929,7 @@ Now your project has the dependency in place, however you can work on both of th
929929
Here is simple but complete example of working with data:
930930
931931
~~~ js
932-
var Cloudant = require('cloudant')
932+
var Cloudant = require('@cloudant/cloudant')
933933
934934
var me = 'nodejs' // Set this to your own account
935935
var password = process.env.cloudant_password

example/crud.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if (!process.env.CLOUDANT_URL) {
2020

2121
// load the Cloudant library
2222
var async = require('async');
23-
var Cloudant = require('cloudant');
23+
var Cloudant = require('@cloudant/cloudant');
2424
var cloudant = Cloudant({url: process.env.CLOUDANT_URL});
2525
var dbname = 'crud';
2626
var db = null;

example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
33
"async": "^1.5.0",
4-
"cloudant": "^1.3.0"
4+
"@cloudant/cloudant": "^2.0.1"
55
}
6-
}
6+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "git",
88
"url": "[email protected]:cloudant/nodejs-cloudant.git"
99
},
10-
"version": "2.0.2-SNAPSHOT",
10+
"version": "2.0.2",
1111
"author": {
1212
"name": "IBM Cloudant",
1313
"email": "[email protected]"

test/legacy/readme-examples.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var SERVER = 'https://' + ME + '.cloudant.com';
3636

3737
var real_require = require;
3838
require = function(module) {
39-
return (module == 'cloudant')
39+
return (module == '@cloudant/cloudant')
4040
? real_require('../../cloudant.js')
4141
: real_require.apply(this, arguments);
4242
};
@@ -47,7 +47,7 @@ var console = { log: function() {} };
4747
describe('Getting Started', function() {
4848
var mocks;
4949
after(function(done) {
50-
var Cloudant = require('cloudant');
50+
var Cloudant = require('@cloudant/cloudant');
5151
var cloudant = Cloudant({account: ME, password: PASSWORD, plugins: 'retry'});
5252
cloudant.db.destroy('alice', function(er, d) {
5353
should(er).equal(null);
@@ -70,7 +70,7 @@ describe('Getting Started', function() {
7070

7171
it('Example 1', function(done) {
7272
// Load the Cloudant library.
73-
var Cloudant = require('cloudant');
73+
var Cloudant = require('@cloudant/cloudant');
7474

7575
var me = ME; // Set this to your own account
7676
var password = process.env.cloudant_password || 'sjedon';
@@ -87,7 +87,7 @@ describe('Getting Started', function() {
8787

8888
it('Example 2', function(done) {
8989
// Load the Cloudant library.
90-
var Cloudant = require('cloudant');
90+
var Cloudant = require('@cloudant/cloudant');
9191

9292
// Initialize Cloudant with settings from .env
9393
var username = ME;
@@ -132,7 +132,7 @@ describe('Initialization', function() {
132132
});
133133

134134
it('Example 1', function(done) {
135-
var Cloudant = require('cloudant');
135+
var Cloudant = require('@cloudant/cloudant');
136136
var me = ME; // Replace with your account.
137137
var password = process.env.cloudant_password || 'sjedon';
138138

@@ -168,7 +168,7 @@ describe('Password authentication', function() {
168168
});
169169

170170
it('Example 1', function(done) {
171-
var Cloudant = require('cloudant');
171+
var Cloudant = require('@cloudant/cloudant');
172172

173173
Cloudant({account: ME, username: ME, password: PASSWORD}, function(er, cloudant, reply) {
174174
if (er) {
@@ -205,7 +205,7 @@ describe('Authorization and API Keys', function() {
205205
});
206206

207207
it('Example 1', function(done) {
208-
var Cloudant = require('cloudant');
208+
var Cloudant = require('@cloudant/cloudant');
209209
var me = ME; // Replace with your account.
210210
var password = process.env.cloudant_password || 'sjedon';
211211
var cloudant = Cloudant({account: me, password: password, plugins: 'retry'});
@@ -272,7 +272,7 @@ describe('CORS', function() {
272272

273273
var cloudant;
274274
before(function() {
275-
var Cloudant = require('cloudant');
275+
var Cloudant = require('@cloudant/cloudant');
276276
cloudant = Cloudant({account: ME, password: process.env.cloudant_password, plugins: 'retry'});
277277
});
278278

@@ -327,7 +327,7 @@ describe('Virtual Hosts', function() {
327327

328328
var cloudant;
329329
before(function() {
330-
var Cloudant = require('cloudant');
330+
var Cloudant = require('@cloudant/cloudant');
331331
cloudant = Cloudant({account: ME, password: process.env.cloudant_password, plugins: 'retry'});
332332
});
333333

@@ -383,7 +383,7 @@ describe('Cloudant Query', function() {
383383

384384
var cloudant, db;
385385
before(function(done) {
386-
var Cloudant = require('cloudant');
386+
var Cloudant = require('@cloudant/cloudant');
387387
cloudant = Cloudant({account: ME, password: process.env.cloudant_password, plugins: 'retry'});
388388
cloudant.db.create('my_db', function(er) {
389389
if (er) throw er;
@@ -465,7 +465,7 @@ describe('Cloudant Search', function() {
465465

466466
var cloudant, db;
467467
before(function(done) {
468-
var Cloudant = require('cloudant');
468+
var Cloudant = require('@cloudant/cloudant');
469469
cloudant = Cloudant({account: ME, password: process.env.cloudant_password, plugins: 'retry'});
470470
cloudant.db.create('my_db', function(er) {
471471
if (er) throw er;
@@ -552,7 +552,7 @@ describe('Cookie Authentication', function() {
552552
var cloudant;
553553
var mocks;
554554
after(function(done) {
555-
var Cloudant = require('cloudant');
555+
var Cloudant = require('@cloudant/cloudant');
556556
cloudant = Cloudant({account: ME, password: process.env.cloudant_password, plugins: []});
557557
cloudant.db.destroy('alice', function() {
558558
mocks.done();
@@ -567,7 +567,7 @@ describe('Cookie Authentication', function() {
567567
.get('/_session').reply(200, {ok: true, userCtx: {name: ME, roles: ['_admin', '_reader', '_writer']}})
568568
.delete('/alice').reply(200, {ok: true});
569569

570-
var Cloudant = require('cloudant');
570+
var Cloudant = require('@cloudant/cloudant');
571571
cloudant = Cloudant({account: ME, password: process.env.cloudant_password, plugins: []});
572572
cloudant.db.create('alice', function() {
573573
done();
@@ -577,7 +577,7 @@ describe('Cookie Authentication', function() {
577577
var cookies;
578578

579579
it('Example 1', function(done) {
580-
var Cloudant = require('cloudant');
580+
var Cloudant = require('@cloudant/cloudant');
581581
var username = ME; // Set this to your own account
582582
var password = process.env.cloudant_password || 'sjedon';
583583
var cloudant = Cloudant({account: username, password: password, plugins: []});
@@ -607,7 +607,7 @@ describe('Cookie Authentication', function() {
607607

608608
it('Example 2', function(done) {
609609
// Make a new connection with the cookie.
610-
var Cloudant = require('cloudant');
610+
var Cloudant = require('@cloudant/cloudant');
611611
var username = ME; // Set this to your own account
612612
var other_cloudant = Cloudant({account: username, cookie: cookies[username], plugins: []});
613613

@@ -632,7 +632,7 @@ describe('Cookie Authentication', function() {
632632
it('Example 3', function(done) {
633633
// (Presuming the "cookie" global from the above example is still in scope.)
634634

635-
var Cloudant = require('cloudant');
635+
var Cloudant = require('@cloudant/cloudant');
636636
var username = ME; // Set this to your own account
637637
var cloudant = Cloudant({account: username, cookie: cookies[username], plugins: []});
638638

0 commit comments

Comments
 (0)