Skip to content

Commit

Permalink
feat(package): upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
zack9433 committed Jan 25, 2018
1 parent 093ad12 commit 540b59f
Show file tree
Hide file tree
Showing 18 changed files with 9,396 additions and 293 deletions.
28 changes: 25 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
{
"presets": ["es2015"],
"plugins": ["lodash"],
"presets": [
[
"env",
{
"modules": false,
"targets": {
"browsers": ["last 2 versions"]
}
}
]
],
"plugins": [
[
"angularjs-annotate",
{
"explicitOnly": true
}
]
],
"env": {
"test": {
"plugins": [
["__coverage__", {"ignore": "*.+(test|spec).*"}]
[
"__coverage__",
{
"ignore": "*.+(test|spec).*"
}
]
]
}
}
Expand Down
51 changes: 22 additions & 29 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"parser": "babel-eslint",
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"extends": [
"kentcdodds/possible-errors",
"kentcdodds/es6/possible-errors",
"kentcdodds/es6/stylistic",
"kentcdodds/best-practices",
"prettier"
],
"plugins": ["prettier"],
"env": {
"es6": true,
"browser": true,
Expand All @@ -16,33 +18,24 @@
"angular": true,
"sinon": true,
"expect": true,
"__BASE_PATH__": true
"Offline": true,
"__BASE_PATH__": true,
"__API_TOKEN__": true,
"__VERSION__": true
},
"rules": {
"no-unexpected-multiline": "off",
"indent": [
"prettier/prettier": [
"error",
2,
{
"SwitchCase": 1
}
],
"quotes": [
2,
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
"printWidth": 120,
"singleQuote": true,
"trailingComma": "none"
}
],
"linebreak-style": [
2,
"unix"
],
"semi": [
2,
"always"
],
"no-console": 0
"no-console": "off",
"complexity": "off",
"no-return-assign": "off",
"babel/object-curly-spacing": "off",
"babel/semi": "off"
}
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ npm-debug.log
demo
coverage/
.opt-in
dist/
52 changes: 28 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
sudo: required
dist: trusty
language: node_js
node_js:
- "8"
addons:
chrome: stable
cache:
yarn: true
directories:
- ~/.yarn
- node_modules
notifications:
email: false
node_js:
- '6'
branches:
only:
- master
env:
global:
- YARN_VERSION=1.3.2

before_install:
- npm i -g npm@^3.0.0
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sudo apt-get update
- sudo apt-get install -y libappindicator1 fonts-liberation
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome*.deb
before_script:
- npm prune
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
- yarn global add greenkeeper-lockfile@1
- |
if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
fi
before_script: greenkeeper-lockfile-update
after_script: greenkeeper-lockfile-upload
script:
- npm run test:once
- npm run check-coverage
- npm run build
after_success:
- npm run report-coverage
- npm run semantic-release
- yarn test:once
- yarn check-coverage
after_success:
- yarn report-coverage
- yarn travis-deploy-once "yarn semantic-release"
branches:
except:
- /^v\d+\.\d+\.\d+$/

32 changes: 6 additions & 26 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const webpackConfig = require('./webpack.test');
const test = process.env.NODE_ENV === 'test';
const IS_TRAVIS = process.env.TRAVIconst

module.exports = function(config) {
config.set({
Expand All @@ -14,13 +13,6 @@ module.exports = function(config) {
'karma-spec-reporter'
],

customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},

autoWatch: test,

webpack: webpackConfig,
Expand All @@ -37,54 +29,42 @@ module.exports = function(config) {
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai', 'chai-as-promised', 'sinon-chai'],


// list of files / patterns to load in the browser
files: [
'node_modules/jquery/dist/jquery.js',
'src/app.test.js'
],

files: ['node_modules/jquery/dist/jquery.js', 'src/app.test.js'],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
// run the bundle through the webpack and sourcemap plugins
preprocessors: {
'src/app.test.js': [ 'webpack', 'sourcemap' ]
'src/app.test.js': ['webpack', 'sourcemap']
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['spec', 'coverage'],


coverageReporter: {
reporters: [
{type: 'lcov', dir: 'coverage/', subdir: '.'},
{type: 'json', dir: 'coverage/', subdir: '.'},
{type: 'text-summary'}
{ type: 'lcov', dir: 'coverage/', subdir: '.' },
{ type: 'json', dir: 'coverage/', subdir: '.' },
{ type: 'text-summary' }
]
},


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [(IS_TRAVIS) ? 'Chrome_travis_ci' : 'Chrome'],

browsers: ['ChromeHeadless'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
Expand Down
49 changes: 25 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,45 @@
"name": "sanji-rest-ui",
"author": "Zack Yang <[email protected]> (https://github.com/zack9433)",
"description": "sanji-rest-ui UI",
"version": "0.0.0-semantic-released",
"version": "0.0.0-development",
"main": "dist/sanji-rest-ui.js",
"config": {
"ghooks": {
"pre-commit": "opt --in pre-commit --exec 'npm run validate'"
"pre-commit": "opt --in pre-commit --exec 'yarn validate'"
},
"commitizen": {
"path": "node_modules/cz-conventional-changelog"
}
},
"scripts": {
"validate": "npm run test:once && npm run check-coverage",
"validate": "yarn test:once && yarn check-coverage",
"test": "cross-env NODE_ENV=test BABEL_ENV=test karma start",
"test:once": "cross-env BABEL_ENV=test karma start",
"prebuild": "rimraf dist && mkdir dist",
"build": "cross-env NODE_ENV=production webpack --config webpack.build.js --display-modules",
"build": "cross-env NODE_ENV=production webpack --config webpack.build.js",
"commit": "git-cz",
"check-coverage": "istanbul check-coverage --statements 60 --branches 40 --functions 70 --lines 70",
"report-coverage": "cat ./coverage/lcov.info | codecov",
"start": "cross-env NODE_ENV=development node server/dev-server.js",
"postpublish": "publish-latest",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
"prepublishOnly": "yarn build",
"travis-deploy-once": "travis-deploy-once",
"semantic-release": "semantic-release"
},
"devDependencies": {
"angular-animate": "~1.5.0",
"angular-aria": "~1.5.0",
"angular-material": "~1.1.0",
"angular-material-icons": "~0.7.0",
"angular-mocks": "~1.5.0",
"angular-sanji-window": "~2.1.12",
"angular": "~1.6.8",
"ng-file-upload": "^12.2.13",
"angular-animate": "~1.6.8",
"angular-aria": "~1.6.8",
"angular-material": "~1.1.6",
"angular-material-icons": "~0.7.1",
"angular-mocks": "~1.6.8",
"angular-sanji-window": "~2.2.0",
"codecov.io": "^0.1.6",
"publish-latest": "~1.1.2",
"sanji-common-devs-ui": "~1.0.4",
"semantic-release": "^6.3.2",
"svg-morpheus": "alexk111/SVG-Morpheus#v0.1.8",
"toastr": "~2.1.2"
"sanji-common-devs-ui": "^7.0.0",
"svg-morpheus": "^0.3.0",
"toastr": "~2.1.4",
"travis-deploy-once": "^4.3.3",
"semantic-release": "^12.2.4"
},
"repository": {
"type": "git",
Expand All @@ -46,13 +49,11 @@
"bugs": {
"url": "https://github.com/Sanji-IO/sanji-rest-ui/issues"
},
"keywords": [
"sanji"
],
"keywords": ["sanji"],
"license": "MIT",
"homepage": "https://github.com/Sanji-IO/sanji-rest-ui",
"dependencies": {
"angular": "~1.5.0",
"ng-file-upload": "~12.2.0"
"peerDependencies": {
"angular": ">=1.4 <1.7",
"ng-file-upload": "^12.2.13"
}
}
}
3 changes: 3 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
plugins: [require('autoprefixer')({ browsers: 'last 2 versions' })]
};
17 changes: 9 additions & 8 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import 'angular-sanji-window.css';
import './app.scss';
import angular from 'angular';
import sjWindow from 'angular-sanji-window';
import {sjRest} from './component';
import { sjRest } from './component';

class EthernetController {
constructor(...injects) {
EthernetController.$inject.forEach((item, index) => this[item] = injects[index]);
this.rest.get('/network/ethernets/1', {
params: {
hello: 'world'
}
})
EthernetController.$inject.forEach((item, index) => (this[item] = injects[index]));
this.rest
.get('/network/ethernets/1', {
params: {
hello: 'world'
}
})
.then(res => {
this.ethernet = {
ip: res.data.ip,
Expand All @@ -27,7 +28,7 @@ EthernetController.$inject = ['rest'];

const app = angular.module('webapp', [sjRest, sjWindow]);
app.config(restProvider => {
restProvider.configure({basePath: 'http://private-d8e84-sanjigeneric.apiary-mock.com'});
restProvider.configure({ basePath: 'http://private-d8e84-sanjigeneric.apiary-mock.com' });
});
app.controller('EthernetController', EthernetController);

Expand Down
2 changes: 1 addition & 1 deletion src/component/http.service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const $inject = ['$http'];
class HttpService {
constructor(...injects) {
HttpService.$inject.forEach((item, index) => this[item] = injects[index]);
HttpService.$inject.forEach((item, index) => (this[item] = injects[index]));
}

get(httpArgs) {
Expand Down
2 changes: 1 addition & 1 deletion src/component/http.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import angular from 'angular';
import 'angular-mocks';

import HttpService from './http.service' ;
import HttpService from './http.service';

let $http;
let httpService;
Expand Down
Loading

0 comments on commit 540b59f

Please sign in to comment.