@metasession.co/devaudit-cli 0.1.15 → 0.1.17

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/index.js CHANGED
@@ -54,7 +54,7 @@ function emitJsonResult(payload) {
54
54
 
55
55
  // package.json
56
56
  var package_default = {
57
- version: "0.1.15"};
57
+ version: "0.1.17"};
58
58
 
59
59
  // src/lib/version.ts
60
60
  var CLI_VERSION = package_default.version;
@@ -1194,6 +1194,7 @@ async function writeSdlcConfig(ctx, plan) {
1194
1194
  build_env: {},
1195
1195
  e2e_project: "",
1196
1196
  e2e_start_command: "",
1197
+ e2e_setup_command: "",
1197
1198
  e2e_seed_command: "",
1198
1199
  e2e_projects: [],
1199
1200
  e2e_env: {},
@@ -1806,6 +1807,45 @@ function indentEnvBlock(env, indent) {
1806
1807
  const pad = " ".repeat(indent);
1807
1808
  return Object.entries(env).map(([k, v]) => `${pad}${k}: ${v}`).join("\n");
1808
1809
  }
1810
+ function buildE2eSetupStep(cfg) {
1811
+ const cmd = (cfg.e2e_setup_command ?? "").trim();
1812
+ if (!cmd) return "";
1813
+ const env = cfg.e2e_env ?? {};
1814
+ const lines = [" - name: E2E setup"];
1815
+ if (Object.keys(env).length > 0) lines.push(" env:", indentEnvBlock({ ...env }, 10));
1816
+ if (cmd.includes("\n")) {
1817
+ lines.push(" run: |");
1818
+ for (const l of cmd.split("\n")) lines.push(` ${l}`);
1819
+ } else {
1820
+ lines.push(` run: ${cmd}`);
1821
+ }
1822
+ lines.push("");
1823
+ return lines.join("\n");
1824
+ }
1825
+ function buildE2eDevServerStep(cfg) {
1826
+ const env = cfg.e2e_env ?? {};
1827
+ const lines = [" - name: Start dev server"];
1828
+ if (Object.keys(env).length > 0) lines.push(" env:", indentEnvBlock({ ...env }, 10));
1829
+ lines.push(` run: ${cfg.e2e_start_command} &`);
1830
+ return lines.join("\n");
1831
+ }
1832
+ function buildE2eTestStep(cfg) {
1833
+ const env = cfg.e2e_env ?? {};
1834
+ const lines = [
1835
+ " - name: E2E Tests",
1836
+ " env:",
1837
+ " # PLAYWRIGHT_JSON_OUTPUT_NAME makes the json reporter write straight",
1838
+ " # to the file. Capturing stdout (`> e2e-results.json`) instead mixed",
1839
+ ` # the html reporter's "To open report" line in after the JSON blob`,
1840
+ " # and produced an unparseable file (DevAudit #48). html report still",
1841
+ " # lands in playwright-report/.",
1842
+ " PLAYWRIGHT_HTML_REPORTER_OPEN: never",
1843
+ " PLAYWRIGHT_JSON_OUTPUT_NAME: e2e-results.json"
1844
+ ];
1845
+ if (Object.keys(env).length > 0) lines.push(indentEnvBlock({ ...env }, 10));
1846
+ lines.push(` run: npx playwright test --project=${cfg.e2e_project} --reporter=json,html`);
1847
+ return lines.join("\n");
1848
+ }
1809
1849
  function buildAuthenticatedE2eStep(cfg) {
1810
1850
  const projects = cfg.e2e_projects ?? [];
1811
1851
  const seed = (cfg.e2e_seed_command ?? "").trim();
@@ -1890,6 +1930,9 @@ async function syncCiTemplates(ctx) {
1890
1930
  APP_ENV: cfg.app_env ? indentEnvBlock({ ...cfg.app_env }, 6) : "",
1891
1931
  BUILD_ENV: cfg.build_env ? indentEnvBlock({ ...cfg.build_env }, 10) : "",
1892
1932
  DATABASE_URI_STEP: buildDbUriStep(cfg.database_service, cfg.database_port),
1933
+ E2E_SETUP_STEP: buildE2eSetupStep(cfg),
1934
+ E2E_DEV_SERVER_STEP: buildE2eDevServerStep(cfg),
1935
+ E2E_TEST_STEP: buildE2eTestStep(cfg),
1893
1936
  E2E_AUTHENTICATED_STEP: buildAuthenticatedE2eStep(cfg)
1894
1937
  };
1895
1938
  let count = 0;