From be0b98a5f93b31062fe6d4d663e8d404cbb1ba96 Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Thu, 25 Aug 2016 17:32:22 +0300 Subject: [PATCH 01/10] refactor(*): rename files and directories to bring in-line with modern best practices Partly addresses #334. --- README.md | 8 ++++---- app/app.js | 2 +- app/{components => core}/version/interpolate-filter.js | 0 .../version/interpolate-filter.spec.js} | 0 app/{components => core}/version/version-directive.js | 0 .../version/version-directive.spec.js} | 0 app/{components => core}/version/version.js | 0 .../version_test.js => core/version/version.spec.js} | 0 app/index-async.html | 6 +++--- app/index.html | 6 +++--- app/view1/{view1_test.js => view1.spec.js} | 0 app/view2/{view2_test.js => view2.spec.js} | 0 karma.conf.js | 2 +- 13 files changed, 12 insertions(+), 12 deletions(-) rename app/{components => core}/version/interpolate-filter.js (100%) rename app/{components/version/interpolate-filter_test.js => core/version/interpolate-filter.spec.js} (100%) rename app/{components => core}/version/version-directive.js (100%) rename app/{components/version/version-directive_test.js => core/version/version-directive.spec.js} (100%) rename app/{components => core}/version/version.js (100%) rename app/{components/version/version_test.js => core/version/version.spec.js} (100%) rename app/view1/{view1_test.js => view1.spec.js} (100%) rename app/view2/{view2_test.js => view2.spec.js} (100%) diff --git a/README.md b/README.md index 8d52ba48b7..4a3223acd0 100644 --- a/README.md +++ b/README.md @@ -79,9 +79,9 @@ Now browse to the app at [`localhost:8000/index.html`][local-app-url]. ## Directory Layout ``` -app/ --> all of the source files for the application +app/ --> all of the source files for the application app.css --> default stylesheet - components/ --> all app specific modules + core/ --> all app specific modules version/ --> version related components version.js --> version module declaration and basic "version" value service version_test.js --> "version" value service tests @@ -117,8 +117,8 @@ The `angular-seed` app comes preconfigured with unit tests. These are written in which we run with the [Karma][karma] test runner. We provide a Karma configuration file to run them. * The configuration is found at `karma.conf.js`. -* The unit tests are found next to the code they are testing and have an `_test.js` suffix (e.g. - `view1_test.js`). +* The unit tests are found next to the code they are testing and have a `.spec.js` suffix (e.g. + `view1.spec.js`). The easiest way to run the unit tests is to use the supplied npm script: diff --git a/app/app.js b/app/app.js index 6ea2401bcd..3a0ca2557e 100644 --- a/app/app.js +++ b/app/app.js @@ -1,6 +1,6 @@ 'use strict'; -// Declare app level module which depends on views, and components +// Declare app level module which depends on views, and core components angular.module('myApp', [ 'ngRoute', 'myApp.view1', diff --git a/app/components/version/interpolate-filter.js b/app/core/version/interpolate-filter.js similarity index 100% rename from app/components/version/interpolate-filter.js rename to app/core/version/interpolate-filter.js diff --git a/app/components/version/interpolate-filter_test.js b/app/core/version/interpolate-filter.spec.js similarity index 100% rename from app/components/version/interpolate-filter_test.js rename to app/core/version/interpolate-filter.spec.js diff --git a/app/components/version/version-directive.js b/app/core/version/version-directive.js similarity index 100% rename from app/components/version/version-directive.js rename to app/core/version/version-directive.js diff --git a/app/components/version/version-directive_test.js b/app/core/version/version-directive.spec.js similarity index 100% rename from app/components/version/version-directive_test.js rename to app/core/version/version-directive.spec.js diff --git a/app/components/version/version.js b/app/core/version/version.js similarity index 100% rename from app/components/version/version.js rename to app/core/version/version.js diff --git a/app/components/version/version_test.js b/app/core/version/version.spec.js similarity index 100% rename from app/components/version/version_test.js rename to app/core/version/version.spec.js diff --git a/app/index-async.html b/app/index-async.html index 281254ed11..ee903b7dcc 100644 --- a/app/index-async.html +++ b/app/index-async.html @@ -33,9 +33,9 @@ 'app.js', 'view1/view1.js', 'view2/view2.js', - 'components/version/version.js', - 'components/version/version-directive.js', - 'components/version/interpolate-filter.js' + 'core/version/version.js', + 'core/version/version-directive.js', + 'core/version/interpolate-filter.js' ], function() { // when all is done, execute bootstrap angular application angular.bootstrap(document, ['myApp']); diff --git a/app/index.html b/app/index.html index ec9da03650..91c0b55126 100644 --- a/app/index.html +++ b/app/index.html @@ -36,8 +36,8 @@ - - - + + + diff --git a/app/view1/view1_test.js b/app/view1/view1.spec.js similarity index 100% rename from app/view1/view1_test.js rename to app/view1/view1.spec.js diff --git a/app/view2/view2_test.js b/app/view2/view2.spec.js similarity index 100% rename from app/view2/view2_test.js rename to app/view2/view2.spec.js diff --git a/karma.conf.js b/karma.conf.js index 7271e9fef8..eadf08bca3 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -8,7 +8,7 @@ module.exports = function(config) { 'bower_components/angular/angular.js', 'bower_components/angular-route/angular-route.js', 'bower_components/angular-mocks/angular-mocks.js', - 'components/**/*.js', + 'core/**/*.js', 'view*/**/*.js' ], From 10a4f372766f2bed6831fde78dc65b4b6159c882 Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Wed, 7 Dec 2016 13:26:43 +0200 Subject: [PATCH 02/10] chore(*): switch from `bower` to `npm` for frontend dependencies Closes #385 Closes #389 --- .bowerrc | 3 --- .gitignore | 2 +- .travis.yml | 2 +- README.md | 30 +++++++++++++----------------- app/index-async.html | 10 +++++----- app/index.html | 10 +++++----- bower.json | 15 --------------- karma.conf.js | 6 +++--- package.json | 22 ++++++++++++---------- 9 files changed, 40 insertions(+), 60 deletions(-) delete mode 100644 .bowerrc delete mode 100644 bower.json diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 8c58c8efc9..0000000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "app/bower_components" -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b702acc68f..bcecdc7669 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ logs/* !.gitkeep node_modules/ -bower_components/ +app/lib/ tmp .DS_Store .idea \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 78680206f9..7cd8405390 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ dist: trusty language: node_js node_js: - - '4.5' + - 6 install: - export DISPLAY=:99.0 diff --git a/README.md b/README.md index 4a3223acd0..7986c60bd8 100644 --- a/README.md +++ b/README.md @@ -42,27 +42,26 @@ The `depth=1` tells git to only pull down one commit worth of historical data. We have two kinds of dependencies in this project: tools and Angular framework code. The tools help us manage and test the application. -* We get the tools we depend upon via `npm`, the [Node package manager][npm]. -* We get the Angular code via `bower`, a [client-side code package manager][bower]. +* We get the tools we depend upon and the Angular code via `npm`, the [Node package manager][npm]. * In order to run the end-to-end tests, you will also need to have the [Java Development Kit (JDK)][jdk] installed on your machine. Check out the section on [end-to-end testing](#e2e-testing) for more info. -We have preconfigured `npm` to automatically run `bower` so we can simply do: +We have preconfigured `npm` to automatically copy the downloaded Angular files to `app/lib` so we +can simply do: ``` npm install ``` -Behind the scenes this will also call `bower install`. After that, you should find out that you have -two new folders in your project. +Behind the scenes this will also call `npm run copy-libs`, which copies the AngularJS files and other +frontend dependencies. After that, you should find out that you have two new directories in your project. * `node_modules` - contains the npm packages for the tools we need -* `app/bower_components` - contains the Angular framework files +* `app/lib` - contains the Angular framework files and other frontend dependencies -*Note that the `bower_components` folder would normally be installed in the root folder but -`angular-seed` changes this location through the `.bowerrc` file. Putting it in the `app` folder -makes it easier to serve the files by a web server.* +*Note copying the Angular files from `node_modules` to `app/lib` makes it easier to serve the files +by a web server.* ### Run the Application @@ -190,17 +189,15 @@ If JDK is not already installed, you can download it [here][jdk-download]. ## Updating Angular -Since the Angular framework library code and tools are acquired through package managers (npm and -bower) you can use these tools to easily update the dependencies. Simply run the preconfigured -script: +Since the AngularJS framework library code and tools are acquired through package managers (e.g. +npm) you can use these tools to easily update the dependencies. Simply run the preconfigured script: ``` npm run update-deps ``` -This will call `npm update` and `bower update`, which in turn will find and install the latest -versions that match the version ranges specified in the `package.json` and `bower.json` files -respectively. +This will call `npm update` and `npm run copy-libs`, which in turn will find and install the latest +versions that match the version ranges specified in the `package.json` file. ## Loading Angular Asynchronously @@ -236,7 +233,7 @@ choose to install the tool globally: sudo npm install -g http-server ``` -Then you can start your own development web server to serve static files from a folder by running: +Then you can start your own development web server to serve static files from any folder by running: ``` http-server -a localhost -p 8000 @@ -279,7 +276,6 @@ For more information on AngularJS please check out [angularjs.org][angularjs]. [angularjs]: https://angularjs.org/ -[bower]: http://bower.io/ [git]: https://git-scm.com/ [http-server]: https://github.com/indexzero/http-server [jasmine]: https://jasmine.github.io/ diff --git a/app/index-async.html b/app/index-async.html index ee903b7dcc..72e202ea78 100644 --- a/app/index-async.html +++ b/app/index-async.html @@ -2,14 +2,14 @@ - - + + - + +