@aqa-pulse/cli 0.1.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.
Files changed (37) hide show
  1. package/README.md +43 -0
  2. package/bin/aqa-pulse.js +49 -0
  3. package/dist/backend/generate-source-facts.d.ts +2 -0
  4. package/dist/backend/generate-source-facts.js +607 -0
  5. package/dist/backend/merge-reports.d.ts +19 -0
  6. package/dist/backend/merge-reports.js +314 -0
  7. package/dist/backend/upload-report-artifacts.d.ts +9 -0
  8. package/dist/backend/upload-report-artifacts.js +772 -0
  9. package/dist/backend/upload-report.d.ts +13 -0
  10. package/dist/backend/upload-report.js +338 -0
  11. package/dist/dashboard-utils.d.ts +437 -0
  12. package/dist/dashboard-utils.js +2627 -0
  13. package/dist/history-utils.d.ts +72 -0
  14. package/dist/history-utils.js +267 -0
  15. package/dist/shared/business-assumptions.d.ts +14 -0
  16. package/dist/shared/business-assumptions.js +61 -0
  17. package/dist/shared/dashboard-helpers.d.ts +63 -0
  18. package/dist/shared/dashboard-helpers.js +429 -0
  19. package/dist/shared/dashboard-metric-info.d.ts +61 -0
  20. package/dist/shared/dashboard-metric-info.js +15 -0
  21. package/dist/shared/error-utils.d.ts +1 -0
  22. package/dist/shared/error-utils.js +6 -0
  23. package/dist/shared/formatting.d.ts +3 -0
  24. package/dist/shared/formatting.js +42 -0
  25. package/dist/shared/i18n/ru.d.ts +558 -0
  26. package/dist/shared/i18n/ru.js +577 -0
  27. package/dist/shared/metric-info.d.ts +5 -0
  28. package/dist/shared/metric-info.js +210 -0
  29. package/dist/shared/navigation.d.ts +31 -0
  30. package/dist/shared/navigation.js +99 -0
  31. package/dist/shared/test-history-helpers.d.ts +51 -0
  32. package/dist/shared/test-history-helpers.js +294 -0
  33. package/dist/shared/test-history-metric-info.d.ts +17 -0
  34. package/dist/shared/test-history-metric-info.js +20 -0
  35. package/dist/shared/text-utils.d.ts +2 -0
  36. package/dist/shared/text-utils.js +15 -0
  37. package/package.json +37 -0
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # @aqa-pulse/cli
2
+
3
+ CLI для подключения Playwright-проектов к AQA Pulse без локальных helper-скриптов в репозитории автотестов.
4
+
5
+ ## Команды
6
+
7
+ ```bash
8
+ aqa-pulse upload-report --generate-source-facts --repo-root "$CI_PROJECT_DIR"
9
+ aqa-pulse merge-reports --project-kind ui --output test-results/dashboard/ui-merged.json test-results/dashboard/ui-*.json
10
+ aqa-pulse generate-source-facts --report test-results/dashboard/data.json --repo-root .
11
+ ```
12
+
13
+ ## GitLab CI
14
+
15
+ ```yaml
16
+ variables:
17
+ AQA_PULSE_BASE_URL: "https://aqa-pulse.example.com"
18
+ AQA_PULSE_WORKSPACE_SLUG: "autotests-main"
19
+ AQA_PULSE_REPORT_PATH: "Playwright/test-results/dashboard/data.json"
20
+
21
+ script:
22
+ - npm ci
23
+ - npm test
24
+ - npx @aqa-pulse/cli upload-report --generate-source-facts --repo-root "$CI_PROJECT_DIR"
25
+ ```
26
+
27
+ `AQA_PULSE_WORKSPACE_API_KEY` лучше хранить в GitLab CI/CD Variables.
28
+
29
+ ## Публикация
30
+
31
+ Публичный npm:
32
+
33
+ ```bash
34
+ npm publish --access public
35
+ ```
36
+
37
+ GitLab Package Registry:
38
+
39
+ ```bash
40
+ echo "@aqa-pulse:registry=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/" > .npmrc
41
+ echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc
42
+ npm publish
43
+ ```
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('node:path')
4
+ const { spawnSync } = require('node:child_process')
5
+
6
+ const [, , command = '--help', ...restArgs] = process.argv
7
+
8
+ const commandMap = {
9
+ 'upload-report': '../dist/backend/upload-report.js',
10
+ upload: '../dist/backend/upload-report.js',
11
+ 'merge-reports': '../dist/backend/merge-reports.js',
12
+ merge: '../dist/backend/merge-reports.js',
13
+ 'generate-source-facts': '../dist/backend/generate-source-facts.js',
14
+ 'source-facts': '../dist/backend/generate-source-facts.js',
15
+ }
16
+
17
+ if (command === '--help' || command === '-h') {
18
+ printHelp()
19
+ } else if (!commandMap[command]) {
20
+ console.error(`Неизвестная команда: ${command}`)
21
+ printHelp()
22
+ process.exitCode = 1
23
+ } else {
24
+ const entryFile = path.resolve(__dirname, commandMap[command])
25
+ const result = spawnSync(process.execPath, [entryFile, ...restArgs], {
26
+ stdio: 'inherit',
27
+ env: process.env,
28
+ })
29
+
30
+ if (result.error) {
31
+ throw result.error
32
+ }
33
+
34
+ process.exit(result.status ?? 1)
35
+ }
36
+
37
+ function printHelp() {
38
+ console.log('AQA Pulse CLI')
39
+ console.log('')
40
+ console.log('Использование:')
41
+ console.log(' aqa-pulse upload-report [--report <path>] [--generate-source-facts] [--repo-root <path>]')
42
+ console.log(' aqa-pulse merge-reports --project-kind ui|api --output <path> [--allow-missing] <input...>')
43
+ console.log(' aqa-pulse generate-source-facts [--report <path>] [--out <path>] [--repo-root <path>]')
44
+ console.log('')
45
+ console.log('Короткие алиасы:')
46
+ console.log(' aqa-pulse upload')
47
+ console.log(' aqa-pulse merge')
48
+ console.log(' aqa-pulse source-facts')
49
+ }
@@ -0,0 +1,2 @@
1
+ import { type PrecomputedCodeQualitySourceFacts, type ReporterRoot } from '../dashboard-utils';
2
+ export declare function buildPrecomputedSourceFacts(report: ReporterRoot, repoRoot: string, reportPath: string): PrecomputedCodeQualitySourceFacts;