virmator 7.2.2 → 7.2.3

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.
@@ -7,10 +7,10 @@ exports.noCommandLogging = {
7
7
  };
8
8
  exports.defaultConsoleLogging = {
9
9
  stdout: (input) => {
10
- console.info(input.replace(/\n$/, ''));
10
+ process.stdout.write(input.replace(/\n$/, '') + '\n');
11
11
  },
12
12
  stderr: (input) => {
13
- console.error(input.replace(/\n$/, ''));
13
+ process.stderr.write(input.replace(/\n$/, '') + '\n');
14
14
  },
15
15
  };
16
16
  const identityCommandLogTransform = (input) => input;
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.regenDepsCommandDefinition = void 0;
4
+ const common_1 = require("@augment-vir/common");
4
5
  const node_js_1 = require("@augment-vir/node-js");
6
+ const fs_1 = require("fs");
7
+ const promises_1 = require("fs/promises");
8
+ const path_1 = require("path");
5
9
  const define_command_1 = require("../api/command/define-command");
6
- const fs_1 = require("../augments/fs");
10
+ const fs_2 = require("../augments/fs");
7
11
  exports.regenDepsCommandDefinition = (0, define_command_1.defineCommand)({
8
12
  commandName: 'regen-deps',
9
13
  subCommandDescriptions: {},
@@ -21,12 +25,43 @@ exports.regenDepsCommandDefinition = (0, define_command_1.defineCommand)({
21
25
  };
22
26
  }, async (inputs) => {
23
27
  const allChildNodeModules = await (0, node_js_1.readDirRecursive)(inputs.repoDir);
24
- const nodeModulesPaths = new Set(allChildNodeModules
28
+ const nodeModulesPaths = Array.from(new Set(allChildNodeModules
25
29
  .filter((path) => path.includes('node_modules'))
26
- .map((path) => path.replace(/([\\\/]|^)node_modules[\\\/].+$/, '$1node_modules')));
27
- await Promise.all(Array.from(nodeModulesPaths).map(async (nodeModulesPath) => {
28
- await (0, fs_1.removeDirectory)(nodeModulesPath);
30
+ .map((path) => path.replace(/([\\\/]|^)node_modules[\\\/].+$/, '$1node_modules'))));
31
+ const packageLockPath = (0, path_1.join)(inputs.repoDir, 'package-lock.json');
32
+ const removePackageLock = (0, fs_1.existsSync)(packageLockPath);
33
+ inputs.logging.stdout((0, node_js_1.toLogString)({
34
+ args: [
35
+ 'Removing node_modules:',
36
+ ...nodeModulesPaths.map((nodeModulesPath) => ` ${nodeModulesPath}`),
37
+ removePackageLock ? 'Removing package-lock.json' : '',
38
+ ].filter(common_1.isTruthy),
39
+ colors: node_js_1.ColorKey.faint,
40
+ }));
41
+ let errorsHappened = false;
42
+ if (removePackageLock) {
43
+ try {
44
+ await (0, promises_1.unlink)(packageLockPath);
45
+ }
46
+ catch (error) {
47
+ errorsHappened = true;
48
+ inputs.logging.stderr('Failed to remove package-lock.json.');
49
+ }
50
+ }
51
+ await Promise.all(nodeModulesPaths.map(async (nodeModulesPath) => {
52
+ try {
53
+ await (0, fs_2.removeDirectory)(nodeModulesPath);
54
+ }
55
+ catch (error) {
56
+ errorsHappened = true;
57
+ inputs.logging.stderr('Failed to remove package-lock.json.');
58
+ }
29
59
  }));
60
+ if (errorsHappened) {
61
+ return {
62
+ success: false,
63
+ };
64
+ }
30
65
  return {
31
66
  args: [
32
67
  'npm',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virmator",
3
- "version": "7.2.2",
3
+ "version": "7.2.3",
4
4
  "description": "Handle common package configs, commands, and dependencies.",
5
5
  "keywords": [
6
6
  "automation",
@@ -43,8 +43,8 @@
43
43
  "test:types": "tsc --noEmit"
44
44
  },
45
45
  "dependencies": {
46
- "@augment-vir/common": "^15.3.0",
47
- "@augment-vir/node-js": "^15.3.0",
46
+ "@augment-vir/common": "^15.4.0",
47
+ "@augment-vir/node-js": "^15.4.0",
48
48
  "ansi-colors": "^4.1.3",
49
49
  "concurrently": "^8.2.0",
50
50
  "glob": "^8.1.0",
@@ -91,7 +91,7 @@
91
91
  "ts-node": "^10.9.1",
92
92
  "tsconfig-paths": "^4.2.0",
93
93
  "typescript": "^5.1.6",
94
- "virmator": "^7.2.1",
94
+ "virmator": "^7.2.2",
95
95
  "vite": "^4.4.4",
96
96
  "vite-tsconfig-paths": "^4.2.0"
97
97
  },