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

Suggestion: ship production ready build to npm #196

Open
jmike opened this issue Sep 2, 2018 · 9 comments
Open

Suggestion: ship production ready build to npm #196

jmike opened this issue Sep 2, 2018 · 9 comments
Labels
enhancement New feature or request

Comments

@jmike
Copy link

jmike commented Sep 2, 2018

Hey,

I noticed that the current version deployed on npm (i.e. https://www.npmjs.com/package/javascript-algorithms-and-data-structures) is more or less a mirror of the source code here. javascript-algorithms is really awesome and someone might want to use it as an external library on production (e.g. a web app or node app). Unfortunately, the use of ES modules, complicates things a bit.

May I suggest:

  1. Transpiling code to ES2015, using CommonJS instead of ES modules;
  2. Removing redundant source code (e.g. comments, README, etc) to reduce package size.

I'd be more that willing to provide a PR using rollup + babel.

@trekhleb trekhleb added the enhancement New feature or request label Sep 5, 2018
@trekhleb
Copy link
Owner

trekhleb commented Sep 5, 2018

Hi @jmike
Thank you for suggestion.

Please go ahead and create a PR for that if you want to.

One important thing that should probably be mentioned here is that this repo is not meant to be used on production. It is for learning and researching purposes only. The only reason for having this repo on npm is probably to make it possible to re-use its functions by other non-production research projects.

@jasonwilliams
Copy link

jasonwilliams commented Sep 13, 2018

I agree with @trekhleb i'm not sure its a good idea to signal this project is for production use, it might set a precedent of users then wanting to optimise certain functions, which then defeats the learning aspect of it.
Maybe its worth saying in the README these shouldn't be used in production instead?

@trekhleb
Copy link
Owner

@jasonwilliams this notification it is already in README here.

@jasonwilliams
Copy link

ahh i should have RTFM!

@trekhleb
Copy link
Owner

No problem :D

@ozzyogkush
Copy link

Perhaps a forked repository with production-ready code that does have such optimizations would be useful.

@JXWJS
Copy link

JXWJS commented Nov 8, 2018

J

@mik-laj
Copy link

mik-laj commented Jun 22, 2019

@jmike Have you made any progress in this issues? Recently, I worked on a college project and the lack of a proper package in npm made my work very difficult.

@moodmosaic
Copy link

moodmosaic commented Feb 26, 2020

Edit: Resolved via https://babeljs.io/en/setup#installation.


What would be the easiest way to reference this project from another project? Cloning the repo and running npm install didn't help much:

require(
  "../node_modules/javascript-algorithms-and-data-structures/src/algorithms/graph/bellman-ford/bellmanFord.js")
export default function bellmanFord(graph, startVertex) {
^^^^^^

SyntaxError: Unexpected token 'export'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants