Skip to content

Conversation

@hsubox76
Copy link
Collaborator

ESM requires import statements to only occur once, at the top of each file. Since we have multiple samples in each file, we use comments to indicate to users which imports are needed for each sample, and what the import statements should be.

I wrote a script (insert-import-comments.js) to parse each sample and identify which symbols it needs to import, and from which path, and add the comments, and ran the script.

I also abstracted the code that parses function info and shared it between the new script and the check-samples.js script.

@hsubox76 hsubox76 requested a review from dlarocque July 11, 2024 20:04
@hsubox76 hsubox76 marked this pull request as ready for review July 11, 2024 20:10
Copy link
Collaborator

@dlarocque dlarocque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool script

@hsubox76 hsubox76 merged commit 803071b into main Jul 12, 2024
@hsubox76 hsubox76 deleted the ch-insert-imports-2 branch July 12, 2024 18:50
hsubox76 added a commit that referenced this pull request Jul 12, 2024
Copy link

@wwgamorcom wwgamorcom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants