Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
scarry1992 committed Nov 17, 2017
0 parents commit 9524ffc
Show file tree
Hide file tree
Showing 60 changed files with 3,085 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .babelrc
@@ -0,0 +1,5 @@
{
"presets": [["es2015", {"modules": false}], "stage-2"],
"plugins": ["transform-runtime"],
"comments": false
}
9 changes: 9 additions & 0 deletions .editorconfig
@@ -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
3 changes: 3 additions & 0 deletions .eslintignore
@@ -0,0 +1,3 @@
build/*.js
config/*.js
dist/*.js
40 changes: 40 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,40 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: [
'standard'
],
// required to lint *.vue files
plugins: [
'html',
'import'
],
globals: {
'cordova': true,
'DEV': true,
'PROD': true,
'__THEME': true,
'SERVER': true
},
// add your custom rules here
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0,
'one-var': 0,
'import/first': 0,
'import/named': 2,
'import/namespace': 2,
'import/default': 2,
'import/export': 2,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'brace-style': [2, 'stroustrup', { 'allowSingleLine': true }]
}
}
8 changes: 8 additions & 0 deletions .gitignore
@@ -0,0 +1,8 @@
.DS_Store
.thumbs.db
node_modules/
dist/
npm-debug.log*
cordova/platforms
cordova/plugins
.idea/
35 changes: 35 additions & 0 deletions .stylintrc
@@ -0,0 +1,35 @@
{
"blocks": "never",
"brackets": "never",
"colons": "never",
"colors": "always",
"commaSpace": "always",
"commentSpace": "always",
"cssLiteral": "never",
"depthLimit": false,
"duplicates": true,
"efficient": "always",
"extendPref": false,
"globalDupe": true,
"indentPref": 2,
"leadingZero": "never",
"maxErrors": false,
"maxWarnings": false,
"mixed": false,
"namingConvention": false,
"namingConventionStrict": false,
"none": "never",
"noImportant": false,
"parenSpace": "never",
"placeholder": false,
"prefixVarsWithDollar": "always",
"quotePref": "single",
"semicolons": "never",
"sortOrder": false,
"stackedProperties": "never",
"trailingWhitespace": "never",
"universal": "never",
"valid": true,
"zeroUnits": "never",
"zIndexNormalize": false
}
1 change: 1 addition & 0 deletions CNAME
@@ -0,0 +1 @@
trackit.flespi.io
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 flespi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
54 changes: 54 additions & 0 deletions README.md
@@ -0,0 +1,54 @@
# Track It!

> A simple application based on [flespi.io](https://flespi.io) and built with [Quasar](http://quasar-framework.org) and [Leaflet.js](http://leafletjs.com). Allows tracking different devices on the map, viewing telemetry messages for these devices.
![Screenshot](/misc/screenshot.jpg?raw=true "Track it!")

## Features
* ES6 Javascript
* Vue.js
* Writing .vue files
* Vuex
* Webpack
* Responsive layout
* NPM ecosystems
* Leaflet
* Material theme
* Dev Hot Reload
* and many more!

## Prerequisites:

- [Node.js](https://nodejs.org/en/) (>=6.x)
- npm version 3+ and [Git](https://git-scm.com/).

## Build Setup

``` bash
# clone the repo
$ git clone https://github.com/flespi-software/TrackIt.git mytracker

# go into app's directory and install dependencies
$ cd mytracker
$ npm install

# serve with hot reload at localhost:7006 for flespi.io
$ quasar dev

# build for production with minification for flespi.io
$ quasar build

# lint code
$ quasar lint

# serve with hot reload at localhost:7006 for localhost:9005
$ npm run dev_local

# build for production with minification for current host
$ npm run build_local
```
## Demo
Check it out [live](http://trackit.flespi.io)!

## License
[MIT](https://github.com/flespi-software/TrackIt/blob/master/LICENSE) license.
91 changes: 91 additions & 0 deletions build/css-utils.js
@@ -0,0 +1,91 @@
var
ExtractTextPlugin = require('extract-text-webpack-plugin'),
autoprefixer = require('autoprefixer'),
purify = require('purify-css'),
glob = require('glob'),
path = require('path'),
fs = require('fs')

module.exports.postcss = [autoprefixer()]

module.exports.styleLoaders = function (options) {
options = options || {}

function generateLoaders (loaders) {
if (options.postcss) {
loaders.splice(1, 0, 'postcss')
}

var sourceLoader = loaders.map(function (loader) {
var extraParamChar
if (/\?/.test(loader)) {
loader = loader.replace(/\?/, '-loader?')
extraParamChar = '&'
}
else {
loader = loader + '-loader'
extraParamChar = '?'
}
return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')
}).join('!')

if (options.extract) {
return ExtractTextPlugin.extract({
use: sourceLoader,
fallback: 'vue-style-loader'
})
}
else {
return ['vue-style-loader', sourceLoader].join('!')
}
}

return {
css: generateLoaders(['css']),
less: generateLoaders(['css', 'less']),
sass: generateLoaders(['css', 'sass?indentedSyntax']),
scss: generateLoaders(['css', 'sass']),
styl: generateLoaders(['css', 'stylus']),
stylus: generateLoaders(['css', 'stylus'])
}
}

module.exports.styleRules = function (options) {
var output = []
var loaders = exports.styleLoaders(options)
for (var extension in loaders) {
var loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
loader: loader
})
}
return output
}

function getSize (size) {
return (size / 1024).toFixed(2) + 'kb'
}

module.exports.purify = function(cb) {
var css = glob.sync(path.join(__dirname, '../dist/**/*.css'))
var js = glob.sync(path.join(__dirname, '../dist/**/*.js'))

Promise.all(css.map(function (file) {
return new Promise(function (resolve) {
console.log('\n Purifying ' + path.relative(path.join(__dirname, '../dist'), file).bold + '...')
purify(js, [file], {minify: true}, function (purified) {
var oldSize = fs.statSync(file).size
fs.writeFileSync(file, purified)
var newSize = fs.statSync(file).size

console.log(
' * Reduced size by ' + ((1 - newSize / oldSize) * 100).toFixed(2) + '%, from ' +
getSize(oldSize) + ' to ' + getSize(newSize) + '.'
)
resolve()
})
})
}))
.then(cb)
}
14 changes: 14 additions & 0 deletions build/env-utils.js
@@ -0,0 +1,14 @@
var
config = require('../config'),
theme = process.argv[2] || config.defaultTheme,
server = process.argv[3] || config.defaultServer

module.exports = {
dev: process.env.NODE_ENV === 'development',
prod: process.env.NODE_ENV === 'production',
server: server,
platform: {
theme: theme,
cordovaAssets: './cordova/platforms/' + (theme === 'mat' ? 'android' : 'ios') + '/platform_www'
}
}
3 changes: 3 additions & 0 deletions build/hot-reload.js
@@ -0,0 +1,3 @@
/* eslint-disable */
require('eventsource-polyfill')
require('webpack-hot-middleware/client?noInfo=true&reload=true')
56 changes: 56 additions & 0 deletions build/script.build.js
@@ -0,0 +1,56 @@
process.env.NODE_ENV = 'production'

require('colors')

var
shell = require('shelljs'),
path = require('path'),
env = require('./env-utils'),
css = require('./css-utils'),
config = require('../config'),
webpack = require('webpack'),
webpackConfig = require('./webpack.prod.conf'),
targetPath = path.join(__dirname, '../dist')

console.log(' WARNING!'.bold)
console.log(' Do NOT use VueRouter\'s "history" mode if')
console.log(' building for Cordova or Electron.\n')

require('./script.clean.js')
console.log((' Building Quasar App with "' + env.platform.theme + '" theme...\n').bold)
console.log((' Building Quasar App for "' + env.server + '" server...\n').bold)

shell.mkdir('-p', targetPath)
shell.cp('-R', 'src/statics', targetPath)

function finalize () {
console.log((
'\n Build complete with "' + env.platform.theme.bold + '" theme in ' +
'"/dist"'.bold + ' folder.\n').cyan)

console.log(' Built files are meant to be served over an HTTP server.'.bold)
console.log(' Opening index.html over file:// won\'t work.'.bold)
}

webpack(webpackConfig, function (err, stats) {
if (err) throw err

process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false
}) + '\n')

if (stats.hasErrors()) {
process.exit(1)
}

if (config.build.purifyCSS) {
css.purify(finalize)
}
else {
finalize()
}
})
7 changes: 7 additions & 0 deletions build/script.clean.js
@@ -0,0 +1,7 @@
var
shell = require('shelljs'),
path = require('path')

shell.rm('-rf', path.resolve(__dirname, '../dist/*'))
shell.rm('-rf', path.resolve(__dirname, '../dist/.*'))
console.log(' Cleaned build artifacts.\n')

0 comments on commit 9524ffc

Please sign in to comment.