Skip to content

Commit 1a32a68

Browse files
committed
open source!
0 parents  commit 1a32a68

Some content is hidden

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

84 files changed

+9912
-0
lines changed

.babelrc

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

.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

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

.eslintrc.js

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
13+
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
14+
extends: 'airbnb-base',
15+
// required to lint *.vue files
16+
plugins: [
17+
'html'
18+
],
19+
// check if imports actually resolve
20+
settings: {
21+
'import/resolver': {
22+
webpack: {
23+
config: 'build/webpack.base.conf.js'
24+
}
25+
}
26+
},
27+
// add your custom rules here
28+
rules: {
29+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
30+
// don't require .vue extension when importing
31+
'import/extensions': ['error', 'always', {
32+
js: 'never',
33+
vue: 'never'
34+
}],
35+
// allow optionalDependencies
36+
'import/no-extraneous-dependencies': ['error', {
37+
optionalDependencies: ['test/unit/index.js']
38+
}],
39+
// allow debugger during development
40+
'object-shorthand': ['error', 'always'],
41+
'object-curly-newline': ['error', { consistent: true }],
42+
'import/prefer-default-export': 0,
43+
'arrow-parens': ['error', 'always'],
44+
'no-unused-vars': [2, { 'argsIgnorePattern': '^_', 'varsIgnorePattern': '^_' }],
45+
'no-bitwise': 0,
46+
'no-alert': 0,
47+
'no-console': 0,
48+
'no-shadow': 0,
49+
'no-lonely-if': 0,
50+
'no-continue': 0,
51+
'no-param-reassign': 0,
52+
'no-else-return': 0,
53+
'no-irregular-whitespace': 0,
54+
'linebreak-style': 0,
55+
'semi': ['error', 'never']
56+
}
57+
}

.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.DS_Store
2+
/node_modules/
3+
/dist/
4+
/static/
5+
/Icon?
6+
package-lock.json
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
11+
# Editor directories and files
12+
.idea
13+
.vscode
14+
*.suo
15+
*.ntvs*
16+
*.njsproj
17+
*.sln

.postcssrc.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// https://github.com/michael-ciniawsky/postcss-load-config
2+
3+
module.exports = {
4+
"plugins": {
5+
"postcss-import": {},
6+
"postcss-url": {},
7+
// to edit target browsers: use "browserslist" field in package.json
8+
"autoprefixer": {}
9+
}
10+
}

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<img alt src="https://ebb.io/favicon.ico" />
2+
3+
## ebbx
4+
5+
ebb front-end project
6+
7+
``` zsh
8+
# install dependencies
9+
npm i
10+
11+
# start development
12+
npm start
13+
14+
# build for production
15+
npm run build
16+
17+
# build for production and view the bundle analyzer report
18+
npm run build --report
19+
```

build/build.js

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

build/check-versions.js

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
'use strict'
2+
const chalk = require('chalk')
3+
const semver = require('semver')
4+
const packageConfig = require('../package.json')
5+
const shell = require('shelljs')
6+
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+
30+
for (let i = 0; i < versionRequirements.length; i++) {
31+
const mod = versionRequirements[i]
32+
33+
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
34+
warnings.push(mod.name + ': ' +
35+
chalk.red(mod.currentVersion) + ' should be ' +
36+
chalk.green(mod.versionRequirement)
37+
)
38+
}
39+
}
40+
41+
if (warnings.length) {
42+
console.log('')
43+
console.log(chalk.yellow('To use this template, you must update following to modules:'))
44+
console.log()
45+
46+
for (let i = 0; i < warnings.length; i++) {
47+
const warning = warnings[i]
48+
console.log(' ' + warning)
49+
}
50+
51+
console.log()
52+
process.exit(1)
53+
}
54+
}

build/logo.png

6.69 KB
Loading

build/utils.js

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
'use strict'
2+
const path = require('path')
3+
const config = require('../config')
4+
const ExtractTextPlugin = require('extract-text-webpack-plugin')
5+
const packageConfig = require('../package.json')
6+
7+
exports.assetsPath = function (_path) {
8+
const assetsSubDirectory = process.env.NODE_ENV === 'production'
9+
? config.build.assetsSubDirectory
10+
: config.dev.assetsSubDirectory
11+
12+
return path.posix.join(assetsSubDirectory, _path)
13+
}
14+
15+
exports.cssLoaders = function (options) {
16+
options = options || {}
17+
18+
const cssLoader = {
19+
loader: 'css-loader',
20+
options: {
21+
sourceMap: options.sourceMap
22+
}
23+
}
24+
25+
const postcssLoader = {
26+
loader: 'postcss-loader',
27+
options: {
28+
sourceMap: options.sourceMap
29+
}
30+
}
31+
32+
// generate loader string to be used with extract text plugin
33+
function generateLoaders (loader, loaderOptions) {
34+
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
35+
36+
if (loader) {
37+
loaders.push({
38+
loader: loader + '-loader',
39+
options: Object.assign({}, loaderOptions, {
40+
sourceMap: options.sourceMap
41+
})
42+
})
43+
}
44+
45+
// Extract CSS when that option is specified
46+
// (which is the case during production build)
47+
if (options.extract) {
48+
return ExtractTextPlugin.extract({
49+
use: loaders,
50+
fallback: 'vue-style-loader'
51+
})
52+
} else {
53+
return ['vue-style-loader'].concat(loaders)
54+
}
55+
}
56+
57+
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
58+
return {
59+
css: generateLoaders(),
60+
postcss: generateLoaders(),
61+
less: generateLoaders('less'),
62+
sass: generateLoaders('sass', { indentedSyntax: true }),
63+
scss: generateLoaders('sass'),
64+
stylus: generateLoaders('stylus'),
65+
styl: generateLoaders('stylus')
66+
}
67+
}
68+
69+
// Generate loaders for standalone style files (outside of .vue)
70+
exports.styleLoaders = function (options) {
71+
const output = []
72+
const loaders = exports.cssLoaders(options)
73+
74+
for (const extension in loaders) {
75+
const loader = loaders[extension]
76+
output.push({
77+
test: new RegExp('\\.' + extension + '$'),
78+
use: loader
79+
})
80+
}
81+
82+
return output
83+
}
84+
85+
exports.createNotifierCallback = () => {
86+
const notifier = require('node-notifier')
87+
88+
return (severity, errors) => {
89+
if (severity !== 'error') return
90+
91+
const error = errors[0]
92+
const filename = error.file && error.file.split('!').pop()
93+
94+
notifier.notify({
95+
title: packageConfig.name,
96+
message: severity + ': ' + error.name,
97+
subtitle: filename || '',
98+
icon: path.join(__dirname, 'logo.png')
99+
})
100+
}
101+
}

build/vue-loader.conf.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict'
2+
const utils = require('./utils')
3+
const config = require('../config')
4+
const isProduction = process.env.NODE_ENV === 'production'
5+
const sourceMapEnabled = isProduction
6+
? config.build.productionSourceMap
7+
: config.dev.cssSourceMap
8+
9+
module.exports = {
10+
loaders: utils.cssLoaders({
11+
sourceMap: sourceMapEnabled,
12+
extract: isProduction
13+
}),
14+
cssSourceMap: sourceMapEnabled,
15+
cacheBusting: config.dev.cacheBusting,
16+
transformToRequire: {
17+
video: ['src', 'poster'],
18+
source: 'src',
19+
img: 'src',
20+
image: 'xlink:href'
21+
}
22+
}

0 commit comments

Comments
 (0)