Skip to content

Commit 9205cc6

Browse files
committed
testing file deps for #111
1 parent e89607a commit 9205cc6

File tree

8 files changed

+83
-19
lines changed

8 files changed

+83
-19
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ in the folder with module *foo*. Here is the example output:
5656
0.2.6 PASS
5757
0.2.7 PASS
5858
0.2.8 PASS
59-
60-
> next updates:
61-
express 3.21.2 -> 4.15.3
62-
async 3.21.2 -> 0.2.8
63-
64-
> kept working updates
6559

66-
If your tests pass, the dependencies will be upgraded to the new working versions in
67-
*package.json* and the *node_modules* folder.
60+
61+
Both *package.json* file and *node_modules* folder are left unchanged,
62+
and now you know that you can safely upgrade both libraries to later versions.
63+
64+
#### It even tells you the install command ;)
65+
66+
Use the following command to install working versions
67+
npm install --save lodash@2.1.0
6868

6969
This might not appear like a big deal for a single module that is using
7070
popular 3rd party libraries with stable apis only. *next-update* is most useful
@@ -89,29 +89,30 @@ grunt-bump 0.0.13 0.0.12 100% 4
8989

9090
### Install
9191

92-
You can install this tool globally:
92+
You can install this tool globally
9393

94-
npm install -g next-update // install module globally
95-
next-update --help // show command line options
94+
npm install -g next-update // installs module globally
95+
next-update --help // shows command line options
9696

97-
Then run inside any package folder:
97+
Then run inside any package folder
9898

9999
/git/my-awesome-module
100100
$ next-update
101101

102-
Or you can use this module as a devDependency and a script command:
102+
Or you can use this module as a devDependency and a script command
103103

104104
npm install --save-dev next-update
105105

106106
```json
107107
{
108108
"scripts": {
109-
"next-update": "next-update --tldr"
109+
"next-update": "next-update -k true --tldr"
110110
}
111111
}
112112
```
113113

114-
This command will use the `--tldr` flag, which causes it to be less verbose when run.
114+
This command will keep the successfuly version upgrades in the package.json file,
115+
but will not be very verbose when run.
115116

116117
### Anonymous usage collection
117118

@@ -230,8 +231,7 @@ like this `changed foo` (*foo* is package name)
230231
* install new versions of the desired modules using standard `npm i dependency@version --save`
231232
* You can use custom test command, for example `next-update -t "grunt test"`
232233
* `npm test` is used by default.
233-
* You can disable the behavior to automatically upgrade to new working versions by passing
234-
the `--keep false` option.
234+
* You can keep each working version in package.json by using `--keep` flag.
235235

236236

237237

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"chdir-promise": "0.4.0",
3131
"check-more-types": "2.24.0",
3232
"cli-color": "1.2.0",
33-
"common-tags": "^1.4.0",
33+
"common-tags": "1.4.0",
3434
"console.json": "0.2.1",
3535
"console.table": "0.8.0",
3636
"debug": "2.6.8",
@@ -54,7 +54,7 @@
5454
"condition-node-version": "1.3.0",
5555
"coveralls": "2.11.4",
5656
"git-issues": "1.3.1",
57-
"github-post-release": "^1.12.1",
57+
"github-post-release": "1.12.1",
5858
"grunt": "0.4.5",
5959
"grunt-bump": "0.7.3",
6060
"grunt-cli": "0.1.13",

test/file-deps-spec.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
'use strict'
2+
3+
var la = require('lazy-ass')
4+
var is = require('check-more-types')
5+
var pause = 30 * 1000
6+
var chdir = require('chdir-promise')
7+
var join = require('path').join
8+
var testFolder = join(__dirname, 'test-file-deps')
9+
10+
/* global describe, it */
11+
describe('scoped packages', function () {
12+
var nextUpdate = require('../src/next-update')
13+
14+
it('is an object', function () {
15+
la(is.object(nextUpdate))
16+
})
17+
18+
it('has available method', function () {
19+
la(is.fn(nextUpdate.available))
20+
})
21+
22+
it('handles file: package names', function () {
23+
this.timeout(pause)
24+
return chdir
25+
.to(testFolder)
26+
.then(function () {
27+
return nextUpdate.available()
28+
})
29+
.then(function (available) {
30+
console.log('available', available)
31+
})
32+
.then(chdir.back)
33+
})
34+
})

test/test-file-deps/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=http://registry.npmjs.org/

test/test-file-deps/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('do nothing')
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('local dependency')
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "local-dependency",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC"
12+
}

test/test-file-deps/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "test-scoped-names",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "node index.js"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"dependencies": {
13+
"local-dependency": "file:./local-dependency"
14+
}
15+
}

0 commit comments

Comments
 (0)