Yeoman with git - node.js

I am a complete new user of Yeoman. I am trying to learn the work flow of this Yeoman. So far I understand some of it but I am stuck in a very basic process.
Here is what I mean:
When I push all my directory to my repository it takes necessary files and folders. I used Yeoman .gitignor so that it ignores unwanted large files like bower_component
Other them member can clone my repository and run : bower install && npm install
to have all bower and npm components. and then run grunt build to make dist folder.
Upto now all works fine but my question is do they need to do same processes every time when they pull any new item ?
like I made some changes and pushed to my repository so what they have to do to get my new changes ? They need to do bower install && npm install again ?
Thanks in advance and sorry for really poor English

You only need to run bower install and npm install again if any dependencies changed! Otherwise, it will make no difference.
The git pull command won't touch directories that are not versioned (that is, that were ignored).
Hey, perfectly understandable english. Do continue participating!

Related

Force project to use Yarn but not npm

As a team practice, I would like to force my teammate to use yarn install/ run but not npm install/ run.
Is it possible to force a package.json 's dependency be installed only via yarn install or package.json's script be run only via yarn run?
If it cannot be done, can I at least get a warning when using npm install?
Again, this is only to align the team practice, so that reduces the possibility of error/ problem produced during dev/ops. Thanks
One of the way I can think of is CI can set a rules to detect if there is new file package-lock.json file being created, make the build fail. The developer will then realized he made a mistake since his build failed.
Alternatively you can also rely on husky pre-commit hook, which essentially runs a command to check if package-lock.json existed everytime developer trying to run git commit.

How to run npm webpack vue project on both Windows and Mac?

I took a Vue 2 online course and it did show (but didn't really explain) how to install node.js, npm and vue. Currently using vue-cli to set up my project using vue init webpack-simple. Problem is I have a Windows desktop and a Mac laptop. I'm using Box cloud on both but I need to have 2 separate folders for the same project. Basically, project-1-windows and project-1-mac.
I can't run npm run dev on the project-1-mac while on Windows 10 and vice versa. The only way I know to run both is to delete the node_modules folder and run npm install. However it takes a while for the files to download. Is there an easier way to do this?
It looks like you want either GitHub/BitBucket/friends or (for much more complex set-ups) Docker.
I will explain only the first (easier) option. To set-up docker, you rather go to its docks.
So, for GitHub/BitBucket/friends way, you need some one-time set-up (you have to do all of this in terminal of your machine. I don't go too deep into details because you may find corresponding docks for each thing easily by googling it).
Install git if needed on both machines. On mac, you just run git --version in terminal. It'll either show the version of installed git or will ask if you want to install git together with other developer tools.
Install brew on Mac, install any of these on Windows. These are just package managers. Use them to install nvm.
Install nvm (it's node version manager, arguably the most convenient way to manage node.js installations) on both machines.
Use nvm to install node.js (npm comes bundled with it) on both machines. That's it! One-time set-up done. Run node -v && npm -v to check that both are installed.
Now, to start each project you would do the following:
Create a repo (which is like a folder but on GitHub/BitBucket server) that you may freely access from any device that has internet connection.
Start project on any of your machines with something like npm init or vue init webpack-simple or whatever you feel comfortable with.
Run git init
When you do changes, commit & push them into your online repo.
Avoid committing files that might be auto-regenerated, they simply don't worth storing.
You may use any npm commands.
When you want to continue working on another machine, simply git clone your existing repo, run npm install and you are done.
Commit changes if needed.
git pull changes to another device if needed

Issue cloning every repository

I have been cloning repositories with node and MongoDB but I always run into issues running npm install when I cd into the folder directory.
It has to be me because I happens every time. What am I missing?
Seems like npm install is the 3rd step after 1: git clone "repository link", 2: cd in clone folder.
Please guide me in the right direction.
Thanks a ton
You can run npm install from a directory where package.json file is located since this is the one which holds all the info regarding packages.
So just try to make it sure that the directory from where you are firing npm install command, have package.json file.
Apart from this, just check if you have npm installed. Run npm -v

My Grunt Modules are enormous. What am I doing wrong?

I've started using NodeJS and Grunt to do things like run LESS, Concat JS library files and Uglify them, etc. I have a total of only 5 modules installed: less, concat, watch, copy, and uglify.
My node_modules directory contains a whopping 3,500 files!
I am using this setup in 4 related projects in my SVN repository. Since Grunt doesn't support any kind of "global" installation, I have to install these modules separately for every project.
That's added 14,000 files to my repository, and and added a very, very large amount of time to me check-out process.
I can't imagine that everyone using Grunt is quietly ignoring and tolerating this kind of repository bloat, but I can't see how to reduce the module size.
Does anyone know what am I doing wrong?? How do I get the functionality of less, concat, watch, copy, and uglify, but without the ridiculous file count that I'm seeing today?
i dont know of a way to get the functionality without having the files on disk.
but the usual solution to avoid bloating your repo is to rely on npm install to get all those files. add node_modules/ and maybe bower_components/ to your .gitignore to make sure you dont commit them by accident.
npm install --save-dev grunt-contrib-copy
git add package.json; git commit -m 'Add grunt copy dep'; git push
cd ~
git checkout https://github.com/myName/myGruntProject; cd myGruntProject
npm install
grunt

NPM throws errors at traceur install on OS X

https://github.com/tejas-manohar/itnerary-civic-hacking -- I cloned this git repo down locally. Installed grunt-cli globally, and ran npm run nss (script written by author of original server template -- look in package.json, not complex) and faced numerous errors at the traceur install + git cloning. I've included the trail from terminal window in the pastebin linked below. The npm debug/error log mentioned is not present at the suggested location. npm install alone does not help the situation and returns nothing back. NodeJS v0.10.29 is installed via Node Version Manager (NVM) on OS X 10.9.3.
http://pastebin.com/UJFL3k2E
I'm not the most adept with some of the technologies discussed here. Would someone please attempt to walk me through (a) solution(s) and/or steps to get better clues? All assistance is appreciated.
There's a couple of problems going on which are causing the problems you have seen. The first of which is the command that is run when you run npm run nss, which fails for you with this:
rm: ../../app/static/js/vendor/traceur.js: No such file or directory
This is because, well, the file simply does not exist (yet). If you look at the commands which are run when you run npm run nss, you'll see that the remove file is followed by the copy file of traceur.js to that very location. So I would guess that whoever wrote the script intended for this to be run after it was initially setup, and the remove/copy would be done once the file was initially copied there. Therefore, you must first copy the traceur.js file to app/static/js/vendor before you can successfully execute npm run nss.
But then the next problem, the file should be copied from tools/traceur-compiler/bin doesn't exist either. This is because the traceur-compiler project has recently deleted this (compiled) file from their project, which you can see via this commit: https://github.com/google/traceur-compiler/commit/429c3d850dcb7636320e81fd782c61a06de0fbf1
So you need to regenerate this file, which you can do by (from the itnerary-civic-hacking root directory):
cd tools/traceur-compiler
make bin/traceur.js
cp bin/traceur.js ../../app/static/js/vendor
This will get you in the same state as if you successfully ran npm run nss.
You won't be able to re-run the npm run nss command, but you really shouldn't need to since its more of a setup command than anything (it creates a directory, clones a github repo, etc). If you wanted to update the traceur-compiler in the future (though you may never have to do this) then I would recommend running the following steps (from the itnerary-civic-hacking root directory):
cd tools/traceur-compiler
git pull origin master
npm install
make bin/traceur.js
cp bin/traceur.js ../../app/static/js/vendor

Resources