pepr 0.51.4 → 0.51.5-nightly.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.
package/package.json CHANGED
@@ -14,39 +14,43 @@
14
14
  "/src",
15
15
  "!src/**/*.test.ts",
16
16
  "!src/fixtures/**",
17
- "!dist/**/*.test.d.ts*",
18
- "!src/cli/docs/**"
17
+ "!dist/**/*.test.d.ts*"
19
18
  ],
20
- "version": "0.51.4",
19
+ "version": "0.51.5-nightly.0",
21
20
  "main": "dist/lib.js",
22
21
  "types": "dist/lib.d.ts",
23
22
  "scripts": {
24
23
  "ci": "npm ci",
25
24
  "gen-data-json": "node hack/build-template-data.js",
26
25
  "prebuild": "rm -fr dist/* && npm run gen-data-json",
27
- "build": "tsc && node build.mjs && npm pack",
26
+ "build": "tsc -p config/tsconfig.root.json && node build.mjs && npm pack",
28
27
  "build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .",
29
28
  "build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) .",
30
29
  "set:version": "node scripts/set-version.js",
31
30
  "test": "npm run test:unit && npm run test:journey && npm run test:journey-wasm",
32
- "test:artifacts": "npm run build && jest src/build-artifact.test.ts",
33
- "test:docs": "jest --verbose src/cli/docs/*.test.ts",
31
+ "test:artifacts": "npm run build && vitest run src/build-artifact.test.ts",
32
+ "test:docs": "vitest run --config=config/vitest.integration.config.ts integration/cli/docs/*.test.ts",
34
33
  "test:integration": "npm run test:integration:prep && npm run test:integration:run",
35
34
  "test:integration:prep": "./integration/prep.sh",
36
- "test:integration:run": "jest --maxWorkers=4 integration",
35
+ "test:integration:run": "vitest run --config=config/vitest.integration.config.ts integration",
37
36
  "test:journey": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run",
38
37
  "test:journey-wasm": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run-wasm",
39
38
  "test:journey-wasm:unicorn": "npm run test:journey:k3d && npm run build && npm run test:journey:image:unicorn && npm run test:journey:run-wasm",
40
39
  "test:journey:image": "docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev",
41
40
  "test:journey:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev",
42
41
  "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system",
43
- "test:journey:run": "jest --detectOpenHandles journey/entrypoint.test.ts && npm run test:journey:upgrade",
44
- "test:journey:run-wasm": "jest --detectOpenHandles journey/entrypoint-wasm.test.ts",
42
+ "test:journey:run": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint.test.ts && npm run test:journey:upgrade",
43
+ "test:journey:run-wasm": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint-wasm.test.ts",
45
44
  "test:journey:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && npm run test:journey:run",
46
- "test:journey:upgrade": "npm run test:journey:k3d && npm run test:journey:image && jest --detectOpenHandles journey/pepr-upgrade.test.ts",
47
- "test:unit": "npm run gen-data-json && jest src --coverage --detectOpenHandles --coverageDirectory=./coverage --testPathIgnorePatterns=\"build-artifact.test.ts|src/cli/docs/.*\\.test\\.ts\"",
48
- "format:check": "eslint --ignore-pattern src/templates/eslint.config.mjs src && prettier --config .prettierrc src --check && npx -y markdownlint-cli --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore pepr-upgrade-test --ignore node_modules \"**/*.md\"",
49
- "format:fix": "eslint --fix --ignore-pattern src/templates/eslint.config.mjs src && prettier --config .prettierrc src --write && npx -y markdownlint-cli --fix --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore pepr-upgrade-test --ignore node_modules \"**/*.md\"",
45
+ "format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check",
46
+ "format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write",
47
+ "format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers",
48
+ "format:markdown": "npx -y markdownlint-cli --config config/.markdownlint.json --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore pepr-upgrade-test --ignore node_modules \"**/*.md\"",
49
+ "format:prettier": "prettier --config config/.prettierrc src integration/cli/**/*.ts integration/helpers/**/*.ts",
50
+ "format:src": "eslint --config config/eslint.root.config.mjs 'src/**/*.ts' --ignore-pattern '**/*.test.ts' --ignore-pattern 'src/templates/**'",
51
+ "format:tests": "eslint --config config/eslint.test.config.mjs 'src/**/*.test.ts'",
52
+ "test:journey:upgrade": "npm run test:journey:k3d && npm run test:journey:image && vitest run --config=config/vitest.journey.config.ts journey/pepr-upgrade.test.ts",
53
+ "test:unit": "npm run gen-data-json && NODE_OPTIONS=--no-deprecation vitest --config config/vitest.root.config.ts run --coverage",
50
54
  "prepare": "if [ \"$NODE_ENV\" != 'production' ]; then husky; fi"
51
55
  },
52
56
  "dependencies": {
@@ -68,25 +72,26 @@
68
72
  "devDependencies": {
69
73
  "@commitlint/cli": "19.8.1",
70
74
  "@commitlint/config-conventional": "19.8.1",
71
- "@fast-check/jest": "^2.0.1",
72
- "@jest/globals": "29.7.0",
75
+ "@fast-check/vitest": "^0.2.1",
73
76
  "@types/eslint": "9.6.1",
74
77
  "@types/express": "5.0.3",
75
78
  "@types/json-pointer": "^1.0.34",
76
- "@types/node": "22.x.x",
79
+ "@types/node": "24.x.x",
77
80
  "@types/node-forge": "1.3.11",
78
81
  "@types/uuid": "10.0.0",
82
+ "@vitest/coverage-v8": "^3.2.3",
79
83
  "fast-check": "^4.0.0",
80
84
  "globals": "^16.0.0",
81
85
  "husky": "^9.1.6",
82
- "jest": "29.7.0",
83
86
  "js-yaml": "^4.1.0",
84
87
  "shellcheck": "^3.0.0",
85
- "ts-jest": "29.3.4",
86
- "undici": "^7.0.1"
88
+ "tsx": "^4.20.3",
89
+ "undici": "^7.0.1",
90
+ "vitest": "^3.2.3"
87
91
  },
88
92
  "overrides": {
89
- "glob": "^9.0.0"
93
+ "glob": "^9.0.0",
94
+ "brace-expansion": "1.1.11"
90
95
  },
91
96
  "peerDependencies": {
92
97
  "@types/prompts": "2.4.9",
@@ -100,4 +105,4 @@
100
105
  "typescript": "5.8.3",
101
106
  "uuid": "11.1.0"
102
107
  }
103
- }
108
+ }
@@ -105,6 +105,9 @@ export function genPkgJSON(opts: InitOptions, pgkVerOverride?: string): peprPack
105
105
  devDependencies: {
106
106
  typescript,
107
107
  },
108
+ overrides: {
109
+ "brace-expansion": "1.1.11",
110
+ },
108
111
  };
109
112
 
110
113
  return {
@@ -12,6 +12,7 @@ import { resolveIgnoreNamespaces } from "./ignoredNamespaces";
12
12
  import { Assets } from "./assets";
13
13
  import { Event, WebhookType } from "../enums";
14
14
  import { Binding } from "../types";
15
+ import Log from "../telemetry/logger";
15
16
 
16
17
  export const peprIgnoreNamespaces: string[] = ["kube-system", "pepr-system"];
17
18
 
@@ -49,7 +50,7 @@ export async function generateWebhookRules(
49
50
  const { config, capabilities } = assets;
50
51
 
51
52
  const rules = capabilities.flatMap(capability => {
52
- console.info(`Module ${config.uuid} has capability: ${capability.name}`);
53
+ Log.info(`Module ${config.uuid} has capability: ${capability.name}`);
53
54
 
54
55
  return capability.bindings
55
56
  .map(binding => validateRule(binding, isMutateWebhook))
@@ -18,7 +18,7 @@ export class MeasureWebhookTimeout {
18
18
  start(timeout: number = 10): void {
19
19
  this.#startTime = getNow();
20
20
  this.timeout = timeout;
21
- Log.info(`Starting timer at ${this.#startTime}`);
21
+ Log.debug(`Starting timer at ${this.#startTime}`);
22
22
  }
23
23
 
24
24
  stop(): void {
@@ -27,7 +27,7 @@ export class MeasureWebhookTimeout {
27
27
  }
28
28
 
29
29
  const elapsedTime = getNow() - this.#startTime;
30
- Log.info(`Webhook ${this.#startTime} took ${elapsedTime}ms`);
30
+ Log.debug(`Webhook ${this.#startTime} took ${elapsedTime}ms`);
31
31
  this.#startTime = null;
32
32
 
33
33
  if (elapsedTime > this.timeout) {
package/src/lib.ts CHANGED
@@ -8,8 +8,10 @@ import { PeprMutateRequest } from "./lib/mutate-request";
8
8
  import * as PeprUtils from "./lib/utils";
9
9
  import { PeprValidateRequest } from "./lib/validate-request";
10
10
  import * as sdk from "./sdk/sdk";
11
+ import { metricsCollector } from "./lib/telemetry/metrics";
11
12
 
12
13
  export {
14
+ metricsCollector,
13
15
  Capability,
14
16
  K8s,
15
17
  Log,
@@ -1,12 +0,0 @@
1
- /**
2
- * Parse CLI output into options and commands
3
- */
4
- export declare const parseCLIOutput: (cliOutput: string) => {
5
- options: string[];
6
- commands: string[];
7
- };
8
- /**
9
- * Normalize whitespace between CLI options and their descriptions to be exactly two spaces
10
- */
11
- export declare const normalizeOptionWhitespace: (option: string) => string;
12
- //# sourceMappingURL=cli.helper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.helper.d.ts","sourceRoot":"","sources":["../../../src/cli/docs/cli.helper.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,KAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CASzF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,KAAG,MAW1D,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Get documentation for a Pepr command from the markdown docs
3
- */
4
- export declare const getDocsForCommand: (cmd?: string) => {
5
- options: string[];
6
- commands: string[];
7
- };
8
- //# sourceMappingURL=markdown.helper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markdown.helper.d.ts","sourceRoot":"","sources":["../../../src/cli/docs/markdown.helper.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAK,MAAW,KAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAoB3F,CAAC"}