Skip to content

Commit

Permalink
Merge pull request #135 from sliit-foss/feature/timekeeper
Browse files Browse the repository at this point in the history
Fix(timekeeper): output directory
  • Loading branch information
Akalanka47000 authored Jan 1, 2024
2 parents 1e602ea + 35553d8 commit 4a46948
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/timekeeper/src/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,24 @@ const config = {
plugins: [["@sliit-foss/babel-plugin-transform-trace"]]
};

const outputDir = path.join(__dirname, "..", "out");
const configPath = path.join(__dirname, "..", "babel.config.js");

const runner = async (p, options) => {
config.plugins[0].push({
"ignore-functions": options.ignoreFunctions?.split(",") ?? [],
clean: options.clean ?? false
});

fs.writeFileSync(path.join(__dirname, "..", "babel.config.js"), `module.exports = ${JSON.stringify(config)}`);
fs.writeFileSync(configPath, `module.exports = ${JSON.stringify(config)}`);

console.info(`[Timekeeper] transpiling...`.green);

await exec(
`npx babel ${p} --out-dir ./out --copy-files --config-file=${path.join(__dirname, "..", "babel.config.js")}`
);
await exec(`npx babel ${p} --out-dir ${outputDir} --copy-files --config-file=${configPath}`);

console.info(`[Timekeeper] executing...`.green);

await exec(`bash -c "node out/${path.basename(p)}"`).then(({ stdout, stderr }) => {
await exec(`bash -c "node ${outputDir}/${path.basename(p)}"`).then(({ stdout, stderr }) => {
if (stdout) console.log(stdout);
if (stderr) console.error(stderr.red);
});
Expand Down

0 comments on commit 4a46948

Please sign in to comment.