Skip to content

Commit

Permalink
Other files added
Browse files Browse the repository at this point in the history
  • Loading branch information
igogrek committed Apr 26, 2018
1 parent d3f85b7 commit 781fe24
Show file tree
Hide file tree
Showing 25 changed files with 9,528 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
}
}
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/build/
/config/
/dist/
/*.js
/test/unit/reports/
93 changes: 93 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// https://eslint.org/docs/user-guide/configuring

module.exports = {
root: true,
parserOptions: {
parser: 'typescript-eslint-parser'
},
env: {
browser: true,
},
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
extends: ['plugin:vue/recommended', 'airbnb-base'],
// required to lint *.vue files
plugins: [
'vue',
'typescript'
],
// check if imports actually resolve
settings: {
'import/resolver': {
webpack: {
config: 'build/webpack.base.conf.js'
}
}
},
// add your custom rules here
rules: {
// don't require .vue extension when importing
'import/extensions': ['error', 'always', {
js: 'never',
ts: 'never',
//vue: 'never'
}],
// disallow reassignment of function parameters
// disallow parameter object manipulation except for specific exclusions
'no-param-reassign': 'off',
// TODO investigate a.b = !a.b assignments
// 'no-param-reassign': ['error', {
// props: true,
// ignorePropertyModificationsFor: [
// 'state', // for vuex state
// 'acc', // for reduce accumulators
// 'e' // for e.returnvalue
// ]
// }],
// allow optionalDependencies
'import/no-extraneous-dependencies': ['error', {
optionalDependencies: ['test/unit/index.js']
}],
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'indent': ['error', 2],
'object-curly-spacing': ['error', 'never'],
'comma-dangle': ['error', 'never'],
'arrow-parens': ['error', 'as-needed'],
'max-len': ['error', { "code": 120 }],
// Broken
'space-infix-ops': 'off',
// TypeScript checks this via compiler options - see tsconfig
'no-undef': 'off',
'no-unused-vars': 'off',
// TODO fix after parser fixed https://github.com/eslint/typescript-eslint-parser#known-issues
'import/prefer-default-export': 'off',
// TODO enable later if really needed
'vue/require-v-for-key': 'off',

// Typescript Plugin
'typescript/adjacent-overload-signatures': ['error'],
'typescript/class-name-casing': ['error'],
'typescript/interface-name-prefix': ['error', 'always'],
'typescript/member-ordering': ['error'],
'typescript/no-angle-bracket-type-assertion': ['error'],
'typescript/no-array-constructor': ['error'],
'typescript/no-empty-interface': ['error'],
'typescript/no-explicit-any': ['error'],
'typescript/no-namespace': ['error'],
'typescript/no-triple-slash-reference': ['error'],
'typescript/type-annotation-spacing': ['error'],
},
overrides: [
{
files: ["*.vue"],
rules: {
'indent': 'off',
'vue/script-indent': [
'error',
2,
{'baseIndent': 1}
],
}
}
]
}
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.DS_Store
node_modules/
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/test/unit/reports/
/test/e2e/reports/
/test/e2e/reatures/undefined-steps.js
selenium-debug.log

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
10 changes: 10 additions & 0 deletions .postcssrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// https://github.com/michael-ciniawsky/postcss-load-config

module.exports = {
"plugins": {
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}
47 changes: 47 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
dist: trusty

services:
- postgresql

env:
# Use test credentials for sequelize
- NODE_ENV=test

sudo: required
before_install:
# Repo for Yarn
- sudo apt-key adv --fetch-keys http://dl.yarnpkg.com/debian/pubkey.gpg
- echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- sudo apt-get update -qq
- sudo apt-get install -y -qq yarn=1.5.1-1
addons:
chrome: stable

language: node_js
node_js:
- "9"

cache:
yarn: true
directories:
- ./node_modules


install:
- yarn install

script:
# Use Chromium instead of Chrome.
# - export CHROME_BIN=chromium-browser
# Run unit tests
- xvfb-run -a yarn run unit
# Run e2e tests
- xvfb-run -a yarn run e2e
# - sleep 3

after_script:
# Stop backend
- pkill node

notifications:
email: false
89 changes: 88 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,88 @@
# Cumulocity-Prototype
# vue-typescript-seed

> A Vue.js seed project with TypeScript, TS-Jest, Nightwatch and ESlint
It's highly recommended to use [Yarn](https://yarnpkg.com/en/) for this project

Unit tests are done with Jest.
e2e tests are based on Nightwatch and Cucumber.

## How to run
``` bash
# Install dependencies
yarn
OR
npm install

# Serve with hot reload at localhost:8080
yarn run dev

# Build for production with minification
yarn run build

# Run unit tests
yarn run unit
# Report will be located at: test/unit/reports/test-report.html
# Coverage report will be located at: test/unit/reports/coverage/index.html

# Run e2e tests with output to console
yarn run e2e

# Generate HTML report (after running e2e)
yarn run e2e-html-report
# Report will be located at: test/e2e/reports/html/cucumber_report.html

# Perform ESLint code check
yarn run lint
```

## Other commands
```
# build for production and view the bundle analyzer report
yarn run build --report
# Run unit tests in watch mode for development
yarn run unit-watch
# Perform ESLint code check + autofix all possible issues
yarn run lint --fix
```

## WebStorm / Intellij IDEA configuration

Enable ESlint plugin, Vue plugin and TypeScript integration.
All of these should work by default.

### Unit testing via Jest

1. Click Run in the main toolbar
2. Edit Configurations
3. On the top left of the Run/Debug Configurations dialog, click the + sign.
4. Choose Jest
5. Name the new configuration "Jest"
6. Under "Configuration file" enter `{YOUR_PATH}\test\unit\jest.conf.js` (be sure to change {YOUR_PATH})
7. Click Apply

You can now both run Unit tests and debug them inside the IDE.

### e2e testing via Nightwatch

1. Click Run in the main toolbar
2. Edit Configurations
3. On the top left of the Run/Debug Configurations dialog, click the + sign.
4. Choose Node.js
5. Name the new configuration "Nightwatch"
6. Under "JavaScript file" enter `node_modules\nightwatch\bin\runner.js`
7. Under "Application parameters" enter `--config test/e2e/nightwatch.conf.js --env chrome`
8. Click Apply

You can now both run e2e tests and debug them inside the IDE.

**Note that this is different from running via console** `yarn run e2e`
**which also starts the http server and checks if port is in use.**

**If your app is not served at default port (8080), change devServerURL in** `nightwatch.conf.js`

**For this to work you will need a running SPA in background, e.g. run** `yarn run dev` **and start e2e in IDE afterwards.**

For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
15 changes: 15 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" />
<link rel="stylesheet" href="https://unpkg.com/vue-material@beta/dist/vue-material.min.css">

<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Vue Seed</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
4 changes: 4 additions & 0 deletions jesthtmlreporter.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"outputPath": "./test/unit/reports/test-report.html",
"includeFailureMsg": true
}
Loading

0 comments on commit 781fe24

Please sign in to comment.