Skip to content

Commit

Permalink
Fixed relative path calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
max-leuthaeuser committed Nov 13, 2024
1 parent e957281 commit ae3e1eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ const getCircularReplacer = () => {
* Write AST data to a json file
*/
const writeAstFile = (file, ast, options) => {
const relativePath = file.replace(new RegExp("^" + options.src + "/"), "");
const relativePath = path.relative(options.src, file)
const outAstFile = path.join(options.output, relativePath + ".json");
const data = {
fullName: file,
Expand All @@ -384,7 +384,7 @@ const writeAstFile = (file, ast, options) => {
};

const writeTypesFile = (file, seenTypes, options) => {
const relativePath = file.replace(new RegExp("^" + options.src + "/"), "");
const relativePath = path.relative(options.src, file)
const outTypeFile = path.join(options.output, relativePath + ".typemap");
fs.mkdirSync(path.dirname(outTypeFile), {recursive: true});
fs.writeFileSync(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@joernio/astgen",
"version": "3.16.0",
"version": "3.17.0",
"description": "Generate JS/TS AST in json format with Babel",
"exports": "./index.js",
"keywords": [
Expand Down

0 comments on commit ae3e1eb

Please sign in to comment.