@dragonshorn-studios/elyseum-cli 0.1.2 → 0.1.4

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":"command.d.ts","sourceRoot":"","sources":["../../src/commands/command.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,qBAAa,cAAc;IACzB,QAAQ,EAAE,UAAU,CAAM;;IAM1B,UAAU,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS;IAQ1C,oBAAoB;IAQpB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;CAgBjC"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/commands/command.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,qBAAa,cAAc;IACzB,QAAQ,EAAE,UAAU,CAAM;;IAO1B,UAAU,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS;IAU1C,oBAAoB;IASpB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;CAiBjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"coverage-command.d.ts","sourceRoot":"","sources":["../../src/commands/coverage-command.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEhD,qBAAa,eAAgB,YAAW,OAAO;IAC7C,IAAI,EAAE,MAAM,CAAc;gBACd,QAAQ,EAAE,UAAU;IAInB,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;YAoB5B,iBAAiB;YA4DjB,iBAAiB;CAWhC"}
1
+ {"version":3,"file":"coverage-command.d.ts","sourceRoot":"","sources":["../../src/commands/coverage-command.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEhD,qBAAa,eAAgB,YAAW,OAAO;IAC7C,IAAI,EAAE,MAAM,CAAc;gBACd,QAAQ,EAAE,UAAU;IAInB,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;YAoB5B,iBAAiB;YA8DjB,iBAAiB;CAWhC"}
@@ -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;AAEjD,qBAAa,mBAAoB,YAAW,OAAO;IACjD,IAAI,EAAE,MAAM,CAAmB;IAC/B,MAAM,CAAC,EAAE,YAAY,CAanB;gBACU,QAAQ,EAAE,UAAU;IAInB,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;YAuD5B,qBAAqB;YAuIrB,iBAAiB;YAYjB,eAAe;CA4E9B"}
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;YAuE5B,qBAAqB;YAuIrB,iBAAiB;YAajB,eAAe;CA4E9B"}
package/dist/index.js CHANGED
@@ -9964,12 +9964,12 @@ class GithubPRCommentCoverageReporter {
9964
9964
  this.config = {
9965
9965
  "comment-file-path": {
9966
9966
  help: "The file path to write the coverage report to",
9967
- type: "string",
9967
+ type: "str",
9968
9968
  default: "coverage/github.pr.coverage.md",
9969
9969
  },
9970
9970
  "comment-name": {
9971
9971
  help: "The name of the comment",
9972
- type: "string",
9972
+ type: "str",
9973
9973
  default: "coverage/github.pr.coverage.md",
9974
9974
  },
9975
9975
  "quality-gate": {
@@ -10228,6 +10228,8 @@ class CoverageCommand {
10228
10228
  }
10229
10229
  async calculateCoverage(coverage) {
10230
10230
  const coverageResult = {
10231
+ headSha: "",
10232
+ baseSha: "",
10231
10233
  lines: {
10232
10234
  total: 0,
10233
10235
  covered: 0,
@@ -39072,6 +39074,21 @@ minimatch.Minimatch = Minimatch;
39072
39074
  minimatch.escape = escape;
39073
39075
  minimatch.unescape = unescape;
39074
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
+
39075
39092
  function readCoverageConfig(filePath) {
39076
39093
  if (!fs$1.existsSync(filePath)) {
39077
39094
  return null;
@@ -39093,18 +39110,18 @@ function readCoverageConfig(filePath) {
39093
39110
  return JSON.parse(coverageConfig);
39094
39111
  }
39095
39112
  function getCoverageExcludes(configDir) {
39096
- const tools = ["vitest", "jest", "mocha"];
39113
+ const tools = ["vitest", "jest", "mocha", "vite"];
39097
39114
  let excludes = [];
39098
39115
  for (const tool of tools) {
39099
39116
  const configPaths = [
39100
- path$2.join(configDir, `vite.config.js`),
39101
- path$2.join(configDir, `vite.config.mjs`),
39102
39117
  path$2.join(configDir, `${tool}.config.js`),
39103
39118
  path$2.join(configDir, `${tool}.config.mjs`),
39104
39119
  ];
39105
39120
  for (const configPath of configPaths) {
39106
39121
  const config = readCoverageConfig(configPath);
39107
39122
  if (config) {
39123
+ Logger.debug(`Found coverage config in ${configPath}`);
39124
+ Logger.debug(`Excludes: ${config.exclude.join(", ")}`);
39108
39125
  return config.exclude;
39109
39126
  }
39110
39127
  }
@@ -39118,16 +39135,22 @@ class DiffCoverageCommand {
39118
39135
  this.config = {
39119
39136
  base: {
39120
39137
  help: "The base branch/sha to compare against",
39121
- type: "string",
39138
+ type: "str",
39122
39139
  required: false,
39123
39140
  default: process.env.GITHUB_BASE_REF || "origin/main",
39124
39141
  },
39125
39142
  head: {
39126
39143
  help: "The head branch/sha to compare against",
39127
- type: "string",
39144
+ type: "str",
39128
39145
  required: false,
39129
39146
  default: process.env.GITHUB_SHA || "HEAD",
39130
39147
  },
39148
+ "changed-files": {
39149
+ help: "Comma separated list of changed files",
39150
+ type: "str",
39151
+ required: false,
39152
+ default: "",
39153
+ },
39131
39154
  };
39132
39155
  commands[this.name] = this;
39133
39156
  }
@@ -39149,6 +39172,7 @@ class DiffCoverageCommand {
39149
39172
  "**/*.vue",
39150
39173
  ];
39151
39174
  try {
39175
+ let changedFiles = Config$1.get(this.name, "changed-files", "");
39152
39176
  let headSha = await git.resolveRef({
39153
39177
  fs: fs$2,
39154
39178
  dir: process.cwd(),
@@ -39159,7 +39183,20 @@ class DiffCoverageCommand {
39159
39183
  dir: process.cwd(),
39160
39184
  ref: Config$1.get(this.name, "base"),
39161
39185
  });
39162
- let files = await this.getChangedFiles(process.cwd(), headSha, baseSha);
39186
+ Logger.debug(`Head SHA: ${headSha}`);
39187
+ Logger.debug(`Base SHA: ${baseSha}`);
39188
+ Logger.debug(`Changed files: ${changedFiles}`);
39189
+ let files = [];
39190
+ if (!changedFiles) {
39191
+ files = await this.getChangedFiles(process.cwd(), headSha, baseSha);
39192
+ }
39193
+ else {
39194
+ files = changedFiles.split(",").map((file) => {
39195
+ return {
39196
+ path: file,
39197
+ };
39198
+ });
39199
+ }
39163
39200
  files = files.filter((file) => {
39164
39201
  return (!coverageExcludes.some((exclude) => {
39165
39202
  return minimatch(file.path.replace(/^\//, ""), exclude);
@@ -39168,6 +39205,8 @@ class DiffCoverageCommand {
39168
39205
  return minimatch(file.path.replace(/^\//, ""), include);
39169
39206
  }));
39170
39207
  });
39208
+ Logger.debug(`Files: ${files.map((file) => file.path).join(", ")}`);
39209
+ // normalize file paths
39171
39210
  let coverage = await this.getCoverageReport("coverage/lcov.info");
39172
39211
  let diffCoverage = await this.calculateDiffCoverage(files, coverage, {
39173
39212
  headSha,
@@ -39306,6 +39345,7 @@ class DiffCoverageCommand {
39306
39345
  }
39307
39346
  async getCoverageReport(file) {
39308
39347
  const lcov = await fs$2.readFile(file, "utf-8");
39348
+ Logger.debug(`Coverage report loaded from ${file}`);
39309
39349
  return new Promise((resolve, reject) => {
39310
39350
  parse$1(lcov, (err, data) => {
39311
39351
  if (err) {
@@ -39395,13 +39435,16 @@ class CommandFactory {
39395
39435
  }
39396
39436
  getCommand(args) {
39397
39437
  try {
39438
+ Logger.debug(`Fetching command: ${args.command}`); // Add debug log
39398
39439
  return this.commands[args.command];
39399
39440
  }
39400
39441
  catch (error) {
39442
+ Logger.error(`Error fetching command: ${error.message}`); // Add error log
39401
39443
  return undefined;
39402
39444
  }
39403
39445
  }
39404
39446
  getAvailableCommands() {
39447
+ Logger.debug("Fetching available commands"); // Add debug log
39405
39448
  let availableCommands = [];
39406
39449
  for (const command of Object.keys(this.commands)) {
39407
39450
  availableCommands.push(command);
@@ -39409,6 +39452,7 @@ class CommandFactory {
39409
39452
  return availableCommands;
39410
39453
  }
39411
39454
  addCommandArgs(yargs) {
39455
+ Logger.debug("Adding command arguments"); // Add debug log
39412
39456
  for (const command of this.getAvailableCommands()) {
39413
39457
  const commandInstance = this.commands[command];
39414
39458
  const commandGroup = yargs.add_argument_group({
@@ -39467,7 +39511,6 @@ parser.add_argument("--reporter.coverage.quality-gate", {
39467
39511
  });
39468
39512
  for (let reporter of Object.keys(COVERAGE_REPORTERS)) {
39469
39513
  const reporterConfig = COVERAGE_REPORTERS[reporter].config || {};
39470
- // add group for specific reporter so it looks better in help
39471
39514
  const reporterGroup = parser.add_argument_group({
39472
39515
  title: `Coverage reporter: ${reporter}`,
39473
39516
  });