@ts-dev-tools/core 1.12.1 → 1.12.2
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.
- package/dist/bin.js +26 -76
- package/dist/constants.js +2 -2
- package/dist/eslint-plugin-ts-dev-tools/index.js +18 -30
- package/dist/install/command.js +30 -80
- package/dist/install/migrations/20201024173398-init.js +89 -141
- package/dist/install/migrations/20220617100200-prettier-cache.js +9 -49
- package/dist/install/migrations/20240329200200-eslint-ignore.js +9 -49
- package/dist/install/migrations/20240412185500-eslint-config.js +16 -53
- package/dist/install/migrations/20240617094000-config-nx-scopes.js +22 -67
- package/dist/install/migrations/20250623095500-add-prettier-oxc.js +9 -49
- package/dist/install/migrations/20250623095600-remove-prettier-oxc.js +15 -55
- package/dist/services/CmdService.js +17 -21
- package/dist/services/CorePackageService.js +8 -11
- package/dist/services/DuplicateDependenciesService.js +28 -33
- package/dist/services/FileService.js +11 -14
- package/dist/services/GitService.js +36 -83
- package/dist/services/MigrationsService.js +52 -121
- package/dist/services/PackageJson.js +47 -57
- package/dist/services/PackageJsonMerge.js +17 -21
- package/dist/services/PackageManagerService.js +25 -80
- package/dist/services/PeerDependenciesService.js +92 -157
- package/dist/services/PluginService.js +32 -39
- package/dist/services/SymlinkDependenciesService.js +52 -133
- package/dist/services/package-manager/AbstractPackageManagerAdapter.js +84 -138
- package/dist/services/package-manager/NpmPackageManagerAdapter.js +58 -158
- package/dist/services/package-manager/YarnPackageManagerAdapter.js +122 -235
- package/dist/tests/cli.js +12 -57
- package/dist/tests/console.js +5 -6
- package/dist/tests/file-system.js +23 -92
- package/dist/tests/test-cache.js +5 -5
- package/dist/tests/test-packages.js +33 -95
- package/dist/tests/test-project-monorepo.js +22 -85
- package/dist/tests/test-project.js +49 -127
- package/package.json +12 -12
|
@@ -1,54 +1,14 @@
|
|
|
1
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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["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 (g && (g = 0, op[0] && (_ = 0)), _) 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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.up = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
packageJson.merge({
|
|
49
|
-
eslintConfig: eslintConfig,
|
|
50
|
-
});
|
|
51
|
-
return [2 /*return*/];
|
|
4
|
+
const PackageJson_1 = require("../../services/PackageJson");
|
|
5
|
+
const up = async (absoluteProjectDir) => {
|
|
6
|
+
const eslintConfig = {
|
|
7
|
+
ignorePatterns: ["dist", "node_modules"],
|
|
8
|
+
};
|
|
9
|
+
const packageJson = PackageJson_1.PackageJson.fromDirPath(absoluteProjectDir);
|
|
10
|
+
packageJson.merge({
|
|
11
|
+
eslintConfig,
|
|
52
12
|
});
|
|
53
|
-
}
|
|
13
|
+
};
|
|
54
14
|
exports.up = up;
|
|
@@ -1,57 +1,20 @@
|
|
|
1
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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["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 (g && (g = 0, op[0] && (_ = 0)), _) 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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.up = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}); };
|
|
4
|
+
const FileService_1 = require("../../services/FileService");
|
|
5
|
+
const PackageJson_1 = require("../../services/PackageJson");
|
|
6
|
+
const up = async (absoluteProjectDir) => {
|
|
7
|
+
const packageJson = PackageJson_1.PackageJson.fromDirPath(absoluteProjectDir);
|
|
8
|
+
const packageJsonContent = packageJson.getContent();
|
|
9
|
+
delete packageJsonContent.eslintConfig;
|
|
10
|
+
packageJson.setContent(packageJsonContent);
|
|
11
|
+
const eslintConfigFilePath = `${absoluteProjectDir}/eslint.config.mjs`;
|
|
12
|
+
if (FileService_1.FileService.fileExists(eslintConfigFilePath)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
FileService_1.FileService.putFileContent(eslintConfigFilePath, `import { default as tsDevToolsCore } from "@ts-dev-tools/core/dist/eslint-plugin-ts-dev-tools/index.js";
|
|
16
|
+
|
|
17
|
+
export default tsDevToolsCore.default;
|
|
18
|
+
`);
|
|
19
|
+
};
|
|
57
20
|
exports.up = up;
|
|
@@ -1,72 +1,27 @@
|
|
|
1
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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["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 (g && (g = 0, op[0] && (_ = 0)), _) 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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.up = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
case 3:
|
|
62
|
-
commitlint = {
|
|
63
|
-
extends: [packageToInstall],
|
|
64
|
-
};
|
|
65
|
-
packageJson.merge({
|
|
66
|
-
commitlint: commitlint,
|
|
67
|
-
});
|
|
68
|
-
return [2 /*return*/];
|
|
69
|
-
}
|
|
4
|
+
const PackageJson_1 = require("../../services/PackageJson");
|
|
5
|
+
const PackageManagerService_1 = require("../../services/PackageManagerService");
|
|
6
|
+
const up = async (absoluteProjectDir) => {
|
|
7
|
+
const nxDeps = ["@nrwl/workspace", "nx", "lerna"];
|
|
8
|
+
const packageToInstall = "@commitlint/config-nx-scopes";
|
|
9
|
+
// Check if project is using nx or lerna
|
|
10
|
+
const packageJson = PackageJson_1.PackageJson.fromDirPath(absoluteProjectDir);
|
|
11
|
+
const hasNx = nxDeps.some((dep) => packageJson.hasDependency(dep));
|
|
12
|
+
if (!hasNx) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
// Ensure that package is installed
|
|
16
|
+
if (!(await PackageManagerService_1.PackageManagerService.isPackageInstalled(packageToInstall, absoluteProjectDir))) {
|
|
17
|
+
await PackageManagerService_1.PackageManagerService.addDevPackage(packageToInstall, absoluteProjectDir);
|
|
18
|
+
}
|
|
19
|
+
// Update commitlint config
|
|
20
|
+
const commitlint = {
|
|
21
|
+
extends: [packageToInstall],
|
|
22
|
+
};
|
|
23
|
+
packageJson.merge({
|
|
24
|
+
commitlint,
|
|
70
25
|
});
|
|
71
|
-
}
|
|
26
|
+
};
|
|
72
27
|
exports.up = up;
|
|
@@ -1,54 +1,14 @@
|
|
|
1
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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["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 (g && (g = 0, op[0] && (_ = 0)), _) 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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.up = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
packageJson.merge({
|
|
49
|
-
prettier: prettierConfig,
|
|
50
|
-
});
|
|
51
|
-
return [2 /*return*/];
|
|
4
|
+
const PackageJson_1 = require("../../services/PackageJson");
|
|
5
|
+
const up = async (absoluteProjectDir) => {
|
|
6
|
+
const prettierConfig = {
|
|
7
|
+
plugins: ["@prettier/plugin-oxc"],
|
|
8
|
+
};
|
|
9
|
+
const packageJson = PackageJson_1.PackageJson.fromDirPath(absoluteProjectDir);
|
|
10
|
+
packageJson.merge({
|
|
11
|
+
prettier: prettierConfig,
|
|
52
12
|
});
|
|
53
|
-
}
|
|
13
|
+
};
|
|
54
14
|
exports.up = up;
|
|
@@ -1,61 +1,21 @@
|
|
|
1
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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["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 (g && (g = 0, op[0] && (_ = 0)), _) 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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.up = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
prettierConfig.plugins = filteredPlugins;
|
|
54
|
-
packageJson.setContent(packageJsonContent);
|
|
55
|
-
}
|
|
4
|
+
const PackageJson_1 = require("../../services/PackageJson");
|
|
5
|
+
const up = async (absoluteProjectDir) => {
|
|
6
|
+
const packageJson = PackageJson_1.PackageJson.fromDirPath(absoluteProjectDir);
|
|
7
|
+
const packageJsonContent = packageJson.getContent();
|
|
8
|
+
// Remove @prettier/plugin-oxc from prettier.plugins if it exists
|
|
9
|
+
if (packageJsonContent.prettier && typeof packageJsonContent.prettier === "object") {
|
|
10
|
+
const prettierConfig = packageJsonContent.prettier;
|
|
11
|
+
if (Array.isArray(prettierConfig.plugins)) {
|
|
12
|
+
const plugins = prettierConfig.plugins;
|
|
13
|
+
const filteredPlugins = plugins.filter((plugin) => plugin !== "@prettier/plugin-oxc");
|
|
14
|
+
if (filteredPlugins.length !== plugins.length) {
|
|
15
|
+
prettierConfig.plugins = filteredPlugins;
|
|
16
|
+
packageJson.setContent(packageJsonContent);
|
|
56
17
|
}
|
|
57
18
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}); };
|
|
19
|
+
}
|
|
20
|
+
};
|
|
61
21
|
exports.up = up;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CmdService = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
CmdService.execCmd = function (args, cwd, silent) {
|
|
10
|
-
if (silent === void 0) { silent = false; }
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
class CmdService {
|
|
7
|
+
static execCmd(args, cwd, silent = false) {
|
|
11
8
|
if (!args.length) {
|
|
12
9
|
throw new Error("Command args must not be empty");
|
|
13
10
|
}
|
|
14
11
|
if (cwd) {
|
|
15
12
|
if (!(0, fs_1.existsSync)(cwd) || !(0, fs_1.statSync)(cwd).isDirectory()) {
|
|
16
|
-
throw new Error(
|
|
13
|
+
throw new Error(`Directory "${cwd}" does not exist`);
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
|
|
16
|
+
let cmd;
|
|
20
17
|
if (Array.isArray(args)) {
|
|
21
18
|
cmd = args.shift() || "";
|
|
22
19
|
}
|
|
@@ -24,15 +21,15 @@ var CmdService = /** @class */ (function () {
|
|
|
24
21
|
cmd = args;
|
|
25
22
|
args = [];
|
|
26
23
|
}
|
|
27
|
-
return new Promise(
|
|
28
|
-
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
const child = (0, child_process_1.spawn)(cmd, args, {
|
|
29
26
|
stdio: silent ? "pipe" : "inherit",
|
|
30
27
|
shell: true,
|
|
31
28
|
windowsVerbatimArguments: true,
|
|
32
|
-
cwd
|
|
29
|
+
cwd,
|
|
33
30
|
});
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
let output = "";
|
|
32
|
+
let error = "";
|
|
36
33
|
child.on("exit", function (code) {
|
|
37
34
|
if (code) {
|
|
38
35
|
return reject(error);
|
|
@@ -40,17 +37,16 @@ var CmdService = /** @class */ (function () {
|
|
|
40
37
|
resolve(output);
|
|
41
38
|
});
|
|
42
39
|
if (child.stdout) {
|
|
43
|
-
child.stdout.on("data",
|
|
44
|
-
output +=
|
|
40
|
+
child.stdout.on("data", (data) => {
|
|
41
|
+
output += `\n${data}`;
|
|
45
42
|
});
|
|
46
43
|
}
|
|
47
44
|
if (child.stderr) {
|
|
48
|
-
child.stderr.on("data",
|
|
49
|
-
error +=
|
|
45
|
+
child.stderr.on("data", (data) => {
|
|
46
|
+
error += `\n${data}`;
|
|
50
47
|
});
|
|
51
48
|
}
|
|
52
49
|
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
56
52
|
exports.CmdService = CmdService;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CorePackageService = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
CorePackageService.getPackageRootPath = function () {
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const PackageJson_1 = require("./PackageJson");
|
|
6
|
+
class CorePackageService {
|
|
7
|
+
static getPackageRootPath() {
|
|
10
8
|
return (0, path_1.resolve)(__dirname, "../..");
|
|
11
|
-
}
|
|
12
|
-
|
|
9
|
+
}
|
|
10
|
+
static getPackageName() {
|
|
13
11
|
return PackageJson_1.PackageJson.fromDirPath(CorePackageService.getPackageRootPath()).getPackageName();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
}());
|
|
12
|
+
}
|
|
13
|
+
}
|
|
17
14
|
exports.CorePackageService = CorePackageService;
|
|
@@ -1,58 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DuplicateDependenciesService = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
console.info("Checking for duplicate dev dependencies...");
|
|
11
|
-
var duplicateDependencies = new Map();
|
|
4
|
+
const PackageJson_1 = require("./PackageJson");
|
|
5
|
+
const PluginService_1 = require("./PluginService");
|
|
6
|
+
class DuplicateDependenciesService {
|
|
7
|
+
static executeDeduplication(absoluteProjectDir) {
|
|
8
|
+
console.info(`Checking for duplicate dev dependencies...`);
|
|
9
|
+
const duplicateDependencies = new Map();
|
|
12
10
|
DuplicateDependenciesService.getProjectDuplicateDependencies(absoluteProjectDir, duplicateDependencies);
|
|
13
11
|
DuplicateDependenciesService.printDuplicatedDependencies(duplicateDependencies);
|
|
14
|
-
console.info(
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
for (
|
|
21
|
-
var plugin = installedPlugins_1[_i];
|
|
12
|
+
console.info(`Check for duplicate dev dependencies done!`);
|
|
13
|
+
}
|
|
14
|
+
static getProjectDuplicateDependencies(absoluteProjectDir, duplicateDependencies) {
|
|
15
|
+
const installedPlugins = PluginService_1.PluginService.getInstalledPlugins(absoluteProjectDir);
|
|
16
|
+
const projectPackageJson = PackageJson_1.PackageJson.fromDirPath(absoluteProjectDir);
|
|
17
|
+
const projectDevDependencies = projectPackageJson.getDevDependenciesPackageNames();
|
|
18
|
+
for (const plugin of installedPlugins) {
|
|
22
19
|
DuplicateDependenciesService.getPluginDuplicateDependencies(plugin, projectDevDependencies, duplicateDependencies);
|
|
23
20
|
}
|
|
24
21
|
return duplicateDependencies;
|
|
25
|
-
}
|
|
26
|
-
|
|
22
|
+
}
|
|
23
|
+
static getPluginDuplicateDependencies(plugin, projectDevDependencies, duplicateDependencies) {
|
|
27
24
|
// First check for duplicate of inherited plugins
|
|
28
25
|
DuplicateDependenciesService.getProjectDuplicateDependencies(plugin.path, duplicateDependencies);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const pluginPackageJson = PackageJson_1.PackageJson.fromDirPath(plugin.path);
|
|
27
|
+
const pluginDependencies = pluginPackageJson.getDependenciesPackageNames();
|
|
28
|
+
let pluginDuplicateDependencies = duplicateDependencies.get(plugin.fullname);
|
|
32
29
|
if (!pluginDuplicateDependencies) {
|
|
33
30
|
pluginDuplicateDependencies = new Set();
|
|
34
31
|
duplicateDependencies.set(plugin.fullname, pluginDuplicateDependencies);
|
|
35
32
|
}
|
|
36
|
-
for (
|
|
37
|
-
var projectDevDependency = projectDevDependencies_1[_i];
|
|
33
|
+
for (const projectDevDependency of projectDevDependencies) {
|
|
38
34
|
if (pluginDependencies.includes(projectDevDependency)) {
|
|
39
35
|
pluginDuplicateDependencies.add(projectDevDependency);
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
duplicateDependencies.forEach(
|
|
38
|
+
}
|
|
39
|
+
static printDuplicatedDependencies(duplicateDependencies) {
|
|
40
|
+
let hasDuplicates = false;
|
|
41
|
+
duplicateDependencies.forEach((pluginDuplicateDependencies, plugin) => {
|
|
46
42
|
if (pluginDuplicateDependencies.size) {
|
|
47
|
-
|
|
43
|
+
const pluginDuplicateDependenciesValue = Array.from(pluginDuplicateDependencies);
|
|
48
44
|
hasDuplicates = true;
|
|
49
|
-
console.info(
|
|
45
|
+
console.info(`Some dev dependencies are unnecessarily installed as their are already required by "${plugin}":\n - ${pluginDuplicateDependenciesValue.join("\n - ")}\n`);
|
|
50
46
|
}
|
|
51
47
|
});
|
|
52
48
|
if (!hasDuplicates) {
|
|
53
|
-
console.info(
|
|
49
|
+
console.info(`No duplicate dev dependencies found.`);
|
|
54
50
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
}());
|
|
51
|
+
}
|
|
52
|
+
}
|
|
58
53
|
exports.DuplicateDependenciesService = DuplicateDependenciesService;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileService = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
FileService.fileExists = function (filePath) {
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
class FileService {
|
|
6
|
+
static fileExists(filePath) {
|
|
9
7
|
return (0, fs_1.existsSync)(filePath);
|
|
10
|
-
}
|
|
11
|
-
|
|
8
|
+
}
|
|
9
|
+
static getFileContent(filePath) {
|
|
12
10
|
return (0, fs_1.readFileSync)(filePath, "utf-8");
|
|
13
|
-
}
|
|
14
|
-
|
|
11
|
+
}
|
|
12
|
+
static putFileContent(path, content) {
|
|
15
13
|
(0, fs_1.writeFileSync)(path, content);
|
|
16
|
-
}
|
|
17
|
-
|
|
14
|
+
}
|
|
15
|
+
static copyFile(sourcePath, destinationPath) {
|
|
18
16
|
(0, fs_1.copyFileSync)(sourcePath, destinationPath);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
22
19
|
exports.FileService = FileService;
|