diff --git a/.electron-vue/webpack.docs.config.js b/.electron-vue/webpack.docs.config.js new file mode 100644 index 000000000..0c5fff4cd --- /dev/null +++ b/.electron-vue/webpack.docs.config.js @@ -0,0 +1,92 @@ +const HtmlWebpackPlugin = require('html-webpack-plugin') +const ExtractTextPlugin = require('extract-text-webpack-plugin') +const path = require('path') + +module.exports = { + context: path.resolve(__dirname, '../docs'), + entry: './main.js', + output: { + path: path.resolve(__dirname, '../docs/dist'), + filename: "index.js" + }, + resolve: { + alias: { + 'icons': path.resolve(__dirname, '../build/icons') + } + }, + module: { + rules: [ + { + test: /\.(js|vue)$/, + enforce: 'pre', + exclude: /node_modules/, + use: { + loader: 'eslint-loader', + options: { + formatter: require('eslint-friendly-formatter') + } + } + }, + { + test: /\.css$/, + use: ExtractTextPlugin.extract({ + fallback: 'style-loader', + use: 'css-loader' + }) + }, + { + test: /\.html$/, + use: 'vue-html-loader' + }, + { + test: /\.js$/, + use: 'babel-loader', + exclude: /node_modules/ + }, + { + test: /\.node$/, + use: 'node-loader' + }, + { + test: /\.vue$/, + use: { + loader: 'vue-loader', + } + }, + { + test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, + use: { + loader: 'url-loader', + query: { + limit: 10000, + name: 'imgs/[name]--[folder].[ext]' + } + } + }, + { + test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, + loader: 'url-loader', + options: { + limit: 10000, + name: 'media/[name]--[folder].[ext]' + } + }, + { + test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, + use: { + loader: 'url-loader', + query: { + limit: 10000, + name: 'fonts/[name]--[folder].[ext]' + } + } + } + ] + }, + plugins: [ + new HtmlWebpackPlugin({ + template: path.resolve(__dirname, '../docs/template.html') + }), + new ExtractTextPlugin("styles.css") + ] +} diff --git a/.gitignore b/.gitignore index 15976a90d..998a10de7 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ npm-debug.log.* thumbs.db !.gitkeep yarn-error.log +docs/dist/ diff --git a/docs/APP.vue b/docs/APP.vue new file mode 100644 index 000000000..5c866bb40 --- /dev/null +++ b/docs/APP.vue @@ -0,0 +1,185 @@ + + + \ No newline at end of file diff --git a/docs/main.js b/docs/main.js new file mode 100644 index 000000000..59513adb8 --- /dev/null +++ b/docs/main.js @@ -0,0 +1,7 @@ +import Vue from 'vue' +import App from './APP.vue' +import 'melody.css' + +new Vue({ + render: h => h(App) +}).$mount('#app') diff --git a/docs/template.html b/docs/template.html new file mode 100644 index 000000000..88af5996f --- /dev/null +++ b/docs/template.html @@ -0,0 +1,12 @@ + + + + + + + PicGo + + +
+ + \ No newline at end of file diff --git a/package.json b/package.json index e178f1370..21a1e8682 100644 --- a/package.json +++ b/package.json @@ -19,10 +19,12 @@ "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js", "test": "npm run unit && npm run e2e", "unit": "karma start test/unit/karma.conf.js", - "postinstall": "npm run lint:fix" + "postinstall": "npm run lint:fix", + "build:docs": "webpack -p --config .electron-vue/webpack.docs.config.js", + "docs": "webpack-dev-server --content-base docs/dist --config .electron-vue/webpack.docs.config.js --hot --inline" }, "build": { - "productName": "picgo", + "productName": "PicGo", "appId": "org.simulatedgreg.electron-vue", "directories": { "output": "build" @@ -46,7 +48,10 @@ ] }, "mac": { - "icon": "build/icons/icon.icns" + "icon": "build/icons/icon.icns", + "extendInfo": { + "LSUIElement": 1 + } }, "win": { "icon": "build/icons/icon.ico" @@ -62,6 +67,7 @@ "image-size": "^0.6.1", "lodash-id": "^0.14.0", "lowdb": "^1.0.0", + "melody.css": "^1.0.2", "qiniu": "^7.1.1", "request": "^2.83.0", "request-promise": "^4.2.2", @@ -118,6 +124,8 @@ "mocha": "^3.0.2", "multispinner": "^0.2.1", "node-loader": "^0.6.0", + "pug": "^2.0.0-rc.4", + "pug-loader": "^2.3.0", "require-dir": "^0.3.0", "spectron": "^3.7.1", "style-loader": "^0.18.2", diff --git a/src/main/index.js b/src/main/index.js index 09e183d2f..5500be5a7 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -25,15 +25,12 @@ const settingWinURL = process.env.NODE_ENV === 'development' function createTray () { tray = new Tray(`${__static}/menubar.png`) const contextMenu = Menu.buildFromTemplate([ - { - role: 'quit', - label: 'Quit' - }, { label: '打开详细窗口', click () { if (settingWindow === null) { createSettingWindow() + settingWindow.show() } else { settingWindow.show() settingWindow.focus() @@ -63,6 +60,10 @@ function createTray () { } } ] + }, + { + role: 'quit', + label: '退出' } ]) tray.on('right-click', () => { @@ -92,7 +93,7 @@ function createTray () { }) tray.on('drag-end', () => { - tray.setImage(`${__static}/menubarDefaultTemplate.png`) + tray.setImage(`${__static}/menubar.png`) }) tray.on('drop-files', async (event, files) => { diff --git a/yarn.lock b/yarn.lock index 351a153d7..46895b472 100644 --- a/yarn.lock +++ b/yarn.lock @@ -62,17 +62,23 @@ acorn-dynamic-import@^2.0.0: dependencies: acorn "^4.0.3" +acorn-globals@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" + dependencies: + acorn "^4.0.4" + acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" dependencies: acorn "^3.0.4" -acorn@^3.0.4: +acorn@^3.0.4, acorn@^3.1.0, acorn@~3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^4.0.3: +acorn@^4.0.3, acorn@^4.0.4, acorn@~4.0.2: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" @@ -288,6 +294,10 @@ arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" +asap@~2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + asar-integrity@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/asar-integrity/-/asar-integrity-0.2.3.tgz#b238a68ef1218561b4904db8400c0943fbc62c62" @@ -1841,6 +1851,12 @@ change-case@3.0.x: upper-case "^1.1.1" upper-case-first "^1.1.0" +character-parser@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/character-parser/-/character-parser-2.2.0.tgz#c7ce28f36d4bcd9744e5ffc2c5fcde1c73261fc0" + dependencies: + is-regex "^1.0.3" + chardet@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.0.tgz#0bbe1355ac44d7a3ed4a925707c4ef70f8190f6c" @@ -1893,7 +1909,7 @@ clap@^1.0.9: dependencies: chalk "^1.1.3" -clean-css@3.4.x: +clean-css@3.4.x, clean-css@^3.3.0: version "3.4.28" resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-3.4.28.tgz#bf1945e82fc808f55695e6ddeaec01400efd03ff" dependencies: @@ -2148,6 +2164,13 @@ constant-case@^2.0.0: snake-case "^2.1.0" upper-case "^1.1.1" +constantinople@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/constantinople/-/constantinople-3.1.0.tgz#7569caa8aa3f8d5935d62e1fa96f9f702cd81c79" + dependencies: + acorn "^3.1.0" + is-expression "^2.0.1" + constants-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" @@ -2678,6 +2701,10 @@ doctrine@^2.0.0: esutils "^2.0.2" isarray "^1.0.0" +doctypes@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/doctypes/-/doctypes-1.1.0.tgz#ea80b106a87538774e8a3a4a5afe293de489e0a9" + dom-converter@~0.1: version "0.1.4" resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.1.4.tgz#a45ef5727b890c9bffe6d7c876e7b19cb0e17f3b" @@ -4403,6 +4430,20 @@ is-equal-shallow@^0.1.3: dependencies: is-primitive "^2.0.0" +is-expression@^2.0.1: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-expression/-/is-expression-2.1.0.tgz#91be9d47debcfef077977e9722be6dcfb4465ef0" + dependencies: + acorn "~3.3.0" + object-assign "^4.0.1" + +is-expression@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-expression/-/is-expression-3.0.0.tgz#39acaa6be7fd1f3471dc42c7416e61c24317ac9f" + dependencies: + acorn "~4.0.2" + object-assign "^4.0.1" + is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -4514,7 +4555,7 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" -is-promise@^2.1.0: +is-promise@^2.0.0, is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" @@ -4522,7 +4563,7 @@ is-redirect@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" -is-regex@^1.0.4: +is-regex@^1.0.3, is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" dependencies: @@ -4643,6 +4684,10 @@ js-string-escape@~1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/js-string-escape/-/js-string-escape-1.0.1.tgz#e2625badbc0d67c7533e9edc1068c587ae4137ef" +js-stringify@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/js-stringify/-/js-stringify-1.0.2.tgz#1736fddfd9724f28a3682adc6230ae7e4e9679db" + js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" @@ -4732,6 +4777,13 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" +jstransformer@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/jstransformer/-/jstransformer-1.0.0.tgz#ed8bf0921e2f3f1ed4d5c1a44f68709ed24722c3" + dependencies: + is-promise "^2.0.0" + promise "^7.0.1" + karma-chai@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/karma-chai/-/karma-chai-0.1.0.tgz#bee5ad40400517811ae34bb945f762909108b79a" @@ -4919,7 +4971,7 @@ loader-runner@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2" -loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@^0.2.5: +loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@^0.2.5, loader-utils@~0.2.5: version "0.2.17" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348" dependencies: @@ -5221,6 +5273,10 @@ media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" +melody.css@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/melody.css/-/melody.css-1.0.2.tgz#dd754d36316e01d9fe0cd025f61808359ac6efa5" + mem@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" @@ -6314,6 +6370,12 @@ progress@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" +promise@^7.0.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + dependencies: + asap "~2.0.3" + proxy-addr@~2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.2.tgz#6571504f47bb988ec8180253f85dd7e14952bdec" @@ -6339,6 +6401,107 @@ public-encrypt@^4.0.0: parse-asn1 "^5.0.0" randombytes "^2.0.1" +pug-attrs@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/pug-attrs/-/pug-attrs-2.0.2.tgz#8be2b2225568ffa75d1b866982bff9f4111affcb" + dependencies: + constantinople "^3.0.1" + js-stringify "^1.0.1" + pug-runtime "^2.0.3" + +pug-code-gen@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pug-code-gen/-/pug-code-gen-2.0.0.tgz#96aea39a9e62f1ec5d2b6a5b42a29d528c70b43d" + dependencies: + constantinople "^3.0.1" + doctypes "^1.1.0" + js-stringify "^1.0.1" + pug-attrs "^2.0.2" + pug-error "^1.3.2" + pug-runtime "^2.0.3" + void-elements "^2.0.1" + with "^5.0.0" + +pug-error@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/pug-error/-/pug-error-1.3.2.tgz#53ae7d9d29bb03cf564493a026109f54c47f5f26" + +pug-filters@^2.1.5: + version "2.1.5" + resolved "https://registry.yarnpkg.com/pug-filters/-/pug-filters-2.1.5.tgz#66bf6e80d97fbef829bab0aa35eddff33fc964f3" + dependencies: + clean-css "^3.3.0" + constantinople "^3.0.1" + jstransformer "1.0.0" + pug-error "^1.3.2" + pug-walk "^1.1.5" + resolve "^1.1.6" + uglify-js "^2.6.1" + +pug-lexer@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/pug-lexer/-/pug-lexer-3.1.0.tgz#fd087376d4a675b4f59f8fef422883434e9581a2" + dependencies: + character-parser "^2.1.1" + is-expression "^3.0.0" + pug-error "^1.3.2" + +pug-linker@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/pug-linker/-/pug-linker-3.0.3.tgz#25f59eb750237f0368e59c3379764229c0189c41" + dependencies: + pug-error "^1.3.2" + pug-walk "^1.1.5" + +pug-load@^2.0.9: + version "2.0.9" + resolved "https://registry.yarnpkg.com/pug-load/-/pug-load-2.0.9.tgz#ee217c914cc1d9324d44b86c32d1df241d36de7a" + dependencies: + object-assign "^4.1.0" + pug-walk "^1.1.5" + +pug-loader@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pug-loader/-/pug-loader-2.3.0.tgz#b869294413a2218f0a7dd92a953e592283676c10" + dependencies: + loader-utils "~0.2.5" + pug-walk "^1.0.0" + resolve "^1.1.7" + +pug-parser@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pug-parser/-/pug-parser-4.0.0.tgz#c9f52322e4eabe4bf5beeba64ed18373bb627801" + dependencies: + pug-error "^1.3.2" + token-stream "0.0.1" + +pug-runtime@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/pug-runtime/-/pug-runtime-2.0.3.tgz#98162607b0fce9e254d427f33987a5aee7168bda" + +pug-strip-comments@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pug-strip-comments/-/pug-strip-comments-1.0.2.tgz#d313afa01bcc374980e1399e23ebf2eb9bdc8513" + dependencies: + pug-error "^1.3.2" + +pug-walk@^1.0.0, pug-walk@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/pug-walk/-/pug-walk-1.1.5.tgz#90e943acbcf7021e6454cf1b32245891cba6f851" + +pug@^2.0.0-rc.4: + version "2.0.0-rc.4" + resolved "https://registry.yarnpkg.com/pug/-/pug-2.0.0-rc.4.tgz#b7b08f6599bd5302568042b7436984fb28c80a13" + dependencies: + pug-code-gen "^2.0.0" + pug-filters "^2.1.5" + pug-lexer "^3.1.0" + pug-linker "^3.0.3" + pug-load "^2.0.9" + pug-parser "^4.0.0" + pug-runtime "^2.0.3" + pug-strip-comments "^1.0.2" + pump@^1.0.0, pump@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/pump/-/pump-1.0.3.tgz#5dfe8311c33bbf6fc18261f9f34702c47c08a954" @@ -6787,7 +6950,7 @@ resolve@1.1.x: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" -resolve@^1.2.0, resolve@^1.3.3, resolve@^1.4.0: +resolve@^1.1.6, resolve@^1.1.7, resolve@^1.2.0, resolve@^1.3.3, resolve@^1.4.0: version "1.5.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: @@ -7580,6 +7743,10 @@ to-fast-properties@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" +token-stream@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/token-stream/-/token-stream-0.0.1.tgz#ceeefc717a76c4316f126d0b9dbaa55d7e7df01a" + toposort@^1.0.0: version "1.0.6" resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.6.tgz#c31748e55d210effc00fdcdc7d6e68d7d7bb9cec" @@ -7659,7 +7826,7 @@ uglify-js@3.1.x: commander "~2.11.0" source-map "~0.6.1" -uglify-js@^2.6, uglify-js@^2.8.29: +uglify-js@^2.6, uglify-js@^2.6.1, uglify-js@^2.8.29: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" dependencies: @@ -7887,7 +8054,7 @@ vm-browserify@0.0.4: dependencies: indexof "0.0.1" -void-elements@^2.0.0: +void-elements@^2.0.0, void-elements@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec" @@ -8162,6 +8329,13 @@ window-size@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.3.0.tgz#b8f0b66e325d22160751e496337e44b45b727546" +with@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/with/-/with-5.1.1.tgz#fa4daa92daf32c4ea94ed453c81f04686b575dfe" + dependencies: + acorn "^3.1.0" + acorn-globals "^3.0.0" + wordwrap@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"