├── .babelrc
├── .electron-vue
├── build.config.js
├── build.js
├── dev-client.js
├── dev-runner.js
├── webpack.main.config.js
├── webpack.renderer.config.js
└── webpack.web.config.js
├── .eslintignore
├── .eslintrc.js
├── .gitignore
├── LICENSE
├── README.md
├── dist
├── electron
│ └── .gitkeep
└── web
│ └── .gitkeep
├── icons
├── icon.icns
└── icon.ico
├── package.json
├── screenshot.png
├── src
├── index.ejs
├── main
│ ├── index.dev.js
│ └── index.js
└── renderer
│ ├── App.vue
│ ├── assets
│ ├── .gitkeep
│ └── logo.png
│ ├── components
│ ├── BookmarkList.vue
│ ├── SideDrawer.vue
│ └── registerComponents.js
│ ├── db.js
│ ├── helper
│ └── fetch.js
│ ├── main.js
│ └── store
│ ├── index.js
│ └── modules
│ ├── bookmark.js
│ └── index.js
├── static
└── .gitkeep
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "comments": false,
3 | "env": {
4 | "main": {
5 | "presets": [
6 | ["env", {
7 | "targets": { "node": 7 }
8 | }],
9 | "stage-0"
10 | ]
11 | },
12 | "renderer": {
13 | "presets": [
14 | ["env", {
15 | "modules": false
16 | }],
17 | "stage-0"
18 | ]
19 | },
20 | "web": {
21 | "presets": [
22 | ["env", {
23 | "modules": false
24 | }],
25 | "stage-0"
26 | ]
27 | }
28 | },
29 | "plugins": ["transform-runtime"]
30 | }
31 |
--------------------------------------------------------------------------------
/.electron-vue/build.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 |
3 | /**
4 | * `electron-packager` options
5 | * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-packager.html
6 | */
7 | module.exports = {
8 | arch: 'x64',
9 | asar: true,
10 | dir: path.join(__dirname, '../'),
11 | icon: path.join(__dirname, '../icons/icon'),
12 | ignore: /(^\/(src|test|\.[a-z]+|README|yarn|static|dist\/web))|\.gitkeep/,
13 | out: path.join(__dirname, '../build'),
14 | overwrite: true,
15 | platform: process.env.BUILD_TARGET || 'all'
16 | }
17 |
--------------------------------------------------------------------------------
/.electron-vue/build.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | process.env.NODE_ENV = 'production'
4 |
5 | const { say } = require('cfonts')
6 | const chalk = require('chalk')
7 | const del = require('del')
8 | const packager = require('electron-packager')
9 | const webpack = require('webpack')
10 | const Multispinner = require('multispinner')
11 |
12 | const buildConfig = require('./build.config')
13 | const mainConfig = require('./webpack.main.config')
14 | const rendererConfig = require('./webpack.renderer.config')
15 | const webConfig = require('./webpack.web.config')
16 |
17 | const doneLog = chalk.bgGreen.white(' DONE ') + ' '
18 | const errorLog = chalk.bgRed.white(' ERROR ') + ' '
19 | const okayLog = chalk.bgBlue.white(' OKAY ') + ' '
20 | const isCI = process.env.CI || false
21 |
22 | if (process.env.BUILD_TARGET === 'clean') clean()
23 | else if (process.env.BUILD_TARGET === 'web') web()
24 | else build()
25 |
26 | function clean () {
27 | del.sync(['build/*', '!build/icons', '!build/icons/icon.*'])
28 | console.log(`\n${doneLog}\n`)
29 | process.exit()
30 | }
31 |
32 | function build () {
33 | greeting()
34 |
35 | del.sync(['dist/electron/*', '!.gitkeep'])
36 |
37 | const tasks = ['main', 'renderer']
38 | const m = new Multispinner(tasks, {
39 | preText: 'building',
40 | postText: 'process'
41 | })
42 |
43 | let results = ''
44 |
45 | m.on('success', () => {
46 | process.stdout.write('\x1B[2J\x1B[0f')
47 | console.log(`\n\n${results}`)
48 | console.log(`${okayLog}take it away ${chalk.yellow('`electron-packager`')}\n`)
49 | bundleApp()
50 | })
51 |
52 | pack(mainConfig).then(result => {
53 | results += result + '\n\n'
54 | m.success('main')
55 | }).catch(err => {
56 | m.error('main')
57 | console.log(`\n ${errorLog}failed to build main process`)
58 | console.error(`\n${err}\n`)
59 | process.exit(1)
60 | })
61 |
62 | pack(rendererConfig).then(result => {
63 | results += result + '\n\n'
64 | m.success('renderer')
65 | }).catch(err => {
66 | m.error('renderer')
67 | console.log(`\n ${errorLog}failed to build renderer process`)
68 | console.error(`\n${err}\n`)
69 | process.exit(1)
70 | })
71 | }
72 |
73 | function pack (config) {
74 | return new Promise((resolve, reject) => {
75 | webpack(config, (err, stats) => {
76 | if (err) reject(err.stack || err)
77 | else if (stats.hasErrors()) {
78 | let err = ''
79 |
80 | stats.toString({
81 | chunks: false,
82 | colors: true
83 | })
84 | .split(/\r?\n/)
85 | .forEach(line => {
86 | err += ` ${line}\n`
87 | })
88 |
89 | reject(err)
90 | } else {
91 | resolve(stats.toString({
92 | chunks: false,
93 | colors: true
94 | }))
95 | }
96 | })
97 | })
98 | }
99 |
100 | function bundleApp () {
101 | packager(buildConfig, (err, appPaths) => {
102 | if (err) {
103 | console.log(`\n${errorLog}${chalk.yellow('`electron-packager`')} says...\n`)
104 | console.log(err + '\n')
105 | } else {
106 | console.log(`\n${doneLog}\n`)
107 | }
108 | })
109 | }
110 |
111 | function web () {
112 | del.sync(['dist/web/*', '!.gitkeep'])
113 | webpack(webConfig, (err, stats) => {
114 | if (err || stats.hasErrors()) console.log(err)
115 |
116 | console.log(stats.toString({
117 | chunks: false,
118 | colors: true
119 | }))
120 |
121 | process.exit()
122 | })
123 | }
124 |
125 | function greeting () {
126 | const cols = process.stdout.columns
127 | let text = ''
128 |
129 | if (cols > 85) text = 'lets-build'
130 | else if (cols > 60) text = 'lets-|build'
131 | else text = false
132 |
133 | if (text && !isCI) {
134 | say(text, {
135 | colors: ['yellow'],
136 | font: 'simple3d',
137 | space: false
138 | })
139 | } else console.log(chalk.yellow.bold('\n lets-build'))
140 | console.log()
141 | }
142 |
--------------------------------------------------------------------------------
/.electron-vue/dev-client.js:
--------------------------------------------------------------------------------
1 | const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
2 |
3 | hotClient.subscribe(event => {
4 | /**
5 | * Reload browser when HTMLWebpackPlugin emits a new index.html
6 | */
7 | if (event.action === 'reload') {
8 | window.location.reload()
9 | }
10 |
11 | /**
12 | * Notify `mainWindow` when `main` process is compiling,
13 | * giving notice for an expected reload of the `electron` process
14 | */
15 | if (event.action === 'compiling') {
16 | document.body.innerHTML += `
17 |
30 |
31 |
32 | Compiling Main Process...
33 |
34 | `
35 | }
36 | })
37 |
--------------------------------------------------------------------------------
/.electron-vue/dev-runner.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | const chalk = require('chalk')
4 | const electron = require('electron')
5 | const path = require('path')
6 | const { say } = require('cfonts')
7 | const { spawn } = require('child_process')
8 | const webpack = require('webpack')
9 | const WebpackDevServer = require('webpack-dev-server')
10 | const webpackHotMiddleware = require('webpack-hot-middleware')
11 |
12 | const mainConfig = require('./webpack.main.config')
13 | const rendererConfig = require('./webpack.renderer.config')
14 |
15 | let electronProcess = null
16 | let manualRestart = false
17 | let hotMiddleware
18 |
19 | function logStats (proc, data) {
20 | let log = ''
21 |
22 | log += chalk.yellow.bold(`┏ ${proc} Process ${new Array((19 - proc.length) + 1).join('-')}`)
23 | log += '\n\n'
24 |
25 | if (typeof data === 'object') {
26 | data.toString({
27 | colors: true,
28 | chunks: false
29 | }).split(/\r?\n/).forEach(line => {
30 | log += ' ' + line + '\n'
31 | })
32 | } else {
33 | log += ` ${data}\n`
34 | }
35 |
36 | log += '\n' + chalk.yellow.bold(`┗ ${new Array(28 + 1).join('-')}`) + '\n'
37 |
38 | console.log(log)
39 | }
40 |
41 | function startRenderer () {
42 | return new Promise((resolve, reject) => {
43 | rendererConfig.entry.renderer = [path.join(__dirname, 'dev-client')].concat(rendererConfig.entry.renderer)
44 |
45 | const compiler = webpack(rendererConfig)
46 | hotMiddleware = webpackHotMiddleware(compiler, {
47 | log: false,
48 | heartbeat: 2500
49 | })
50 |
51 | compiler.plugin('compilation', compilation => {
52 | compilation.plugin('html-webpack-plugin-after-emit', (data, cb) => {
53 | hotMiddleware.publish({ action: 'reload' })
54 | cb()
55 | })
56 | })
57 |
58 | compiler.plugin('done', stats => {
59 | logStats('Renderer', stats)
60 | })
61 |
62 | const server = new WebpackDevServer(
63 | compiler,
64 | {
65 | contentBase: path.join(__dirname, '../'),
66 | quiet: true,
67 | setup (app, ctx) {
68 | app.use(hotMiddleware)
69 | ctx.middleware.waitUntilValid(() => {
70 | resolve()
71 | })
72 | }
73 | }
74 | )
75 |
76 | server.listen(9080)
77 | })
78 | }
79 |
80 | function startMain () {
81 | return new Promise((resolve, reject) => {
82 | mainConfig.entry.main = [path.join(__dirname, '../src/main/index.dev.js')].concat(mainConfig.entry.main)
83 |
84 | const compiler = webpack(mainConfig)
85 |
86 | compiler.plugin('watch-run', (compilation, done) => {
87 | logStats('Main', chalk.white.bold('compiling...'))
88 | hotMiddleware.publish({ action: 'compiling' })
89 | done()
90 | })
91 |
92 | compiler.watch({}, (err, stats) => {
93 | if (err) {
94 | console.log(err)
95 | return
96 | }
97 |
98 | logStats('Main', stats)
99 |
100 | if (electronProcess && electronProcess.kill) {
101 | manualRestart = true
102 | process.kill(electronProcess.pid)
103 | electronProcess = null
104 | startElectron()
105 |
106 | setTimeout(() => {
107 | manualRestart = false
108 | }, 5000)
109 | }
110 |
111 | resolve()
112 | })
113 | })
114 | }
115 |
116 | function startElectron () {
117 | electronProcess = spawn(electron, ['--inspect=5858', path.join(__dirname, '../dist/electron/main.js')])
118 |
119 | electronProcess.stdout.on('data', data => {
120 | electronLog(data, 'blue')
121 | })
122 | electronProcess.stderr.on('data', data => {
123 | electronLog(data, 'red')
124 | })
125 |
126 | electronProcess.on('close', () => {
127 | if (!manualRestart) process.exit()
128 | })
129 | }
130 |
131 | function electronLog (data, color) {
132 | let log = ''
133 | data = data.toString().split(/\r?\n/)
134 | data.forEach(line => {
135 | log += ` ${line}\n`
136 | })
137 | if (/[0-9A-z]+/.test(log)) {
138 | console.log(
139 | chalk[color].bold('┏ Electron -------------------') +
140 | '\n\n' +
141 | log +
142 | chalk[color].bold('┗ ----------------------------') +
143 | '\n'
144 | )
145 | }
146 | }
147 |
148 | function greeting () {
149 | const cols = process.stdout.columns
150 | let text = ''
151 |
152 | if (cols > 104) text = 'electron-vue'
153 | else if (cols > 76) text = 'electron-|vue'
154 | else text = false
155 |
156 | if (text) {
157 | say(text, {
158 | colors: ['yellow'],
159 | font: 'simple3d',
160 | space: false
161 | })
162 | } else console.log(chalk.yellow.bold('\n electron-vue'))
163 | console.log(chalk.blue(' getting ready...') + '\n')
164 | }
165 |
166 | function init () {
167 | greeting()
168 |
169 | Promise.all([startRenderer(), startMain()])
170 | .then(() => {
171 | startElectron()
172 | })
173 | .catch(err => {
174 | console.error(err)
175 | })
176 | }
177 |
178 | init()
179 |
--------------------------------------------------------------------------------
/.electron-vue/webpack.main.config.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | process.env.BABEL_ENV = 'main'
4 |
5 | const path = require('path')
6 | const { dependencies } = require('../package.json')
7 | const webpack = require('webpack')
8 |
9 | const BabiliWebpackPlugin = require('babili-webpack-plugin')
10 |
11 | let mainConfig = {
12 | entry: {
13 | main: path.join(__dirname, '../src/main/index.js')
14 | },
15 | externals: [
16 | ...Object.keys(dependencies || {})
17 | ],
18 | module: {
19 | rules: [
20 | {
21 | test: /\.(js)$/,
22 | enforce: 'pre',
23 | exclude: /node_modules/,
24 | use: {
25 | loader: 'eslint-loader',
26 | options: {
27 | formatter: require('eslint-friendly-formatter')
28 | }
29 | }
30 | },
31 | {
32 | test: /\.js$/,
33 | use: 'babel-loader',
34 | exclude: /node_modules/
35 | },
36 | {
37 | test: /\.node$/,
38 | use: 'node-loader'
39 | }
40 | ]
41 | },
42 | node: {
43 | __dirname: process.env.NODE_ENV !== 'production',
44 | __filename: process.env.NODE_ENV !== 'production'
45 | },
46 | output: {
47 | filename: '[name].js',
48 | libraryTarget: 'commonjs2',
49 | path: path.join(__dirname, '../dist/electron')
50 | },
51 | plugins: [
52 | new webpack.NoEmitOnErrorsPlugin()
53 | ],
54 | resolve: {
55 | extensions: ['.js', '.json', '.node']
56 | },
57 | target: 'electron-main'
58 | }
59 |
60 | /**
61 | * Adjust mainConfig for development settings
62 | */
63 | if (process.env.NODE_ENV !== 'production') {
64 | mainConfig.plugins.push(
65 | new webpack.DefinePlugin({
66 | '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
67 | })
68 | )
69 | }
70 |
71 | /**
72 | * Adjust mainConfig for production settings
73 | */
74 | if (process.env.NODE_ENV === 'production') {
75 | mainConfig.plugins.push(
76 | new BabiliWebpackPlugin({
77 | removeConsole: true,
78 | removeDebugger: true
79 | }),
80 | new webpack.DefinePlugin({
81 | 'process.env.NODE_ENV': '"production"'
82 | })
83 | )
84 | }
85 |
86 | module.exports = mainConfig
87 |
--------------------------------------------------------------------------------
/.electron-vue/webpack.renderer.config.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | process.env.BABEL_ENV = 'renderer'
4 |
5 | const path = require('path')
6 | const { dependencies } = require('../package.json')
7 | const webpack = require('webpack')
8 |
9 | const BabiliWebpackPlugin = require('babili-webpack-plugin')
10 | const CopyWebpackPlugin = require('copy-webpack-plugin')
11 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
12 | const HtmlWebpackPlugin = require('html-webpack-plugin')
13 |
14 | /**
15 | * List of node_modules to include in webpack bundle
16 | *
17 | * Required for specific packages like Vue UI libraries
18 | * that provide pure *.vue files that need compiling
19 | * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
20 | */
21 | let whiteListedModules = ['vue']
22 |
23 | let rendererConfig = {
24 | devtool: '#cheap-module-eval-source-map',
25 | entry: {
26 | renderer: path.join(__dirname, '../src/renderer/main.js')
27 | },
28 | externals: [
29 | ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d))
30 | ],
31 | module: {
32 | rules: [
33 | {
34 | test: /\.(js|vue)$/,
35 | enforce: 'pre',
36 | exclude: /node_modules/,
37 | use: {
38 | loader: 'eslint-loader',
39 | options: {
40 | formatter: require('eslint-friendly-formatter')
41 | }
42 | }
43 | },
44 | {
45 | test: /\.css$/,
46 | use: ExtractTextPlugin.extract({
47 | fallback: 'style-loader',
48 | use: 'css-loader'
49 | })
50 | },
51 | {
52 | test: /\.styl$/,
53 | loader: 'style-loader!css-loader!stylus-loader'
54 | },
55 | {
56 | test: /\.html$/,
57 | use: 'vue-html-loader'
58 | },
59 | {
60 | test: /\.js$/,
61 | use: 'babel-loader',
62 | exclude: /node_modules/
63 | },
64 | {
65 | test: /\.node$/,
66 | use: 'node-loader'
67 | },
68 | {
69 | test: /\.vue$/,
70 | use: {
71 | loader: 'vue-loader',
72 | options: {
73 | extractCSS: process.env.NODE_ENV === 'production',
74 | loaders: {
75 | sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1',
76 | scss: 'vue-style-loader!css-loader!sass-loader',
77 | stylus: 'vue-style-loader!css-loader!stylus-loader'
78 | }
79 | }
80 | }
81 | },
82 | {
83 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
84 | use: {
85 | loader: 'url-loader',
86 | query: {
87 | limit: 10000,
88 | name: 'imgs/[name].[ext]'
89 | }
90 | }
91 | },
92 | {
93 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
94 | use: {
95 | loader: 'url-loader',
96 | query: {
97 | limit: 10000,
98 | name: 'fonts/[name].[ext]'
99 | }
100 | }
101 | }
102 | ]
103 | },
104 | plugins: [
105 | new ExtractTextPlugin('styles.css'),
106 | new HtmlWebpackPlugin({
107 | filename: 'index.html',
108 | template: path.resolve(__dirname, '../src/index.ejs'),
109 | minify: {
110 | collapseWhitespace: true,
111 | removeAttributeQuotes: true,
112 | removeComments: true
113 | },
114 | nodeModules: process.env.NODE_ENV !== 'production'
115 | ? path.resolve(__dirname, '../node_modules')
116 | : false
117 | }),
118 | new webpack.HotModuleReplacementPlugin(),
119 | new webpack.NoEmitOnErrorsPlugin()
120 | ],
121 | output: {
122 | filename: '[name].js',
123 | libraryTarget: 'commonjs2',
124 | path: path.join(__dirname, '../dist/electron')
125 | },
126 | resolve: {
127 | alias: {
128 | '@': path.join(__dirname, '../src/renderer'),
129 | 'vue$': 'vue/dist/vue.esm.js'
130 | },
131 | extensions: ['.js', '.vue', '.json', '.css', '.node']
132 | },
133 | target: 'electron-renderer'
134 | }
135 |
136 | /**
137 | * Adjust rendererConfig for development settings
138 | */
139 | if (process.env.NODE_ENV !== 'production') {
140 | rendererConfig.plugins.push(
141 | new webpack.DefinePlugin({
142 | '__static': `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`
143 | })
144 | )
145 | }
146 |
147 | /**
148 | * Adjust rendererConfig for production settings
149 | */
150 | if (process.env.NODE_ENV === 'production') {
151 | rendererConfig.devtool = ''
152 |
153 | rendererConfig.plugins.push(
154 | new BabiliWebpackPlugin({
155 | removeConsole: true,
156 | removeDebugger: true
157 | }),
158 | new CopyWebpackPlugin([
159 | {
160 | from: path.join(__dirname, '../static'),
161 | to: path.join(__dirname, '../dist/electron/static'),
162 | ignore: ['.*']
163 | }
164 | ]),
165 | new webpack.DefinePlugin({
166 | 'process.env.NODE_ENV': '"production"'
167 | }),
168 | new webpack.LoaderOptionsPlugin({
169 | minimize: true
170 | })
171 | )
172 | }
173 |
174 | module.exports = rendererConfig
175 |
--------------------------------------------------------------------------------
/.electron-vue/webpack.web.config.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | process.env.BABEL_ENV = 'web'
4 |
5 | const path = require('path')
6 | const webpack = require('webpack')
7 |
8 | const BabiliWebpackPlugin = require('babili-webpack-plugin')
9 | const CopyWebpackPlugin = require('copy-webpack-plugin')
10 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
11 | const HtmlWebpackPlugin = require('html-webpack-plugin')
12 |
13 | let webConfig = {
14 | devtool: '#cheap-module-eval-source-map',
15 | entry: {
16 | web: path.join(__dirname, '../src/renderer/main.js')
17 | },
18 | module: {
19 | rules: [
20 | {
21 | test: /\.(js|vue)$/,
22 | enforce: 'pre',
23 | exclude: /node_modules/,
24 | use: {
25 | loader: 'eslint-loader',
26 | options: {
27 | formatter: require('eslint-friendly-formatter')
28 | }
29 | }
30 | },
31 | {
32 | test: /\.css$/,
33 | use: ExtractTextPlugin.extract({
34 | fallback: 'style-loader',
35 | use: 'css-loader'
36 | })
37 | },
38 | {
39 | test: /\.styl$/,
40 | loader: 'style-loader!css-loader!stylus-loader'
41 | },
42 | {
43 | test: /\.html$/,
44 | use: 'vue-html-loader'
45 | },
46 | {
47 | test: /\.js$/,
48 | use: 'babel-loader',
49 | include: [ path.resolve(__dirname, '../src/renderer') ],
50 | exclude: /node_modules/
51 | },
52 | {
53 | test: /\.vue$/,
54 | use: {
55 | loader: 'vue-loader',
56 | options: {
57 | extractCSS: true,
58 | loaders: {
59 | sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1',
60 | scss: 'vue-style-loader!css-loader!sass-loader',
61 | stylus: 'vue-style-loader!css-loader!stylus-loader'
62 | }
63 | }
64 | }
65 | },
66 | {
67 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
68 | use: {
69 | loader: 'url-loader',
70 | query: {
71 | limit: 10000,
72 | name: 'imgs/[name].[ext]'
73 | }
74 | }
75 | },
76 | {
77 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
78 | use: {
79 | loader: 'url-loader',
80 | query: {
81 | limit: 10000,
82 | name: 'fonts/[name].[ext]'
83 | }
84 | }
85 | }
86 | ]
87 | },
88 | plugins: [
89 | new ExtractTextPlugin('styles.css'),
90 | new HtmlWebpackPlugin({
91 | filename: 'index.html',
92 | template: path.resolve(__dirname, '../src/index.ejs'),
93 | minify: {
94 | collapseWhitespace: true,
95 | removeAttributeQuotes: true,
96 | removeComments: true
97 | },
98 | nodeModules: false
99 | }),
100 | new webpack.DefinePlugin({
101 | 'process.env.IS_WEB': 'true'
102 | }),
103 | new webpack.HotModuleReplacementPlugin(),
104 | new webpack.NoEmitOnErrorsPlugin()
105 | ],
106 | output: {
107 | filename: '[name].js',
108 | path: path.join(__dirname, '../dist/web')
109 | },
110 | resolve: {
111 | alias: {
112 | '@': path.join(__dirname, '../src/renderer'),
113 | 'vue$': 'vue/dist/vue.esm.js'
114 | },
115 | extensions: ['.js', '.vue', '.json', '.css']
116 | },
117 | target: 'web'
118 | }
119 |
120 | /**
121 | * Adjust webConfig for production settings
122 | */
123 | if (process.env.NODE_ENV === 'production') {
124 | webConfig.devtool = ''
125 |
126 | webConfig.plugins.push(
127 | new BabiliWebpackPlugin({
128 | removeConsole: true,
129 | removeDebugger: true
130 | }),
131 | new CopyWebpackPlugin([
132 | {
133 | from: path.join(__dirname, '../static'),
134 | to: path.join(__dirname, '../dist/web/static'),
135 | ignore: ['.*']
136 | }
137 | ]),
138 | new webpack.DefinePlugin({
139 | 'process.env.NODE_ENV': '"production"'
140 | }),
141 | new webpack.LoaderOptionsPlugin({
142 | minimize: true
143 | })
144 | )
145 | }
146 |
147 | module.exports = webConfig
148 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrgodhani/bookmark/ba6a0f85d9010705dc2da9814cffda5ea05fea62/.eslintignore
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parser: 'babel-eslint',
4 | parserOptions: {
5 | sourceType: 'module'
6 | },
7 | env: {
8 | browser: true,
9 | node: true
10 | },
11 | extends: 'standard',
12 | globals: {
13 | __static: true
14 | },
15 | plugins: [
16 | 'html'
17 | ],
18 | 'rules': {
19 | // allow paren-less arrow functions
20 | 'arrow-parens': 0,
21 | // allow async-await
22 | 'generator-star-spacing': 0,
23 | // allow debugger during development
24 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | dist/electron/*
3 | dist/web/*
4 | build/*
5 | !build/icons
6 | node_modules/
7 | npm-debug.log
8 | npm-debug.log.*
9 | thumbs.db
10 | !.gitkeep
11 | src/renderer/.env
12 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Meet Godhani
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #### Note
2 |
3 | This repository currently is not maintained.
4 |
5 | # Bookmark
6 |
7 | > Bookmark is simple desktop application example for organizing and storing bookmarked links in one place made using [Vue.js](https://vuejs.org), [Atom Electron](https://electron.atom.io/) and [Firebase](https://firebase.google.com).
8 |
9 | [Cross browser extension](https://github.com/mrgodhani/bookmarkextension) made using Vue.js to make bookmark links easier directly from browser.
10 |
11 | 
12 |
13 | #### Build Setup
14 |
15 | ``` bash
16 |
17 | # Make sure in your firebase console under database you set rules for read and write to true
18 |
19 | # Set firebase database url in either src/renderer/db.js file
20 |
21 | # install dependencies
22 | npm install
23 |
24 | # serve with hot reload at localhost:9080
25 | npm run dev
26 |
27 | # build electron application for production
28 | npm run build
29 |
30 |
31 | # lint all JS/Vue component files in `src/`
32 | npm run lint
33 |
34 | ```
35 |
36 | ### Features
37 |
38 | - [ ] Offline
39 | - [x] Categories
40 | - [x] Marking as Favourite
41 | - [ ] Rich Text Media for each link bookmarked
42 | - [ ] Export/Import
43 |
44 |
45 | ### License
46 |
47 | [MIT License](https://github.com/mrgodhani/bookmark/blob/master/LICENSE)
48 |
49 | ---
50 |
51 | This project was generated with [electron-vue](https://github.com/SimulatedGREG/electron-vue).
52 |
--------------------------------------------------------------------------------
/dist/electron/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrgodhani/bookmark/ba6a0f85d9010705dc2da9814cffda5ea05fea62/dist/electron/.gitkeep
--------------------------------------------------------------------------------
/dist/web/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrgodhani/bookmark/ba6a0f85d9010705dc2da9814cffda5ea05fea62/dist/web/.gitkeep
--------------------------------------------------------------------------------
/icons/icon.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrgodhani/bookmark/ba6a0f85d9010705dc2da9814cffda5ea05fea62/icons/icon.icns
--------------------------------------------------------------------------------
/icons/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrgodhani/bookmark/ba6a0f85d9010705dc2da9814cffda5ea05fea62/icons/icon.ico
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bookmark",
3 | "productName": "bookmark",
4 | "version": "0.0.0",
5 | "author": "Meet Godhani ",
6 | "description": "Bookmark app using firebase, vuejs and atom electron",
7 | "license": null,
8 | "main": "./dist/electron/main.js",
9 | "scripts": {
10 | "build": "node .electron-vue/build.js",
11 | "build:darwin": "cross-env BUILD_TARGET=darwin node .electron-vue/build.js",
12 | "build:linux": "cross-env BUILD_TARGET=linux node .electron-vue/build.js",
13 | "build:mas": "cross-env BUILD_TARGET=mas node .electron-vue/build.js",
14 | "build:win32": "cross-env BUILD_TARGET=win32 node .electron-vue/build.js",
15 | "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
16 | "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
17 | "dev": "node .electron-vue/dev-runner.js",
18 | "lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src",
19 | "lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src",
20 | "pack": "npm run pack:main && npm run pack:renderer",
21 | "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
22 | "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
23 | "postinstall": "npm run lint:fix"
24 | },
25 | "dependencies": {
26 | "axios": "^0.16.1",
27 | "cheerio": "^1.0.0-rc.1",
28 | "dotenv": "^4.0.0",
29 | "firebase": "^4.1.2",
30 | "got": "^7.0.0",
31 | "vue": "^2.3.3",
32 | "vue-electron": "^1.0.6",
33 | "vue-router": "^2.5.3",
34 | "vuefire": "^1.4.3",
35 | "vuetify": "^0.12.7",
36 | "vuex": "^2.3.1",
37 | "vuexfire": "^2.1.3"
38 | },
39 | "devDependencies": {
40 | "babel-core": "^6.22.1",
41 | "babel-eslint": "^7.0.0",
42 | "babel-loader": "^7.0.0",
43 | "babel-plugin-transform-runtime": "^6.22.0",
44 | "babel-preset-env": "^1.3.3",
45 | "babel-preset-stage-0": "^6.5.0",
46 | "babel-register": "^6.2.0",
47 | "babili-webpack-plugin": "^0.1.1",
48 | "cfonts": "^1.1.3",
49 | "chalk": "^1.1.3",
50 | "copy-webpack-plugin": "^4.0.1",
51 | "cross-env": "^5.0.0",
52 | "css-loader": "^0.28.4",
53 | "del": "^2.2.1",
54 | "devtron": "^1.1.0",
55 | "electron": "^1.7.2",
56 | "electron-debug": "^1.1.0",
57 | "electron-devtools-installer": "^2.0.1",
58 | "electron-packager": "^8.5.0",
59 | "electron-rebuild": "^1.1.3",
60 | "eslint": "^3.13.1",
61 | "eslint-config-standard": "^10.2.1",
62 | "eslint-friendly-formatter": "^3.0.0",
63 | "eslint-loader": "^1.3.0",
64 | "eslint-plugin-html": "^2.0.0",
65 | "eslint-plugin-import": "^2.3.0",
66 | "eslint-plugin-node": "^4.2.2",
67 | "eslint-plugin-promise": "^3.4.0",
68 | "eslint-plugin-standard": "^3.0.1",
69 | "extract-text-webpack-plugin": "^2.0.0-beta.4",
70 | "file-loader": "^0.11.1",
71 | "html-webpack-plugin": "^2.16.1",
72 | "json-loader": "^0.5.4",
73 | "multispinner": "^0.2.1",
74 | "style-loader": "^0.18.1",
75 | "stylus": "^0.54.5",
76 | "stylus-loader": "^3.0.1",
77 | "url-loader": "^0.5.7",
78 | "vue-html-loader": "^1.2.2",
79 | "vue-loader": "^12.2.1",
80 | "vue-style-loader": "^3.0.1",
81 | "vue-template-compiler": "^2.3.3",
82 | "webpack": "^2.2.1",
83 | "webpack-dev-server": "^2.3.0",
84 | "webpack-hot-middleware": "^2.18.0"
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrgodhani/bookmark/ba6a0f85d9010705dc2da9814cffda5ea05fea62/screenshot.png
--------------------------------------------------------------------------------
/src/index.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Bookmark
6 |
7 | <% if (htmlWebpackPlugin.options.nodeModules) { %>
8 |
9 |
12 | <% } %>
13 |
14 |
15 |
16 |
17 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/index.dev.js:
--------------------------------------------------------------------------------
1 | /**
2 | * This file is used specifically and only for development. It installs
3 | * `electron-debug` & `vue-devtools`. There shouldn't be any need to
4 | * modify this file, but it can be used to extend your development
5 | * environment.
6 | */
7 |
8 | /* eslint-disable */
9 |
10 | // Set environment for development
11 | process.env.NODE_ENV = 'development'
12 |
13 | // Install `electron-debug` with `devtron`
14 | require('electron-debug')({ showDevTools: true })
15 |
16 | // Install `vue-devtools`
17 | require('electron').app.on('ready', () => {
18 | let installExtension = require('electron-devtools-installer')
19 | installExtension.default(installExtension.VUEJS_DEVTOOLS)
20 | .then(() => {})
21 | .catch(err => {
22 | console.log('Unable to install `vue-devtools`: \n', err)
23 | })
24 | })
25 |
26 | // Require `main` process to boot app
27 | require('./index')
28 |
--------------------------------------------------------------------------------
/src/main/index.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | import { app, BrowserWindow, Menu } from 'electron'
4 |
5 | /**
6 | * Set `__static` path to static files in production
7 | * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
8 | */
9 | if (process.env.NODE_ENV !== 'development') {
10 | global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
11 | }
12 |
13 | let mainWindow
14 | const winURL = process.env.NODE_ENV === 'development'
15 | ? `http://localhost:9080`
16 | : `file://${__dirname}/index.html`
17 |
18 | function createWindow () {
19 | /**
20 | * Initial window options
21 | */
22 | mainWindow = new BrowserWindow({
23 | height: 700,
24 | useContentSize: true,
25 | width: 1200,
26 | minWidth: 1200,
27 | minHeight: 700
28 | })
29 | mainWindow.loadURL(winURL)
30 | var template = [{
31 | label: 'Application',
32 | submenu: [
33 | { label: 'About Application', selector: 'orderFrontStandardAboutPanel:' },
34 | { type: 'separator' },
35 | {label: 'Quit', accelerator: 'Command+Q', click: function () { app.quit() }}
36 | ]}, {
37 | label: 'Edit',
38 | submenu: [
39 | { label: 'Undo', accelerator: 'CmdOrCtrl+Z', selector: 'undo:' },
40 | { label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', selector: 'redo:' },
41 | { type: 'separator' },
42 | { label: 'Cut', accelerator: 'CmdOrCtrl+X', selector: 'cut:' },
43 | { label: 'Copy', accelerator: 'CmdOrCtrl+C', selector: 'copy:' },
44 | { label: 'Paste', accelerator: 'CmdOrCtrl+V', selector: 'paste:' },
45 | { label: 'Select All', accelerator: 'CmdOrCtrl+A', selector: 'selectAll:' }
46 | ]}
47 | ]
48 |
49 | Menu.setApplicationMenu(Menu.buildFromTemplate(template))
50 |
51 | mainWindow.on('closed', () => {
52 | mainWindow = null
53 | })
54 | }
55 |
56 | app.on('ready', createWindow)
57 |
58 | app.on('window-all-closed', () => {
59 | if (process.platform !== 'darwin') {
60 | app.quit()
61 | }
62 | })
63 |
64 | app.on('activate', () => {
65 | if (mainWindow === null) {
66 | createWindow()
67 | }
68 | })
69 |
--------------------------------------------------------------------------------
/src/renderer/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {{ title }}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | add
15 |
16 |
17 |
18 | Add a New Bookmark
19 |
20 |
21 |
22 |
23 |
34 |
35 |
36 |
37 |
38 | Cancel
39 | Add
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
98 |
99 |
121 |
--------------------------------------------------------------------------------
/src/renderer/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrgodhani/bookmark/ba6a0f85d9010705dc2da9814cffda5ea05fea62/src/renderer/assets/.gitkeep
--------------------------------------------------------------------------------
/src/renderer/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrgodhani/bookmark/ba6a0f85d9010705dc2da9814cffda5ea05fea62/src/renderer/assets/logo.png
--------------------------------------------------------------------------------
/src/renderer/components/BookmarkList.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | {{ bookmark.title }}
13 |
14 |
15 | grade
16 |
17 |
18 | {{ bookmark.category.name }}
19 |
20 |
21 |
22 |
23 | more_vert
24 |
25 |
26 |
27 |
28 | Mark as favourite
29 | Mark as unfavourite
30 |
31 |
32 |
33 |
34 | Delete
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | No bookmarks found.
50 |
51 |
52 |
53 |
102 |
107 |
--------------------------------------------------------------------------------
/src/renderer/components/SideDrawer.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | bookmark
8 |
9 |
10 |
11 | All Bookmarks
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | grade
21 |
22 |
23 |
24 | Favourites
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | Categories
34 |
35 |
36 |
37 |
38 |
39 | add
40 |
41 |
42 |
43 | Add a new category
44 |
45 |
46 |
47 |
48 |
56 |
57 |
58 |
59 | Cancel
60 | Add
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | fiber_manual_record
70 |
71 |
72 |
73 | {{ category.name }}
74 |
75 |
76 |
77 |
78 | delete
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
131 |
--------------------------------------------------------------------------------
/src/renderer/components/registerComponents.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Sidebar from './SideDrawer'
3 | import BookmarkList from './BookmarkList'
4 |
5 | export default {
6 | registerComponents () {
7 | Vue.component('sidebar', Sidebar)
8 | Vue.component('bookmark-list', BookmarkList)
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/renderer/db.js:
--------------------------------------------------------------------------------
1 | import firebase from 'firebase'
2 |
3 | let instance = null
4 |
5 | class Database {
6 | constructor () {
7 | if (!instance) {
8 | instance = this
9 | }
10 | this.config = {
11 | databaseURL: ''
12 | }
13 | this.fire = firebase.initializeApp(this.config)
14 | this.db = this.fire.database()
15 |
16 | return instance
17 | }
18 | }
19 |
20 | export default Database
21 |
--------------------------------------------------------------------------------
/src/renderer/helper/fetch.js:
--------------------------------------------------------------------------------
1 | import cheerio from 'cheerio'
2 | import got from 'got'
3 | import urlUtil from 'url'
4 |
5 | export default {
6 | /**
7 | * Extract basic information from link
8 | * @param {string} url Link Url that needs to be fetched
9 | * @param {string} cat Category that needs to be attached
10 | * @return {object} Returns object
11 | */
12 | extractLink (url, cat) {
13 | return new Promise((resolve, reject) => {
14 | got(url, { useElectronNet: false }).then(response => {
15 | const $ = cheerio.load(response.body)
16 | const title = $('title').text()
17 | const favicon = $('link[rel="icon"], link[rel="shortcut icon"], link[rel="Shortcut Icon"]').last().attr('href')
18 | resolve({
19 | title: title,
20 | favicon: urlUtil.resolve(response.url, favicon),
21 | category: {
22 | name: cat.name,
23 | color: cat.color
24 | },
25 | favourite: false,
26 | url: urlUtil.resolve(url)
27 | })
28 | })
29 | })
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/renderer/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuetify from 'vuetify'
3 | import VueFire from 'vuefire'
4 | import axios from 'axios'
5 |
6 | import App from './App'
7 | import store from './store'
8 | import Register from './components/registerComponents'
9 | import Database from './db'
10 | const db = new Database().db
11 |
12 | Vue.use(Vuetify)
13 | Vue.use(VueFire)
14 | Register.registerComponents()
15 |
16 | if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
17 | Vue.http = Vue.prototype.$http = axios
18 | Vue.prototype.$db = db
19 | Vue.config.productionTip = false
20 |
21 | /* eslint-disable no-new */
22 | new Vue({
23 | components: { App },
24 | store,
25 | template: ''
26 | }).$mount('#app')
27 |
--------------------------------------------------------------------------------
/src/renderer/store/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Vuex from 'vuex'
3 |
4 | import modules from './modules'
5 |
6 | Vue.use(Vuex)
7 |
8 | export default new Vuex.Store({
9 | modules,
10 | strict: process.env.NODE_ENV !== 'production'
11 | })
12 |
--------------------------------------------------------------------------------
/src/renderer/store/modules/bookmark.js:
--------------------------------------------------------------------------------
1 | import { firebaseAction, firebaseMutations } from 'vuexfire'
2 |
3 | const state = {
4 | categories: [],
5 | bookmarks: [],
6 | favourites: []
7 | }
8 |
9 | const mutations = {
10 | ...firebaseMutations
11 | }
12 | const actions = {
13 | loadCategories: firebaseAction(({ bindFirebaseRef, unbindFirebaseRef }, { ref }) => {
14 | bindFirebaseRef('categories', ref)
15 | }),
16 | loadFavourites: firebaseAction(({ bindFirebaseRef, unbindFirebaseRef }, { ref }) => {
17 | bindFirebaseRef('favourites', ref)
18 | }),
19 | loadBookmarks: firebaseAction(({ bindFirebaseRef, unbindFirebaseRef }, { ref }) => {
20 | bindFirebaseRef('bookmarks', ref)
21 | })
22 | }
23 |
24 | export default {
25 | state,
26 | mutations,
27 | actions
28 | }
29 |
--------------------------------------------------------------------------------
/src/renderer/store/modules/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * The file enables `@/store/index.js` to import all vuex modules
3 | * in a one-shot manner. There should not be any reason to edit this file.
4 | */
5 |
6 | const files = require.context('.', false, /\.js$/)
7 | const modules = {}
8 |
9 | files.keys().forEach(key => {
10 | if (key === './index.js') return
11 | modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default
12 | })
13 |
14 | export default modules
15 |
--------------------------------------------------------------------------------
/static/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrgodhani/bookmark/ba6a0f85d9010705dc2da9814cffda5ea05fea62/static/.gitkeep
--------------------------------------------------------------------------------