Skip to content

Commit

Permalink
update project
Browse files Browse the repository at this point in the history
  • Loading branch information
lemmo committed Jul 11, 2018
0 parents commit 100aecd
Show file tree
Hide file tree
Showing 87 changed files with 1,897 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .babelrc
@@ -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"]
}
}
}
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
2 changes: 2 additions & 0 deletions .eslintignore
@@ -0,0 +1,2 @@
build/*.js
config/*.js
108 changes: 108 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,108 @@
// http://eslint.org/docs/user-guide/configuring

module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: {
browser: false,
node: true,
es6: true
},
extends: ['plugin:vue/essential', 'airbnb-base'],
// required to lint *.vue files
plugins: [
'vue'
],
// check if imports actually resolve
'settings': {
'import/resolver': {
'webpack': {
'config': 'build/webpack.base.conf.js'
}
}
},
// add your custom rules here
'rules': {
// don't require .vue extension when importing
'import/extensions': ['error', 'always', {
'js': 'never',
'vue': 'never'
}],
// allow optionalDependencies
'import/no-extraneous-dependencies': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
// allow paren-less arrow functions
// allow async-await
'generator-star-spacing': 0,
"linebreak-style": 0,
"func-names": 0,
"max-len": [
"warn",
150,
4,
{
"comments": 150
}
],
"indent": 0,
"comma-dangle": 0,
"arrow-parens": 0,
"arrow-body-style": 0,
"no-tabs": 0,
"spaced-comment": 0,
"semi": 0,
"prefer-const": 1,
"no-plusplus": 1,
"no-unused-expressions": [
"warn",
{
"allowShortCircuit": true,
"allowTernary": true
}
],
"function-paren-newline": 0,
"no-unused-vars": [
"warn",
{
"vars": "all",
"args": "none"
}
],
"no-param-reassign": [
"error",
{
"props": false
}
],
"object-shorthand": 0,
"no-useless-constructor": 0,
"import/prefer-default-export": 0,
"no-underscore-dangle": 0,
"prefer-template": 0,
"object-curly-newline": 0,
"class-methods-use-this": 0,
"no-restricted-syntax": 0
},
globals: {
App: true,
Page: true,
wx: true,
getApp: true,
getPage: true
},
overrides: [
{
files: ['*.vue'],
rules: {
'indent': 'off',
'vue/script-indent': ['warn', 2, {
'baseIndent': 1
}]
}
}
]
}
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
node_modules
dist
.idea
20 changes: 20 additions & 0 deletions .postcssrc.js
@@ -0,0 +1,20 @@
// https://github.com/michael-ciniawsky/postcss-load-config

const replaceTagSelectorMap = require('postcss-mpvue-wxss/lib/wxmlTagMap')

module.exports = {
"plugins": {
"postcss-mpvue-wxss": {
// cleanSelector: ['*'],
remToRpx: 1,
replaceTagSelector: Object.assign(replaceTagSelectorMap, {
'*': 'view, text' // 将覆盖前面的 * 选择器被清理规则
})
},
"postcss-pxtorem": {
"rootValue": 1,
"propList": ["*"],
"selectorBlackList": ["weui-"]
}
}
}
35 changes: 35 additions & 0 deletions README.md
@@ -0,0 +1,35 @@
# 白云生 - 小程序

[http://mpvue.com/](http://mpvue.com/)

> A Mpvue 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).


minui使用方法:(https://meili.github.io/min/docs/minui/index.html)
1、安装min (npm install -g @mindev/min-cli) 查看安装是否成功: min -V
2、在项目中需要使用到组件的时候,需要使用min来安装,这里以panel为例,
[ --------
1、min install @minui/wxc-panel
2、在main文件中添加:
usingComponents: {
'wxc-loadmore': '../../../dist/@minui/wxc-panel/dist/index'
}
---------------]
40 changes: 40 additions & 0 deletions build/build.js
@@ -0,0 +1,40 @@
require('./check-versions')()

process.env.NODE_ENV = 'production'

var ora = require('ora')
var rm = require('rimraf')
var path = require('path')
var chalk = require('chalk')
var webpack = require('webpack')
var config = require('../config')
var webpackConfig = require('./webpack.prod.conf')

var 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')

if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}

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'
))
})
})
48 changes: 48 additions & 0 deletions build/check-versions.js
@@ -0,0 +1,48 @@
var chalk = require('chalk')
var semver = require('semver')
var packageConfig = require('../package.json')
var shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}

var 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 () {
var warnings = []
for (var i = 0; i < versionRequirements.length; i++) {
var 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 (var i = 0; i < warnings.length; i++) {
var warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}
9 changes: 9 additions & 0 deletions build/dev-client.js
@@ -0,0 +1,9 @@
/* 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()
}
})

0 comments on commit 100aecd

Please sign in to comment.