Skip to content

Commit 19edc5e

Browse files
committed
Initial commit
0 parents  commit 19edc5e

Some content is hidden

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

88 files changed

+19041
-0
lines changed

.babelrc

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"presets": [
3+
["env", {
4+
"modules": false,
5+
"targets": {
6+
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7+
}
8+
}],
9+
"stage-2"
10+
],
11+
"plugins": ["transform-runtime"],
12+
"env": {
13+
"test": {
14+
"presets": ["env", "stage-2"],
15+
"plugins": [ "istanbul" ]
16+
}
17+
}
18+
}

.editorconfig

+9
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

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/*.js
2+
config/*.js

.eslintrc.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
13+
extends: 'standard',
14+
// required to lint *.vue files
15+
plugins: [
16+
'html'
17+
],
18+
// add your custom rules here
19+
'rules': {
20+
// allow paren-less arrow functions
21+
'arrow-parens': 0,
22+
// allow async-await
23+
'generator-star-spacing': 0,
24+
// allow debugger during development
25+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
26+
}
27+
}

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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
10+
/platforms/ios/
11+
/platforms/android/
12+
/www/
13+
14+
# Editor directories and files
15+
.idea
16+
*.suo
17+
*.ntvs*
18+
*.njsproj
19+
*.sln

.postcssrc.js

+8
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+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Francisco Igor
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# vuetify-cordova
2+
3+
A VuetifyJs App template ready for Cordova App.
4+
5+
Web demo in https://fraigo.github.io/vuetify-cordova/www/
6+
7+
Android demo in https://build.phonegap.com/apps/3121691/share
8+
9+
## Initial Setup
10+
11+
``` bash
12+
# install dependencies
13+
npm install
14+
15+
# add respective platforms
16+
cordova platform add android
17+
cordova platform add ios
18+
```
19+
20+
## Build commands
21+
22+
```bash
23+
# serve with hot reload at localhost:8080
24+
npm run dev
25+
26+
# build for production with minification
27+
npm run build
28+
29+
# build for production and view the bundle analyzer report
30+
npm run build --report
31+
32+
# create an Archive.zip package for Adobe Phonegap
33+
npm run pack
34+
35+
# run unit tests
36+
npm run unit
37+
38+
# run e2e tests
39+
npm run e2e
40+
41+
# run all tests
42+
npm test
43+
44+
# build for production and cordova build.
45+
npm run cordova-build
46+
47+
# build for production and serve the app through the browser - no hot reload.
48+
npm run browser
49+
50+
51+
# build for production and serve the app on an iOS device
52+
npm run ios
53+
54+
# build for production and serve the app on an android device (won't serve on a virtual device)
55+
npm run android
56+
57+
# build for production and serve the app on an android device (will serve on a virtual device or physical device - prefers virtual)
58+
npm run android-vm
59+
```
60+
61+
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).
62+
63+
64+
## Command line tools
65+
66+
### Cordova CLI
67+
68+
```
69+
npm install -g cordova
70+
```
71+
72+
### PhoneGap Build CLI
73+
74+
```
75+
npm install -g pgb-cli
76+
```

build/build.js

+35
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

+48
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

+9
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+
})

build/dev-server.js

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
require('./check-versions')()
2+
3+
var config = require('../config')
4+
if (!process.env.NODE_ENV) {
5+
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
6+
}
7+
8+
var opn = require('opn')
9+
var path = require('path')
10+
var express = require('express')
11+
var webpack = require('webpack')
12+
var proxyMiddleware = require('http-proxy-middleware')
13+
var webpackConfig = process.env.NODE_ENV === 'testing'
14+
? require('./webpack.prod.conf')
15+
: require('./webpack.dev.conf')
16+
17+
// default port where dev server listens for incoming traffic
18+
var port = process.env.PORT || config.dev.port
19+
// automatically open browser, if not set will be false
20+
var autoOpenBrowser = !!config.dev.autoOpenBrowser
21+
// Define HTTP proxies to your custom API backend
22+
// https://github.com/chimurai/http-proxy-middleware
23+
var proxyTable = config.dev.proxyTable
24+
25+
var app = express()
26+
var compiler = webpack(webpackConfig)
27+
28+
var devMiddleware = require('webpack-dev-middleware')(compiler, {
29+
publicPath: webpackConfig.output.publicPath,
30+
quiet: true
31+
})
32+
33+
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
34+
log: false
35+
})
36+
// force page reload when html-webpack-plugin template changes
37+
compiler.plugin('compilation', function (compilation) {
38+
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
39+
hotMiddleware.publish({ action: 'reload' })
40+
cb()
41+
})
42+
})
43+
44+
// proxy api requests
45+
Object.keys(proxyTable).forEach(function (context) {
46+
var options = proxyTable[context]
47+
if (typeof options === 'string') {
48+
options = { target: options }
49+
}
50+
app.use(proxyMiddleware(options.filter || context, options))
51+
})
52+
53+
// handle fallback for HTML5 history API
54+
app.use(require('connect-history-api-fallback')())
55+
56+
// serve webpack bundle output
57+
app.use(devMiddleware)
58+
59+
// enable hot-reload and state-preserving
60+
// compilation error display
61+
app.use(hotMiddleware)
62+
63+
// serve pure static assets
64+
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
65+
app.use(staticPath, express.static('./static'))
66+
67+
var uri = 'http://localhost:' + port
68+
69+
var _resolve
70+
var readyPromise = new Promise(resolve => {
71+
_resolve = resolve
72+
})
73+
74+
console.log('> Starting dev server...')
75+
devMiddleware.waitUntilValid(() => {
76+
console.log('> Listening at ' + uri + '\n')
77+
// when env is testing, don't need open it
78+
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
79+
opn(uri)
80+
}
81+
_resolve()
82+
})
83+
84+
var server = app.listen(port)
85+
86+
module.exports = {
87+
ready: readyPromise,
88+
close: () => {
89+
server.close()
90+
}
91+
}

build/load-minified.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var fs = require('fs')
2+
var UglifyJS = require('uglify-es')
3+
4+
module.exports = function(filePath) {
5+
var code = fs.readFileSync(filePath, 'utf-8')
6+
var result = UglifyJS.minify(code)
7+
if (result.error) return ''
8+
return result.code
9+
}

0 commit comments

Comments
 (0)