张恒

合并分支

{
"comments": false,
"env": {
"test": {
"presets": [
["env", {
"targets": { "node": 7 }
}],
"stage-0"
],
"plugins": ["istanbul"]
},
"main": {
"presets": [
["env", {
"targets": { "node": 7 }
}],
"stage-0"
[
"@babel/preset-env",
{
"targets": {
"node": 7
}
}
]
],
"plugins": [
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-logical-assignment-operators",
"@babel/plugin-proposal-optional-chaining",
[
"@babel/plugin-proposal-pipeline-operator",
{
"proposal": "minimal"
}
],
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-do-expressions",
"@babel/plugin-proposal-function-bind"
]
},
"renderer": {
"presets": [
["env", {
"modules": false
}],
"stage-3"
[
"@babel/preset-env",
{
"modules": false
}
]
],
"plugins": [
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-logical-assignment-operators",
"@babel/plugin-proposal-optional-chaining",
[
"@babel/plugin-proposal-pipeline-operator",
{
"proposal": "minimal"
}
],
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-do-expressions",
"@babel/plugin-proposal-function-bind"
]
},
"web": {
"presets": [
["env", {
"modules": false
}],
"stage-3"
[
"@babel/preset-env",
{
"modules": false
}
]
],
"plugins": [
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-logical-assignment-operators",
"@babel/plugin-proposal-optional-chaining",
[
"@babel/plugin-proposal-pipeline-operator",
{
"proposal": "minimal"
}
],
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-do-expressions",
"@babel/plugin-proposal-function-bind"
]
}
},
"plugins": ["transform-runtime","dynamic-import-webpack"]
"plugins": [
"@babel/transform-runtime",
"@babel/plugin-syntax-dynamic-import"
]
}
......
.DS_Store
node_modules/
build/win-ia32-unpacked/
build/win-unpacked/
/dist/
build/win-unpacked/
build/win-ia32-unpacked/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
......@@ -14,4 +14,5 @@ yarn-error.log*
*.ntvs*
*.njsproj
*.sln
electron-vue-template-ts.7z
server/client/electron-vue-admin Setup 0.0.1.exe
......
# Commented sections below can be used to run tests on the CI server
# https://simulatedgreg.gitbooks.io/electron-vue/content/en/testing.html#on-the-subject-of-ci-testing
osx_image: xcode8.3
sudo: required
dist: trusty
language: c
matrix:
include:
- os: osx
- os: linux
env: CC=clang CXX=clang++ npm_config_clang=1
compiler: clang
cache:
directories:
- node_modules
- "$HOME/.electron"
- "$HOME/.cache"
addons:
apt:
packages:
- libgnome-keyring-dev
- icnsutils
#- xvfb
before_install:
- mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v1.2.1/git-lfs-$([
"$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-1.2.1.tar.gz
| tar -xz -C /tmp/git-lfs --strip-components 1 && /tmp/git-lfs/git-lfs pull
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install --no-install-recommends -y icnsutils graphicsmagick xz-utils; fi
install:
#- export DISPLAY=':99.0'
#- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- nvm install 7
- curl -o- -L https://yarnpkg.com/install.sh | bash
- source ~/.bashrc
- npm install -g xvfb-maybe
- yarn
script:
#- xvfb-maybe node_modules/.bin/karma start test/unit/karma.conf.js
#- yarn run pack && xvfb-maybe node_modules/.bin/mocha test/e2e
- yarn run build
branches:
only:
- master
# Electron-Vue-template
> 这是一个基于electron的vue最基本的模板,其中前端技术栈则用到vue全家桶,axios作为http请求,而本地数据库则是nedb。现在合并了花裤衩的vue-admin中的东西,由于我司需求方面,所以侧栏的渲染比较新奇,侧栏样式是在` src/renderer/layout/components/sidebar `文件夹中,大家可以根据需求进行个性化更改,鄙人后续会将这个和花裤衩大大的同步.
- 因为花裤衩大大的ELECTRON版本已经一年没有更新了,而且ELECTRON,vue,elementui,都已经迭代太多,刚好我司有这方面的需求,我就在vue-electron脚手架生成的项目基础上,将花裤衩大大的项目核心组件提取出来合并到这个项目中,在我简单的封装了axios和db.以及electron常用的信息弹窗,错误弹窗,稍后的日子中我会慢慢完善这个文档,暂时如果有人需要使用这个项目,还请多多包含,因为文档不够完善,只能用过直接看代码,在路由页面我有注释.
#### 如何安装
``` bash
# 首先全局安装nrm
npm i -g nrm
# 然后使用nrm切换为淘宝源,或者你已经切换了npm的源也是可以的,强烈不建议使用cnpm如果你不想看到什么奇奇怪怪的爆红问题
nrm ls
nrm use taobao
# 安装依赖,这里有个问题,可能ELECTRON或者postcss会由于玄学原因安装失败,此时我推荐使用cnpm安装依赖然后!删除那个node_modules包,重新npm i,这样做的原因是
# ELECTRON只要下载了一次您自己没有清除缓存的话,就可以直接使用上次的安装包,这样通过cnpm安装完成之后,一定!要删除一次依赖包!一定哦!
# 再使用npm安装就会使用缓存了,免去那个魔法的过程~~
# 或者可以使用更加优秀的yarn。
npm install or yarn install
# 启动之后,会在9080端口监听
# 需要重新运行一次此命令
npm run dev
# build命令在不同系统环境中,需要的的不一样,需要自己根据自身环境进行配置
npm run build
# 启动单元测试模块,但是需要注意的是,我没有更新依赖,所以很可能会导致失败
npm test
# 如若实在不行无法安装electron依赖,请使用
npm config edit
# 该命令会打开npm的配置文件,请在registry=https://registry.npm.taobao.org/这行代码后的下一行添加
# electron_mirror=https://cdn.npm.taobao.org/dist/electron/ 和 sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
# 然后关闭该窗口,重启命令行,删除node_modules文件夹,并重新安装依赖即可
```
---
这个项目使用了 [electron-vue](https://github.com/SimulatedGREG/electron-vue)@[8fae476](https://github.com/SimulatedGREG/electron-vue/tree/8fae4763e9d225d3691b627e83b9e09b56f6c935) using [vue-cli](https://github.com/vuejs/vue-cli). 文档你们可以在这里看到: [这里](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html).
这是花裤衩大大原本的[地址](https://github.com/PanJiaChen/electron-vue-admin)
# 更新日志
- 剔除win打包依赖,因为太大了,将它放到码云的额外仓库中,[地址](https://gitee.com/Zh-Sky/HardToDownloadLib)
- 2020年02月06日更新:提升electron版本至7.1.11
- 2019年12月18日更新:例行更新了依赖,以及,我在build文件夹中加入了windows打包时候可能会用到的依赖,具体使用方法在压缩包内。
- 2019年11月11日更新:祝大家光棍节钱包快乐~~,今天的更新没有什么亮点,都是针对依赖的升级,新功能的添加可能会进入一个冷淡期,我现在也没有了好点子,也要步入学习了,可能master分支以后就是稳定的更新依赖,而另一个分支的话,则是我的一些觉得大家都会遇到的一些小问题,我尽量都实现出来。
- 2019年10月18日更新:不知不觉中倒也过去了一个月,啊哈哈这次更新给大家带来的是updater的示例,这依旧是个实验特性,所以在新分支中才可以使用,使用方式则是,安装依赖,
运行 `npm run update:serve` 来启动这个node服务器,然后您如果想在dev的时候就看到效果需要先运行build拿到 `latest.yml`文件,然后将其更名为 `dev-app-update.yml` 放入`dist/electron`中,和`main.js`同级,然后你需要关闭或者排除webpack的自动清除插件(我已经屏蔽了,所以无需大家自己动手),然后点击软件中的检查更新即可,记住当软件正在运行的时候,是无法应用安装的,所以您需要关闭之后方可安装。这并不是一个错误!
- 2019年9月18日更新:修正生产环境时,没有正确去除控制台输出的问题,双分支例行更新依赖,修正ui部分颜色问题,日后准备使用element主题功能
- 2019年9月16日更新:去除easymock,直接粗暴更改登陆验证,如有需要请自行修改,例行更新新分支依赖,修正当自定义头部和系统头部互换时,布局不会做出相应变化的问题。
- 2019年9月3日更新:修正了当nodejs >= 12时,出现process未定义的问题,新分支加入自定义头部,现在我们可以做出更cooool~~的效果了。
- 2019年8月20日更新:添加登录拦击,实现登录功能,在dev中加入关闭ELECTRON无用控制台输出,新分支例行更新依赖,加入生产环境屏蔽f12按键。
- 2019年8月13日更新:将新分支的所有依赖均更新至最新(但是我觉得,babel似乎有些东西不需要,还是保留着吧,日后测试后移除)依赖更新之后通过打包和dev测试
- 2019年8月12日更新:添加一个新分支,该新分支后续将会持续保持ELECTRON(包括其对应的辅助组件)的版本处于最新状态,去除了单元测试和一些无用的文件。master分支中则是为路由添加新参数具体
用途,详看路由中的注释
- 2019年8月10日更新:添加各个平台的build脚本,当您直接使用build时,则会打包您当前操作系统对应的安装包,mac需要在macos上才能进行打包,而linux打包win的话,需要wine的支持,否则会失败
- 2019年8月4日更新:修正原webpack配置中没有将config注入的小问题,添加了拦截实例,修改了侧栏,侧栏需要底色的请勿更新,此更新可能会导致侧栏底色无法完全覆盖(待修正),添加axios接口示例,待测。
- 2019年8月1日更新:将node-sass版本更新至最新版本,尝试修正由于nodejs环境是12版导致失败(注意!此次更新可能会导致32位系统或者nodejs版本低于10的用户安装依赖报错)去除路由表中重复路由,解决控制台无端报错问题。
This project was generated with [electron-vue](https://github.com/SimulatedGREG/electron-vue)@[8fae476](https://github.com/SimulatedGREG/electron-vue/tree/8fae4763e9d225d3691b627e83b9e09b56f6c935) using [vue-cli](https://github.com/vuejs/vue-cli). Documentation about the original structure can be found [here](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html).
# Electron-Vue-template
> An electron-vue project
#### Build Setup
``` bash
# For Chinese Developers
# install nrm
npm i -g nrm
# Switch to Taobao Source with NRM
nrm ls
nrm use taobao
# install dependencies
npm install
# serve with hot reload at localhost:9080
npm run dev
# build electron application for production
npm run build
# run unit & end-to-end tests
npm test
```
---
This project was generated with [electron-vue](https://github.com/SimulatedGREG/electron-vue)@[8fae476](https://github.com/SimulatedGREG/electron-vue/tree/8fae4763e9d225d3691b627e83b9e09b56f6c935) using [vue-cli](https://github.com/vuejs/vue-cli). Documentation about the original structure can be found [here](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html).
# Commented sections below can be used to run tests on the CI server
# https://simulatedgreg.gitbooks.io/electron-vue/content/en/testing.html#on-the-subject-of-ci-testing
version: 0.1.{build}
branches:
only:
- master
image: Visual Studio 2017
platform:
- x64
cache:
- node_modules
- '%APPDATA%\npm-cache'
- '%USERPROFILE%\.electron'
- '%USERPROFILE%\AppData\Local\Yarn\cache'
init:
- git config --global core.autocrlf input
install:
- ps: Install-Product node 8 x64
- git reset --hard HEAD
- yarn
- node --version
build_script:
#- yarn test
- yarn build
test: off
此文件的差异太大,无法显示。
......@@ -17,16 +17,16 @@
"pack": "npm run pack:main && npm run pack:renderer",
"pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
"pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
"update:serve": "node server/index.js",
"e2e": "npm run pack && mocha test/e2e",
"test": "npm run unit && npm run e2e",
"unit": "karma start test/unit/karma.conf.js"
"update:serve": "node server/index.js"
},
"build": {
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true
},
"extraFiles": [],
"publish": [
{
"provider": "generic",
"url": "http://127.0.0.1"
}
],
"productName": "electron-vue-admin",
"appId": "org.simulatedgreg.electron-vue",
"directories": {
......@@ -54,7 +54,16 @@
"icon": "build/icons/icon.icns"
},
"win": {
"icon": "build/icons/icon.ico"
"icon": "build/icons/icon.ico",
"target": [
{
"target": "nsis",
"arch": [
"x64",
"ia32"
]
}
]
},
"linux": {
"icon": "build/icons"
......@@ -70,7 +79,6 @@
"js-cookie": "^2.2.1",
"nedb": "^1.8.0",
"nprogress": "^0.2.0",
"sortablejs": "^1.10.2",
"vue": "^2.6.11",
"vue-electron": "^1.0.6",
"vue-router": "^3.1.6",
......@@ -78,65 +86,65 @@
"vuex-electron": "^1.0.3"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/plugin-proposal-do-expressions": "^7.8.3",
"@babel/plugin-proposal-export-default-from": "^7.8.3",
"@babel/plugin-proposal-export-namespace-from": "^7.8.3",
"@babel/plugin-proposal-function-bind": "^7.8.3",
"@babel/plugin-proposal-function-sent": "^7.8.3",
"@babel/plugin-proposal-json-strings": "^7.8.3",
"@babel/plugin-proposal-logical-assignment-operators": "^7.8.3",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
"@babel/plugin-proposal-numeric-separator": "^7.8.3",
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
"@babel/plugin-proposal-pipeline-operator": "^7.8.3",
"@babel/plugin-proposal-throw-expressions": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.9.0",
"@babel/polyfill": "^7.8.7",
"@babel/preset-env": "^7.9.5",
"@babel/register": "^7.9.0",
"@babel/runtime": "^7.9.2",
"ajv": "^6.12.0",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.3",
"babel-loader": "^7.1.5",
"babel-eslint": "^9.0.0",
"babel-loader": "^8.1.0",
"babel-minify-webpack-plugin": "^0.3.1",
"babel-plugin-dynamic-import-webpack": "^1.1.0",
"babel-plugin-istanbul": "^5.2.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.26.0",
"babili-webpack-plugin": "^0.1.2",
"cfonts": "^2.8.1",
"chai": "^4.2.0",
"chalk": "^4.0.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1",
"cross-env": "^7.0.2",
"css-loader": "^3.5.2",
"del": "^5.1.0",
"devtron": "^1.4.0",
"electron": "^7.2.1",
"electron-builder": "^22.4.1",
"electron-debug": "^3.0.1",
"electron-devtools-installer": "^3.0.0",
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"electron-devtools-installer": "^2.2.4",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.1",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^2.0.0",
"eslint-plugin-html": "^4.0.3",
"eslint-loader": "^3.0.4",
"eslint-plugin-html": "^6.0.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-standard": "^3.1.0",
"eslint-plugin-node": "^9.2.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"file-loader": "^6.0.0",
"happypack": "^5.0.1",
"hard-source-webpack-plugin": "^0.13.1",
"html-webpack-plugin": "^3.2.0",
"inject-loader": "^4.0.1",
"karma": "^2.0.2",
"karma-chai": "^0.1.0",
"karma-coverage": "^1.1.2",
"karma-electron": "^6.0.0",
"karma-mocha": "^1.3.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "^3.0.0",
"mini-css-extract-plugin": "0.9.0",
"mocha": "^5.2.0",
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
"node-sass": "^4.13.1",
"portfinder": "^1.0.25",
"require-dir": "^1.2.0",
"sass-loader": "^8.0.2",
"spectron": "^3.8.0",
"split2": "^3.1.1",
"style-loader": "^1.1.3",
"svg-sprite-loader": "^4.2.5",
"terser-webpack-plugin": "^2.3.5",
"through2-filter": "^3.0.0",
"url-loader": "^4.1.0",
"vue-html-loader": "^1.2.4",
"vue-loader": "^15.9.1",
......
version: 6.1.1
files:
- url: electron-vue-admin Setup 0.0.1.exe
sha512: 6higqp9mFJANIRdE59Cyl/3CgaWuHZU92EaRUfwTjXPi9b/OH/ndiLNhK8AgWB9JIz57xBwnmgXl+eT0xAjUGw==
size: 46775259
path: electron-vue-admin Setup 0.0.1.exe
sha512: 6higqp9mFJANIRdE59Cyl/3CgaWuHZU92EaRUfwTjXPi9b/OH/ndiLNhK8AgWB9JIz57xBwnmgXl+eT0xAjUGw==
releaseDate: '2019-10-18T05:21:25.707Z'
const express = require('express')
const path = require('path')
const app = express()
app.use(express.static(path.join(__dirname, './client')))
const server = app.listen(25565, function () {
const host = server.address().address
const port = server.address().port
console.log('服务启动', host, port)
})
{
"env": {
"mocha": true
},
"globals": {
"assert": true,
"expect": true,
"should": true,
"__static": true
}
}
'use strict'
// Set BABEL_ENV to use proper env config
process.env.BABEL_ENV = 'test'
// Enable use of ES6+ on required files
require('babel-register')({
ignore: /node_modules/
})
// Attach Chai APIs to global scope
const { expect, should, assert } = require('chai')
global.expect = expect
global.should = should
global.assert = assert
// Require all JS files in `./specs` for Mocha to consume
require('require-dir')('./specs')
import utils from '../utils'
describe('Launch', function () {
beforeEach(utils.beforeEach)
afterEach(utils.afterEach)
it('shows the proper application title', function () {
return this.app.client.getTitle()
.then(title => {
expect(title).to.equal('my-project')
})
})
})
import electron from 'electron'
import { Application } from 'spectron'
export default {
afterEach () {
this.timeout(10000)
if (this.app && this.app.isRunning()) {
return this.app.stop()
}
},
beforeEach () {
this.timeout(10000)
this.app = new Application({
path: electron,
args: ['dist/electron/main.js'],
startTimeout: 10000,
waitTimeout: 10000
})
return this.app.start()
}
}
import Vue from 'vue'
Vue.config.devtools = false
Vue.config.productionTip = false
// require all test files (files that ends with .spec.js)
const testsContext = require.context('./specs', true, /\.spec$/)
testsContext.keys().forEach(testsContext)
// require all src files except main.js for coverage.
// you can also change this to match only the subset of files that
// you want coverage for.
const srcContext = require.context('../../src/renderer', true, /^\.\/(?!main(\.js)?$)/)
srcContext.keys().forEach(srcContext)
'use strict'
const path = require('path')
const merge = require('webpack-merge')
const webpack = require('webpack')
const baseConfig = require('../../.electron-vue/webpack.renderer.config')
const projectRoot = path.resolve(__dirname, '../../src/renderer')
// Set BABEL_ENV to use proper preset config
process.env.BABEL_ENV = 'test'
let webpackConfig = merge(baseConfig, {
devtool: '#inline-source-map',
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"testing"'
})
]
})
// don't treat dependencies as externals
delete webpackConfig.entry
delete webpackConfig.externals
delete webpackConfig.output.libraryTarget
// apply vue option to apply isparta-loader on js
webpackConfig.module.rules
.find(rule => rule.use.loader === 'vue-loader').use.options.loaders.js = 'babel-loader'
module.exports = config => {
config.set({
browsers: ['visibleElectron'],
client: {
useIframe: false
},
coverageReporter: {
dir: './coverage',
reporters: [
{ type: 'lcov', subdir: '.' },
{ type: 'text-summary' }
]
},
customLaunchers: {
'visibleElectron': {
base: 'Electron',
flags: ['--show']
}
},
frameworks: ['mocha', 'chai'],
files: ['./index.js'],
preprocessors: {
'./index.js': ['webpack', 'sourcemap']
},
reporters: ['spec', 'coverage'],
singleRun: true,
webpack: webpackConfig,
webpackMiddleware: {
noInfo: true
}
})
}
import Vue from 'vue'
import LandingPage from '@/components/LandingPage'
describe('LandingPage.vue', () => {
it('should render correct contents', () => {
const vm = new Vue({
el: document.createElement('div'),
render: h => h(LandingPage)
}).$mount()
expect(vm.$el.querySelector('.title').textContent).to.contain('Welcome to your new project!')
})
})
- iohook<br/>地址是:https://github.com/wilix-team/iohook 文档地址:https://wilix-team.github.io/iohook/ <br/>该库功能为全局监听键盘和鼠标事件,因为是由c++去实现的,所以可能需要rebuild。具体使用请看文档
-
\ No newline at end of file