Skip to content

Commit

Permalink
feat: Rewrite
Browse files Browse the repository at this point in the history
### Changes

- A batch update is attempted for all **non-breaking** updates according to semver
- All **breaking** updates are still performed in a sequential manner
- If the batch update fails, the failed update tasks are performed sequentially to find out, which module was breaking
- During a rollback, the next module update is installed in parallel
- The `package.json` is now written in the end after the whole operation
- The updtr tries to preserve the semver range style. If the style can not be preserved, it falls back to caret ranges.
- This behavior can be changed by specifying a `--save` option
- By specifying the `update-to=non-breaking` option, you can now choose to install non-breaking updates. It replaces the old `--wanted` flag
- Re-design of the default reporter (it's now called `dense`)
- Missing dependencies are now installed automatically before running `npm outdated`

### Fixes

- Fixes #14 #47 #46 #13 #51 #58
- Provides a workaround for #48 by sorting all dependencies

BREAKING CHANGE: New and changed CLI options

``` 
  --use, -u             Specify the package manager to use  [choices: "npm", "yarn"] [default: "npm"]
  --exclude, --ex       Space separated list of module names that should not be updated  [array]
  --update-to, --to     Specify which updates you want to install  [choices: "latest", "non-breaking", "wanted"] [default: "latest"]
  --save, -s            Specify how updated versions should be saved to the package.json  [choices: "smart", "caret", "exact"] [default: "smart"]
  --reporter, -r        Choose a reporter for the console output  [choices: "dense", "none"] [default: "dense"]
  --test, -t            Specify a custom test command. Surround with quotes.
  --test-stdout, --out  Show test stdout if the update fails  [boolean]
  --registry, --reg     Specify a custom registry to use
  --version             Show version number  [boolean]
  --help                Show help  [boolean]
```
  • Loading branch information
jhnns authored May 8, 2017
1 parent fb29909 commit 7ffc10a
Show file tree
Hide file tree
Showing 129 changed files with 9,184 additions and 2,219 deletions.
44 changes: 44 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"env": {
"development": {
"presets": [
[
"env",
{
"targets": "current"
}
]
]
},
"test": {
"presets": [
[
"env",
{
"targets": "current"
}
]
]
},
"production": {
"presets": [
[
"env",
{
"targets": {
"node": 4
},
"modules": false
}
]
]
}
},
"plugins": [
"transform-runtime",
"transform-object-rest-spread",
"external-helpers"
],
"sourceMaps": "inline",
"retainLines": true
}
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": [
"peerigon/base",
"peerigon/es5"
"peerigon/base"
],
"env": {
"node": true
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ node_modules

# IDE stuff
.idea
.vscode

# Will be generated by npm run ensure-fixtures
test/fixtures/*/**

# Rollup output
dist
20 changes: 0 additions & 20 deletions .npmignore

This file was deleted.

23 changes: 10 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
language: node_js
node_js:
- "7"
- "6"
- "5"
- "4"
- "0.12"
- "0.10"

install:
- npm install
os:
- linux
node_js:
- 7
- 6
- 4

script:
- npm test
- npm install
- npm install -g yarn
- npm test

after_success:
- npm install -g istanbul
- npm install coveralls
- istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
- bash <(curl -s https://codecov.io/bash)
42 changes: 42 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Bin",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/babel-node",
"runtimeArgs": [
"--harmony_async_await"
],
"program": "${workspaceRoot}/src/bin/index.js"
},
{
"name": "Current test",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"stopOnEntry": false,
"args": [
"${file}",
"--runInBand"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--harmony_async_await",
"--nolazy"
],
"env": {
"NODE_ENV": "test"
},
"externalConsole": false,
"sourceMaps": true,
"outDir": null
}
]
}
18 changes: 18 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
environment:
matrix:
- nodejs_version: 7
- nodejs_version: 6
# Node 4 doesn't work because of an AppVeyor bug
# - nodejs_version: 4

install:
- ps: Install-Product node $env:nodejs_version
- npm install

test_script:
- npm install -g yarn
- node --version
- npm --version
- npm test

build: off
39 changes: 1 addition & 38 deletions bin/updtr
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
#!/usr/bin/env node

var program = require("commander");
var updtr = require("../lib");
var pkg = require("../package.json");
var reporters = Object.keys(updtr.reporters);

program
.version(pkg.version)
.description(pkg.description)
.option("-R, --reporter <reporter>", "choose reporter: " + reporters.join(", "), "default")
.option("-w, --wanted", "updates to wanted version specified in package.json instead of the modules latest version")
.option("-t, --test <test>", "change the command for the tests")
.option("-e, --exclude <exclude>", "exclude modules comma seperated, e.g. updtr --exclude module1,module2")
.option("--test-stdout", "shows stdout if your test command fails")
.option("--save-exact", "save exact module version")
.option("--registry", "change registry");

program.parse(process.argv);

if (program.reporter in updtr.reporters === false) {
console.log(program.reporter + " is not a reporter.");
console.log("Available reporters: " + reporters.join(", "));
process.exit(1);
}

updtr.run({
cwd: process.cwd(),
reporter: updtr.reporters[program.reporter],
wanted: program.wanted,
testCmd: program.test,
exclude: program.exclude,
testStdout: program.testStdout,
saveExact: program.saveExact,
registry: program.registry
}, function (err) {
if (err) {
throw err;
}
});
require("../dist"); // eslint-disable-line
10 changes: 0 additions & 10 deletions lib/EventEmitter.js

This file was deleted.

38 changes: 0 additions & 38 deletions lib/filter.js

This file was deleted.

6 changes: 0 additions & 6 deletions lib/index.js

This file was deleted.

106 changes: 0 additions & 106 deletions lib/reporters/default.js

This file was deleted.

7 changes: 0 additions & 7 deletions lib/reporters/index.js

This file was deleted.

6 changes: 0 additions & 6 deletions lib/reporters/shy.js

This file was deleted.

Loading

0 comments on commit 7ffc10a

Please sign in to comment.