@comet/upgrade 1.1.0 → 1.2.0
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,22 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.formatCode = void 0;
|
|
13
|
+
const eslint_1 = require("eslint");
|
|
14
|
+
function formatCode(code, filePath) {
|
|
15
|
+
var _a, _b, _c, _d;
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const eslint = new eslint_1.ESLint({ cwd: process.cwd(), fix: true });
|
|
18
|
+
const lintResult = yield eslint.lintText(code, { filePath });
|
|
19
|
+
return (_d = (_b = (_a = lintResult[0]) === null || _a === void 0 ? void 0 : _a.output) !== null && _b !== void 0 ? _b : (_c = lintResult[0]) === null || _c === void 0 ? void 0 : _c.source) !== null && _d !== void 0 ? _d : code;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
exports.formatCode = formatCode;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const promises_1 = require("fs/promises");
|
|
13
|
+
const glob_1 = require("glob");
|
|
14
|
+
const format_code_util_1 = require("../util/format-code.util");
|
|
15
|
+
/**
|
|
16
|
+
* Renames BuildRuntime component to JobRuntime.
|
|
17
|
+
*/
|
|
18
|
+
function renameBuildRuntime() {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const files = glob_1.glob.sync(["admin/src/**/*.tsx"]);
|
|
21
|
+
for (const filePath of files) {
|
|
22
|
+
let fileContent = (yield (0, promises_1.readFile)(filePath)).toString();
|
|
23
|
+
if (!fileContent.includes("BuildRuntime")) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
fileContent = fileContent.replace(/BuildRuntime/g, "JobRuntime");
|
|
27
|
+
yield (0, promises_1.writeFile)(filePath, yield (0, format_code_util_1.formatCode)(fileContent, filePath));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.default = renameBuildRuntime;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const promises_1 = require("fs/promises");
|
|
13
|
+
const glob_1 = require("glob");
|
|
14
|
+
const format_code_util_1 = require("../util/format-code.util");
|
|
15
|
+
/**
|
|
16
|
+
* Renames JobStatus enum to KubernetesJobStatus.
|
|
17
|
+
*/
|
|
18
|
+
function renameJobStatusEnum() {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const files = glob_1.glob.sync(["api/src/**/*.ts"]);
|
|
21
|
+
for (const filePath of files) {
|
|
22
|
+
let fileContent = (yield (0, promises_1.readFile)(filePath)).toString();
|
|
23
|
+
// Some of our projects have a custom JobStatus enum, so we need to check for that.
|
|
24
|
+
if (!/import { .*JobStatus.*} from "@comet\/cms-api";/.test(fileContent)) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
fileContent = fileContent.replace(/JobStatus/g, "KubernetesJobStatus");
|
|
28
|
+
yield (0, promises_1.writeFile)(filePath, yield (0, format_code_util_1.formatCode)(fileContent, filePath));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.default = renameJobStatusEnum;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const promises_1 = require("fs/promises");
|
|
13
|
+
const glob_1 = require("glob");
|
|
14
|
+
const format_code_util_1 = require("../util/format-code.util");
|
|
15
|
+
/**
|
|
16
|
+
* Renames @SubjectEntity() decorator to @AffectedEntity().
|
|
17
|
+
*/
|
|
18
|
+
function renameSubjectEntityDecorator() {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const files = glob_1.glob.sync(["api/src/**/*.ts"]);
|
|
21
|
+
for (const filePath of files) {
|
|
22
|
+
let fileContent = (yield (0, promises_1.readFile)(filePath)).toString();
|
|
23
|
+
if (!fileContent.includes("SubjectEntity")) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
fileContent = fileContent.replace(/SubjectEntity/g, "AffectedEntity");
|
|
27
|
+
yield (0, promises_1.writeFile)(filePath, yield (0, format_code_util_1.formatCode)(fileContent, filePath));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.default = renameSubjectEntityDecorator;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comet/upgrade",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Upgrade scripts for Comet DXP",
|
|
5
5
|
"homepage": "https://github.com/vivid-planet/comet-upgrade#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
"start": "yarn clean && tsc --watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"eslint": "^8.56.0",
|
|
32
|
+
"glob": "^10.3.10",
|
|
31
33
|
"prettier": "^2.8.1",
|
|
32
34
|
"semver": "^7.3.8"
|
|
33
35
|
},
|
|
@@ -36,7 +38,6 @@
|
|
|
36
38
|
"@types/node": "^14.18.34",
|
|
37
39
|
"@types/prettier": "^2.7.1",
|
|
38
40
|
"@types/semver": "^7.3.13",
|
|
39
|
-
"eslint": "^8.29.0",
|
|
40
41
|
"husky": "^8.0.2",
|
|
41
42
|
"lint-staged": "^13.1.0",
|
|
42
43
|
"rimraf": "^3.0.2",
|