Wednesday, May 17, 2017

Installing and configuring Bower




Install:
Use command line or terminal to install these packages:
$ npm install -g bower
$ npm install -g bower-art-resolver

Configure Bower

  • Go to your development root directory e.g. c:\code
  • Create new file named, .bowerrc
  • Add below content to the file
{
  "registry": {
    "search": [
      "http://bams-sami-api.int.thomsonreuters.com/artifactory/api/bower/default.bower.global",
      "https://bower.herokuapp.com"
    ]
  },
  "resolvers": [
    "bower-art-resolver"
  ],
  "proxy": "http://webproxy.int.westgroup.com:80/",
  "https-proxy": "http://webproxy.int.westgroup.com:80/",
  "strict-ssl": false
}
Note: The proxy and https-proxy are optional parameters.

Proxy

Depending on your proxy setting, you may have problems connecting to BAMS e.g. if you have HTTP_PROXY and HTTPS_PROXY.
You can pass a comma separated hostnames to NO_PROXY environment variable for which the proxy settings will be ignored e.g. the BAMS hostname and specific emea BAMS url: bams-sami-api.int.thomsonreuters.com,bams-emea-sami-api.int.thomsonreuters.com.

Install Elements

With .bowerrc in place, you can now install any elements by simply running bower install element-name:
example : $ bower install dependency_libraries
install jquery using bower :
$ bower install jquery
install typeScript using bower :
bower install DefinitelyTyped
install Inversify JS using bower :bower install inversify#v1.0.0
Default Installation by npm can be done,
  • check if there is package.json in your project
  • add all dependencies in package.json then save package.json in root folder of the project (as direct child)
  • below is sample code for package.json
{
"name": "Ownership",
"version": "12.1.0",
"private": true,
"config": {
"save-exact": true
},
"dependencies": {
"lodash": "3.10.1",
"request": "2.72.0",
"xmldom": "0.1.19"
},
"devDependencies": {
"autoprefixer-loader": "3.1.0",
"babel-core": "6.10.4",
"babel-eslint": "6.1.0",
"babel-loader": "6.2.4",
"babel-plugin-check-es2015-constants": "6.8.0",
"babel-plugin-transform-class-properties": "6.10.2",
"babel-plugin-transform-es2015-arrow-functions": "6.8.0",
"babel-plugin-transform-es2015-block-scoping": "6.10.1",
"babel-plugin-transform-es2015-classes": "6.9.0",
"babel-plugin-transform-es2015-computed-properties": "6.8.0",
"babel-plugin-transform-es2015-destructuring": "6.9.0",
"babel-plugin-transform-es2015-object-super": "6.8.0",
"babel-plugin-transform-es2015-parameters": "6.9.0",
"babel-plugin-transform-es2015-shorthand-properties": "6.8.0",
"babel-plugin-transform-es2015-spread": "6.8.0",
"babel-plugin-transform-es2015-template-literals": "6.8.0",
"babel-plugin-transform-exponentiation-operator": "6.8.0",
"babel-plugin-transform-function-bind": "6.8.0",
"babel-plugin-transform-object-rest-spread": "6.8.0",
"babel-plugin-transform-regenerator": "6.9.0",
"babel-polyfill": "6.9.1",
"connect-livereload": "0.4.0",
"css-loader": "0.19.0",
"eslint": "3.9.1",
"eslint-loader": "1.4.0",
"exports-loader": "0.6.3",
"expose-loader": "0.7.0",
"express": "4.10.2",
"extract-text-webpack-plugin": "0.8.2",
"file-loader": "0.8.4",
"grunt": "0.4.5",
"grunt-bump": "0.3.0",
"grunt-connect-proxy": "0.1.10",
"grunt-contrib-clean": "0.6.0",
"grunt-contrib-connect": "0.7.1",
"grunt-contrib-copy": "0.5.0",
"grunt-contrib-less": "1.4.0",
"grunt-exec": "0.4.5",
"grunt-githooks": "0.5.0",
"grunt-karma": "0.12.1",
"grunt-prompt": "1.3.0",
"grunt-webpack": "1.0.11",
"html-loader": "0.3.0",
"html-webpack-plugin": "1.6.2",
"istanbul-instrumenter-loader": "0.2.0",
"jasmine-core": "2.2.0",
"json-dup-key-validator-loader": "^1.0.0",
"json-loader": "0.5.3",
"karma": "0.13.22",
"karma-coverage": "1.1.0",
"karma-jasmine": "0.3.6",
"karma-phantomjs-launcher": "0.2.1",
"karma-sourcemap-loader": "0.3.6",
"karma-spec-reporter": "0.0.20",
"karma-webpack": "1.7.0",
"less": "2.5.3",
"less-loader": "2.2.1",
"load-grunt-tasks": "0.6.0",
"ng-annotate-loader": "0.0.10",
"ngtemplate-loader": "1.3.1",
"null-loader": "0.1.1",
"phantomjs": "1.9.18",
"semver": "4.3.6",
"style-loader": "0.12.4",
"time-grunt": "0.4.0",
"url-loader": "0.5.6",
"webpack": "1.12.2",
"webpack-dev-server": "1.12.0"
},
"scripts": {
"start": "grunt serve",
"postinstall": "grunt githooks"
}
}
run all below commands in npm (make sure you are in the project folder directory)
  • npm install -g bower-art-resolver
  • npm i
  • In order to run an application one should first build it and then publish this build into Eikon App Engine. Development build, which results in non-minified files with sourcemaps in /__dist/
Production build, results in minified files in /__dist/ npm run prod
Testing Tests are implemented very roughly and are subject to some further development. As for now unit testing is supported by running npm test You can also debug tests by running them in Chrome: karma start karma.conf.js --browsers=Chrome --single-run=false In initial version there's a single unit test for Jet Quote Service.