ericblade / quagga2

An advanced barcode-scanner written in Javascript and TypeScript - Continuation from https://github.com/serratus/quaggajs
MIT License
759 stars 85 forks source link

Document dist file creation #42

Open Rytiss opened 5 years ago

Rytiss commented 5 years ago

27 has instructions on how to get a precompiled file that can later be included in a script tag. While I don't approve of this approach, if the compiled JS file will never be published, it should be documented in the README. Right now README tells to include a file from a dist/ folder, which is gone.

I would propose to include .js/.min.js files within the release though.

ericblade commented 5 years ago

Hi, Rytiss!

I appreciate the input. The recommended way to install a usable lib is from npm or yarn, which include only the bundled package, and not the source code. Github contains the source code, but not the bundled package. IMO, that works a lot better -- no one will ever have to deal with merge conflicts in bundled code, or the problem where someone updates the source, but doesn't change the bundle .. or the weirder one i've seen happen occasionally, where someone writes code directly into the bundle, instead of the source code. I will hopefully soon have this setup to automatically publish changes to npm, as well, so that github and npm cannot get out of sync.

I will update the README to include instructions for using the github repository, though. I've been doing a lot of maintenance work to bring this up to date, and some of the README has probably fallen behind some.

Thank you!

WardLootens commented 4 years ago

I think @Rytiss did not meant to include dist/quagga.js and dist/quagga.min.js under version control.

But rather to include them in the zip file when a new release is published, which I think does makes sense.

Currently, it is not possible to simply download the dist files somewhere to get started quickly without having to build yourself. This might be a burden for some...

Are the zip files for releases create automatically? I couldn't find the script yet. If yes, I'm willing to change this to include dist files in the zip.

ericblade commented 4 years ago

... in the zip file where specifically? I feel confused here.

WardLootens commented 4 years ago

I mean the zip that is found in the Assets part of the releases.

But now I come to think of it, this is probably just the state of the repository at the time of release? So including the dist files there won't be possible in that case. Maybe as a separate asset?

ericblade commented 4 years ago

ahhh, that page. I think it's pretty clear that from the release page, you should be expecting a source code zip, not the bundled code, I hope. Maybe that's not what someone wants when they go there, but that's what github provides. And yeah, that's automatically handled by github as a bundle probably zipped on request.

I'm not sure what a solution to this would look like. I'm definitely not including the built libraries in the source code repo, because that definitely has problems. The npm package does include all builds, and if you have a copy of the repo, then you can use npm to make a build.

I'd entertain any other suggestions, that don't involve committing the built libraries to the source repository. :-)

WardLootens commented 4 years ago

Yes, I definitely agree with not adding the built libraries in source code repo!

According to this (step 7), I should be possible to add additional files when creating a release.

ericblade commented 4 years ago

hmm. yeah that does look like the correct thing to do, and it does look like there's a way to automate that .. https://developer.github.com/v3/repos/releases/#upload-a-release-asset

I wonder if there's some existing scripts out there for dealing with that, and how difficult they are to add. semantic-release seems like it would be a package that could benefit from it, and might already have that functionality, i just don't know about it. I use the npm semantic-release package on a few other repositories, but I haven't added it to this one yet because it's pretty touchy and not well documented. If I can just fire off a single command to handle it (or have it handled automatically by something), it's going to get a lot more support from me, than having to remember to go to github and upload the built code each time i run npm publish.

Adi-18 commented 1 year ago

I also don't know how to do that. So please provide the compiled version. I don't have any knowledge and time to solve like this

npm WARN npm npm does not support Node.js v10.24.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN notice [SECURITY] lodash has the following vulnerability: 1 high. Go here for more details: https://github.com/advisories?query=lodash - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN deprecated @babel/polyfill@7.12.1:  This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

> core-js@2.6.12 postinstall /var/www/quagga2/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
npm WARN saveError ENOENT: no such file or directory, open '/var/www/quagga2/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/@ericblade/quagga2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open '/var/www/quagga2/package.json'
npm WARN quagga2 No description
npm WARN quagga2 No repository field.
npm WARN quagga2 No README data
npm WARN quagga2 No license field.
ericblade commented 1 year ago

Node.js support for v10 ended almost 3 years ago, and you're using the wrong version of npm for node 10. (node 18 is the current long term support version, for another 8 months)

If you're just trying to get a package to use with a browser, I'd suggest using a CDN to load it with a script tag: https://www.jsdelivr.com/package/npm/@ericblade/quagga2

Or you could grab the package from the link in the CDN, if you must include it with whatever you're doing https://cdn.jsdelivr.net/npm/@ericblade/quagga2@1.8.2/dist/quagga.min.js

You could also use the original package from before the fork, which I believe was implemented with node 6-10

I definitely do sympathize with your plight on the issue, but the majority of us out there using packages like this are using modern releases of node and npm and webpack and typescript and all the other support systems that have been built up.

Adi-18 commented 1 year ago

Ok, Thank you. I just did apt install on debian 10 and got those version.