Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite #60

Merged
merged 228 commits into from
May 8, 2017
Merged

Rewrite #60

merged 228 commits into from
May 8, 2017

Conversation

jhnns
Copy link
Member

@jhnns jhnns commented Apr 25, 2017

This PR is a total rewrite and brings some bug fixes and performance improvements. It is also a breaking change.

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

New CLI


 Update outdated npm modules with zero pain™
 Usage: bin/updtr [options]

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]

Internal changes

  • All code is transpiled via Babel
  • The code has been rewritten to use async/await
  • It has been split into several small modules
  • Mocha, chai, Istanbul has been replaced with Jest as test runner to use snapshot testing for deep nested object structures and CLI output
  • We now have 294 tests with >95% test coverage
  • The dist is created via rollup to speed up the CLI boot time
  • The code is tested against real npm/yarn output (integration test)
  • Added AppVeyor for Windows CI tests

@matthaias ok? 😁

Please do not merge yet, because it needs to be squashed.

@codecov-io
Copy link

codecov-io commented Apr 25, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@fb29909). Click here to learn what that means.
The diff coverage is 97.93%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #60   +/-   ##
=========================================
  Coverage          ?   97.93%           
=========================================
  Files             ?       35           
  Lines             ?      677           
  Branches          ?      132           
=========================================
  Hits              ?      663           
  Misses            ?       14           
  Partials          ?        0
Impacted Files Coverage Δ
src/tasks/util/Sequence.js 100% <100%> (ø)
src/Updtr.js 100% <100%> (ø)
src/constants/filterReasons.js 100% <100%> (ø)
src/tasks/util/updateVersionRange.js 100% <100%> (ø)
src/reporters/util/msToString.js 100% <100%> (ø)
src/constants/config.js 100% <100%> (ø)
src/run.js 100% <100%> (ø)
src/reporters/util/Indicator.js 100% <100%> (ø)
src/reporters/util/pluralize.js 100% <100%> (ø)
src/index.js 100% <100%> (ø)
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb29909...3727e77. Read the comment docs.

@matthaias
Copy link
Member

@matthaias ok? 😁

Sure! Great job!

@jhnns jhnns merged commit 7ffc10a into master May 8, 2017
@jhnns jhnns deleted the refactor branch May 8, 2017 15:17
@jcrben
Copy link

jcrben commented Nov 25, 2017

The updtr tries to preserve the semver range style. If the style can not be preserved, it falls back to caret ranges.

I wonder how it could be that the range cannot be preserved in some situations... also I believe that exact is a better default.

@jhnns
Copy link
Member Author

jhnns commented Nov 27, 2017

I wonder how it could be that the range cannot be preserved in some situations...

NPM allows a lot of semver range notations, like 1.2.7 || >=1.2.9 <2.0.0. These notations cannot be translated when the version has been updated.

also I believe that exact is a better default.

There are a lot of different opinions on this topic. We stick to npm's default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keep the same rule for the versions instead of forcing ^
4 participants