@dragonshorn-studios/elyseum-cli 0.1.3 → 0.1.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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-coverage-command.d.ts","sourceRoot":"","sources":["../../src/commands/diff-coverage-command.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChD,OAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGjD,qBAAa,mBAAoB,YAAW,OAAO;IACjD,IAAI,EAAE,MAAM,CAAmB;IAC/B,MAAM,CAAC,EAAE,YAAY,CAmBnB;gBACU,QAAQ,EAAE,UAAU;IAInB,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"diff-coverage-command.d.ts","sourceRoot":"","sources":["../../src/commands/diff-coverage-command.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChD,OAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGjD,qBAAa,mBAAoB,YAAW,OAAO;IACjD,IAAI,EAAE,MAAM,CAAmB;IAC/B,MAAM,CAAC,EAAE,YAAY,CAmBnB;gBACU,QAAQ,EAAE,UAAU;IAInB,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;YA8E5B,qBAAqB;YAuIrB,iBAAiB;YAajB,eAAe;CA4E9B"}
|
package/dist/index.js
CHANGED
|
@@ -39074,6 +39074,21 @@ minimatch.Minimatch = Minimatch;
|
|
|
39074
39074
|
minimatch.escape = escape;
|
|
39075
39075
|
minimatch.unescape = unescape;
|
|
39076
39076
|
|
|
39077
|
+
class Logger {
|
|
39078
|
+
static debug(message) {
|
|
39079
|
+
console.debug(`[DEBUG] ${message}`);
|
|
39080
|
+
}
|
|
39081
|
+
static info(message) {
|
|
39082
|
+
console.info(`[INFO] ${message}`);
|
|
39083
|
+
}
|
|
39084
|
+
static warn(message) {
|
|
39085
|
+
console.warn(`[WARN] ${message}`);
|
|
39086
|
+
}
|
|
39087
|
+
static error(message) {
|
|
39088
|
+
console.error(`[ERROR] ${message}`);
|
|
39089
|
+
}
|
|
39090
|
+
}
|
|
39091
|
+
|
|
39077
39092
|
function readCoverageConfig(filePath) {
|
|
39078
39093
|
if (!fs$1.existsSync(filePath)) {
|
|
39079
39094
|
return null;
|
|
@@ -39095,18 +39110,18 @@ function readCoverageConfig(filePath) {
|
|
|
39095
39110
|
return JSON.parse(coverageConfig);
|
|
39096
39111
|
}
|
|
39097
39112
|
function getCoverageExcludes(configDir) {
|
|
39098
|
-
const tools = ["vitest", "jest", "mocha"];
|
|
39113
|
+
const tools = ["vitest", "jest", "mocha", "vite"];
|
|
39099
39114
|
let excludes = [];
|
|
39100
39115
|
for (const tool of tools) {
|
|
39101
39116
|
const configPaths = [
|
|
39102
|
-
path$2.join(configDir, `vite.config.js`),
|
|
39103
|
-
path$2.join(configDir, `vite.config.mjs`),
|
|
39104
39117
|
path$2.join(configDir, `${tool}.config.js`),
|
|
39105
39118
|
path$2.join(configDir, `${tool}.config.mjs`),
|
|
39106
39119
|
];
|
|
39107
39120
|
for (const configPath of configPaths) {
|
|
39108
39121
|
const config = readCoverageConfig(configPath);
|
|
39109
39122
|
if (config) {
|
|
39123
|
+
Logger.debug(`Found coverage config in ${configPath}`);
|
|
39124
|
+
Logger.debug(`Excludes: ${config.exclude.join(", ")}`);
|
|
39110
39125
|
return config.exclude;
|
|
39111
39126
|
}
|
|
39112
39127
|
}
|
|
@@ -39114,21 +39129,6 @@ function getCoverageExcludes(configDir) {
|
|
|
39114
39129
|
return excludes;
|
|
39115
39130
|
}
|
|
39116
39131
|
|
|
39117
|
-
class Logger {
|
|
39118
|
-
static debug(message) {
|
|
39119
|
-
console.debug(`[DEBUG] ${message}`);
|
|
39120
|
-
}
|
|
39121
|
-
static info(message) {
|
|
39122
|
-
console.info(`[INFO] ${message}`);
|
|
39123
|
-
}
|
|
39124
|
-
static warn(message) {
|
|
39125
|
-
console.warn(`[WARN] ${message}`);
|
|
39126
|
-
}
|
|
39127
|
-
static error(message) {
|
|
39128
|
-
console.error(`[ERROR] ${message}`);
|
|
39129
|
-
}
|
|
39130
|
-
}
|
|
39131
|
-
|
|
39132
39132
|
class DiffCoverageCommand {
|
|
39133
39133
|
constructor(commands) {
|
|
39134
39134
|
this.name = "diff-coverage";
|
|
@@ -39172,19 +39172,22 @@ class DiffCoverageCommand {
|
|
|
39172
39172
|
"**/*.vue",
|
|
39173
39173
|
];
|
|
39174
39174
|
try {
|
|
39175
|
+
Logger.debug("Running diff-coverage command");
|
|
39176
|
+
Logger.debug(`head branch/sha: ${Config$1.get(this.name, "head")}, base branch/sha: ${Config$1.get(this.name, "base")}`);
|
|
39175
39177
|
let changedFiles = Config$1.get(this.name, "changed-files", "");
|
|
39176
39178
|
let headSha = await git.resolveRef({
|
|
39177
39179
|
fs: fs$2,
|
|
39178
39180
|
dir: process.cwd(),
|
|
39179
39181
|
ref: Config$1.get(this.name, "head"),
|
|
39180
39182
|
});
|
|
39183
|
+
Logger.debug(`Head SHA: ${headSha}`);
|
|
39181
39184
|
let baseSha = await git.resolveRef({
|
|
39182
39185
|
fs: fs$2,
|
|
39183
39186
|
dir: process.cwd(),
|
|
39184
39187
|
ref: Config$1.get(this.name, "base"),
|
|
39185
39188
|
});
|
|
39186
|
-
Logger.debug(`Head SHA: ${headSha}`);
|
|
39187
39189
|
Logger.debug(`Base SHA: ${baseSha}`);
|
|
39190
|
+
Logger.debug(`Changed files: ${changedFiles}`);
|
|
39188
39191
|
let files = [];
|
|
39189
39192
|
if (!changedFiles) {
|
|
39190
39193
|
files = await this.getChangedFiles(process.cwd(), headSha, baseSha);
|
|
@@ -39196,7 +39199,6 @@ class DiffCoverageCommand {
|
|
|
39196
39199
|
};
|
|
39197
39200
|
});
|
|
39198
39201
|
}
|
|
39199
|
-
Logger.debug(`Changed files: ${files.map((file) => file.path).join(", ")}`);
|
|
39200
39202
|
files = files.filter((file) => {
|
|
39201
39203
|
return (!coverageExcludes.some((exclude) => {
|
|
39202
39204
|
return minimatch(file.path.replace(/^\//, ""), exclude);
|
|
@@ -39205,6 +39207,8 @@ class DiffCoverageCommand {
|
|
|
39205
39207
|
return minimatch(file.path.replace(/^\//, ""), include);
|
|
39206
39208
|
}));
|
|
39207
39209
|
});
|
|
39210
|
+
Logger.debug(`Files: ${files.map((file) => file.path).join(", ")}`);
|
|
39211
|
+
// normalize file paths
|
|
39208
39212
|
let coverage = await this.getCoverageReport("coverage/lcov.info");
|
|
39209
39213
|
let diffCoverage = await this.calculateDiffCoverage(files, coverage, {
|
|
39210
39214
|
headSha,
|
|
@@ -39343,6 +39347,7 @@ class DiffCoverageCommand {
|
|
|
39343
39347
|
}
|
|
39344
39348
|
async getCoverageReport(file) {
|
|
39345
39349
|
const lcov = await fs$2.readFile(file, "utf-8");
|
|
39350
|
+
Logger.debug(`Coverage report loaded from ${file}`);
|
|
39346
39351
|
return new Promise((resolve, reject) => {
|
|
39347
39352
|
parse$1(lcov, (err, data) => {
|
|
39348
39353
|
if (err) {
|