Skip to content

Commit

Permalink
Point load entrypoint to typescript source
Browse files Browse the repository at this point in the history
  • Loading branch information
nyan-left committed Dec 9, 2024
1 parent 24f7f04 commit 95b5574
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
13 changes: 13 additions & 0 deletions javascript/just.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,29 @@ function recursiveReplace(obj, pattern, replacement) {
}
}
}

function transformLoadEntryPointTask() {
return async () => {
const loadPath = path.join(__dirname, 'load.ts');
const loadContent = await readFile(loadPath, 'utf-8');
const transformedContent = loadContent.replace(
/\.\/src\/(.*)\.js/,
'./dist/src/$1.js',
);
await writeFile(loadPath, transformedContent);

await tscTask({
project: 'tsconfig.load.json',
rootDir: '.',
outDir: '.',
})();

await babelTransformTask({
src: 'load.ts',
dst: '.',
})();

await writeFile(loadPath, loadContent);
};
}

Expand Down
2 changes: 1 addition & 1 deletion javascript/load.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './dist/src/load.js';
export * from './src/load.js';
3 changes: 2 additions & 1 deletion javascript/tsconfig.load.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"outDir": ".",
"emitDeclarationOnly": true
},
"files": ["load.ts"]
"files": ["load.ts"],
"exclude": ["tests/**/*", "src/**/*"]
}

0 comments on commit 95b5574

Please sign in to comment.