bower packages update crashed the app - how to roll back - angularjs

I've installed another additional module for my app with bower. As project dependencies in bower.json were not very strict, and a lot of time passed since last update, bower updated a lot of packages to newer ones. There were a lot of changes, and incompatibility between packages was the reason for major app crash.
I never asked for this, not a good moment for total upgrade&debug. How can I just roll back to previous packages?
Original package sources are in .gitignore and built with grunt into one file (so I can't just revert the commit - as packages renewed by bower will be the same in the next build)
I couldn't find out the old package set which was OK for my app (as package sources with specific version numbers are in .gitignore) UPD: found versions in built file, see my answer
I couldn't find any information about sort of "bower package history" or "bower undo".
UPD: I solved the issue for myself and described the solution in the answer. But I'm really not sure it's a good way, and would be grateful for any kind of mentorship about the subject.

I solved the problem for myself by digging into incompatiblities showed by bower, and finding compromise package set. Main issues were between newest angular asked by some packages and angular-ui-bootsrap working with older versions only for that moment. Also there were some issues with other newest packages, which I downgraded and will solve later on. So I used bower install [PackageName]#=[SpecificPackageVersion] (can use --save here to save it to bower.json) for manually setting compromise packages.
At the moment I realized, that there were old package versions in license comment blocks in the previous commits of built file, so in order to have old working set of packages I could:
git checkout HEAD~1 to have old file, which was built with previous package set
grep (search) package names or license comments in it
bower install [PackageName]#=[OldWorkingPackageVersion] (can use --save to save it to bower.json)
git checkout [BranchName] to make HEAD back
Make build (with previous packages installed again)
However, I'm not sure it's a good solution, and would be grateful for any kind of clarification about the subject.

Related

create-react-app taking up too much disk space and time

It's my first experience with react and as stated in official docs, I was trying out create-react-app to create my first react app.
But I notice that it takes around 15-20 minutes to get finished( even though I have good internet connection) and once it was completed, I noticed the space taken by the newly created folder to be around 165-170 MB.
Isn't there any quicker way to get started with react as the above mentioned method probably installs some modules that are never going to be used.
Thank You.
I also faced the same problem when i first started learning react. What i did was i manually configured webpack to bundle my code. And then i created central node_modules folder in particular place. So anytime i want start a react project i just create a symlink to the node_modules folder. And also if i want install a new package, i go the central folder and install it, so the package will be available in the node_modules folder and for any of my project that may need it. That way i only need to install a package once not every time i want to use it for a new project.
But recently i found a package manager called pnpm. Instead of downloading a package anytime need to install it, pnpm maintains a central cache of packages such that anytime you want to install a package, it just creates a symlink(or junction in windows) (similar to what i used to do).
Conclusion
In conclusion i would recommend you to just configure a bundler (vite is cool) by yourself and use pnpm to install packages. You can read more about pnpm on there website

summarize mutliple typings in one file

My problem is, that I've some older Angular 1 projects, where I use Ui-Router in version 0.2.8 and I want to upgrade to the newest RC release which is no longer available with NuGet
https://ui-router.github.io/ng1/tutorial/helloworld
but in my Project I've no npm or bower, its a Visual Studio project where I use NuGet so far and I've no chance to use npm at the moment.
when I get the ui-router from npm in an new project, I see all the Typing files. Is it possible to summarize them all in one file? Is there a tool out there that can do this? Or what would be the best Solution for my problem?

How do you manage versioning of dependencies, in nodejs?

We've been a Windows shop, mainly relying on Visual Studio as our IDE and build tool. We've begun to explore using Angular and node, and angular-cli.
We have a project that depends upon "angular-cli": "1.0.0-beta.10". I was trying to get this to build on a new machine.
I installed nodejs, then did a global install of angular-cli using npm:
npm install -g angular-cli
Then I tried to do a build:
ng build
I got an error:
It seems like you're using a project generated using an old version of the Angular CLI.
The latest CLI now uses webpack and has a lot of improvements including a simpler
workflow, a faster build, and smaller bundles.
To get more info, including a step-by-step guide to upgrade the CLI, follow this link:
https://github.com/angular/angular-cli/wiki/Upgrading-from-Beta.10-to-Beta.14
What I did to get things working was to uninstall angular-cli, and then install version beta.10
npm uninstall -g angular-cli
npm install -g angular-cli#1.0.0-beta.10
After that, things work just fine.
Unfortunately, that's not a solution.
We will, eventually, have multiple projects using node packages, we need them to be able to run simultaneously, without having to uninstall and reinstall global packages.
And we need to be able to run builds automatically on our build machines, without having to RDP into the build machines to mess about with which node packages are installed.
That is, if I have three projects that use angular-cli#1.0.0-beta.10, I expect all three to work on any of the developers machines, and that the build machines will be able to check out any of the three projects and successfully build them.
And if I update one to use beta-12, and another to use beta-14, I expect to be able to commit them to version control, and for the build machine to be able to check out any of three and still be able to build them, regardless of which version they use.
I thought the whole idea of tracking local dependencies in package.json, and storing local copies in node_modules was to avoid dependencies on globally installed packages.
How do people usually manage this issue?
Is there a way I can configure angular-cli so it doesn't depend upon a global install?
Are there other packages with which I'm likely to encounter similar problems? Is there an approach that will work for any of them?
The Angular-CLI can be run with, and the global ng command uses, a locally installed version for each project. This local version can be accessed using the command ./node_modules/.bin/ng
I recommend uninstalling the global CLI you have and taking the time to modify your package.json scripts to reference the local CLI installation rather than the global ng. This is my method to handle varied CLIs on my Jenkins server.
On that note, I do highly suggest following the instructions to move from Beta.10 to Beta.14 (https://github.com/angular/angular-cli/wiki/Upgrading-from-Beta.10-to-Beta.14) if you can stomach the change to WebPack. Any projects utilizing CLI Beta.14 or higher can be upgraded to the latest beta simply by uninstalling the CLI, reinstalling it, and then running ng init (Diff [d] any files you've modified!) to update the boilerplate.
Copy & Paste the typescript components html's and css/scss files to a new build, it's not even worth it to mess with the core build of those stuff.
Bear in mind that you might see imports being grayed and the same very imports to be needed to add in app.module.ts as its a core file nowadays to every single project of ours.

Is there an official nuget package for Angular 2?

I'm currently working in a work environment where I do not have access to npm / node. The npm download location is actually blocked so I can't get any packages.
I want to build an Angular 2 site. As I can't access npm, I want to use Nuget to get the files. Although I can see the Angular 1 packages, I cannot seem to see any Angular 2 packages. Is there one for Nuget?
Also, is populating the node_module folder and compiling the Typescript the only thing that npm does for Angular? If I can just get a copy of the node_module folder (from outside work) and get TypeScript working in my solution, can I basically bypass the need for npm?
In short; No.
You can see a list of all available NuGet package versions here, with the most recent being 1.5.3.
Even performing a generic search shows most recent versions as 1.5.3.
Sometimes they'll have beta versions of packages available that you can install with a command similar to: Install-Package EntityFramework -Version 6.1.3-beta1 -Pre, but it doesn't appear as if they have created any pre-release packages.
So, as #Michal Dymel mentioned, you could get it from a CDN or some other location.

How do you manage bower dependencies in your apps when there are external fixes prior to releases?

I'm using angular-ui-calendar which is at 0.8.0 in bower. I see a problem, and I see it has been fixed on the master branch, but there is no new release. In fact there are quite a few changes between 0.8.0 and the HEAD of the master branch.
I can copy their latest master into my bower_components folder, BUT that won't help anyone else (including jenkins) because when bower_install is done on any other machine, it won't get my changes.
Is there some viable method to deal with this kind of problem that already works?
Do I setup my own bower repos and publish my own version of 0.8.1 for my company?
Do I setup a script that will apply my fixes to the bower_components folder?
Do I add bower_components to git and then check them out the same way I get the rest of my project?
I'm seriously leaning toward the last method because that removes the need for bower to install in other places (bower is struggling to get those 5 9s of reliability)
What problems could ensue if I commit bower_components to my own repo?
(I have a similar problem with ng-grid, so it isn't just the calendar that is giving me heartburn)
I finally decided to commit my bower_components to the git repo so that if I need to make changes to something between releases, I can do that. So far, so good. It also helps me remember when I need to add things to the bower.json file (with --save or manually) since those things are now tracked by git, they show up as untracked files.
Also allows me to diff the changes to components, if I update my bower packages, I can see what changed in those packages and how that might affect my project.

Resources