Hi, I got started with the starter project, and I’ve been building it up. I had to pull in angular-resource and another package angular-webstorage, so I dug through ionic.bundle.js and saw that it includes angular 1.3.6, so I execute:
I did not manually manipulate any of the directories or files, but when I go to check git status I see a whole slew of the bundled files are marked for deletion, and I’m not sure why?
$git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: bower.json
modified: platforms/ios/warehouse-mobile/config.xml
modified: platforms/ios/www/index.html
modified: platforms/ios/www/js/app.js
deleted: platforms/ios/www/lib/ionic/js/angular-ui/angular-ui-router.js
deleted: platforms/ios/www/lib/ionic/js/angular-ui/angular-ui-router.min.js
deleted: platforms/ios/www/lib/ionic/js/angular/angular-animate.js
deleted: platforms/ios/www/lib/ionic/js/angular/angular-animate.min.js
deleted: platforms/ios/www/lib/ionic/js/angular/angular-resource.js
deleted: platforms/ios/www/lib/ionic/js/angular/angular-resource.min.js
deleted: platforms/ios/www/lib/ionic/js/angular/angular-sanitize.js
deleted: platforms/ios/www/lib/ionic/js/angular/angular-sanitize.min.js
deleted: platforms/ios/www/lib/ionic/js/angular/angular.js
deleted: platforms/ios/www/lib/ionic/js/angular/angular.min.js
modified: platforms/ios/www/lib/ionic/scss/_reset.scss
modified: platforms/ios/www/lib/ionic/scss/ionicons/_ionicons-animation.scss
modified: platforms/ios/www/lib/ionic/scss/ionicons/_ionicons-font.scss
modified: platforms/ios/www/lib/ionic/scss/ionicons/_ionicons-icons.scss
modified: platforms/ios/www/lib/ionic/scss/ionicons/_ionicons-variables.scss
modified: platforms/ios/www/lib/ionic/scss/ionicons/ionicons.scss
deleted: platforms/ios/www/lib/ionic/version.json
modified: www/index.html
modified: www/js/app.js
deleted: www/lib/ionic/js/angular-ui/angular-ui-router.js
deleted: www/lib/ionic/js/angular-ui/angular-ui-router.min.js
deleted: www/lib/ionic/js/angular/angular-animate.js
deleted: www/lib/ionic/js/angular/angular-animate.min.js
deleted: www/lib/ionic/js/angular/angular-resource.js
deleted: www/lib/ionic/js/angular/angular-resource.min.js
deleted: www/lib/ionic/js/angular/angular-sanitize.js
deleted: www/lib/ionic/js/angular/angular-sanitize.min.js
deleted: www/lib/ionic/js/angular/angular.js
deleted: www/lib/ionic/js/angular/angular.min.js
modified: www/lib/ionic/scss/_reset.scss
modified: www/lib/ionic/scss/ionicons/_ionicons-animation.scss
modified: www/lib/ionic/scss/ionicons/_ionicons-font.scss
modified: www/lib/ionic/scss/ionicons/_ionicons-icons.scss
modified: www/lib/ionic/scss/ionicons/_ionicons-variables.scss
modified: www/lib/ionic/scss/ionicons/ionicons.scss
deleted: www/lib/ionic/version.json
Untracked files:
(use "git add <file>..." to include in what will be committed)
platforms/ios/www/lib/angular-animate/
platforms/ios/www/lib/angular-resource/
platforms/ios/www/lib/angular-sanitize/
platforms/ios/www/lib/angular-ui-router/
platforms/ios/www/lib/angular-webstorage/
platforms/ios/www/lib/angular/
platforms/ios/www/lib/ionic/.bower.json
platforms/ios/www/lib/ionic/README.md
platforms/ios/www/lib/ionic/bower.json
platforms/ios/www/lib/ionic/scss/_split-pane.scss
www/lib/angular-animate/
www/lib/angular-resource/
www/lib/angular-sanitize/
www/lib/angular-ui-router/
www/lib/angular-webstorage/
www/lib/angular/
www/lib/ionic/.bower.json
www/lib/ionic/README.md
www/lib/ionic/bower.json
www/lib/ionic/scss/_split-pane.scss
The only thing other thing I did do was update the ionic CLI: npm update -g ionic
Why are the files, specifically under www/lib/ionic/js/angular/* all marked for deletion?
Just looking for a quick answer here – docs are not clear on the directory layout. I’d like to know how Ionic manages bundled dependencies vs. bower installed dependencies, and explicitly why did git mark the directory www/lib/ionic/js/angular- for deletion. I did not manually remove that directory, so it must have been some command run from the ionic CLI.
ionic start tmp && cd tmp
git init
# angular-resource@1.3.6 wasn't resolving for me, so dropped the version
bower install angular-resource angular-webstorage --save
git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: bower.json
deleted: www/lib/ionic/js/angular-ui/angular-ui-router.js
deleted: www/lib/ionic/js/angular-ui/angular-ui-router.min.js
deleted: www/lib/ionic/js/angular/angular-animate.js
deleted: www/lib/ionic/js/angular/angular-animate.min.js
deleted: www/lib/ionic/js/angular/angular-resource.js
deleted: www/lib/ionic/js/angular/angular-resource.min.js
deleted: www/lib/ionic/js/angular/angular-sanitize.js
deleted: www/lib/ionic/js/angular/angular-sanitize.min.js
deleted: www/lib/ionic/js/angular/angular.js
deleted: www/lib/ionic/js/angular/angular.min.js
modified: www/lib/ionic/scss/_reset.scss
modified: www/lib/ionic/scss/ionicons/_ionicons-animation.scss
modified: www/lib/ionic/scss/ionicons/_ionicons-font.scss
modified: www/lib/ionic/scss/ionicons/_ionicons-icons.scss
modified: www/lib/ionic/scss/ionicons/_ionicons-variables.scss
modified: www/lib/ionic/scss/ionicons/ionicons.scss
deleted: www/lib/ionic/version.json
Untracked files:
(use "git add <file>..." to include in what will be committed)
www/lib/angular-animate/
www/lib/angular-resource/
www/lib/angular-sanitize/
www/lib/angular-ui-router/
www/lib/angular-webstorage/
www/lib/angular/
www/lib/ionic/.bower.json
www/lib/ionic/README.md
www/lib/ionic/bower.json
www/lib/ionic/scss/_split-pane.scss
no changes added to commit (use "git add" and/or "git commit -a")
This is an expected out put, since bower will install all the needed dependencies for everything in your bower.json file.
The only unexpected thing I can is why the changes are taking place inside your platform/ios folder.
@mhartington thanks for the reply. I figured the stuff under the platforms/* folder is auto-generated each time you either build for that platform or run the simulator for that platform, am I wrong? In fact, I was assuming that {%project-root%}/platforms/* could be added to .gitignore. Is there a reason why I need to check in anything under this directory?
The deletions under /www/lib/ionic/js/ were more curious to me. I haven’t inspected the gulp files in detail, but are you actually investigating the root project bower.json and if you find dependencies there that override those in the bundled directory www/lib/ionic/js/* you are removing them? What tool / command actually does this?
Yup, things in the platforms/ios directory will get replaced every build.
There are some cases were you would want to check in custom code, but it’s not always something you want to do.
So this
Is a case were we upgrade our version angular and other libraries.
In that case, because things are tagged at difference versions, they are deleted and new versions are added.
@mhartington that helps explain the platforms/ dir for sure.
I’m still wondering what was going on with the www/lib/ionic/js/ folder and why these were all marked for deletion on my initial commit after creating the starter project?
Ah it was on the initial commit? Hmm that is interesting.
Hmm, yeah not too sure to be honest
If all the files are there, then I don’t think theres an issue.
@mhartington ok quick follow-up: I see now that the ionic CLI has these commands (missed these before):
add ............ Add a bower component to the project
remove ......... Remove a bower component from the project
list ........... List bower components from the project
I was/am using bower directly, e.g. bower install angular-webstorage. What is the rationale where one would want to do ionic add angular-webstorage vs. just bower install angular-webstorage --save
Think of those commands as aliases to bower commands.
Instead of jumping around different commands, the logic is that you can stick with ionic <command> to get all the functionality you need.
I’m seeing same issues when I tried to add angular-bootstrap package in bower.
This is what I found out. There is a file in the root project folder called .bowerrc which contains the information about where the bower components should be installed. This is currently pointing at the lib directory.
{
“directory”: “www/lib”
}
After run the bower install/update all the angular folders moved from lib/js to lib.
Bower tries to install all the components on the lib folder but all the previously installed angular components got removed from lib/js folder. I’m not sure this is an expected behavior.
I have since re-written the gulpfile.js to do minification, bower dependency injection, concatenation, etc.
I changed .bowerrc to use the standard ./bower_components, and my gulpfile watches the ./src/ directory and concats, minifies, and generates source maps into a single file into ./www
I didn’t like the way the stock build worked, b/c it will include the entire distribution of files included by any bower dependency due to the fact that it packaged up everything under ./www/lib.
I’ll post a gist of my new build system – which so far, seems to be working very well for me.
A small update on my previous post. The js folder is actually located inside the ionic folder. So I meant to say the angular folders from lib/ionic/js got moved to lib folder after run the bower install/update.