Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyuvn committed Feb 14, 2018
0 parents commit 93a8404
Show file tree
Hide file tree
Showing 41 changed files with 17,098 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
end_of_line = lf
charset = utf-8
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
node_modules/
dist/
coverage/
src/css
src/**/*.js
src/**/*.map
*.log
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# server-status

> A Vue.js project
## Build Setup

``` bash
# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# lint the Typescript
npm run lint

# run the tests
npm test

# run the tests on changes
npm run test:watch

# run the test suite and generate a coverage report
npm run coverage

# run the tests on Teamcity
npm run ci:teamcity

# run the tests on Jenkins
npm run ci:jenkins

# build for production with minification
npm run build

# clean the production build
npm run clean
```
10 changes: 10 additions & 0 deletions config/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require('path')

const ROOT = path.resolve(__dirname, '..')

function root (args) {
args = Array.prototype.slice.call(arguments, 0)
return path.join.apply(path, [ROOT].concat(args))
}

exports.root = root
58 changes: 58 additions & 0 deletions config/karma.coverage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
var parseArgs = require('minimist')
var webpackConfig = require('./webpack.config.coverage')

var args = parseArgs(process.argv.slice(2), {
string: ['env'],
default: {
'env': 'mocha'
}
})

var reporters = ['mocha', 'coverage']

if (args.env === 'tc') {
reporters = ['teamcity', 'coverage']
}

if (args.env === 'jk') {
reporters = ['junit', 'coverage']
}

module.exports = function (config) {
config.set({
basePath: '..',
frameworks: ['mocha', 'chai', 'sinon'],
files: [
'node_modules/es6-promise/dist/es6-promise.auto.js',
'src/test.ts'
],
reporters: reporters,
preprocessors: {
'src/test.ts': ['webpack']
},
webpack: webpackConfig,
webpackServer: {
noInfo: true
},
junitReporter: {
outputDir: 'reports/'
},
coverageReporter: {
reporters: [{
type: 'json',
dir: 'coverage/json',
subdir: '.'
}]
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['Chrome'],
mime: {
'text/x-typescript': ['ts']
},
singleRun: true,
concurrency: Infinity
})
}
42 changes: 42 additions & 0 deletions config/karma.debug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
var webpackConfig = require('./webpack.config.test')

module.exports = function (config) {
config.set({
basePath: '..',
frameworks: ['source-map-support', 'mocha', 'chai', 'sinon'],
files: [
'node_modules/es6-promise/dist/es6-promise.auto.js',
{
pattern: 'node_modules/es6-promise/dist/es6-promise.auto.map',
watched: false,
included: false,
served: true
},
'src/test.ts'
],
reporters: ['mocha'],
preprocessors: {
'src/test.ts': ['webpack']
},
webpack: webpackConfig,
webpackServer: {
noInfo: true
},
mime: {
'text/x-typescript': ['ts']
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome_with_debugging'],
customLaunchers: {
Chrome_with_debugging: {
base: 'Chrome',
flags: ['--remote-debugging-port=9222'],
debug: true
}
},
singleRun: false
})
}
27 changes: 27 additions & 0 deletions config/karma.unit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var webpackConfig = require('./webpack.config.test')

module.exports = function (config) {
config.set({
basePath: '..',
frameworks: ['mocha', 'chai', 'sinon'],
files: [
'node_modules/es6-promise/dist/es6-promise.auto.js',
'src/test.ts'
],
preprocessors: {
'src/test.ts': ['webpack']
},
webpack: webpackConfig,
webpackServer: { noInfo: true },
reporters: ['mocha'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['Chrome'],
mime: {
'text/x-typescript': ['ts']
},
singleRun: true
})
}
50 changes: 50 additions & 0 deletions config/webpack.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const helpers = require('./helpers')
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')

let config = {
entry: {
'main': helpers.root('/src/main.ts')
},
output: {
path: helpers.root('/dist'),
filename: 'js/[name].[hash].js',
chunkFilename: 'js/[name].[hash].js',
publicPath: '/'
},
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.js', '.html'],
alias: {
'vue$': 'vue/dist/vue.esm.js'
}
},
module: {
rules: [{
test: /\.ts$/,
exclude: /node_modules/,
enforce: 'pre',
loader: 'tslint-loader'
},
{
test: /\.ts$/,
exclude: /node_modules/,
loader: 'awesome-typescript-loader'
},
{
test: /\.html$/,
loader: 'raw-loader',
exclude: ['./src/index.html']
}
]
},
plugins: [
new NamedModulesPlugin(),
new CopyWebpackPlugin([{
from: 'src/assets',
to: './assets'
} ])
]
}

module.exports = config
18 changes: 18 additions & 0 deletions config/webpack.config.coverage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const webpackConfig = require('./webpack.config.test')

webpackConfig.module.rules = [...webpackConfig.module.rules,
{
test: /\.ts$/,
enforce: 'post',
loader: 'istanbul-instrumenter-loader',
exclude: [
'node_modules',
/\.spec\.ts$/
],
query: {
esModules: true
}
}
]

module.exports = webpackConfig
50 changes: 50 additions & 0 deletions config/webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const helpers = require('./helpers')
const webpackConfig = require('./webpack.config.base')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const DefinePlugin = require('webpack/lib/DefinePlugin')
const env = require('../environment/dev.env')

webpackConfig.module.rules = [...webpackConfig.module.rules,
{
test: /\.scss$/,
use: [{
loader: 'style-loader'
},
{
loader: 'css-loader'
},
{
loader: 'sass-loader'
}
]
},
{
test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader'
}
]

webpackConfig.plugins = [...webpackConfig.plugins,
new HtmlWebpackPlugin({
inject: true,
template: helpers.root('/src/index.html'),
favicon: helpers.root('/src/favicon.ico')
}),
new DefinePlugin({
'process.env': env
})
]

webpackConfig.devServer = {
port: 8080,
host: 'localhost',
historyApiFallback: true,
watchOptions: {
aggregateTimeout: 300,
poll: 1000
},
contentBase: './src',
open: true
}

module.exports = webpackConfig
Loading

0 comments on commit 93a8404

Please sign in to comment.