Skip to content

Commit c283636

Browse files
committed
Initial commit
Signed-off-by: Finnian Anderson <[email protected]>
1 parent 5056677 commit c283636

Some content is hidden

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

52 files changed

+15448
-0
lines changed

.babelrc

Lines changed: 18 additions & 0 deletions
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

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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/build/
2+
/config/
3+
/dist/
4+
/*.js
5+
/test/unit/coverage/

.eslintrc.js

Lines changed: 27 additions & 0 deletions
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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
11+
# Editor directories and files
12+
.idea
13+
*.suo
14+
*.ntvs*
15+
*.njsproj
16+
*.sln

.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: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,31 @@
11
# swapi-vue-pwa
22
Progressive Web App example with Vue
3+
4+
> A Vue.js project
5+
6+
## Build Setup
7+
8+
``` bash
9+
# install dependencies
10+
npm install
11+
12+
# serve with hot reload at localhost:8080
13+
npm run dev
14+
15+
# build for production with minification
16+
npm run build
17+
18+
# build for production and view the bundle analyzer report
19+
npm run build --report
20+
21+
# run unit tests
22+
npm run unit
23+
24+
# run e2e tests
25+
npm run e2e
26+
27+
# run all tests
28+
npm test
29+
```
30+
31+
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).

build/build.js

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

build/check-versions.js

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

build/dev-client.js

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

0 commit comments

Comments
 (0)