libnpmdiff 2.0.4 → 4.0.1
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/README.md +1 -1
- package/lib/format-diff.js +8 -6
- package/{index.js → lib/index.js} +10 -5
- package/lib/should-print-patch.js +2 -1
- package/lib/tarball.js +2 -1
- package/package.json +23 -21
- package/CHANGELOG.md +0 -30
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ hesitate to jump in if you'd like to, or even ask us questions if something
|
|
|
61
61
|
isn't clear.
|
|
62
62
|
|
|
63
63
|
All participants and maintainers in this project are expected to follow the
|
|
64
|
-
[npm Code of Conduct](https://
|
|
64
|
+
[npm Code of Conduct](https://docs.npmjs.com/policies/conduct), and just
|
|
65
65
|
generally be excellent to each other.
|
|
66
66
|
|
|
67
67
|
Please refer to the [Changelog](CHANGELOG.md) for project history details, too.
|
package/lib/format-diff.js
CHANGED
|
@@ -30,8 +30,9 @@ const formatDiff = ({ files, opts = {}, refs, versions }) => {
|
|
|
30
30
|
b: filenames.b && filenames.b.mode,
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
if (contents.a === contents.b && modes.a === modes.b)
|
|
33
|
+
if (contents.a === contents.b && modes.a === modes.b) {
|
|
34
34
|
continue
|
|
35
|
+
}
|
|
35
36
|
|
|
36
37
|
if (opts.diffNameOnly) {
|
|
37
38
|
res += `${filename}${EOL}`
|
|
@@ -47,18 +48,19 @@ const formatDiff = ({ files, opts = {}, refs, versions }) => {
|
|
|
47
48
|
|
|
48
49
|
// manually build a git diff-compatible header
|
|
49
50
|
header(`diff --git ${names.a} ${names.b}`)
|
|
50
|
-
if (modes.a === modes.b)
|
|
51
|
+
if (modes.a === modes.b) {
|
|
51
52
|
fileMode = filenames.a.mode
|
|
52
|
-
else {
|
|
53
|
-
if (modes.a && !modes.b)
|
|
53
|
+
} else {
|
|
54
|
+
if (modes.a && !modes.b) {
|
|
54
55
|
header(`deleted file mode ${modes.a}`)
|
|
55
|
-
else if (!modes.a && modes.b)
|
|
56
|
+
} else if (!modes.a && modes.b) {
|
|
56
57
|
header(`new file mode ${modes.b}`)
|
|
57
|
-
else {
|
|
58
|
+
} else {
|
|
58
59
|
header(`old mode ${modes.a}`)
|
|
59
60
|
header(`new mode ${modes.b}`)
|
|
60
61
|
}
|
|
61
62
|
}
|
|
63
|
+
/* eslint-disable-next-line max-len */
|
|
62
64
|
header(`index ${opts.tagVersionPrefix || 'v'}${versions.a}..${opts.tagVersionPrefix || 'v'}${versions.b} ${fileMode}`)
|
|
63
65
|
|
|
64
66
|
if (shouldPrintPatch(filename)) {
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
const pacote = require('pacote')
|
|
2
2
|
|
|
3
|
-
const formatDiff = require('./
|
|
4
|
-
const getTarball = require('./
|
|
5
|
-
const untar = require('./
|
|
6
|
-
|
|
3
|
+
const formatDiff = require('./format-diff.js')
|
|
4
|
+
const getTarball = require('./tarball.js')
|
|
5
|
+
const untar = require('./untar.js')
|
|
6
|
+
|
|
7
|
+
// TODO: we test this condition in the diff command
|
|
8
|
+
// so this error probably doesnt need to be here. Or
|
|
9
|
+
// if it does we should figure out a standard code
|
|
10
|
+
// so we can catch it in the cli and display it consistently
|
|
7
11
|
const argsError = () =>
|
|
8
12
|
Object.assign(
|
|
9
13
|
new TypeError('libnpmdiff needs two arguments to compare'),
|
|
10
14
|
{ code: 'EDIFFARGS' }
|
|
11
15
|
)
|
|
12
16
|
const diff = async (specs, opts = {}) => {
|
|
13
|
-
if (specs.length !== 2)
|
|
17
|
+
if (specs.length !== 2) {
|
|
14
18
|
throw argsError()
|
|
19
|
+
}
|
|
15
20
|
|
|
16
21
|
const [
|
|
17
22
|
aManifest,
|
|
@@ -5,8 +5,9 @@ const binaryExtensions = require('binary-extensions')
|
|
|
5
5
|
// we should try to print patches as long as the
|
|
6
6
|
// extension is not identified as binary files
|
|
7
7
|
const shouldPrintPatch = (path, opts = {}) => {
|
|
8
|
-
if (opts.diffText)
|
|
8
|
+
if (opts.diffText) {
|
|
9
9
|
return true
|
|
10
|
+
}
|
|
10
11
|
|
|
11
12
|
const filename = basename(path)
|
|
12
13
|
const extension = (
|
package/lib/tarball.js
CHANGED
|
@@ -24,8 +24,9 @@ const tarball = (manifest, opts) => {
|
|
|
24
24
|
const fromNodeModules = npa(resolved).type === 'directory'
|
|
25
25
|
&& /node_modules[\\/](@[^\\/]+\/)?[^\\/]+[\\/]?$/.test(relative(where, resolved))
|
|
26
26
|
|
|
27
|
-
if (fromNodeModules)
|
|
27
|
+
if (fromNodeModules) {
|
|
28
28
|
return nodeModulesTarball(manifest, opts)
|
|
29
|
+
}
|
|
29
30
|
|
|
30
31
|
return pacote.tarball(manifest._resolved, opts)
|
|
31
32
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libnpmdiff",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "The registry diff",
|
|
5
|
-
"repository":
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/npm/cli",
|
|
8
|
+
"directory": "workspaces/libnpmdiff"
|
|
9
|
+
},
|
|
10
|
+
"main": "lib/index.js",
|
|
6
11
|
"files": [
|
|
7
|
-
"
|
|
12
|
+
"bin",
|
|
8
13
|
"lib"
|
|
9
14
|
],
|
|
10
15
|
"engines": {
|
|
11
|
-
"node": ">=
|
|
16
|
+
"node": "^12.13.0 || ^14.15.0 || >=16"
|
|
12
17
|
},
|
|
13
18
|
"keywords": [
|
|
14
19
|
"npm",
|
|
@@ -28,30 +33,24 @@
|
|
|
28
33
|
"license": "ISC",
|
|
29
34
|
"scripts": {
|
|
30
35
|
"eslint": "eslint",
|
|
31
|
-
"lint": "
|
|
36
|
+
"lint": "eslint '**/*.js'",
|
|
32
37
|
"lintfix": "npm run lint -- --fix",
|
|
33
|
-
"test": "tap
|
|
38
|
+
"test": "tap",
|
|
34
39
|
"posttest": "npm run lint",
|
|
35
|
-
"snap": "tap
|
|
40
|
+
"snap": "tap",
|
|
36
41
|
"preversion": "npm test",
|
|
37
42
|
"postversion": "npm publish",
|
|
38
|
-
"prepublishOnly": "git push origin --follow-tags"
|
|
43
|
+
"prepublishOnly": "git push origin --follow-tags",
|
|
44
|
+
"postlint": "npm-template-check",
|
|
45
|
+
"template-copy": "npm-template-copy --force"
|
|
39
46
|
},
|
|
40
47
|
"tap": {
|
|
41
48
|
"check-coverage": true
|
|
42
49
|
},
|
|
43
|
-
"standard": {
|
|
44
|
-
"ignore": [
|
|
45
|
-
"/tap-snapshots/"
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
50
|
"devDependencies": {
|
|
49
|
-
"
|
|
50
|
-
"eslint
|
|
51
|
-
"
|
|
52
|
-
"eslint-plugin-promise": "^4.2.1",
|
|
53
|
-
"eslint-plugin-standard": "^5.0.0",
|
|
54
|
-
"tap": "^14.11.0"
|
|
51
|
+
"@npmcli/template-oss": "^2.4.2",
|
|
52
|
+
"eslint": "^8.1.0",
|
|
53
|
+
"tap": "^15.0.9"
|
|
55
54
|
},
|
|
56
55
|
"dependencies": {
|
|
57
56
|
"@npmcli/disparity-colors": "^1.0.1",
|
|
@@ -59,8 +58,11 @@
|
|
|
59
58
|
"binary-extensions": "^2.2.0",
|
|
60
59
|
"diff": "^5.0.0",
|
|
61
60
|
"minimatch": "^3.0.4",
|
|
62
|
-
"npm-package-arg": "^
|
|
63
|
-
"pacote": "^
|
|
61
|
+
"npm-package-arg": "^9.0.0",
|
|
62
|
+
"pacote": "^13.0.2",
|
|
64
63
|
"tar": "^6.1.0"
|
|
64
|
+
},
|
|
65
|
+
"templateOSS": {
|
|
66
|
+
"version": "2.9.2"
|
|
65
67
|
}
|
|
66
68
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 2.0.3
|
|
4
|
-
|
|
5
|
-
- fix name of options sent by the npm cli
|
|
6
|
-
|
|
7
|
-
## 2.0.2
|
|
8
|
-
|
|
9
|
-
- fix matching basename file filter
|
|
10
|
-
|
|
11
|
-
## 2.0.1
|
|
12
|
-
|
|
13
|
-
- fix for tarballs not listing folder names
|
|
14
|
-
|
|
15
|
-
## 2.0.0
|
|
16
|
-
|
|
17
|
-
- API rewrite:
|
|
18
|
-
- normalized all options
|
|
19
|
-
- specs to compare are now an array
|
|
20
|
-
- fix context=0
|
|
21
|
-
- added support to filtering by folder names
|
|
22
|
-
|
|
23
|
-
## 1.0.1
|
|
24
|
-
|
|
25
|
-
- fixed nameOnly option
|
|
26
|
-
|
|
27
|
-
## 1.0.0
|
|
28
|
-
|
|
29
|
-
- Initial release
|
|
30
|
-
|