angular-starter-kit
Advanced tools
Comparing version 1.2.0 to 1.3.1
# Angular Starter Kit Changelog | ||
## 1.3.1 - 2016.07.10 | ||
* end-to-end tests introduced with Protractor | ||
* demo e2e scenario | ||
* Travis task updated | ||
* Gulp tasks improved and refactored | ||
* karma-coverage and Istanbul introduced | ||
* documentation updated | ||
## 1.2.1 - 2016.07.09 | ||
@@ -4,0 +13,0 @@ |
@@ -35,4 +35,19 @@ /** | ||
gulp.task('start:server', function() { | ||
// delete build folder | ||
gulp.task('clean', function(done) { | ||
del([ | ||
config.tmp, | ||
config.dist | ||
], { | ||
dot: true | ||
}).then(function(paths) { | ||
console.log('Files and folders that would be deleted:\n', paths.join('\n')); | ||
done(); | ||
}); | ||
}); | ||
gulp.task('server:dev', function() { | ||
browserSync.init({ | ||
port: 8000, | ||
open: false, | ||
server: { | ||
@@ -53,4 +68,6 @@ baseDir: [config.src, config.tmp], | ||
gulp.task('build:serve', function() { | ||
gulp.task('server:dist', function() { | ||
browserSync.init({ | ||
port: 8000, | ||
open: false, | ||
server: { | ||
@@ -96,12 +113,2 @@ baseDir: config.dist, | ||
// delete build folder | ||
gulp.task('clean', function() { | ||
del([ | ||
config.tmp, | ||
config.dist | ||
], { | ||
dot: true | ||
}); | ||
}); | ||
// SASS task, will run when any SCSS files change & BrowserSync | ||
@@ -232,15 +239,21 @@ // will auto-update browsers | ||
/** | ||
* watch for file changes | ||
*/ | ||
gulp.task('watch', function() { | ||
gulp.watch('src/**/*.html').on('change', browserSync.reload); | ||
gulp.watch('src/app/**/*.js').on('change', browserSync.reload); | ||
gulp.watch('src/sass/**/*.scss', ['sass']); | ||
}); | ||
/** | ||
* This task will build your source project in a browser & then use Gulp to watch files. | ||
* When a file is changed, The browser page is automatically refreshed. | ||
*/ | ||
gulp.task('serve', ['clean'], function() { | ||
gulp.task('serve', function() { | ||
runSequence( | ||
'start:server', | ||
'clean', | ||
'sass', | ||
'wiredep', | ||
function() { | ||
gulp.watch('src/**/*.html').on('change', browserSync.reload); | ||
gulp.watch('src/app/**/*.js').on('change', browserSync.reload); | ||
gulp.watch('src/sass/**/*.scss', ['sass']); | ||
} | ||
'server:dev', | ||
'watch' | ||
); | ||
@@ -250,2 +263,13 @@ }); | ||
/** | ||
* This task will build your source project in a browser & then use Gulp to watch files. | ||
* When a file is changed, The browser page is automatically refreshed. | ||
*/ | ||
gulp.task('serve:dist', function() { | ||
runSequence( | ||
'build', | ||
'server:dist' | ||
); | ||
}); | ||
/** | ||
* Build a production version | ||
@@ -256,4 +280,5 @@ * | ||
*/ | ||
gulp.task('build', ['clean'], function(cb) { | ||
gulp.task('build', function(cb) { | ||
runSequence( | ||
'clean', | ||
['images', 'templates', 'copy:scripts', 'copy:root'], | ||
@@ -267,4 +292,2 @@ ['sass:build', 'fonts'], | ||
gulp.task('default', ['build']); | ||
/** | ||
@@ -279,1 +302,3 @@ * Run tests once and exit | ||
}); | ||
gulp.task('default', ['build']); |
@@ -32,3 +32,2 @@ /** | ||
'bower_components/angular-mocks/angular-mocks.js', | ||
'src/app/app.js', | ||
'src/app/**/*.js', | ||
@@ -45,3 +44,4 @@ 'src/app/**/*.html' | ||
preprocessors: { | ||
'src/app/**/*.html': ['ng-html2js'] | ||
'src/app/**/*.html': 'ng-html2js', | ||
'src/**/*.js': 'coverage' | ||
}, | ||
@@ -58,3 +58,5 @@ | ||
'karma-jasmine', | ||
'karma-ng-html2js-preprocessor' | ||
'karma-ng-html2js-preprocessor', | ||
'karma-junit-reporter', | ||
'karma-coverage' | ||
], | ||
@@ -65,4 +67,21 @@ | ||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter | ||
reporters: ['progress'], | ||
reporters: [ | ||
'progress', | ||
'junit', | ||
'coverage' | ||
], | ||
// Istanbul code coverage | ||
coverageReporter: { | ||
type: 'html', | ||
dir: 'coverage/' | ||
}, | ||
// junit configuration | ||
junitReporter: { | ||
outputDir: 'test_out', | ||
outputFile: 'unit.xml', | ||
suite: 'unit' | ||
}, | ||
// web server port | ||
@@ -69,0 +88,0 @@ port: 9876, |
{ | ||
"name": "angular-starter-kit", | ||
"description": "Starter Kit for Angular 1.5+ projects", | ||
"version": "1.2.0", | ||
"version": "1.3.1", | ||
"author": "Andrea SonnY <andreasonny83@gmail.com>", | ||
@@ -32,5 +32,9 @@ "repository": { | ||
"gulp-usemin": "^0.3.23", | ||
"http-server": "^0.9.0", | ||
"istanbul": "^0.4.4", | ||
"jasmine-core": "^2.4.1", | ||
"karma": "^1.1.1", | ||
"karma-coverage": "^1.1.0", | ||
"karma-jasmine": "^1.0.2", | ||
"karma-junit-reporter": "^1.1.0", | ||
"karma-ng-html2js-preprocessor": "^1.0.0", | ||
@@ -40,2 +44,3 @@ "karma-phantomjs-launcher": "^1.0.1", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
"protractor": "^3.3.0", | ||
"run-sequence": "^1.2.2", | ||
@@ -48,8 +53,18 @@ "wiredep": "^4.0.0" | ||
"scripts": { | ||
"postinstall": "bower install", | ||
"start": "gulp serve", | ||
"test": "karma start karma.conf.js", | ||
"test-single-run": "karma start karma.conf.js --single-run", | ||
"update-webdriver": "webdriver-manager update", | ||
"prestartserver": "npm run update-webdriver && npm run build", | ||
"startserver": "http-server -a localhost -p 8000 -c-1 ./dist > /dev/null &", | ||
"preprotractor": "npm run update-webdriver", | ||
"protractor": "protractor protractor.conf.js", | ||
"build": "gulp build", | ||
"test": "gulp test" | ||
"serve:dist": "gulp serve:dist" | ||
}, | ||
"eslintConfig": { | ||
"extends": "google", | ||
"extends": [ | ||
"google" | ||
], | ||
"globals": { | ||
@@ -61,5 +76,6 @@ "angular": true, | ||
"browser": true, | ||
"jasmine": true | ||
"jasmine": true, | ||
"protractor": true | ||
} | ||
} | ||
} |
124
README.md
@@ -1,5 +0,9 @@ | ||
[![Build Status](https://travis-ci.org/andreasonny83/angular-starter-kit.svg?branch=master)](https://travis-ci.org/andreasonny83/angular-starter-kit) | ||
# Angular Starter Kit | ||
[![Join the chat at https://gitter.im/andreasonny83/angular-starter-kit][gitter-badge]](https://gitter.im/andreasonny83/angular-starter-kit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![NPM version][npm-badge]](https://www.npmjs.com/package/angular-starter-kit) | ||
[![Build Status][travis-badge]](https://travis-ci.org/andreasonny83/angular-starter-kit) | ||
[![devDependency Status][dependencies-badge]](https://david-dm.org/andreasonny83/angular-starter-kit#info=devDependencies) | ||
[![npm][license-badge]](https://andreasonny.mit-license.org/@2016/) | ||
> A better way to start your new Angular app | ||
@@ -15,5 +19,18 @@ | ||
* Minified CSS and JS build files | ||
* Unit tests | ||
* E2E tests covered by Protractor | ||
* Istanbul code coverage | ||
## Download | ||
## Prerequisites | ||
We assume you've already installed [NodeJS][nodejs], [Gulp][gulp] and | ||
[Bower][bower] on your machine, if not, | ||
please follow the installation documentation from the official websites. | ||
## Installation | ||
The easiest way to start your Angular project using Angular Starter Kit is | ||
[Downloading the latest release][latest_release] of this project or simply | ||
cloning this repository with: | ||
```sh | ||
@@ -23,23 +40,33 @@ git clone https://github.com/andreasonny83/angular-starter-kit.git | ||
## Setup | ||
### Setup | ||
Install all `npm` and `bower` dependencies with: | ||
Once done with the previous step, open your terminal to your angular-starter-kit | ||
folder, then install all the dependencies with: | ||
```sh | ||
npm install && bower install | ||
npm install | ||
``` | ||
## Watch files | ||
This will create both a `node_modules` and `bower_components` folder inside | ||
your local directory | ||
All SCSS/HTML will be watched for changes and injected into browser thanks | ||
to BrowserSync | ||
## Run the Application | ||
There is already a preconfigured web server for this application. | ||
The simplest way to start this server is: | ||
```sh | ||
gulp | ||
npm start | ||
``` | ||
## Build production version | ||
Now browse to the app url available at | ||
[http://localhost:8000](http://localhost:8000) to see your application running. | ||
This task will also watch for any file change to your project's files and | ||
update the browser with the new changes using BrowserSync and Gulp. | ||
## Build a production version | ||
```sh | ||
gulp build | ||
npm run build | ||
``` | ||
@@ -49,4 +76,4 @@ | ||
* clean `dist` folder | ||
* compile SASS files, minify and uncss compiled css | ||
* clean the `.tmp` and `dist` folder | ||
* compile SASS files, minify and uncss the compiled css | ||
* copy and optimize images | ||
@@ -56,18 +83,65 @@ * minify and copy all HTML files into $templateCache | ||
* minify and copy all JS files | ||
* copy fonts | ||
* copy fonts, if any | ||
## Start webserver without watch task | ||
## Serve the distribution folder | ||
```bash | ||
gulp server | ||
npm run serve:dist | ||
``` | ||
## Serve the distribution folder | ||
This will compile your project in distribution mode and will trigger a | ||
web server to listen to your generated `dist` folder. | ||
Open a browser and navigating to [http://localhost:8000](http://localhost:8000) | ||
to see the rendered application. | ||
## Unit tests | ||
```bash | ||
gulp server:build | ||
npm test | ||
``` | ||
This will run all the unit tests present in your project folder using Karma. | ||
The task will remain idle in your terminal waiting for file changes to | ||
run the tests again. This task is really useful during the development mode | ||
in order to avoid running manually your tests every time. | ||
However, if you want just to run the test once and build a report displaying the | ||
unit test coverage, use the following task: | ||
```bash | ||
npm run test-single-run | ||
``` | ||
Either way, all the reports will be stored inside a generated `test_out` folder | ||
and a `coverage` for the unit test coverage using [Istanbul][istanbul-url] | ||
## End to end testing | ||
The Angular Starter Kit app comes with end-to-end tests written in Jasmine. | ||
These tests are run with the [Protractor][protractor-url] | ||
End-to-End test runner. | ||
Your web server needs to be serving up the application, | ||
so that Protractor can interact with it. | ||
In order to start running your end-to-end tests, | ||
first start your web server with: | ||
```bash | ||
npm start | ||
``` | ||
Now you can run the end-to-end tests, from another terminal instance, | ||
using the supplied `npm` script: | ||
```bash | ||
npm run protractor | ||
``` | ||
## Contributing | ||
We really appreciate your collaborations and feedbacks! | ||
1. Fork it! | ||
@@ -84,1 +158,13 @@ 2. Create your feature branch: `git checkout -b my-new-feature` | ||
[angular_logo]: https://angularjs.org/img/AngularJS-large.png | ||
[gitter-badge]: https://badges.gitter.im/andreasonny83/angular-starter-kit.svg | ||
[npm-badge]: https://badge.fury.io/js/generator-mdl.svg | ||
[travis-badge]: https://travis-ci.org/andreasonny83/angular-starter-kit.svg?branch=master | ||
[dependencies-badge]: https://david-dm.org/andreasonny83/angular-starter-kit/dev-status.svg | ||
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg | ||
[latest_release]: https://github.com/andreasonny83/angular-starter-kit/releases/latest | ||
[nodejs]: https://nodejs.org/ | ||
[gulp]: https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md | ||
[bower]: https://bower.io/#install-bower | ||
[istanbul-url]: https://github.com/gotwarlost/istanbul | ||
[protractor-url]:http://www.protractortest.org | ||
[changelog]: https://github.com/andreasonny83/angular-starter-kit/blob/master/CHANGELOG.md |
@@ -55,4 +55,4 @@ /** | ||
function run() { | ||
console.log('App ready!'); | ||
// console.log('App ready!'); | ||
} | ||
})(); |
@@ -23,5 +23,4 @@ /** | ||
$mdToast.show( | ||
$mdToast.simple().textContent( | ||
'Welcome to Angular Starter Kit!' | ||
)); | ||
$mdToast.simple() | ||
.textContent('Welcome to Angular Starter Kit!')); | ||
@@ -43,5 +42,5 @@ this._init(); | ||
vm.toast.show( | ||
vm.toast.simple().textContent( | ||
'You must fill all the required information first.' | ||
)); | ||
vm.toast.simple() | ||
.textContent('You must fill all the required information first.') | ||
.hideDelay(0)); | ||
@@ -48,0 +47,0 @@ return; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
73293
43
713
166
31
1