-
Notifications
You must be signed in to change notification settings - Fork 17
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
Create NPM package #7
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Nice, thanks! Some thoughts:
|
@RReverser I've made an attempt at a wrapper class named 'Camera' that automatically manages the During my initial tests, I've verified that the following functionalities operate as expected:
Although I haven't extensively tested As for automating package releases, I'll certainly explore the possibilities. However, considering that the repository's codebase isn't likely to undergo frequent updates, the necessity for automating the process seems somewhat diminished. Manual publication of a new release is a straightforward command (`npm publish') away. Feel free to make changes to the code in the PR before merging, I'm note particularly well-versed in writing these kinds of wrapper classes and I wouldn't be surprised if I made some mistakes or missed easy opportunities for improvement. |
Yeah that's fair. Automation could in theory make it easier to update libgphoto2 automatically in the future as well, but for that the changed would need to be backported in a PR first. Maybe something to leave for the future. If we do keep it in the repo, could you at least put built artifacts into a separate library (e.g. |
I moved your demo into a separate |
@RReverser I have made some more minor changes and I'm almost done with the Svelte demo but I want to make a separate PR for that. I also confirmed that video is working as expected with the new implementation! I think its ready for publishing :) |
Hm my follow-up comment disappeared for some reason, but please fix Browser caching makes it a bit less of a problem but it's still not great to recreate the whole "world" for camera instantiation. |
Alright I added the |
Thanks, I think this is looking good! I'll look into updating the official demo (aka what used to be the main app). |
Awesome, thanks @RReverser! Could you also publish the package to NPM using |
I'm trying it out locally now and there are some more minor updates I need to do before publishing, but hopefully will do those soon. |
async setConfigValue(name, value) { | ||
const uiTimeout = new Promise((resolve) => setTimeout(resolve, 800)); | ||
const setResult = this.schedule((context) => | ||
context.setConfigValue(name, value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also only just noticed that this got broken when migrating. Previously uiTimeout
would only start when the scheduled operation is reached (inside the callback), but now it's assigned outside the callback, which makes it start much earlier so it can timeout too early as well.
Hm I don't see anything relevant that was changed by this PR, but looks like
The logs are expired but it clearly still worked in March when I made last update: https://github.com/GoogleChromeLabs/web-gphoto2/actions/runs/4338585581/job/11777833871 So weird... |
Ah. Here are extended logs from
I think setting |
Ok fixed it by switching to |
Heh I reverted version to 0.1.0 since I'm pretty sure this will require some more changes before considered 1.0, but then getting npm ERR! 400 Bad Request - PUT https://registry.npmjs.org/web-gphoto2 - Cannot publish over previously published version "0.1.0". I guess even if you delete package, the version restriction remains. Oh well, I'll update to 0.2.0 or something. |
Ah... you published 0.2.0 before as well. Sigh :( I'll keep trying. FWIW for the future if you're just testing you can use dependency via |
Reached 0.4.0, looks like that finally worked. |
I did not expect that... I did start using a throwaway name but as this is the first time I worked on publishing through NPM I've been learning a lot about the process
Awesome! Luckily there are infinite sub-versions available before publishing a major release ;) |
Heh yeah. I just published 0.4.1 too as apparently needed few more fields for it to resolve on unpkg. Seems to work now, fingers crossed for the demo deploy. |
I'll test it later tonight and will try to have a svelte demo PR ready soon. Thanks for you help on the project, I'm happy I could contribute :) |
Whew the demo seems to work. |
This project is awesome so I did my best to turn it into an NPM package so that it can be installed easily. A few things to note:
npm login
and thennpm publish
. Thats it! I thought the original creator should publish the package as you have direct control over the source code.libapi.*
files (and removed them from the .gitignore) because these files are uploaded to NPM. On subsequent releases you can just rebuild the package, change the version number, and runnpm publish
again.