virmator 4.2.3 → 4.2.5

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.
@@ -1,29 +1,23 @@
1
1
  'use strict';
2
2
 
3
3
  const baseConfig = {
4
- /** Run thresholds on each individual file */
5
- perFile: 100,
6
- /** Caches cause problems. */
4
+ all: true,
5
+ branches: 100,
7
6
  cache: false,
8
- /** Fail when 100% test coverage is not met */
9
7
  checkCoverage: true,
10
- /** Print report to console and also to html files. */
8
+ exclude: ['./test-files'],
9
+ functions: 100,
10
+ include: ['./src/**/*.{ts,tsx,js,mjs,cjs,jsx}'],
11
+ lines: 100,
12
+ perFile: 100,
11
13
  reporter: [
12
14
  'html',
13
15
  'text',
14
16
  ],
15
17
  skipEmpty: true,
16
- /** Don't show files that meet 100% test coverage. */
17
18
  skipFull: true,
18
- tempDir: './node_modules/.nyc-output/',
19
-
20
- /** Require 100% test coverage in all things */
21
- branches: 100,
22
- functions: 100,
23
- lines: 100,
24
19
  statements: 100,
25
-
26
- exclude: ['test-files'],
20
+ tempDir: './node_modules/.nyc-output/',
27
21
  };
28
22
 
29
23
  module.exports = baseConfig;
@@ -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`, { cwd: repoDir });
61
- const currentRepoDepVersions = parseCurrentDeps(listedDeps.stdout);
62
- const packageJson = JSON.parse((await (0, promises_1.readFile)((0, path_1.join)(packageDir, 'package.json'))).toString());
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
- ...packageJson.devDependencies,
65
- ...packageJson.dependencies,
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
- // ignore sub packages
92
- !(depValue === null || depValue === void 0 ? void 0 : depValue.dependencies) &&
103
+ if (depValue &&
104
+ // ignore sub packages
105
+ !depValue.dependencies &&
93
106
  // just a quick check that .version also exists
94
- !!(depValue === null || depValue === void 0 ? void 0 : depValue.version)) {
107
+ !!depValue.version) {
95
108
  depsAndVersions[depName] = depValue.version;
96
109
  }
97
110
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "4.2.3",
3
+ "version": "4.2.5",
4
4
  "description": "Handle all the stuffs in one package.",
5
5
  "keywords": [
6
6
  "automation",