Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove underscore dependency and pika/pack for node/web #5

Merged
merged 3 commits into from
Nov 19, 2019

Conversation

gdbaldw
Copy link
Contributor

@gdbaldw gdbaldw commented Nov 12, 2019

Hi,

While this looks like a major change, its actually minor and of great benefit. Your code can now be used natively in the web browser. To make this work, the few references to Lodash were removed and replaced with native Javascript, and @pika/pack was used to repackage for both node.js and the web browser. I'm now using this package for a toy project, and thought it useful for the community to have the repackaged module distributed by you, the originator. Simply publish the contents of the /pkg directory.

Cheers, Doug

@dachev
Copy link
Owner

dachev commented Nov 18, 2019

@gdbaldw Thank you for sharing your improvements. I am a little concerned about having to manually mainatin multiple copies of the same code for each platform. Is it possible to make this more DRY and have some sort of automation to generate platform-specific files from the same source? Can you think of another project that does something similar and we can use as a reference?

@gdbaldw
Copy link
Contributor Author

gdbaldw commented Nov 18, 2019

@dachev Hi, thank you for the reply and question. My first commit provided the basis for generating the modules, using @pika/pack. This tool is DRY, and generates packages for both node and ESM. I suppose, in the future, one could edit dist-src/index.js, and then use @pika/pack against that source to regenerate the packages for both node.js and ESM. I understand the node.js community is discussing a unified standard, and the @pika project is currently filling the breach. I have a repository using your sudoku module at https://github.com/gdbaldw/lit, and in an earlier commit you will see a lambda/node implementation, whereas the current commit is an ESM/browser implementation.

For other examples of module packaging see https://www.pika.dev/npm/@pika/web

@dachev
Copy link
Owner

dachev commented Nov 19, 2019

@gdbaldw Sounds good. Thank you for your contribution!

@dachev dachev merged commit 83e8907 into dachev:master Nov 19, 2019
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.

2 participants