Skip to content

Commit 12b8170

Browse files
committed
Initial commit
1 parent 8fbc07a commit 12b8170

Some content is hidden

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

55 files changed

+8280
-2
lines changed

.babelrc

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

.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: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
module.exports = {
2+
root: true,
3+
parser: 'babel-eslint',
4+
parserOptions: {
5+
sourceType: 'module'
6+
},
7+
extends: 'airbnb-base',
8+
// required to lint *.vue files
9+
plugins: [
10+
'html'
11+
],
12+
// check if imports actually resolve
13+
'settings': {
14+
'import/resolver': {
15+
'webpack': {
16+
'config': 'build/webpack.base.conf.js'
17+
}
18+
}
19+
},
20+
// add your custom rules here
21+
'rules': {
22+
// don't require .vue extension when importing
23+
'import/extensions': ['error', 'always', {
24+
'js': 'never',
25+
'vue': 'never'
26+
}],
27+
// allow debugger during development
28+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
29+
30+
'no-multi-spaces' : 0,
31+
'no-underscore-dangle' : [0],
32+
'consistent-return' : 0,
33+
'no-unused-expressions' : [2, { allowShortCircuit: true }],
34+
'no-param-reassign' : 0,
35+
'func-names' : 0,
36+
'space-before-function-paren' : [2, 'never'],
37+
'comma-dangle' : [2, 'never'],
38+
'no-shadow' : 0,
39+
'guard-for-in' : 0,
40+
'no-restricted-syntax' : [2, 'WithStatement'],
41+
'newline-per-chained-call' : [2, { ignoreChainWithDepth: 5 }],
42+
'space-in-parens' : 0,
43+
'key-spacing' : 0,
44+
'no-unused-vars' : [2, { vars: 'all', args: 'none' }],
45+
'max-len' : 1,
46+
'padded-blocks' : 0,
47+
'no-console' : 0,
48+
'no-continue' : 0,
49+
'no-extra-boolean-cast' : 0,
50+
'import/no-extraneous-dependencies': 0,
51+
'import/newline-after-import' : 0,
52+
'no-mixed-operators' : 0,
53+
'import/no-unresolved' : 0,
54+
'import/extensions' : 0,
55+
'no-prototype-builtins' : 0
56+
}
57+
}

.gitignore

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

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1-
# cms
2-
📓 Content Management System to administrate FindEarth platform resources
1+
# findearth
2+
3+
> FindEarth Content Management System
4+
5+
## Build Setup
6+
7+
``` bash
8+
# install dependencies
9+
npm install
10+
11+
# serve with hot reload at localhost:8080
12+
npm run dev
13+
14+
# build for production with minification
15+
npm run build
16+
17+
# run unit tests
18+
npm run unit
19+
20+
# run e2e tests
21+
npm run e2e
22+
23+
# run all tests
24+
npm test
25+
```
26+
27+
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: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// https://github.com/shelljs/shelljs
2+
require('./check-versions')()
3+
require('shelljs/global')
4+
env.NODE_ENV = 'production'
5+
6+
var path = require('path')
7+
var config = require('../config')
8+
var ora = require('ora')
9+
var webpack = require('webpack')
10+
var webpackConfig = require('./webpack.prod.conf')
11+
12+
console.log(
13+
' Tip:\n' +
14+
' Built files are meant to be served over an HTTP server.\n' +
15+
' Opening index.html over file:// won\'t work.\n'
16+
)
17+
18+
var spinner = ora('building for production...')
19+
spinner.start()
20+
21+
var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
22+
rm('-rf', assetsPath)
23+
mkdir('-p', assetsPath)
24+
cp('-R', 'static/*', assetsPath)
25+
26+
webpack(webpackConfig, function (err, stats) {
27+
spinner.stop()
28+
if (err) throw err
29+
process.stdout.write(stats.toString({
30+
colors: true,
31+
modules: false,
32+
children: false,
33+
chunks: false,
34+
chunkModules: false
35+
}) + '\n')
36+
})

build/check-versions.js

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

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

build/dev-server.js

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

0 commit comments

Comments
 (0)