Skip to content

Commit

Permalink
testing file deps for #111
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Jul 19, 2017
1 parent e89607a commit 9205cc6
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 19 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ in the folder with module *foo*. Here is the example output:
0.2.6 PASS
0.2.7 PASS
0.2.8 PASS

> next updates:
express 3.21.2 -> 4.15.3
async 3.21.2 -> 0.2.8

> kept working updates

If your tests pass, the dependencies will be upgraded to the new working versions in
*package.json* and the *node_modules* folder.

Both *package.json* file and *node_modules* folder are left unchanged,
and now you know that you can safely upgrade both libraries to later versions.

#### It even tells you the install command ;)

Use the following command to install working versions
npm install --save lodash@2.1.0

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

### Install

You can install this tool globally:
You can install this tool globally

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

Then run inside any package folder:
Then run inside any package folder

/git/my-awesome-module
$ next-update

Or you can use this module as a devDependency and a script command:
Or you can use this module as a devDependency and a script command

npm install --save-dev next-update

```json
{
"scripts": {
"next-update": "next-update --tldr"
"next-update": "next-update -k true --tldr"
}
}
```

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

### Anonymous usage collection

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



Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"chdir-promise": "0.4.0",
"check-more-types": "2.24.0",
"cli-color": "1.2.0",
"common-tags": "^1.4.0",
"common-tags": "1.4.0",
"console.json": "0.2.1",
"console.table": "0.8.0",
"debug": "2.6.8",
Expand All @@ -54,7 +54,7 @@
"condition-node-version": "1.3.0",
"coveralls": "2.11.4",
"git-issues": "1.3.1",
"github-post-release": "^1.12.1",
"github-post-release": "1.12.1",
"grunt": "0.4.5",
"grunt-bump": "0.7.3",
"grunt-cli": "0.1.13",
Expand Down
34 changes: 34 additions & 0 deletions test/file-deps-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict'

var la = require('lazy-ass')
var is = require('check-more-types')
var pause = 30 * 1000
var chdir = require('chdir-promise')
var join = require('path').join
var testFolder = join(__dirname, 'test-file-deps')

/* global describe, it */
describe('scoped packages', function () {
var nextUpdate = require('../src/next-update')

it('is an object', function () {
la(is.object(nextUpdate))
})

it('has available method', function () {
la(is.fn(nextUpdate.available))
})

it('handles file: package names', function () {
this.timeout(pause)
return chdir
.to(testFolder)
.then(function () {
return nextUpdate.available()
})
.then(function (available) {
console.log('available', available)
})
.then(chdir.back)
})
})
1 change: 1 addition & 0 deletions test/test-file-deps/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=http://registry.npmjs.org/
1 change: 1 addition & 0 deletions test/test-file-deps/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('do nothing')
1 change: 1 addition & 0 deletions test/test-file-deps/local-dependency/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('local dependency')
12 changes: 12 additions & 0 deletions test/test-file-deps/local-dependency/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "local-dependency",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
15 changes: 15 additions & 0 deletions test/test-file-deps/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "test-scoped-names",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "node index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"local-dependency": "file:./local-dependency"
}
}

0 comments on commit 9205cc6

Please sign in to comment.