From 9205cc65a52da607a04c274d383510021e76b841 Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Wed, 19 Jul 2017 10:56:59 -0400 Subject: [PATCH] testing file deps for #111 --- README.md | 34 +++++++++---------- package.json | 4 +-- test/file-deps-spec.js | 34 +++++++++++++++++++ test/test-file-deps/.npmrc | 1 + test/test-file-deps/index.js | 1 + test/test-file-deps/local-dependency/index.js | 1 + .../local-dependency/package.json | 12 +++++++ test/test-file-deps/package.json | 15 ++++++++ 8 files changed, 83 insertions(+), 19 deletions(-) create mode 100644 test/file-deps-spec.js create mode 100644 test/test-file-deps/.npmrc create mode 100644 test/test-file-deps/index.js create mode 100644 test/test-file-deps/local-dependency/index.js create mode 100644 test/test-file-deps/local-dependency/package.json create mode 100644 test/test-file-deps/package.json diff --git a/README.md b/README.md index c2ec222..ced620e 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -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. diff --git a/package.json b/package.json index 04c9f6f..264effe 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/test/file-deps-spec.js b/test/file-deps-spec.js new file mode 100644 index 0000000..9847da3 --- /dev/null +++ b/test/file-deps-spec.js @@ -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) + }) +}) diff --git a/test/test-file-deps/.npmrc b/test/test-file-deps/.npmrc new file mode 100644 index 0000000..a57cc9e --- /dev/null +++ b/test/test-file-deps/.npmrc @@ -0,0 +1 @@ +registry=http://registry.npmjs.org/ diff --git a/test/test-file-deps/index.js b/test/test-file-deps/index.js new file mode 100644 index 0000000..3858a79 --- /dev/null +++ b/test/test-file-deps/index.js @@ -0,0 +1 @@ +console.log('do nothing') diff --git a/test/test-file-deps/local-dependency/index.js b/test/test-file-deps/local-dependency/index.js new file mode 100644 index 0000000..424097e --- /dev/null +++ b/test/test-file-deps/local-dependency/index.js @@ -0,0 +1 @@ +console.log('local dependency') diff --git a/test/test-file-deps/local-dependency/package.json b/test/test-file-deps/local-dependency/package.json new file mode 100644 index 0000000..0153f0a --- /dev/null +++ b/test/test-file-deps/local-dependency/package.json @@ -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" +} diff --git a/test/test-file-deps/package.json b/test/test-file-deps/package.json new file mode 100644 index 0000000..f79c289 --- /dev/null +++ b/test/test-file-deps/package.json @@ -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" + } +}