Skip to content

Commit

Permalink
Fix pepr dev regression (#94)
Browse files Browse the repository at this point in the history
Re-adds `ts-node` as a peer dependency due to rollupjs source maps not
working properly during `pepr dev` debugging in Typescript files (only
worked properly in the transpiled Javascript).
  • Loading branch information
jeff-mccoy authored May 9, 2023
1 parent ab35b43 commit 5c7306f
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 5 deletions.
4 changes: 2 additions & 2 deletions hack/e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ let expectedLines = [
"hello-pepr: V1ConfigMap Binding created",
"hello-pepr: V1ConfigMap Binding action created",
"Server listening on port 3000",
"Using beforeHook: req => pepr$1.Log.debug(`beforeHook: ${req.uid}`)",
"Using afterHook: res => pepr$1.Log.debug(`afterHook: ${res.uid}`)",
"Using beforeHook: req => pepr_1.Log.debug(`beforeHook: ${req.uid}`)",
"Using afterHook: res => pepr_1.Log.debug(`afterHook: ${res.uid}`)",
];

function stripAnsiCodes(input) {
Expand Down
149 changes: 147 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"node-forge": "1.3.1",
"prompts": "2.4.2",
"rollup": "3.21.5",
"ts-node": "10.9.1",
"typescript": "5.0.4",
"uuid": "9.0.0"
},
Expand Down
6 changes: 5 additions & 1 deletion src/cli/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Webhook } from "../../src/lib/k8s/webhook";
import Log from "../../src/lib/logger";
import { buildModule } from "./build";
import { RootCmd } from "./root";
import { register } from "ts-node";

export default function (program: RootCmd) {
program
Expand Down Expand Up @@ -104,11 +105,14 @@ export default function (program: RootCmd) {

async function runDev() {
try {
const { path } = await buildModule();
const path = resolve(".", "pepr.ts");

Log.info(`Running module ${path}`);

const program = fork(path, {
// Register ts-node
execArgv: ["-r", "ts-node/register"],
// Pass the environment variables
env: {
...process.env,
LOG_LEVEL: "debug",
Expand Down

0 comments on commit 5c7306f

Please sign in to comment.