Skip to content

Commit f40c521

Browse files
shinnnSBoudrias
authored andcommittedJan 25, 2018
Update got and its dependents (#563)
Highlights: * The latest got prepends `https://` to the protocol-less URL, not `http://` * The end point of npm-keyword has been updated. sindresorhus/npm-keyword@862c1eb * The data structure of npm web API has been drastically changed.
1 parent 649200a commit f40c521

File tree

4 files changed

+5115
-1341
lines changed

4 files changed

+5115
-1341
lines changed
 

‎lib/routes/install.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function searchMatchingGenerators(app, term, cb) {
6161
}));
6262
}, cb);
6363
}
64-
got('yeoman.io/blacklist.json', {json: true})
64+
got('http://yeoman.io/blacklist.json', {json: true})
6565
.then(response => handleBlacklist(response.body))
6666
.catch(() => handleBlacklist([]));
6767
}

‎package-lock.json

+5,059-1,321
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@
4848
"cross-spawn": "^5.0.1",
4949
"figures": "^2.0.0",
5050
"fullname": "^3.2.0",
51-
"got": "^6.7.1",
51+
"got": "^8.0.3",
5252
"humanize-string": "^1.0.0",
5353
"inquirer": "^3.0.1",
5454
"insight": "^0.8.4",
5555
"lodash": "^4.17.4",
5656
"meow": "^3.0.0",
57-
"npm-keyword": "^4.1.0",
57+
"npm-keyword": "^5.0.0",
5858
"opn": "^4.0.2",
59-
"package-json": "^2.1.0",
59+
"package-json": "^4.0.1",
6060
"parse-help": "^0.1.1",
6161
"read-pkg-up": "^2.0.0",
6262
"root-check": "^1.0.0",

‎test/route-install.js

+52-16
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,35 @@ describe('install route', () => {
3030

3131
describe('npm success with results', () => {
3232
beforeEach(function () {
33-
this.rows = [
34-
{key: ['yeoman-generator', 'generator-unicorn', 'some unicorn']},
35-
{key: ['yeoman-generator', 'generator-unrelated', 'some description']},
36-
{key: ['yeoman-generator', 'generator-unicorn-1', 'foo description']},
37-
{key: ['yeoman-generator', 'generator-foo', 'description with unicorn word']},
38-
{key: ['yeoman-generator', 'generator-blacklist-1', 'foo description']},
39-
{key: ['yeoman-generator', 'generator-blacklist-2', 'foo description']},
40-
{key: ['yeoman-generator', 'generator-blacklist-3', 'foo description']}
33+
this.packages = [
34+
{
35+
name: 'generator-unicorn',
36+
description: 'some unicorn'
37+
},
38+
{
39+
name: 'generator-unrelated',
40+
description: 'some description'
41+
},
42+
{
43+
name: 'generator-unicorn-1',
44+
description: 'foo description'
45+
},
46+
{
47+
name: 'generator-foo',
48+
description: 'description with unicorn word'
49+
},
50+
{
51+
name: 'generator-blacklist-1',
52+
description: 'foo description'
53+
},
54+
{
55+
name: 'generator-blacklist-2',
56+
description: 'foo description'
57+
},
58+
{
59+
name: 'generator-blacklist-3',
60+
description: 'foo description'
61+
}
4162
];
4263

4364
this.blacklist = [
@@ -46,15 +67,20 @@ describe('install route', () => {
4667
];
4768

4869
this.pkgData = {
49-
author: {
50-
name: 'Simon'
70+
'dist-tags': {
71+
latest: '1.0.0'
72+
},
73+
versions: {
74+
'1.0.0': {
75+
name: 'test'
76+
}
5177
}
5278
};
5379

5480
nock(registryUrl)
55-
.get('/-/_view/byKeyword')
81+
.get('/-/v1/search')
5682
.query(true)
57-
.reply(200, {rows: this.rows})
83+
.reply(200, {objects: this.packages.map(data => ({package: data}))})
5884
.filteringPath(/\/[^?]+$/g, '/pkg')
5985
.get('/pkg')
6086
.times(4)
@@ -176,12 +202,22 @@ describe('install route', () => {
176202
describe('npm success without results', () => {
177203
beforeEach(() => {
178204
nock(registryUrl)
179-
.get('/-/_view/byKeyword')
205+
.get('/-/v1/search')
180206
.query(true)
181207
.reply(200, {
182-
rows: [
183-
{key: ['yeoman-generator', 'generator-unrelated', 'some description']},
184-
{key: ['yeoman-generator', 'generator-unrelevant', 'some description']}
208+
objects: [
209+
{
210+
package: {
211+
name: 'generator-unrelated',
212+
description: 'some description'
213+
}
214+
},
215+
{
216+
package: {
217+
name: 'generator-unrelevant',
218+
description: 'some description'
219+
}
220+
}
185221
]
186222
});
187223
});

0 commit comments

Comments
 (0)
Please sign in to comment.