feat: support semver #816

Merged
merged 4 commits into from Feb 1, 2016

Projects

None yet

3 participants

@dead-horse
Member

e.x. /npm/~1.0.0

closes #814

@dead-horse dead-horse feat: support semver
e.x. `/npm/~1.0.0`
8d7058b
@dead-horse dead-horse added the feat label Jan 30, 2016
@fengmk2 fengmk2 was assigned by dead-horse Jan 30, 2016
@fengmk2 fengmk2 added the in progress label Jan 30, 2016
@fengmk2 fengmk2 commented on the diff Jan 30, 2016
services/package.js
@@ -73,6 +74,18 @@ exports.getModuleByTag = function* (name, tag) {
return yield* exports.getModule(tag.name, tag.version);
};
+exports.getModuleByRange = function* (name, range) {
+ var rows = yield* exports.listModulesByName(name);
@dead-horse
dead-horse Jan 30, 2016 Member

到处都是 yield* ,先保留,后续找时间重构的时候全部替换掉吧

@fengmk2
Member
fengmk2 commented Jan 30, 2016

pnpm need this feat
image

@fengmk2
Member
fengmk2 commented Jan 30, 2016

@dead-horse ci fail

@fengmk2 fengmk2 commented on the diff Jan 30, 2016
routes/registry.js
@@ -65,9 +65,9 @@ function routes(app) {
// module
// scope package: params: [$name]
- app.get(/^\/(@[\w\-\.]+\/[\w\-\.]+)$/, syncByInstall, listAllVersions);
+ app.get(/^\/(@[\w\-\.]+\/[^\/]+)$/, syncByInstall, listAllVersions);
@fengmk2
fengmk2 Jan 30, 2016 Member

这个不需要修改吧。

@fengmk2 fengmk2 commented on the diff Jan 30, 2016
routes/registry.js
// scope package: params: [$name, $version]
- app.get(/^\/(@[\w\-\.]+\/[\w\-\.]+)\/([\w\.\-]+)$/, syncByInstall, getOneVersion);
+ app.get(/^\/(@[\w\-\.]+\/[\w\-\.]+)\/([^\/]+)$/, syncByInstall, getOneVersion);
@fengmk2
fengmk2 Jan 30, 2016 Member

这个正则范围会不会太广了。[\^\~\>\=\<\|]*[\w\.\-]+ 即可

@fengmk2
fengmk2 Jan 30, 2016 Member

呃,不对,semver 会很复杂。。。还是你改的这样吧。如 >=1.2.7 <1.3.0

@fengmk2 fengmk2 commented on the diff Jan 30, 2016
test/controllers/registry/package/show.test.js
@@ -45,6 +54,19 @@ describe('controllers/registry/package/show.test.js', function () {
});
});
+ it('should return max satisfied package with semver range', function (done) {
+ request(app.listen())
+ .get('/@cnpmtest/testmodule-show/^1.0.0')
@fengmk2
fengmk2 Jan 30, 2016 Member

加一些复杂的情况 >=1.2.7 <1.3.0

@fengmk2
fengmk2 Jan 30, 2016 Member

1.2.7 || >=1.2.9 <2.0.0

@dead-horse
dead-horse Jan 30, 2016 Member

测试补了

dead-horse added some commits Jan 30, 2016
@dead-horse dead-horse test: add complex range test case
4b68eec
@dead-horse dead-horse test: fix unpublish
9da7c6c
@dead-horse
Member

又有人上传了 tfs 导致 ci 挂了,我换了一个包,等它生效。。。

@fengmk2
Member
fengmk2 commented Jan 31, 2016

mysql 挂了?

@dead-horse dead-horse test: fix all test cases
44976f4
@codecov-io

Current coverage is 82.43%

Merging #816 into master will decrease coverage by -0.21% as of 2f29e23

@@            master    #816   diff @@
======================================
  Files           84      84       
  Stmts         3227    3239    +12
  Branches       598     599     +1
  Methods          0       0       
======================================
+ Hit           2667    2670     +3
- Partial        202     211     +9
  Missed         358     358       

Review entire Coverage Diff as of 2f29e23

Powered by Codecov. Updated on successful CI builds.

@dead-horse
Member

过了

@fengmk2
Member
fengmk2 commented Feb 1, 2016

+1

@fengmk2 fengmk2 merged commit 3a46b97 into master Feb 1, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@fengmk2 fengmk2 deleted the feat-semver branch Feb 1, 2016
@fengmk2 fengmk2 removed the in progress label Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment