Skip to content

Commit 7494258

Browse files
committed
* initial commit
1 parent fe2ca73 commit 7494258

69 files changed

Lines changed: 1825 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.babelrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"presets": [
3+
["env", { "modules": false }],
4+
"stage-2"
5+
],
6+
"plugins": ["transform-runtime"],
7+
"comments": false,
8+
"env": {
9+
"test": {
10+
"presets": ["env", "stage-2"],
11+
"plugins": [ "istanbul" ]
12+
}
13+
}
14+
}

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/*.js
2+
config/*.js

.eslintrc.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// http://eslint.org/docs/user-guide/configuring
2+
3+
module.exports = {
4+
root: true,
5+
parser: 'babel-eslint',
6+
parserOptions: {
7+
sourceType: 'module'
8+
},
9+
env: {
10+
browser: true,
11+
},
12+
extends: 'airbnb-base',
13+
// required to lint *.vue files
14+
plugins: [
15+
'html'
16+
],
17+
// check if imports actually resolve
18+
'settings': {
19+
'import/resolver': {
20+
'webpack': {
21+
'config': 'build/webpack.base.conf.js'
22+
}
23+
}
24+
},
25+
// add your custom rules here
26+
'rules': {
27+
// don't require .vue extension when importing
28+
'import/extensions': ['error', 'always', {
29+
'js': 'never',
30+
'vue': 'never'
31+
}],
32+
// allow optionalDependencies
33+
'import/no-extraneous-dependencies': ['error', {
34+
'optionalDependencies': ['test/unit/index.js']
35+
}],
36+
// allow debugger during development
37+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
38+
// allow console.log https://stackoverflow.com/a/43303350/1843755
39+
'no-console': 0,
40+
// disable warning when assignment to property of function parameter
41+
'no-param-reassign': 0
42+
}
43+
}

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.DS_Store
2+
node_modules/
3+
dist/
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
test/unit/coverage
8+
test/e2e/reports
9+
selenium-debug.log

.postcssrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// https://github.com/michael-ciniawsky/postcss-load-config
2+
3+
module.exports = {
4+
"plugins": {
5+
// to edit target browsers: use "browserlist" field in package.json
6+
"autoprefixer": {}
7+
}
8+
}

README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Onsen UI + Vue + Vue Router PWA Starter Project Template
2+
3+
## Information
4+
Please read carefully before use this project starter template
5+
6+
1. This project is based on [onsenui-vue-pwa webpack template](https://github.com/OnsenUI/vue-pwa-webpack)
7+
2. Since I dont need PWA at the moment, so I remove all the script related to PWA in `index.html`. If you want to use PWA, just rename `index-serviceworker.html` to `index.html`
8+
3. Since I need to access the page via URL in the browser, so instead of using Onsen ui `<v-ons-navigator>` system, I use [vue-router](https://router.vuejs.org/en/) to meet my requirement.
9+
4. I separate `html` and `scss` in `*.vue` for my convenience, following [Ionic2 project structure](https://www.joshmorony.com/ionic-2-first-look-series-your-first-ionic-2-app-explained/). However if you prefer the vue way, you can switch to [vue project structure](https://github.com/vuejs-templates/webpack/tree/master/template/src).
10+
5. Use `eslint-airbnb`, thus every line of code should follow [airbnb javascript style guide](http://airbnb.io/javascript/)
11+
6. Additional rules was added to eslintrc.js as follows :
12+
- `'no-console': 0`, // allow console.log
13+
- `'no-param-reassign': 0` // disable warning when assignment to property of function parameter
14+
15+
-------------------------------
16+
17+
## Dependencies
18+
- onsenui
19+
- vue
20+
- vue-onsenui
21+
- vue-router
22+
- vuex
23+
24+
-------------------------------
25+
26+
## Build Setup
27+
28+
``` bash
29+
# install dependencies
30+
npm install
31+
32+
# serve with hot reload at localhost:8080
33+
npm run dev
34+
35+
# build for production with minification
36+
npm run build
37+
38+
# build for production and view the bundle analyzer report
39+
npm run build --report
40+
41+
# run unit tests
42+
npm run unit
43+
44+
# run e2e tests
45+
npm run e2e
46+
47+
# run all tests
48+
npm test
49+
```
50+
51+
For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
52+
53+
-------------------------------
54+
55+
## Reference :
56+
- Separate HTML and SCSS file. [link](https://github.com/vuejs/vueify/issues/35)
57+
- Enable scss working in vue [link](https://github.com/vuejs/vue-loader/issues/363)
58+
- Vue routing using hash setup. [link](http://router.vuejs.org/en/essentials/getting-started.html)
59+
- Getting started with vuex. [link](http://vuex.vuejs.org/en/getting-started.html)
60+
- Delete service worker. [link](https://stackoverflow.com/a/34791693/1843755)
61+
62+
-------------------------------
63+
## Screenshots :
64+
65+
### Android
66+
67+
Home Page
68+
<br/>
69+
<kbd>
70+
<img src="screenshots/android.png" width="250px" />
71+
</kbd>
72+
<br/>
73+
Profile Page
74+
<br/>
75+
<kbd>
76+
<img src="screenshots/android-profile.png" width="250px" />
77+
</kbd>
78+
79+
### iPhone
80+
Home Page
81+
<br/>
82+
<kbd>
83+
<img src="screenshots/iphone.png" width="250px" />
84+
</kbd>
85+
<br/>
86+
Profile Page
87+
<br/>
88+
<kbd>
89+
<img src="screenshots/iphone-profile.png" width="250px" />
90+
</kbd>
91+

build/build.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
require('./check-versions')()
2+
3+
process.env.NODE_ENV = 'production'
4+
5+
var ora = require('ora')
6+
var rm = require('rimraf')
7+
var path = require('path')
8+
var chalk = require('chalk')
9+
var webpack = require('webpack')
10+
var config = require('../config')
11+
var webpackConfig = require('./webpack.prod.conf')
12+
13+
var spinner = ora('building for production...')
14+
spinner.start()
15+
16+
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
17+
if (err) throw err
18+
webpack(webpackConfig, function (err, stats) {
19+
spinner.stop()
20+
if (err) throw err
21+
process.stdout.write(stats.toString({
22+
colors: true,
23+
modules: false,
24+
children: false,
25+
chunks: false,
26+
chunkModules: false
27+
}) + '\n\n')
28+
29+
console.log(chalk.cyan(' Build complete.\n'))
30+
console.log(chalk.yellow(
31+
' Tip: built files are meant to be served over an HTTP server.\n' +
32+
' Opening index.html over file:// won\'t work.\n'
33+
))
34+
})
35+
})

build/check-versions.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
var chalk = require('chalk')
2+
var semver = require('semver')
3+
var packageConfig = require('../package.json')
4+
var shell = require('shelljs')
5+
function exec (cmd) {
6+
return require('child_process').execSync(cmd).toString().trim()
7+
}
8+
9+
var versionRequirements = [
10+
{
11+
name: 'node',
12+
currentVersion: semver.clean(process.version),
13+
versionRequirement: packageConfig.engines.node
14+
},
15+
]
16+
17+
if (shell.which('npm')) {
18+
versionRequirements.push({
19+
name: 'npm',
20+
currentVersion: exec('npm --version'),
21+
versionRequirement: packageConfig.engines.npm
22+
})
23+
}
24+
25+
module.exports = function () {
26+
var warnings = []
27+
for (var i = 0; i < versionRequirements.length; i++) {
28+
var mod = versionRequirements[i]
29+
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
30+
warnings.push(mod.name + ': ' +
31+
chalk.red(mod.currentVersion) + ' should be ' +
32+
chalk.green(mod.versionRequirement)
33+
)
34+
}
35+
}
36+
37+
if (warnings.length) {
38+
console.log('')
39+
console.log(chalk.yellow('To use this template, you must update following to modules:'))
40+
console.log()
41+
for (var i = 0; i < warnings.length; i++) {
42+
var warning = warnings[i]
43+
console.log(' ' + warning)
44+
}
45+
console.log()
46+
process.exit(1)
47+
}
48+
}

build/dev-client.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable */
2+
require('eventsource-polyfill')
3+
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
4+
5+
hotClient.subscribe(function (event) {
6+
if (event.action === 'reload') {
7+
window.location.reload()
8+
}
9+
})

0 commit comments

Comments
 (0)