petrovicstefanrs / 30_seconds_of_knowledge

Google Chrome Extension that lets you gain new developer skills, every time you open a New Tab.
https://30secondsofknowledge.com/
MIT License
942 stars 121 forks source link

Is there any public API to manipulate the data set? #68

Closed amirhoseinsalimi closed 4 years ago

amirhoseinsalimi commented 4 years ago

Hello,

The idea behind this project is kind of cute and is appreciated by developers. I installed the Chrome extension a few months back and now I'm curious to know if there's a public API to be able to do CRUD operations (without DELETE :grinning:) on the data set the extension using. I think it would be nice to have something like that and even if you're not interested in the idea that much to implement it yourself, or if you're busy and looking for a person to do the job, I'm in.

fejes713 commented 4 years ago

Hey @amirhoseinsalimi 👋

At this time the API for fetching all snippets doesn't exist. However, this is something that we had in plan for a long time at our organization.

If we ever decide to implement it we have to really plan it out well. The 30-sec-knowledge repo does a decent job of grouping data from different 30-sec repositories but it doesn't auto-fetch it, and it's not as robust as it should be - If the snippet structure changes on any of the projects it's just not going to work anymore.

I'm going to introduce @Chalarangelo and @skatcat31 to discuss this as it's quite the topic that comes from time to time and we still haven't decided what to do with it.

  1. As far as I know, we're migrating most of the projects to Gatsby this year. In my opinion, if we ever decide to go for this we should make API per project and 30-sec-knowledge would just need to fetch that API.

or

  1. We decide to not implement this as this is the way to much work for very little use (still don't know how many people would use it and for what purposes).

Anyways thanks @amirhoseinsalimi for offering us help. If we ever plan this out you can definitely help us build the API. We just have to be sure not to leave any repo behind this plan as one of the goals of 30-seconds is to make educational materials accessible to everyone.

Chalarangelo commented 4 years ago

An API is too much work, but we can ask individual repos to host their snippetData.json as part of their website, so that anyone (30 seconds of knowledge included) can fetch the data from that. We can even make it part of the starter before we complete any migrations.

fejes713 commented 4 years ago

That would be a good option. Not too much work but definitely serves a purpose. WDYT @amirhoseinsalimi ?

amirhoseinsalimi commented 4 years ago

Having considered what you said, I think this is not a good time to implement such a feature but it still worth it to keep the idea in a wishlist. 30-sec-knowledge can become a culture and I thought maybe a twitter bot and an API to seed the database could help it to gain the popularity it deserves. Anyways, I wish the core team the best and I would welcome any opportunity to help the product in the future. BTW, thank you for your time.

petrovicstefanrs commented 4 years ago

Chiming in with my two cents here. Plugging 30 sec of knowledge to any online API would defeat the purpose of the extension, which is to be an all the time accessible plugin feeding you the snippets whether you are online or not. I got a lot of comments from people claiming they appreciate the fact they could read through the snippets while offline (airplane, bus and so on...) Introducing an API would make this impossible.

A more probable way of dealing with it is having all 30 sec repos share the same project structure, then using those repos as submodules within 30 sec of code, to update the extension on a monthly basis. This means that the extension would need to be manually updated every month which isn't really a problem since any structural change would require manual upload to both the chrome and firefox stores anyway. Submodule updates could be handled through a simple bash/node script run every time the extension update is needed or on build.

Chalarangelo commented 4 years ago

@petrovicstefanrs Good idea. The common infrastructure is already the priority if you are following the latest discussion in the @30-seconds/meta team.

However, submodules should not be in 30-seconds-of-code, but rather a new repo, in my opinion, one where all of the repositories are submodules and it does all of the heavy lifting for us. This seems to me to separate concerns rather nicely and allow for future repositories, official or not, to be integrated more easily.

Provided that fact that we can use a system like that, all repositories should still host their own JSON files and maybe we could make the extension auto-update its content file once a week or so while releasing major versions manually monthly or quarterly. Is that an option? I haven't got much experience with browser extensions.

petrovicstefanrs commented 4 years ago

@Chalarangelo Yes, I'm trying to keep up with the discussion on @30-seconds/meta as much as I can :D

Submodules would be a part of the extension repo, in a scenario where a new 30 sec repo for a new language was released I would just add that repo as a submodule, provided that the structure is the same for all repos ( what you are trying to achieve already ) there would be no need for much coding to update the extension, I think it could be even be automated so the only action needed to update the extension is adding a new submodule.

Now all this being said existing languages (submodules) would still need to be updated by a simple git pull in each submodule ( a simple bash script could automate this and be run on build ).

The release needs to be manual, I couldn't find any possible way to automate it, especially as Firefox store requires human to human correspondence to check the extension every time you update it.