@ts-dev-tools/core 1.5.29 → 1.5.32

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.
@@ -0,0 +1,2 @@
1
+ import { MigrationUpFunction } from "../../services/MigrationsService";
2
+ export declare const up: MigrationUpFunction;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.up = void 0;
40
+ var PackageJson_1 = require("../../services/PackageJson");
41
+ var up = function (absoluteProjectDir) { return __awaiter(void 0, void 0, void 0, function () {
42
+ var scripts, packageJson;
43
+ return __generator(this, function (_a) {
44
+ scripts = {
45
+ format: "prettier --cache --write '**/*.ts'",
46
+ };
47
+ packageJson = PackageJson_1.PackageJson.fromDirPath(absoluteProjectDir);
48
+ packageJson.merge({
49
+ scripts: scripts,
50
+ });
51
+ return [2 /*return*/];
52
+ });
53
+ }); };
54
+ exports.up = up;
@@ -44,7 +44,7 @@ var DuplicateDependenciesService = /** @class */ (function () {
44
44
  duplicateDependencies.forEach(function (pluginDuplicateDependencies, plugin) {
45
45
  if (pluginDuplicateDependencies.size) {
46
46
  var pluginDuplicateDependenciesValue = Array.from(pluginDuplicateDependencies);
47
- console.info("Some dev dependencies are unnecessarily installed as their are already required by \"".concat(plugin, "\":\"\n - \"").concat(pluginDuplicateDependenciesValue.join("\n - "), "\n"));
47
+ console.info("Some dev dependencies are unnecessarily installed as their are already required by \"".concat(plugin, "\":\n - ").concat(pluginDuplicateDependenciesValue.join("\n - "), "\n"));
48
48
  }
49
49
  });
50
50
  };
@@ -7,4 +7,6 @@ export declare class MigrationsService {
7
7
  static executeMigrations(absoluteProjectDir: string, currentVersion: string | undefined): Promise<void>;
8
8
  private static getAvailableMigrations;
9
9
  private static getPluginMigrations;
10
+ static getMigrationNameFromFile(migrationFile: string): string;
11
+ static migrationIsAfterCurrentVersion(migrationName: string, currentVersion?: string): boolean;
10
12
  }
@@ -111,11 +111,11 @@ var MigrationsService = /** @class */ (function () {
111
111
  var pluginMigrationsDirPath = (0, path_1.resolve)(plugin.path, "dist/install/migrations");
112
112
  for (var _i = 0, _a = (0, fs_1.readdirSync)(pluginMigrationsDirPath); _i < _a.length; _i++) {
113
113
  var migrationFile = _a[_i];
114
- if (!migrationFile.match(/^[0-9]{14}-[a-z]+\.(js|ts)$/)) {
114
+ if (!migrationFile.match(/^[0-9]{14}-[-a-z]+\.(js|ts)$/)) {
115
115
  continue;
116
116
  }
117
- var migrationName = migrationFile.split(".").slice(0, -1).join(".");
118
- var shouldApplyMigration = !currentVersion || currentVersion.localeCompare(migrationName) < 0;
117
+ var migrationName = MigrationsService.getMigrationNameFromFile(migrationFile);
118
+ var shouldApplyMigration = MigrationsService.migrationIsAfterCurrentVersion(migrationName, currentVersion);
119
119
  if (!shouldApplyMigration) {
120
120
  continue;
121
121
  }
@@ -126,6 +126,13 @@ var MigrationsService = /** @class */ (function () {
126
126
  }
127
127
  return migrationFiles;
128
128
  };
129
+ MigrationsService.getMigrationNameFromFile = function (migrationFile) {
130
+ var migrationName = migrationFile.split(".").slice(0, -1).join(".");
131
+ return migrationName;
132
+ };
133
+ MigrationsService.migrationIsAfterCurrentVersion = function (migrationName, currentVersion) {
134
+ return !currentVersion || currentVersion.localeCompare(migrationName) < 0;
135
+ };
129
136
  return MigrationsService;
130
137
  }());
131
138
  exports.MigrationsService = MigrationsService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-dev-tools/core",
3
- "version": "1.5.29",
3
+ "version": "1.5.32",
4
4
  "description": "TS dev tools Core",
5
5
  "keywords": [
6
6
  "linter",
@@ -44,26 +44,26 @@
44
44
  "url": "https://github.com/escemi-tech/ts-dev-tools/issues"
45
45
  },
46
46
  "dependencies": {
47
- "@commitlint/cli": "^17.0.1",
48
- "@commitlint/config-conventional": "^17.0.0",
49
- "@types/jest": "^27.5.1",
50
- "@types/node": "^17.0.36",
51
- "@typescript-eslint/eslint-plugin": "^5.26.0",
52
- "@typescript-eslint/parser": "^5.26.0",
53
- "eslint": "^8.16.0",
47
+ "@commitlint/cli": "^17.0.3",
48
+ "@commitlint/config-conventional": "^17.0.3",
49
+ "@types/jest": "^28.1.6",
50
+ "@types/node": "^18.0.6",
51
+ "@typescript-eslint/eslint-plugin": "^5.30.7",
52
+ "@typescript-eslint/parser": "^5.30.6",
53
+ "eslint": "^8.19.0",
54
54
  "eslint-config-prettier": "^8.5.0",
55
55
  "eslint-plugin-import": "^2.26.0",
56
- "eslint-plugin-jest": "^26.4.2",
56
+ "eslint-plugin-jest": "^26.6.0",
57
57
  "eslint-plugin-node": "^11.1.0",
58
58
  "eslint-plugin-promise": "^6.0.0",
59
59
  "import-sort-style-module": "^6.0.0",
60
- "jest": "^28.1.0",
61
- "lint-staged": "^12.4.2",
62
- "prettier": "^2.6.2",
60
+ "jest": "^28.1.3",
61
+ "lint-staged": "^13.0.3",
62
+ "prettier": "^2.7.1",
63
63
  "prettier-plugin-import-sort": "^0.0.7",
64
64
  "pretty-quick": "^3.1.3",
65
- "ts-jest": "^28.0.3",
66
- "typescript": "^4.7.2"
65
+ "ts-jest": "^28.0.6",
66
+ "typescript": "^4.7.4"
67
67
  },
68
68
  "devDependencies": {
69
69
  "pinst": "^3.0.0"
@@ -116,5 +116,5 @@
116
116
  "github-actions"
117
117
  ]
118
118
  },
119
- "gitHead": "b44eaa9ce7c44f06837e14f6a6addd027f6a1f21"
119
+ "gitHead": "d2950589218ac5dcbe4700bbb1a1db4cfc230636"
120
120
  }