badlydrawnrob / anki

Learn to code with Anki — flashcards and themes for all learning levels. Master your programming language of choice!
MIT License
742 stars 62 forks source link

`print-first-css` isn't downloading properly #65

Closed badlydrawnrob closed 11 months ago

badlydrawnrob commented 11 months ago

TL;DR Make sure you're pointing to a proper commit in the dependency (i.e: #a287d7a):

npm update print-first-css (or other Github repo devDependencies) doesn't always do the job, so running npm install print-first-css with the correct #commit-number makes sure that it's updating to a specific commit. This seems to be a longstanding "bug or feature".

Some problems with Github tags and npm

NPM is downloading an old version of print-first-css for some reason (version 2.2.10 on the package.json), so a quick look here seems to point to adding the proper commit link.

My commit tags (v3.1.1) and release files (3.0.0) are a bit out of whack — package.json is 3.0.0 also. Github doesn't automatically add a tag when package.json is updated, so this must be done manually.

Perhaps I made a few minor changes but kept the release number the same? What I must have done is add tags via GitHub Desktop, but kept the same Release number at 3.0.0 — there is a way to update package.json AND major.minor.patch version number, but I don't think it's possible with the desktop app.

I think it's something like npm version patch -m 'message' which in this thread says it adds a Git tag at the same time. See also the official NPM docs.

Important note: This might not play nicely with the GitHub Desktop app.

badlydrawnrob commented 11 months ago

It's better to do this manually through GitHub Desktop and just add the version number directly to the package.json.

Bumping the version with npm, and then pushing the changes with Github Desktop do not seem to push the new version tag at all. You'd have to do it in the terminal and git push -origin or some such bollocks.

Besides that, I think I prefer Semvers 2.1.2 format over Github's preference to add a V in their tags (like v2.1.2) although I think it's a matter of preference and I honestly don't give a shit.

Another developer problem to worry about.

badlydrawnrob commented 11 months ago

Also see this article about using ~ or ^ in front of the dependancies. Perhaps using the updated tag version will work, I have no flippin' idea:

github:badlydrawnrob/print-first-css#a287d7a ~github:badlydrawnrob/print-first-css#a287d7a ^github:badlydrawnrob/print-first-css#a287d7a github:badlydrawnrob/print-first-css#2.1.3

Anyhow, I think npm update <package name> forces the package to be updated.

badlydrawnrob commented 11 months ago

Damn. I think the V in the minor.major.patch tag number might be important. Tried:

github:badlydrawnrob/print-first-css#2.1.3

npm ERR! code 1 npm ERR! The git reference could not be found npm ERR! command git --no-replace-objects checkout 2.1.3 npm ERR! error: pathspec '2.1.3' did not match any file(s) known to git

badlydrawnrob commented 11 months ago

Just reading all the above gives me a headache, so I'm gonna say just npm update print-first-css and stick to using the commit number, i.e: github:badlydrawnrob/print-first-css#a287d7a for now!

badlydrawnrob commented 11 months ago

I'm closing this before my head explodes 🤯