dependabot-npm_and_yarn 0.214.0 → 0.216.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/build +1 -1
- data/helpers/lib/yarn/subdependency-updater.js +15 -44
- data/helpers/package-lock.json +2584 -1559
- data/helpers/package.json +7 -8
- data/helpers/test/npm6/conflicting-dependency-parser.test.js +1 -2
- data/helpers/test/npm6/fixtures/conflicting-dependency-parser/deeply-nested/package-lock.json +3 -3
- data/helpers/test/npm6/updater.test.js +1 -2
- data/helpers/test/yarn/conflicting-dependency-parser.test.js +1 -2
- data/helpers/test/yarn/fixtures/conflicting-dependency-parser/deeply-nested/yarn.lock +3 -3
- data/helpers/test/yarn/updater.test.js +1 -2
- data/lib/dependabot/npm_and_yarn/file_fetcher.rb +26 -38
- data/lib/dependabot/npm_and_yarn/file_parser/json_lock.rb +86 -0
- data/lib/dependabot/npm_and_yarn/file_parser/lockfile_parser.rb +21 -183
- data/lib/dependabot/npm_and_yarn/file_parser/yarn_lock.rb +80 -0
- data/lib/dependabot/npm_and_yarn/file_parser.rb +23 -36
- data/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb +58 -31
- data/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb +43 -16
- data/lib/dependabot/npm_and_yarn/file_updater.rb +1 -4
- data/lib/dependabot/npm_and_yarn/helpers.rb +17 -4
- data/lib/dependabot/npm_and_yarn/native_helpers.rb +15 -2
- data/lib/dependabot/npm_and_yarn/update_checker/dependency_files_builder.rb +6 -0
- data/lib/dependabot/npm_and_yarn/update_checker/subdependency_version_resolver.rb +5 -4
- data/lib/dependabot/npm_and_yarn/update_checker/version_resolver.rb +20 -13
- data/lib/dependabot/npm_and_yarn/update_checker.rb +7 -24
- data/lib/dependabot/npm_and_yarn/version.rb +13 -2
- metadata +37 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8f2067adcff622e13e15f0f69b0af6a37040740153e7259d7a8b10716b21b25
|
4
|
+
data.tar.gz: a6d6ec0f7f3575d681d1e55dffe7d02e573d6733e0a4d1ef2ae85c90064dcd04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab002df13a3712244ce2cba0498d92750a84f89316dcd6809d28a793eda2525c073252797104ac7bdf1b4f13e597ca5e75db14a488cc622fd71e3e2892269ef9
|
7
|
+
data.tar.gz: e2c83d55d329b47796f02a0c4894f64df7d56c1b1ef0a2e8cdb051419a108031a7f86d0d5c77caaf67d8bbd3c22e3b270bcfde232ed1ad3b40cba36876d679fa
|
data/helpers/build
CHANGED
@@ -5,7 +5,7 @@ const Config = require("@dependabot/yarn-lib/lib/config").default;
|
|
5
5
|
const { EventReporter } = require("@dependabot/yarn-lib/lib/reporters");
|
6
6
|
const Lockfile = require("@dependabot/yarn-lib/lib/lockfile").default;
|
7
7
|
const fixDuplicates = require("./fix-duplicates");
|
8
|
-
const {
|
8
|
+
const { LightweightInstall, LOCKFILE_ENTRY_REGEX } = require("./helpers");
|
9
9
|
const { parse } = require("./lockfile-parser");
|
10
10
|
const stringify =
|
11
11
|
require("@dependabot/yarn-lib/lib/lockfile/stringify").default;
|
@@ -21,43 +21,10 @@ function recoverVersionComments(oldLockfile, newLockfile) {
|
|
21
21
|
.replace(nodeRegex, () => oldMatch(nodeRegex) || "");
|
22
22
|
}
|
23
23
|
|
24
|
-
// Installs exact version and returns lockfile entry
|
25
|
-
async function getLockfileEntryForUpdate(depName, depVersion) {
|
26
|
-
const directory = fs.mkdtempSync(`${os.tmpdir()}${path.sep}`);
|
27
|
-
const readFile = (fileName) =>
|
28
|
-
fs.readFileSync(path.join(directory, fileName)).toString();
|
29
|
-
|
30
|
-
const flags = {
|
31
|
-
ignoreScripts: true,
|
32
|
-
ignoreWorkspaceRootCheck: true,
|
33
|
-
ignoreEngines: true,
|
34
|
-
ignorePlatform: true,
|
35
|
-
};
|
36
|
-
const reporter = new EventReporter();
|
37
|
-
const config = new Config(reporter);
|
38
|
-
await config.init({
|
39
|
-
cwd: directory,
|
40
|
-
nonInteractive: true,
|
41
|
-
enableDefaultRc: true,
|
42
|
-
extraneousYarnrcFiles: [".yarnrc"],
|
43
|
-
});
|
44
|
-
|
45
|
-
// Empty lockfile
|
46
|
-
const lockfile = await Lockfile.fromDirectory(directory, reporter);
|
47
|
-
|
48
|
-
const arg = [`${depName}@${depVersion}`];
|
49
|
-
await new LightweightAdd(arg, flags, config, reporter, lockfile).init();
|
50
|
-
|
51
|
-
const lockfileObject = await parse(directory);
|
52
|
-
const noHeader = true;
|
53
|
-
const enableLockfileVersions = false;
|
54
|
-
return stringify(lockfileObject, noHeader, enableLockfileVersions);
|
55
|
-
}
|
56
|
-
|
57
24
|
async function updateDependencyFile(
|
58
25
|
directory,
|
59
26
|
lockfileName,
|
60
|
-
|
27
|
+
dependencies
|
61
28
|
) {
|
62
29
|
const readFile = (fileName) =>
|
63
30
|
fs.readFileSync(path.join(directory, fileName)).toString();
|
@@ -76,23 +43,27 @@ async function updateDependencyFile(
|
|
76
43
|
enableDefaultRc: true,
|
77
44
|
extraneousYarnrcFiles: [".yarnrc"],
|
78
45
|
});
|
46
|
+
const noHeader = !Boolean(originalYarnLock.match(/^# THIS IS AN AU/m));
|
79
47
|
config.enableLockfileVersions = Boolean(originalYarnLock.match(/^# yarn v/m));
|
80
|
-
const depName = updatedDependency && updatedDependency.name;
|
81
|
-
const depVersion = updatedDependency && updatedDependency.version;
|
82
48
|
|
83
49
|
// SubDependencyVersionResolver relies on the install finding the latest
|
84
50
|
// version of a sub-dependency that's been removed from the lockfile
|
85
51
|
// YarnLockFileUpdater passes a specific version to be updated
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
52
|
+
const lockfileObject = await parse(directory);
|
53
|
+
for (const [entry, pkg] of Object.entries(lockfileObject)) {
|
54
|
+
const [_, depName] = entry.match(
|
55
|
+
LOCKFILE_ENTRY_REGEX
|
90
56
|
);
|
91
|
-
|
57
|
+
if (dependencies.some(dependency => dependency.name === depName)) {
|
58
|
+
delete lockfileObject[entry];
|
59
|
+
}
|
60
|
+
}
|
92
61
|
|
93
|
-
|
94
|
-
|
62
|
+
let newLockFileContent = await stringify(lockfileObject, noHeader, config.enableLockfileVersions);
|
63
|
+
for (const dependency of dependencies) {
|
64
|
+
newLockFileContent = fixDuplicates(newLockFileContent, dependency.name);
|
95
65
|
}
|
66
|
+
fs.writeFileSync(path.join(directory, lockfileName), newLockFileContent);
|
96
67
|
|
97
68
|
const lockfile = await Lockfile.fromDirectory(directory, reporter);
|
98
69
|
const install = new LightweightInstall(flags, config, reporter, lockfile);
|