Skip to content

Commit

Permalink
Merge pull request #2 from jingchenxu/electron-builder
Browse files Browse the repository at this point in the history
Electron builder
  • Loading branch information
jingchenxu authored Sep 20, 2018
2 parents 88f3b28 + f856d1d commit 2a79bb9
Show file tree
Hide file tree
Showing 21 changed files with 581 additions and 9,141 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
node_modules
/dist
/outApp
/outinstaller

/tests/e2e/videos/
/tests/e2e/screenshots/
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,43 @@ yarn run test:unit
```
yarn run test:e2e
```

### Color list

white red yellow teal cyan

---

### 备忘

- electron-builder 打包失败问题

> 正常的打包时没有问题的,只要打包程序能够将将所需的包下载即可,看到一些代码好像时golang写的,但是存在一些问题需要注意,我是用的electron-builder是20.28.4版本的,到目前为止应该是最新的。
- 遇到的第一个问题如下:infinite loop

> github上参见issue:[#3037](https://github.com/electron-userland/electron-builder/issues/3037) 主要的修改方法是修改包中的代码:将AppFileCopierHelper.js文件中的```` platformPackager.info.appDir ````修改为 ````(require('path').relative(process.cwd(), platformPackager.info.appDir))````这里修改完成后需要注意的是,这边的代码还应该是有问题的,但是在打包完成时进行安装时出现了报错,主要时找不到npm依赖,将build配置文件中的asar设置为false,这样不会加密开发的代码,不加密代码则可以看到打包后的代码结构,会发现打包后的代码中npm的包少了,dependency中的包时安装了,但是这些包相关的依赖未能正常安装。
- 为electron-builder添加额外的npm包,这些包时dependecy中的依赖的依赖

````
"bignumber.js": "^4.1.0",
"readable-stream": "^2.3.6",
"safe-buffer": "^5.1.2",
"sqlstring": "^2.3.1",
"async": "^0.2.10",
"binary-search-tree": "^0.2.5",
"localforage": "^1.3.0",
"mkdirp": "^0.5.1",
"underscore": "^1.4.4",
"core-util-is": "^1.0.2",
"immediate": "^3.0.6",
"inherits": "^2.0.3",
"isarray": "^1.0.0",
"lie": "^3.1.1",
"process-nextick-args": "^2.0.0",
"util-deprecate": "^1.0.2"
````



8 changes: 7 additions & 1 deletion electron/StorageInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ class StorageInit {

REMOVE (DATA) {
let me = this
console.dir(DATA)
// id 作为主键
let params = {
id: DATA.id
}
let result = new Promise(function (resolve, reject) {
me.db.remove({}, { muti: true }, (err, ret) => {
me.db.remove(params, {}, (err, ret) => {
console.dir(params)
if (err) {
reject(err)
} else {
Expand Down
52 changes: 48 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,73 @@
{
"name": "GoogleKeep",
"author": "[email protected]",
"description": "Rosa",
"license": "ISC",
"version": "0.1.0",
"private": true,
"main": "main.js",
"build": {
"asar": true,
"appId": "com.deepwater.Rosa",
"copyright": "[email protected]",
"productName": "Rosa",
"directories": {
"output": "outInstaller"
},
"dmg": {
"background": "./src/assets/rosa.jpg",
"window": {
"x": 100,
"y": 100,
"width": 600,
"height": 500
}
},
"win": {
"icon": "./public/win.ico",
"publish": ["github"]
},
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true
}
},
"scripts": {
"start": "cross-env NODE_ENV=devlopment electron .",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e",
"package-win": "cross-env NODE_ENV=production electron-packager . GoogleKeep --platform=win32 --arch=x64 --out ./outApp --icon=./dist/favicon.ico --app-version=0.0.1 --electron-version=2.0.8 --overwrite"
"package-win": "cross-env NODE_ENV=production electron-packager . GoogleKeep --platform=win32 --arch=x64 --out ./outApp --icon=./dist/favicon.ico --app-version=0.0.1 --electron-version=2.0.8 --overwrite",
"build-win": "build --win --x64"
},
"dependencies": {
"electron": "^2.0.8",
"mysql": "^2.16.0",
"nedb": "^1.8.0",
"register-service-worker": "^1.0.0",
"vue": "^2.5.17",
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^7.0.0",
"vue-router": "^3.0.1",
"vue-waterfall": "^1.0.6",
"vuetify": "^1.0.19",
"vuex": "^3.0.1"
"vuex": "^3.0.1",
"bignumber.js": "^4.1.0",
"readable-stream": "^2.3.6",
"safe-buffer": "^5.1.2",
"sqlstring": "^2.3.1",
"async": "^0.2.10",
"binary-search-tree": "^0.2.5",
"localforage": "^1.3.0",
"mkdirp": "^0.5.1",
"underscore": "^1.4.4",
"core-util-is": "^1.0.2",
"immediate": "^3.0.6",
"inherits": "^2.0.3",
"isarray": "^1.0.0",
"lie": "^3.1.1",
"process-nextick-args": "^2.0.0",
"util-deprecate": "^1.0.2"
},
"devDependencies": {
"@babel/polyfill": "^7.0.0-beta.49",
Expand All @@ -44,6 +86,8 @@
"babel-plugin-transform-imports": "^1.4.1",
"chai": "^4.1.2",
"cross-env": "^5.2.0",
"electron": "^2.0.8",
"electron-builder": "^20.28.4",
"electron-packager": "^12.1.1",
"less": "^3.0.4",
"less-loader": "^4.1.0",
Expand Down
Binary file added public/win.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions rosa
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{"height":400,"id":1537257592854,"noteContent":"14","noteTitle":"14","width":300,"_id":"Uq3bGApRtXiNKhSw","createdAt":{"$$date":1537257593027},"updatedAt":{"$$date":1537257593027}}
{"height":400,"id":1537259088397,"noteContent":"15","noteTitle":"15","width":300,"_id":"dq6TWS3kIPVsilwO","createdAt":{"$$date":1537259088594},"updatedAt":{"$$date":1537259088594}}
{"height":400,"id":1537257475223,"noteContent":"13","noteTitle":"13","width":300,"_id":"hcNIYxIQecbiji7a","createdAt":{"$$date":1537257475400},"updatedAt":{"$$date":1537257475400}}
{"height":400,"id":1537257588239,"noteContent":"11","noteTitle":"11","width":300,"_id":"llq22mSNgAZMouVG","createdAt":{"$$date":1537257588393},"updatedAt":{"$$date":1537257588393}}
Binary file added src/assets/rosa.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/trash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions src/components/AddCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@
<v-btn small icon>
<v-icon small color="grey">mdi-account-plus</v-icon>
</v-btn>
<v-btn small icon>
<v-icon small color="grey">mdi-palette</v-icon>
</v-btn>
<v-tooltip top>
<v-btn slot="activator" small icon>
<v-icon small color="grey">mdi-palette</v-icon>
</v-btn>
<ColorSelector/>
</v-tooltip>
<v-btn small icon>
<v-icon small color="grey">image</v-icon>
</v-btn>
Expand All @@ -72,9 +75,13 @@

<script>
const {ipcRenderer} = window.require('electron')
import ColorSelector from './ColorSelector'
export default {
name: 'add-card',
components: {
ColorSelector
},
data () {
return {
noteType: 'list', // list | note | image | pen
Expand Down
24 changes: 24 additions & 0 deletions src/components/ColorSelector.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<template>
<div class="color-selector">

</div>
</template>

<script>
export default {
name: 'color-selector',
data () {
return {}
}
}
</script>

<style scoped>
.color-selector {
width: 150px;
height: 120px;
background-color: grey;
}
</style>


54 changes: 8 additions & 46 deletions src/components/NoteCard.vue
Original file line number Diff line number Diff line change
@@ -1,52 +1,16 @@
<template>
<v-card :id="noteDetail.id" ref="notecard" hover active-class="noteDisabled noteActive">
<v-card color="red" :id="noteDetail.id" ref="notecard" hover active-class="noteDisabled noteActive">
<v-card-title @click="noteClick">
<v-badge color="white" left>
<v-btn @click="deleteNote" slot="badge" small icon>
<v-btn outline @click="deleteNote" slot="badge" small icon>
<v-icon small color="grey">mdi-close</v-icon>
</v-btn>
<div class="headline">{{noteDetail.noteTitle}}</div>
<div>{{noteDetail.noteContent}}</div>
</v-badge>
</v-card-title>
<v-card-actions>
<v-tooltip bottom>
<v-btn slot="activator" small icon>
<v-icon small color="grey">mdi-reminder</v-icon>
</v-btn>
<span>提醒我</span>
</v-tooltip>
<v-tooltip bottom>
<v-btn slot="activator" small icon>
<v-icon small color="grey">mdi-account-plus</v-icon>
</v-btn>
<span>协作者</span>
</v-tooltip>
<v-tooltip bottom>
<v-btn slot="activator" small icon>
<v-icon small color="grey">mdi-palette</v-icon>
</v-btn>
<span>更改颜色</span>
</v-tooltip>
<v-tooltip bottom>
<v-btn slot="activator" small icon>
<v-icon small color="grey">image</v-icon>
</v-btn>
<span>添加图片</span>
</v-tooltip>
<v-btn small icon>
<v-icon small color="grey">mdi-package-down</v-icon>
</v-btn>
<v-menu offset-y>
<v-btn slot="activator" small icon>
<v-icon color="grey">mdi-dots-vertical</v-icon>
</v-btn>
<v-list>
<v-list-tile v-for="(item, index) in items" :key="index">
<v-list-tile-title>{{ item.title }}</v-list-tile-title>
</v-list-tile>
</v-list>
</v-menu>
<NoteCardActions></NoteCardActions>
</v-card-actions>
<v-dialog v-model="dialog">
<v-card>
Expand Down Expand Up @@ -105,9 +69,13 @@

<script>
let { ipcRenderer } = window.require('electron')
import NoteCardActions from './NoteCardActions'
export default {
name: 'note-card',
components: {
NoteCardActions
},
props: {
noteDetail: {
type: Object,
Expand All @@ -121,12 +89,6 @@ export default {
data () {
return {
card: { title: 'Favorite road trips', src: 'https://cdn.vuetifyjs.com/images/cards/road.jpg', flex: 6 },
items: [
{ title: '删除这条记事' },
{ title: '添加标签' },
{ title: '添加绘图' },
{ title: '复制' }
],
dialog: false,
note: {},
}
Expand Down Expand Up @@ -214,7 +176,7 @@ export default {
visibility: hidden;
}
.headline {
font-family: 'Roboto Condensed',arial,sans-serif;
font-family: 'Roboto Condensed', arial, sans-serif;
font-size: 17px;
font-weight: bold;
line-height: 23px;
Expand Down
79 changes: 79 additions & 0 deletions src/components/NoteCardActions.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<template>
<div class="note-card-actions">
<v-layout row wrap>
<v-flex xs2>
<v-tooltip bottom>
<v-btn slot="activator" small icon>
<v-icon small color="grey">mdi-reminder</v-icon>
</v-btn>
<span>提醒我</span>
</v-tooltip>
</v-flex>
<v-flex xs2>
<v-tooltip bottom>
<v-btn slot="activator" small icon>
<v-icon small color="grey">mdi-account-plus</v-icon>
</v-btn>
<span>协作者</span>
</v-tooltip>
</v-flex>
<v-flex xs2>
<v-tooltip bottom>
<v-btn slot="activator" small icon>
<v-icon small color="grey">mdi-palette</v-icon>
</v-btn>
<span>更改颜色</span>
</v-tooltip>
</v-flex>
<v-flex xs2>
<v-tooltip bottom>
<v-btn slot="activator" small icon>
<v-icon small color="grey">image</v-icon>
</v-btn>
<span>添加图片</span>
</v-tooltip>
</v-flex>
<v-flex xs2>
<v-btn small icon>
<v-icon small color="grey">mdi-package-down</v-icon>
</v-btn>
</v-flex>
<v-flex xs2>
<v-menu offset-y>
<v-btn slot="activator" small icon>
<v-icon color="grey">mdi-dots-vertical</v-icon>
</v-btn>
<v-list>
<v-list-tile v-for="(item, index) in items" :key="index">
<v-list-tile-title>{{ item.title }}</v-list-tile-title>
</v-list-tile>
</v-list>
</v-menu>
</v-flex>
</v-layout>
</div>
</template>

<script>
export default {
name: 'note-card-actions',
data () {
return {
items: [
{ title: '删除这条记事' },
{ title: '添加标签' },
{ title: '添加绘图' },
{ title: '复制' }
],
}
}
}
</script>

<style scoped>
.note-card-actions {
width: 240px;
height: auto;
}
</style>

Loading

0 comments on commit 2a79bb9

Please sign in to comment.