-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2e9d4ce
Showing
50 changed files
with
14,861 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-runtime"], | ||
"env": { | ||
"test": { | ||
"presets": ["env", "stage-2"], | ||
"plugins": [ "istanbul" ] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/build/ | ||
/config/ | ||
/dist/ | ||
/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// http://eslint.org/docs/user-guide/configuring | ||
|
||
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' | ||
], | ||
// add your custom rules here | ||
'rules': { | ||
// allow paren-less arrow functions | ||
'arrow-parens': 0, | ||
// allow async-await | ||
'generator-star-spacing': 0, | ||
// allow debugger during development | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.DS_Store | ||
node_modules/ | ||
/dist/ | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// https://github.com/michael-ciniawsky/postcss-load-config | ||
|
||
module.exports = { | ||
"plugins": { | ||
// to edit target browsers: use "browserlist" field in package.json | ||
"autoprefixer": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# airplane-game | ||
|
||
> A Vue.js project | ||
## Build Setup | ||
|
||
``` bash | ||
# install dependencies | ||
npm install | ||
|
||
# serve with hot reload at localhost:8080 | ||
npm run dev | ||
|
||
# build for production with minification | ||
npm run build | ||
|
||
# build for production and view the bundle analyzer report | ||
npm run build --report | ||
``` | ||
|
||
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict' | ||
|
||
require('./check-versions')() | ||
|
||
process.env.NODE_ENV = 'production' | ||
|
||
const ora = require('ora') | ||
const rm = require('rimraf') | ||
const path = require('path') | ||
const chalk = require('chalk') | ||
const webpack = require('webpack') | ||
const config = require('../config') | ||
const webpackConfig = require('./webpack.prod.conf') | ||
|
||
const spinner = ora('building for production...') | ||
spinner.start() | ||
|
||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { | ||
if (err) throw err | ||
webpack(webpackConfig, function (err, stats) { | ||
spinner.stop() | ||
if (err) throw err | ||
process.stdout.write(stats.toString({ | ||
colors: true, | ||
modules: false, | ||
children: false, | ||
chunks: false, | ||
chunkModules: false | ||
}) + '\n\n') | ||
|
||
console.log(chalk.cyan(' Build complete.\n')) | ||
console.log(chalk.yellow( | ||
' Tip: built files are meant to be served over an HTTP server.\n' + | ||
' Opening index.html over file:// won\'t work.\n' | ||
)) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
'use strict' | ||
|
||
const chalk = require('chalk') | ||
const semver = require('semver') | ||
const packageConfig = require('../package.json') | ||
const shell = require('shelljs') | ||
function exec (cmd) { | ||
return require('child_process').execSync(cmd).toString().trim() | ||
} | ||
|
||
const versionRequirements = [ | ||
{ | ||
name: 'node', | ||
currentVersion: semver.clean(process.version), | ||
versionRequirement: packageConfig.engines.node | ||
}, | ||
] | ||
|
||
if (shell.which('npm')) { | ||
versionRequirements.push({ | ||
name: 'npm', | ||
currentVersion: exec('npm --version'), | ||
versionRequirement: packageConfig.engines.npm | ||
}) | ||
} | ||
|
||
module.exports = function () { | ||
const warnings = [] | ||
for (let i = 0; i < versionRequirements.length; i++) { | ||
const mod = versionRequirements[i] | ||
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { | ||
warnings.push(mod.name + ': ' + | ||
chalk.red(mod.currentVersion) + ' should be ' + | ||
chalk.green(mod.versionRequirement) | ||
) | ||
} | ||
} | ||
|
||
if (warnings.length) { | ||
console.log('') | ||
console.log(chalk.yellow('To use this template, you must update following to modules:')) | ||
console.log() | ||
for (let i = 0; i < warnings.length; i++) { | ||
const warning = warnings[i] | ||
console.log(' ' + warning) | ||
} | ||
console.log() | ||
process.exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict' | ||
|
||
/* eslint-disable */ | ||
require('eventsource-polyfill') | ||
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') | ||
|
||
hotClient.subscribe(function (event) { | ||
if (event.action === 'reload') { | ||
window.location.reload() | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
'use strict' | ||
|
||
require('./check-versions')() | ||
|
||
const config = require('../config') | ||
if (!process.env.NODE_ENV) { | ||
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) | ||
} | ||
|
||
const opn = require('opn') | ||
const path = require('path') | ||
const express = require('express') | ||
const webpack = require('webpack') | ||
const proxyMiddleware = require('http-proxy-middleware') | ||
const webpackConfig = require('./webpack.dev.conf') | ||
|
||
// default port where dev server listens for incoming traffic | ||
const port = process.env.PORT || config.dev.port | ||
// automatically open browser, if not set will be false | ||
const autoOpenBrowser = !!config.dev.autoOpenBrowser | ||
// Define HTTP proxies to your custom API backend | ||
// https://github.com/chimurai/http-proxy-middleware | ||
const proxyTable = config.dev.proxyTable | ||
|
||
const app = express() | ||
const compiler = webpack(webpackConfig) | ||
|
||
const devMiddleware = require('webpack-dev-middleware')(compiler, { | ||
publicPath: webpackConfig.output.publicPath, | ||
quiet: true | ||
}) | ||
|
||
const hotMiddleware = require('webpack-hot-middleware')(compiler, { | ||
log: false | ||
}) | ||
// force page reload when html-webpack-plugin template changes | ||
compiler.plugin('compilation', function (compilation) { | ||
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { | ||
hotMiddleware.publish({ action: 'reload' }) | ||
cb() | ||
}) | ||
}) | ||
|
||
// enable hot-reload and state-preserving | ||
// compilation error display | ||
app.use(hotMiddleware) | ||
|
||
// proxy api requests | ||
Object.keys(proxyTable).forEach(function (context) { | ||
let options = proxyTable[context] | ||
if (typeof options === 'string') { | ||
options = { target: options } | ||
} | ||
app.use(proxyMiddleware(options.filter || context, options)) | ||
}) | ||
|
||
// handle fallback for HTML5 history API | ||
app.use(require('connect-history-api-fallback')()) | ||
|
||
// serve webpack bundle output | ||
app.use(devMiddleware) | ||
|
||
// serve pure static assets | ||
const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) | ||
app.use(staticPath, express.static('./static')) | ||
|
||
const uri = 'http://localhost:' + port | ||
|
||
let _resolve | ||
const readyPromise = new Promise(resolve => { | ||
_resolve = resolve | ||
}) | ||
|
||
console.log('> Starting dev server...') | ||
devMiddleware.waitUntilValid(() => { | ||
console.log('> Listening at ' + uri + '\n') | ||
// when env is testing, don't need open it | ||
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { | ||
opn(uri) | ||
} | ||
_resolve() | ||
}) | ||
|
||
const server = app.listen(port) | ||
|
||
module.exports = { | ||
ready: readyPromise, | ||
close: () => { | ||
server.close() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict' | ||
|
||
const fs = require('fs') | ||
const UglifyJS = require('uglify-es') | ||
|
||
module.exports = function(filePath) { | ||
const code = fs.readFileSync(filePath, 'utf-8') | ||
const result = UglifyJS.minify(code) | ||
if (result.error) return '' | ||
return result.code | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// This service worker file is effectively a 'no-op' that will reset any | ||
// previous service worker registered for the same host:port combination. | ||
// In the production build, this file is replaced with an actual service worker | ||
// file that will precache your site's local assets. | ||
// See https://github.com/facebookincubator/create-react-app/issues/2272#issuecomment-302832432 | ||
|
||
self.addEventListener('install', () => self.skipWaiting()); | ||
|
||
self.addEventListener('activate', () => { | ||
self.clients.matchAll({ type: 'window' }).then(windowClients => { | ||
for (let windowClient of windowClients) { | ||
// Force open pages to refresh, so that they have a chance to load the | ||
// fresh navigation response from the local dev server. | ||
windowClient.navigate(windowClient.url); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
// Check to make sure service workers are supported in the current browser, | ||
// and that the current page is accessed from a secure origin. Using a | ||
// service worker from an insecure origin will trigger JS console errors. | ||
var isLocalhost = Boolean(window.location.hostname === 'localhost' || | ||
// [::1] is the IPv6 localhost address. | ||
window.location.hostname === '[::1]' || | ||
// 127.0.0.1/8 is considered localhost for IPv4. | ||
window.location.hostname.match( | ||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ | ||
) | ||
); | ||
|
||
window.addEventListener('load', function() { | ||
if ('serviceWorker' in navigator && | ||
(window.location.protocol === 'https:' || isLocalhost)) { | ||
navigator.serviceWorker.register('service-worker.js') | ||
.then(function(registration) { | ||
// updatefound is fired if service-worker.js changes. | ||
registration.onupdatefound = function() { | ||
// updatefound is also fired the very first time the SW is installed, | ||
// and there's no need to prompt for a reload at that point. | ||
// So check here to see if the page is already controlled, | ||
// i.e. whether there's an existing service worker. | ||
if (navigator.serviceWorker.controller) { | ||
// The updatefound event implies that registration.installing is set | ||
var installingWorker = registration.installing; | ||
|
||
installingWorker.onstatechange = function() { | ||
switch (installingWorker.state) { | ||
case 'installed': | ||
// At this point, the old content will have been purged and the | ||
// fresh content will have been added to the cache. | ||
// It's the perfect time to display a "New content is | ||
// available; please refresh." message in the page's interface. | ||
break; | ||
|
||
case 'redundant': | ||
throw new Error('The installing ' + | ||
'service worker became redundant.'); | ||
|
||
default: | ||
// Ignore | ||
} | ||
}; | ||
} | ||
}; | ||
}).catch(function(e) { | ||
console.error('Error during service worker registration:', e); | ||
}); | ||
} | ||
}); | ||
})(); |
Oops, something went wrong.