-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Publish the JS package #155
Comments
I don't know how to publish a package on NPM. It takes time to figure out build tools and packaging standards. Cargo (Rust) was pretty straightforward. PyPI (Python) took more steps and had some ambiguity. Maven Central (Java) was an absolute nightmare to learn and configure and took me several days to figure out, not to mention writing and auditing that opaque pom.xml file. Also, I come from the oldschool style of development of manually downloading source files and dropping them into a project... |
Yeah, I see its never a straightforward thing! |
Alternatively to NPM, we've been using the JS files. We added the UMD module for supporting modules and not module importing: https://github.com/Cyphrme/qrgen See this line: https://github.com/Cyphrme/qrgen/blob/7776160432f435779c29a4c9cdd617cd52643cff/qrgen.js#L1084 |
@zamicol: I see that your copy of qrgen.js comes from my old code. It is the hand-written JavaScript port that existed up until 2019-07-16, before being deleted and superseded by the TypeScript port. Any reason why you chose to package the old JavaScript code? |
Nayuki , thank you for your work! That's when I forked it and have not updated it since. I will update using the Typescript port, and include a Javascript minified distributable, when I get a chance. I'd love to help out with the Javascript process if you'd find that useful. I was thinking about doing it soon and wanted to see if this repo had done that yet, so I searched for an issue and found this by happenstance. What's your Javascript pipeline look like?We typically use |
@zamicol: Thanks. For your reference, you can grab my officially compiled JavaScript code at https://github.com/nayuki/QR-Code-generator/tags , for example https://github.com/nayuki/QR-Code-generator/releases/tag/v1.8.0 . My JavaScript build pipeline is: |
Thanks Nayuki, TL;DR:May I suggest the following addition? tsc --strict --lib DOM,DOM.Iterable,ES6 --target ES6 *.ts
esbuild qrcodegen.js --minify --outfile=qrcodegen.min.js && cat module_append.txt >> qrcodegen.min.js Long:There's a few more things: build instructions for a stand alone qrcodegen file, minification, UMD modules, and a working out-of-the-box demo with JS files included with the release/distributable. Below is detailed suggestions. Looks like build instructions and modules have been mentioned in a previous open issue. I left a comment there as well to link the issues. ModulesModules help integrating with other Javascript applications more expressive, See this file as a suggested way to add UMD module support. Here's an example of it integrated into code here. (Note, this has to be added after esbuild because of a not-yet-fixed bug.) MinificationUsing this command on the release esbuild qrcodegen-v1.8.0-es6.js --minify --outfile=qrcodegen-v1.8.0-es6.min.js The file size is reduced from 45.3 kB to 11.6kB (link). Building/CompilingThe existing tsc --strict --lib DOM,DOM.Iterable,ES6 --target ES6 qrcodegen.ts
tsc --strict --lib DOM,DOM.Iterable,ES6 --target ES6 qrcodegen.ts qrcodegen-input-demo.ts
tsc --strict --lib DOM,DOM.Iterable,ES6 --target ES6 qrcodegen.ts qrcodegen-output-demo.ts Or alternatively as you just suggested:
See also #159 The output files can be included in the release and demo (see below). DemoAs far as the release, (QR-Code-generator-1.8.0.tar.gz or
It seems like a good idea to include these in the release so that the demo works out-of-the-box. Here's an example of included those files so it works out-of-the-box. Thank you again for all your hard work. |
There is already PR for this: #25. |
Hello again! I was also wondering if #159 had been considered? |
Please find our PR : #168 A few comments :
|
I published WebAssembly version on npm |
@nayuki Is there a plan? |
@laterdayi Have you tried my published wasm version? |
I've also published a fully refactored non-WASM version with premade renderers for both the terminal and canvas/svg. |
@nayuki did you close this because you published it yourself? There's little guarantee that the versions published by others are updated |
There hasn't been any change not reflected on my published version. Though, it is also absolutely not 1:1 of this repository's source code. |
It's such a great library, why don't you publish it on NPM so we can install it with
npm install qrcodegen
?Happy to help if you want!
The text was updated successfully, but these errors were encountered: