virmator 4.2.3 → 4.2.4
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.
|
@@ -57,12 +57,19 @@ async function updateDepsAsNeeded(inputs) {
|
|
|
57
57
|
}
|
|
58
58
|
exports.updateDepsAsNeeded = updateDepsAsNeeded;
|
|
59
59
|
async function getVersionsToUpgradeTo({ repoDir, packageDir, npmDeps, packageBinName, }) {
|
|
60
|
-
const listedDeps = await (0, node_only_1.runShellCommand)(`npm list --depth=0 2>&1 -json`, {
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const listedDeps = await (0, node_only_1.runShellCommand)(`npm list --depth=0 2>&1 -json`, {
|
|
61
|
+
cwd: repoDir,
|
|
62
|
+
rejectOnError: true,
|
|
63
|
+
});
|
|
64
|
+
const packageName = (await (0, node_only_1.runShellCommand)(`cut -d "=" -f 2 <<< $(npm run env | grep "npm_package_name")`, {
|
|
65
|
+
cwd: repoDir,
|
|
66
|
+
rejectOnError: true,
|
|
67
|
+
})).stdout.trim();
|
|
68
|
+
const currentRepoDepVersions = parseCurrentDeps(listedDeps.stdout, packageName);
|
|
69
|
+
const virmatorPackageJson = JSON.parse((await (0, promises_1.readFile)((0, path_1.join)(packageDir, 'package.json'))).toString());
|
|
63
70
|
const packageDepVersions = {
|
|
64
|
-
...
|
|
65
|
-
...
|
|
71
|
+
...virmatorPackageJson.devDependencies,
|
|
72
|
+
...virmatorPackageJson.dependencies,
|
|
66
73
|
};
|
|
67
74
|
return npmDeps.map((npmDep) => {
|
|
68
75
|
var _a, _b, _c;
|
|
@@ -81,17 +88,23 @@ async function getVersionsToUpgradeTo({ repoDir, packageDir, npmDeps, packageBin
|
|
|
81
88
|
}
|
|
82
89
|
});
|
|
83
90
|
}
|
|
84
|
-
function parseCurrentDeps(stdout) {
|
|
91
|
+
function parseCurrentDeps(stdout, packageName) {
|
|
85
92
|
const parsedListOutput = JSON.parse(stdout);
|
|
86
93
|
const deps = parsedListOutput.dependencies;
|
|
94
|
+
return readDeps(deps, packageName);
|
|
95
|
+
}
|
|
96
|
+
function readDeps(rawDeps, packageName) {
|
|
97
|
+
var _a;
|
|
87
98
|
const depsAndVersions = {};
|
|
99
|
+
const nestedDeps = (_a = rawDeps[packageName]) === null || _a === void 0 ? void 0 : _a.dependencies;
|
|
100
|
+
const deps = nestedDeps !== null && nestedDeps !== void 0 ? nestedDeps : rawDeps;
|
|
88
101
|
Object.keys(deps).forEach((depName) => {
|
|
89
102
|
const depValue = deps[depName];
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
103
|
+
if (depValue &&
|
|
104
|
+
// ignore sub packages
|
|
105
|
+
!depValue.dependencies &&
|
|
93
106
|
// just a quick check that .version also exists
|
|
94
|
-
!!
|
|
107
|
+
!!depValue.version) {
|
|
95
108
|
depsAndVersions[depName] = depValue.version;
|
|
96
109
|
}
|
|
97
110
|
});
|