create-docusaurus 0.0.0-4411 → 0.0.0-4414
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/templates/classic/package.json +3 -3
- package/templates/classic-typescript/package.json +4 -4
- package/templates/facebook/package.json +3 -3
- package/templates/facebook/node_modules/hosted-git-info/LICENSE +0 -13
- package/templates/facebook/node_modules/hosted-git-info/README.md +0 -133
- package/templates/facebook/node_modules/hosted-git-info/git-host-info.js +0 -184
- package/templates/facebook/node_modules/hosted-git-info/git-host.js +0 -110
- package/templates/facebook/node_modules/hosted-git-info/index.js +0 -237
- package/templates/facebook/node_modules/hosted-git-info/package.json +0 -51
- package/templates/facebook/node_modules/lru-cache/LICENSE +0 -15
- package/templates/facebook/node_modules/lru-cache/README.md +0 -166
- package/templates/facebook/node_modules/lru-cache/index.js +0 -334
- package/templates/facebook/node_modules/lru-cache/package.json +0 -34
- package/templates/facebook/node_modules/normalize-package-data/AUTHORS +0 -4
- package/templates/facebook/node_modules/normalize-package-data/LICENSE +0 -15
- package/templates/facebook/node_modules/normalize-package-data/README.md +0 -108
- package/templates/facebook/node_modules/normalize-package-data/lib/extract_description.js +0 -22
- package/templates/facebook/node_modules/normalize-package-data/lib/fixer.js +0 -474
- package/templates/facebook/node_modules/normalize-package-data/lib/make_warning.js +0 -22
- package/templates/facebook/node_modules/normalize-package-data/lib/normalize.js +0 -48
- package/templates/facebook/node_modules/normalize-package-data/lib/safe_format.js +0 -11
- package/templates/facebook/node_modules/normalize-package-data/lib/typos.json +0 -25
- package/templates/facebook/node_modules/normalize-package-data/lib/warning_messages.json +0 -30
- package/templates/facebook/node_modules/normalize-package-data/package.json +0 -41
|
@@ -1,474 +0,0 @@
|
|
|
1
|
-
var isValidSemver = require('semver/functions/valid')
|
|
2
|
-
var cleanSemver = require('semver/functions/clean')
|
|
3
|
-
var validateLicense = require('validate-npm-package-license')
|
|
4
|
-
var hostedGitInfo = require('hosted-git-info')
|
|
5
|
-
var isBuiltinModule = require('is-core-module')
|
|
6
|
-
var depTypes = ['dependencies', 'devDependencies', 'optionalDependencies']
|
|
7
|
-
var extractDescription = require('./extract_description')
|
|
8
|
-
var url = require('url')
|
|
9
|
-
var typos = require('./typos.json')
|
|
10
|
-
|
|
11
|
-
module.exports = {
|
|
12
|
-
// default warning function
|
|
13
|
-
warn: function () {},
|
|
14
|
-
|
|
15
|
-
fixRepositoryField: function (data) {
|
|
16
|
-
if (data.repositories) {
|
|
17
|
-
this.warn('repositories')
|
|
18
|
-
data.repository = data.repositories[0]
|
|
19
|
-
}
|
|
20
|
-
if (!data.repository) {
|
|
21
|
-
return this.warn('missingRepository')
|
|
22
|
-
}
|
|
23
|
-
if (typeof data.repository === 'string') {
|
|
24
|
-
data.repository = {
|
|
25
|
-
type: 'git',
|
|
26
|
-
url: data.repository,
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
var r = data.repository.url || ''
|
|
30
|
-
if (r) {
|
|
31
|
-
var hosted = hostedGitInfo.fromUrl(r)
|
|
32
|
-
if (hosted) {
|
|
33
|
-
r = data.repository.url
|
|
34
|
-
= hosted.getDefaultRepresentation() === 'shortcut' ? hosted.https() : hosted.toString()
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (r.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)) {
|
|
39
|
-
this.warn('brokenGitUrl', r)
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
fixTypos: function (data) {
|
|
44
|
-
Object.keys(typos.topLevel).forEach(function (d) {
|
|
45
|
-
if (Object.prototype.hasOwnProperty.call(data, d)) {
|
|
46
|
-
this.warn('typo', d, typos.topLevel[d])
|
|
47
|
-
}
|
|
48
|
-
}, this)
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
fixScriptsField: function (data) {
|
|
52
|
-
if (!data.scripts) {
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
if (typeof data.scripts !== 'object') {
|
|
56
|
-
this.warn('nonObjectScripts')
|
|
57
|
-
delete data.scripts
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
Object.keys(data.scripts).forEach(function (k) {
|
|
61
|
-
if (typeof data.scripts[k] !== 'string') {
|
|
62
|
-
this.warn('nonStringScript')
|
|
63
|
-
delete data.scripts[k]
|
|
64
|
-
} else if (typos.script[k] && !data.scripts[typos.script[k]]) {
|
|
65
|
-
this.warn('typo', k, typos.script[k], 'scripts')
|
|
66
|
-
}
|
|
67
|
-
}, this)
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
fixFilesField: function (data) {
|
|
71
|
-
var files = data.files
|
|
72
|
-
if (files && !Array.isArray(files)) {
|
|
73
|
-
this.warn('nonArrayFiles')
|
|
74
|
-
delete data.files
|
|
75
|
-
} else if (data.files) {
|
|
76
|
-
data.files = data.files.filter(function (file) {
|
|
77
|
-
if (!file || typeof file !== 'string') {
|
|
78
|
-
this.warn('invalidFilename', file)
|
|
79
|
-
return false
|
|
80
|
-
} else {
|
|
81
|
-
return true
|
|
82
|
-
}
|
|
83
|
-
}, this)
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
fixBinField: function (data) {
|
|
88
|
-
if (!data.bin) {
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
if (typeof data.bin === 'string') {
|
|
92
|
-
var b = {}
|
|
93
|
-
var match
|
|
94
|
-
if (match = data.name.match(/^@[^/]+[/](.*)$/)) {
|
|
95
|
-
b[match[1]] = data.bin
|
|
96
|
-
} else {
|
|
97
|
-
b[data.name] = data.bin
|
|
98
|
-
}
|
|
99
|
-
data.bin = b
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
fixManField: function (data) {
|
|
104
|
-
if (!data.man) {
|
|
105
|
-
return
|
|
106
|
-
}
|
|
107
|
-
if (typeof data.man === 'string') {
|
|
108
|
-
data.man = [data.man]
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
fixBundleDependenciesField: function (data) {
|
|
112
|
-
var bdd = 'bundledDependencies'
|
|
113
|
-
var bd = 'bundleDependencies'
|
|
114
|
-
if (data[bdd] && !data[bd]) {
|
|
115
|
-
data[bd] = data[bdd]
|
|
116
|
-
delete data[bdd]
|
|
117
|
-
}
|
|
118
|
-
if (data[bd] && !Array.isArray(data[bd])) {
|
|
119
|
-
this.warn('nonArrayBundleDependencies')
|
|
120
|
-
delete data[bd]
|
|
121
|
-
} else if (data[bd]) {
|
|
122
|
-
data[bd] = data[bd].filter(function (bd) {
|
|
123
|
-
if (!bd || typeof bd !== 'string') {
|
|
124
|
-
this.warn('nonStringBundleDependency', bd)
|
|
125
|
-
return false
|
|
126
|
-
} else {
|
|
127
|
-
if (!data.dependencies) {
|
|
128
|
-
data.dependencies = {}
|
|
129
|
-
}
|
|
130
|
-
if (Object.prototype.hasOwnProperty.call(data.dependencies, bd)) {
|
|
131
|
-
this.warn('nonDependencyBundleDependency', bd)
|
|
132
|
-
data.dependencies[bd] = '*'
|
|
133
|
-
}
|
|
134
|
-
return true
|
|
135
|
-
}
|
|
136
|
-
}, this)
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
fixDependencies: function (data, strict) {
|
|
141
|
-
objectifyDeps(data, this.warn)
|
|
142
|
-
addOptionalDepsToDeps(data, this.warn)
|
|
143
|
-
this.fixBundleDependenciesField(data)
|
|
144
|
-
|
|
145
|
-
;['dependencies', 'devDependencies'].forEach(function (deps) {
|
|
146
|
-
if (!(deps in data)) {
|
|
147
|
-
return
|
|
148
|
-
}
|
|
149
|
-
if (!data[deps] || typeof data[deps] !== 'object') {
|
|
150
|
-
this.warn('nonObjectDependencies', deps)
|
|
151
|
-
delete data[deps]
|
|
152
|
-
return
|
|
153
|
-
}
|
|
154
|
-
Object.keys(data[deps]).forEach(function (d) {
|
|
155
|
-
var r = data[deps][d]
|
|
156
|
-
if (typeof r !== 'string') {
|
|
157
|
-
this.warn('nonStringDependency', d, JSON.stringify(r))
|
|
158
|
-
delete data[deps][d]
|
|
159
|
-
}
|
|
160
|
-
var hosted = hostedGitInfo.fromUrl(data[deps][d])
|
|
161
|
-
if (hosted) {
|
|
162
|
-
data[deps][d] = hosted.toString()
|
|
163
|
-
}
|
|
164
|
-
}, this)
|
|
165
|
-
}, this)
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
fixModulesField: function (data) {
|
|
169
|
-
if (data.modules) {
|
|
170
|
-
this.warn('deprecatedModules')
|
|
171
|
-
delete data.modules
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
fixKeywordsField: function (data) {
|
|
176
|
-
if (typeof data.keywords === 'string') {
|
|
177
|
-
data.keywords = data.keywords.split(/,\s+/)
|
|
178
|
-
}
|
|
179
|
-
if (data.keywords && !Array.isArray(data.keywords)) {
|
|
180
|
-
delete data.keywords
|
|
181
|
-
this.warn('nonArrayKeywords')
|
|
182
|
-
} else if (data.keywords) {
|
|
183
|
-
data.keywords = data.keywords.filter(function (kw) {
|
|
184
|
-
if (typeof kw !== 'string' || !kw) {
|
|
185
|
-
this.warn('nonStringKeyword')
|
|
186
|
-
return false
|
|
187
|
-
} else {
|
|
188
|
-
return true
|
|
189
|
-
}
|
|
190
|
-
}, this)
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
fixVersionField: function (data, strict) {
|
|
195
|
-
// allow "loose" semver 1.0 versions in non-strict mode
|
|
196
|
-
// enforce strict semver 2.0 compliance in strict mode
|
|
197
|
-
var loose = !strict
|
|
198
|
-
if (!data.version) {
|
|
199
|
-
data.version = ''
|
|
200
|
-
return true
|
|
201
|
-
}
|
|
202
|
-
if (!isValidSemver(data.version, loose)) {
|
|
203
|
-
throw new Error('Invalid version: "' + data.version + '"')
|
|
204
|
-
}
|
|
205
|
-
data.version = cleanSemver(data.version, loose)
|
|
206
|
-
return true
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
fixPeople: function (data) {
|
|
210
|
-
modifyPeople(data, unParsePerson)
|
|
211
|
-
modifyPeople(data, parsePerson)
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
fixNameField: function (data, options) {
|
|
215
|
-
if (typeof options === 'boolean') {
|
|
216
|
-
options = {strict: options}
|
|
217
|
-
} else if (typeof options === 'undefined') {
|
|
218
|
-
options = {}
|
|
219
|
-
}
|
|
220
|
-
var strict = options.strict
|
|
221
|
-
if (!data.name && !strict) {
|
|
222
|
-
data.name = ''
|
|
223
|
-
return
|
|
224
|
-
}
|
|
225
|
-
if (typeof data.name !== 'string') {
|
|
226
|
-
throw new Error('name field must be a string.')
|
|
227
|
-
}
|
|
228
|
-
if (!strict) {
|
|
229
|
-
data.name = data.name.trim()
|
|
230
|
-
}
|
|
231
|
-
ensureValidName(data.name, strict, options.allowLegacyCase)
|
|
232
|
-
if (isBuiltinModule(data.name)) {
|
|
233
|
-
this.warn('conflictingName', data.name)
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
|
|
237
|
-
fixDescriptionField: function (data) {
|
|
238
|
-
if (data.description && typeof data.description !== 'string') {
|
|
239
|
-
this.warn('nonStringDescription')
|
|
240
|
-
delete data.description
|
|
241
|
-
}
|
|
242
|
-
if (data.readme && !data.description) {
|
|
243
|
-
data.description = extractDescription(data.readme)
|
|
244
|
-
}
|
|
245
|
-
if (data.description === undefined) {
|
|
246
|
-
delete data.description
|
|
247
|
-
}
|
|
248
|
-
if (!data.description) {
|
|
249
|
-
this.warn('missingDescription')
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
|
|
253
|
-
fixReadmeField: function (data) {
|
|
254
|
-
if (!data.readme) {
|
|
255
|
-
this.warn('missingReadme')
|
|
256
|
-
data.readme = 'ERROR: No README data found!'
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
fixBugsField: function (data) {
|
|
261
|
-
if (!data.bugs && data.repository && data.repository.url) {
|
|
262
|
-
var hosted = hostedGitInfo.fromUrl(data.repository.url)
|
|
263
|
-
if (hosted && hosted.bugs()) {
|
|
264
|
-
data.bugs = {url: hosted.bugs()}
|
|
265
|
-
}
|
|
266
|
-
} else if (data.bugs) {
|
|
267
|
-
var emailRe = /^.+@.*\..+$/
|
|
268
|
-
if (typeof data.bugs === 'string') {
|
|
269
|
-
if (emailRe.test(data.bugs)) {
|
|
270
|
-
data.bugs = {email: data.bugs}
|
|
271
|
-
/* eslint-disable-next-line node/no-deprecated-api */
|
|
272
|
-
} else if (url.parse(data.bugs).protocol) {
|
|
273
|
-
data.bugs = {url: data.bugs}
|
|
274
|
-
} else {
|
|
275
|
-
this.warn('nonEmailUrlBugsString')
|
|
276
|
-
}
|
|
277
|
-
} else {
|
|
278
|
-
bugsTypos(data.bugs, this.warn)
|
|
279
|
-
var oldBugs = data.bugs
|
|
280
|
-
data.bugs = {}
|
|
281
|
-
if (oldBugs.url) {
|
|
282
|
-
/* eslint-disable-next-line node/no-deprecated-api */
|
|
283
|
-
if (typeof (oldBugs.url) === 'string' && url.parse(oldBugs.url).protocol) {
|
|
284
|
-
data.bugs.url = oldBugs.url
|
|
285
|
-
} else {
|
|
286
|
-
this.warn('nonUrlBugsUrlField')
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
if (oldBugs.email) {
|
|
290
|
-
if (typeof (oldBugs.email) === 'string' && emailRe.test(oldBugs.email)) {
|
|
291
|
-
data.bugs.email = oldBugs.email
|
|
292
|
-
} else {
|
|
293
|
-
this.warn('nonEmailBugsEmailField')
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
if (!data.bugs.email && !data.bugs.url) {
|
|
298
|
-
delete data.bugs
|
|
299
|
-
this.warn('emptyNormalizedBugs')
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
|
|
304
|
-
fixHomepageField: function (data) {
|
|
305
|
-
if (!data.homepage && data.repository && data.repository.url) {
|
|
306
|
-
var hosted = hostedGitInfo.fromUrl(data.repository.url)
|
|
307
|
-
if (hosted && hosted.docs()) {
|
|
308
|
-
data.homepage = hosted.docs()
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
if (!data.homepage) {
|
|
312
|
-
return
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (typeof data.homepage !== 'string') {
|
|
316
|
-
this.warn('nonUrlHomepage')
|
|
317
|
-
return delete data.homepage
|
|
318
|
-
}
|
|
319
|
-
/* eslint-disable-next-line node/no-deprecated-api */
|
|
320
|
-
if (!url.parse(data.homepage).protocol) {
|
|
321
|
-
data.homepage = 'http://' + data.homepage
|
|
322
|
-
}
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
fixLicenseField: function (data) {
|
|
326
|
-
const license = data.license || data.licence
|
|
327
|
-
if (!license) {
|
|
328
|
-
return this.warn('missingLicense')
|
|
329
|
-
}
|
|
330
|
-
if (
|
|
331
|
-
typeof (license) !== 'string' ||
|
|
332
|
-
license.length < 1 ||
|
|
333
|
-
license.trim() === ''
|
|
334
|
-
) {
|
|
335
|
-
return this.warn('invalidLicense')
|
|
336
|
-
}
|
|
337
|
-
if (!validateLicense(license).validForNewPackages) {
|
|
338
|
-
return this.warn('invalidLicense')
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
function isValidScopedPackageName (spec) {
|
|
344
|
-
if (spec.charAt(0) !== '@') {
|
|
345
|
-
return false
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
var rest = spec.slice(1).split('/')
|
|
349
|
-
if (rest.length !== 2) {
|
|
350
|
-
return false
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
return rest[0] && rest[1] &&
|
|
354
|
-
rest[0] === encodeURIComponent(rest[0]) &&
|
|
355
|
-
rest[1] === encodeURIComponent(rest[1])
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
function isCorrectlyEncodedName (spec) {
|
|
359
|
-
return !spec.match(/[/@\s+%:]/) &&
|
|
360
|
-
spec === encodeURIComponent(spec)
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
function ensureValidName (name, strict, allowLegacyCase) {
|
|
364
|
-
if (name.charAt(0) === '.' ||
|
|
365
|
-
!(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) ||
|
|
366
|
-
(strict && (!allowLegacyCase) && name !== name.toLowerCase()) ||
|
|
367
|
-
name.toLowerCase() === 'node_modules' ||
|
|
368
|
-
name.toLowerCase() === 'favicon.ico') {
|
|
369
|
-
throw new Error('Invalid name: ' + JSON.stringify(name))
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
function modifyPeople (data, fn) {
|
|
374
|
-
if (data.author) {
|
|
375
|
-
data.author = fn(data.author)
|
|
376
|
-
}['maintainers', 'contributors'].forEach(function (set) {
|
|
377
|
-
if (!Array.isArray(data[set])) {
|
|
378
|
-
return
|
|
379
|
-
}
|
|
380
|
-
data[set] = data[set].map(fn)
|
|
381
|
-
})
|
|
382
|
-
return data
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
function unParsePerson (person) {
|
|
386
|
-
if (typeof person === 'string') {
|
|
387
|
-
return person
|
|
388
|
-
}
|
|
389
|
-
var name = person.name || ''
|
|
390
|
-
var u = person.url || person.web
|
|
391
|
-
var url = u ? (' (' + u + ')') : ''
|
|
392
|
-
var e = person.email || person.mail
|
|
393
|
-
var email = e ? (' <' + e + '>') : ''
|
|
394
|
-
return name + email + url
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
function parsePerson (person) {
|
|
398
|
-
if (typeof person !== 'string') {
|
|
399
|
-
return person
|
|
400
|
-
}
|
|
401
|
-
var name = person.match(/^([^(<]+)/)
|
|
402
|
-
var url = person.match(/\(([^)]+)\)/)
|
|
403
|
-
var email = person.match(/<([^>]+)>/)
|
|
404
|
-
var obj = {}
|
|
405
|
-
if (name && name[0].trim()) {
|
|
406
|
-
obj.name = name[0].trim()
|
|
407
|
-
}
|
|
408
|
-
if (email) {
|
|
409
|
-
obj.email = email[1]
|
|
410
|
-
}
|
|
411
|
-
if (url) {
|
|
412
|
-
obj.url = url[1]
|
|
413
|
-
}
|
|
414
|
-
return obj
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
function addOptionalDepsToDeps (data, warn) {
|
|
418
|
-
var o = data.optionalDependencies
|
|
419
|
-
if (!o) {
|
|
420
|
-
return
|
|
421
|
-
}
|
|
422
|
-
var d = data.dependencies || {}
|
|
423
|
-
Object.keys(o).forEach(function (k) {
|
|
424
|
-
d[k] = o[k]
|
|
425
|
-
})
|
|
426
|
-
data.dependencies = d
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
function depObjectify (deps, type, warn) {
|
|
430
|
-
if (!deps) {
|
|
431
|
-
return {}
|
|
432
|
-
}
|
|
433
|
-
if (typeof deps === 'string') {
|
|
434
|
-
deps = deps.trim().split(/[\n\r\s\t ,]+/)
|
|
435
|
-
}
|
|
436
|
-
if (!Array.isArray(deps)) {
|
|
437
|
-
return deps
|
|
438
|
-
}
|
|
439
|
-
warn('deprecatedArrayDependencies', type)
|
|
440
|
-
var o = {}
|
|
441
|
-
deps.filter(function (d) {
|
|
442
|
-
return typeof d === 'string'
|
|
443
|
-
}).forEach(function (d) {
|
|
444
|
-
d = d.trim().split(/(:?[@\s><=])/)
|
|
445
|
-
var dn = d.shift()
|
|
446
|
-
var dv = d.join('')
|
|
447
|
-
dv = dv.trim()
|
|
448
|
-
dv = dv.replace(/^@/, '')
|
|
449
|
-
o[dn] = dv
|
|
450
|
-
})
|
|
451
|
-
return o
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
function objectifyDeps (data, warn) {
|
|
455
|
-
depTypes.forEach(function (type) {
|
|
456
|
-
if (!data[type]) {
|
|
457
|
-
return
|
|
458
|
-
}
|
|
459
|
-
data[type] = depObjectify(data[type], type, warn)
|
|
460
|
-
})
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
function bugsTypos (bugs, warn) {
|
|
464
|
-
if (!bugs) {
|
|
465
|
-
return
|
|
466
|
-
}
|
|
467
|
-
Object.keys(bugs).forEach(function (k) {
|
|
468
|
-
if (typos.bugs[k]) {
|
|
469
|
-
warn('typo', k, typos.bugs[k], 'bugs')
|
|
470
|
-
bugs[typos.bugs[k]] = bugs[k]
|
|
471
|
-
delete bugs[k]
|
|
472
|
-
}
|
|
473
|
-
})
|
|
474
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var util = require('util')
|
|
2
|
-
var messages = require('./warning_messages.json')
|
|
3
|
-
|
|
4
|
-
module.exports = function () {
|
|
5
|
-
var args = Array.prototype.slice.call(arguments, 0)
|
|
6
|
-
var warningName = args.shift()
|
|
7
|
-
if (warningName === 'typo') {
|
|
8
|
-
return makeTypoWarning.apply(null, args)
|
|
9
|
-
} else {
|
|
10
|
-
var msgTemplate = messages[warningName] ? messages[warningName] : warningName + ": '%s'"
|
|
11
|
-
args.unshift(msgTemplate)
|
|
12
|
-
return util.format.apply(null, args)
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function makeTypoWarning (providedName, probableName, field) {
|
|
17
|
-
if (field) {
|
|
18
|
-
providedName = field + "['" + providedName + "']"
|
|
19
|
-
probableName = field + "['" + probableName + "']"
|
|
20
|
-
}
|
|
21
|
-
return util.format(messages.typo, providedName, probableName)
|
|
22
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module.exports = normalize
|
|
2
|
-
|
|
3
|
-
var fixer = require('./fixer')
|
|
4
|
-
normalize.fixer = fixer
|
|
5
|
-
|
|
6
|
-
var makeWarning = require('./make_warning')
|
|
7
|
-
|
|
8
|
-
var fieldsToFix = ['name', 'version', 'description', 'repository', 'modules', 'scripts',
|
|
9
|
-
'files', 'bin', 'man', 'bugs', 'keywords', 'readme', 'homepage', 'license']
|
|
10
|
-
var otherThingsToFix = ['dependencies', 'people', 'typos']
|
|
11
|
-
|
|
12
|
-
var thingsToFix = fieldsToFix.map(function (fieldName) {
|
|
13
|
-
return ucFirst(fieldName) + 'Field'
|
|
14
|
-
})
|
|
15
|
-
// two ways to do this in CoffeeScript on only one line, sub-70 chars:
|
|
16
|
-
// thingsToFix = fieldsToFix.map (name) -> ucFirst(name) + "Field"
|
|
17
|
-
// thingsToFix = (ucFirst(name) + "Field" for name in fieldsToFix)
|
|
18
|
-
thingsToFix = thingsToFix.concat(otherThingsToFix)
|
|
19
|
-
|
|
20
|
-
function normalize (data, warn, strict) {
|
|
21
|
-
if (warn === true) {
|
|
22
|
-
warn = null
|
|
23
|
-
strict = true
|
|
24
|
-
}
|
|
25
|
-
if (!strict) {
|
|
26
|
-
strict = false
|
|
27
|
-
}
|
|
28
|
-
if (!warn || data.private) {
|
|
29
|
-
warn = function (msg) { /* noop */ }
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (data.scripts &&
|
|
33
|
-
data.scripts.install === 'node-gyp rebuild' &&
|
|
34
|
-
!data.scripts.preinstall) {
|
|
35
|
-
data.gypfile = true
|
|
36
|
-
}
|
|
37
|
-
fixer.warn = function () {
|
|
38
|
-
warn(makeWarning.apply(null, arguments))
|
|
39
|
-
}
|
|
40
|
-
thingsToFix.forEach(function (thingName) {
|
|
41
|
-
fixer['fix' + ucFirst(thingName)](data, strict)
|
|
42
|
-
})
|
|
43
|
-
data._id = data.name + '@' + data.version
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function ucFirst (string) {
|
|
47
|
-
return string.charAt(0).toUpperCase() + string.slice(1)
|
|
48
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
var util = require('util')
|
|
2
|
-
|
|
3
|
-
module.exports = function () {
|
|
4
|
-
var args = Array.prototype.slice.call(arguments, 0)
|
|
5
|
-
args.forEach(function (arg) {
|
|
6
|
-
if (!arg) {
|
|
7
|
-
throw new TypeError('Bad arguments.')
|
|
8
|
-
}
|
|
9
|
-
})
|
|
10
|
-
return util.format.apply(null, arguments)
|
|
11
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"topLevel": {
|
|
3
|
-
"dependancies": "dependencies"
|
|
4
|
-
,"dependecies": "dependencies"
|
|
5
|
-
,"depdenencies": "dependencies"
|
|
6
|
-
,"devEependencies": "devDependencies"
|
|
7
|
-
,"depends": "dependencies"
|
|
8
|
-
,"dev-dependencies": "devDependencies"
|
|
9
|
-
,"devDependences": "devDependencies"
|
|
10
|
-
,"devDepenencies": "devDependencies"
|
|
11
|
-
,"devdependencies": "devDependencies"
|
|
12
|
-
,"repostitory": "repository"
|
|
13
|
-
,"repo": "repository"
|
|
14
|
-
,"prefereGlobal": "preferGlobal"
|
|
15
|
-
,"hompage": "homepage"
|
|
16
|
-
,"hampage": "homepage"
|
|
17
|
-
,"autohr": "author"
|
|
18
|
-
,"autor": "author"
|
|
19
|
-
,"contributers": "contributors"
|
|
20
|
-
,"publicationConfig": "publishConfig"
|
|
21
|
-
,"script": "scripts"
|
|
22
|
-
},
|
|
23
|
-
"bugs": { "web": "url", "name": "url" },
|
|
24
|
-
"script": { "server": "start", "tests": "test" }
|
|
25
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"repositories": "'repositories' (plural) Not supported. Please pick one as the 'repository' field"
|
|
3
|
-
,"missingRepository": "No repository field."
|
|
4
|
-
,"brokenGitUrl": "Probably broken git url: %s"
|
|
5
|
-
,"nonObjectScripts": "scripts must be an object"
|
|
6
|
-
,"nonStringScript": "script values must be string commands"
|
|
7
|
-
,"nonArrayFiles": "Invalid 'files' member"
|
|
8
|
-
,"invalidFilename": "Invalid filename in 'files' list: %s"
|
|
9
|
-
,"nonArrayBundleDependencies": "Invalid 'bundleDependencies' list. Must be array of package names"
|
|
10
|
-
,"nonStringBundleDependency": "Invalid bundleDependencies member: %s"
|
|
11
|
-
,"nonDependencyBundleDependency": "Non-dependency in bundleDependencies: %s"
|
|
12
|
-
,"nonObjectDependencies": "%s field must be an object"
|
|
13
|
-
,"nonStringDependency": "Invalid dependency: %s %s"
|
|
14
|
-
,"deprecatedArrayDependencies": "specifying %s as array is deprecated"
|
|
15
|
-
,"deprecatedModules": "modules field is deprecated"
|
|
16
|
-
,"nonArrayKeywords": "keywords should be an array of strings"
|
|
17
|
-
,"nonStringKeyword": "keywords should be an array of strings"
|
|
18
|
-
,"conflictingName": "%s is also the name of a node core module."
|
|
19
|
-
,"nonStringDescription": "'description' field should be a string"
|
|
20
|
-
,"missingDescription": "No description"
|
|
21
|
-
,"missingReadme": "No README data"
|
|
22
|
-
,"missingLicense": "No license field."
|
|
23
|
-
,"nonEmailUrlBugsString": "Bug string field must be url, email, or {email,url}"
|
|
24
|
-
,"nonUrlBugsUrlField": "bugs.url field must be a string url. Deleted."
|
|
25
|
-
,"nonEmailBugsEmailField": "bugs.email field must be a string email. Deleted."
|
|
26
|
-
,"emptyNormalizedBugs": "Normalized value of bugs field is an empty object. Deleted."
|
|
27
|
-
,"nonUrlHomepage": "homepage field must be a string url. Deleted."
|
|
28
|
-
,"invalidLicense": "license should be a valid SPDX license expression"
|
|
29
|
-
,"typo": "%s should probably be %s."
|
|
30
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "normalize-package-data",
|
|
3
|
-
"version": "3.0.3",
|
|
4
|
-
"author": "Meryn Stol <merynstol@gmail.com>",
|
|
5
|
-
"description": "Normalizes data that can be found in package.json files.",
|
|
6
|
-
"license": "BSD-2-Clause",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git://github.com/npm/normalize-package-data.git"
|
|
10
|
-
},
|
|
11
|
-
"main": "lib/normalize.js",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"postversion": "npm publish",
|
|
14
|
-
"prepublishOnly": "git push origin --follow-tags",
|
|
15
|
-
"preversion": "npm test",
|
|
16
|
-
"test": "tap test/*.js --branches 85 --functions 90 --lines 85 --statements 85",
|
|
17
|
-
"npmclilint": "npmcli-lint",
|
|
18
|
-
"lint": "npm run npmclilint -- \"lib/**/*.*js\" \"test/**/*.*js\"",
|
|
19
|
-
"lintfix": "npm run lint -- --fix",
|
|
20
|
-
"posttest": "npm run lint --",
|
|
21
|
-
"postsnap": "npm run lintfix --"
|
|
22
|
-
},
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"hosted-git-info": "^4.0.1",
|
|
25
|
-
"is-core-module": "^2.5.0",
|
|
26
|
-
"semver": "^7.3.4",
|
|
27
|
-
"validate-npm-package-license": "^3.0.1"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@npmcli/lint": "^1.0.2",
|
|
31
|
-
"tap": "^15.0.9"
|
|
32
|
-
},
|
|
33
|
-
"files": [
|
|
34
|
-
"lib/*.js",
|
|
35
|
-
"lib/*.json",
|
|
36
|
-
"AUTHORS"
|
|
37
|
-
],
|
|
38
|
-
"engines": {
|
|
39
|
-
"node": ">=10"
|
|
40
|
-
}
|
|
41
|
-
}
|