I'm having some projects in Eclipse, and two of them are angular apps. I've downloaded and installed some libraries using npm install, but now in Eclipse, I've got a lot of validation errors coming from the /examples and /test folders. I know it's possible to exclude these folders from Eclipse validation, but since none of the project team members use the examples or tests anyway, I'd like to remove them. But npm install retrieves them again.
How can I exclude these folders from the libraries?
Related
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.
I am setting up am Angular.js project from scratch. And I would like to keep it on Github inside a repository.
I have a simple question but I couldn't find a comprehensive answer for it. After establishing the project basic scaffold, and installing some node modules with NPM, there are many libraries, node-modules and etc in project structure. Also there are files of the framework for example Sails framework. Since a developer can install them by running npm install, which files should I push into the repository? Which ones don't need to be pushed?
The problem is, Source tree shows all new files as not staged, and I am confused which one I should exclude, which I should commit.
From personal experience, 2 types of files can be ignored in git
3rd party libraries, which can be installed using npm/bower etc.
Generated files, like css generated from less, minified js files, etc.
which files should I push into the repository?
Any files related to your application that contain business logic, routing, or other files that you've added to the project that are required for your app to run.
Which ones don't need to be pushed?
You should add node_modules to your .gitignore file. In almost all scenarios it would be unnecessary to include installed packages because your package.json maintains a list of packages to install when calling npm install.
If you're not sure about where to start with a .gitignore file, this is the defacto Node.js .gitignore file that is generated by GitHub & many popular IDE's. Just add that file to your project folder and git will automatically detect it, you should include your .gitignore as part of your repository files.
Additionally, if you're using Bower for front-end package management, you should add your bower.json to your repository and add the bower_components directory to your .gitignore.
I am currently getting to grips with angular using a book, currently on testing. So I have the tutorial project folder set up in localhost C:\xampp\htdocs\projects\learningangular. So I installed nodejs as the book instructs and from then on I don't know where to install the modules and dependencies - Karma, Jasmine, Angular-mock...... and what needs to go where because the book doesn't really help with that in the chapter. Do I have to move the tutorial project folder from localhost to nodejs folder which is located in the C:\Program Files\nodejs and also install the modules and dependencies there? Or can I still work from localhost. Also how does one change the npm install destination folder when using the console?
You use the project folder and install the local packages there. The NPM Getting Started will give you the missing information from your book you need to get up and running.
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.
I want to setup a environment on my machine to learn AngularJS. I saw in the videos of egghead.io where he keeps typing AngularJS code and when it refreshes through a server and displays the changes in realtime in the browser. How to do that? I see WebStrom logo in the videos but that's it.
You will need a server to setup your files. The videos you saw might have used browser-reload plugin which watches the files for changes and refreshes the page as soon as there's a change in any of the files.
You can use yeoman (and one of the generators) for project setup (for scaffolding basically). You will need to install NodeJS first which will install NPM (node package manager) with it. Then you can install YEOMAN and use the generator respectively. My recommendation would be generator-gulp-angular.
See the readme for the instructions, but basically you'll have to run these commands in command prompt after you've installed NodeJS properly.
npm install -g yo gulp bower
the above command installs yeoman,gulp and bower respectively
npm install -g generator-gulp-angular
the above command installs the gulp-angular yeoman generator
Then you can create a directory, say 'testDir' and navigate into it. I.e.
cd testDir
Then run
yo gulp-angular
You'll be asked to select desired technologies. Once you're done, you can run the following command to see it working (with live reload)
gulp serve
not sure what video you're talking about but it sounds like he/she has a gulp or grunt task that is watching for changes and then livereloading your browser. It could be either
gulp-livereload (https://www.npmjs.com/package/gulp-livereload)
or
browsersync (https://www.browsersync.io/)