├── .editorconfig ├── .electron-nuxt ├── main.js ├── run-dev.js └── webpack.main.config.js ├── .eslintrc.js ├── .gitignore ├── LICENSE ├── README.md ├── assets └── README.md ├── components ├── AppLogo.vue └── README.md ├── layouts ├── README.md └── default.vue ├── middleware └── README.md ├── nuxt.config.js ├── package-lock.json ├── package.json ├── pages ├── README.md ├── SystemInformation.vue └── index.vue ├── plugins └── README.md ├── static ├── README.md └── favicon.ico └── store └── README.md /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_size = 2 6 | indent_style = space 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.electron-nuxt/main.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | let win = null // Current window 3 | const electron = require('electron') 4 | const path = require('path') 5 | const url = require('url') 6 | const app = electron.app 7 | const BrowserWindow = electron.BrowserWindow 8 | const isDev = !(process.env.NODE_ENV === 'production') 9 | 10 | const newWin = () => { 11 | win = new BrowserWindow({ 12 | width: 800, 13 | height: 600 14 | }) 15 | if (isDev) { 16 | win.loadURL("http://localhost:3000") // eslint-disable-line 17 | } else { 18 | win.loadURL(url.format({ 19 | pathname: path.join(__dirname, '../dist/index.html'), 20 | protocol: 'file:', 21 | slashes: true 22 | })) 23 | } 24 | win.on('closed', () => win = null) // eslint-disable-line 25 | } 26 | 27 | app.on('ready', newWin) 28 | app.on('window-all-closed', () => app.quit()) 29 | app.on('activate', () => win === null && newWin()) 30 | -------------------------------------------------------------------------------- /.electron-nuxt/run-dev.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = 'development' 2 | const path = require('path') 3 | const electron = require('electron') 4 | const { 5 | spawn 6 | } = require('child_process') 7 | 8 | const { 9 | Nuxt, 10 | Builder 11 | } = require('nuxt') 12 | 13 | const config = require('../nuxt.config.js') 14 | const nuxt = new Nuxt(config) 15 | const builder = new Builder(nuxt) 16 | 17 | Promise.resolve() 18 | .then(() => builder.build()) 19 | .then(() => nuxt.listen()) 20 | .then(() => startElectron()) 21 | 22 | function startElectron () { 23 | const electronProcess = spawn(electron, ['--inspect=5858', path.join(__dirname, 'main.js')]) 24 | electronProcess.stdout.on('data', (data) => { 25 | console.log(data.toString()) 26 | }) 27 | 28 | electronProcess.stderr.on('data', (data) => { 29 | console.log(data.toString()) 30 | }) 31 | 32 | electronProcess.on('close', (code) => { 33 | Promise.resolve() 34 | .then(() => builder.unwatch()) 35 | .then(() => nuxt.close()) 36 | }) 37 | } 38 | -------------------------------------------------------------------------------- /.electron-nuxt/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, 'main.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') 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 | new webpack.DefinePlugin({ 78 | 'process.env.NODE_ENV': '"production"' 79 | }) 80 | ) 81 | } 82 | 83 | module.exports = mainConfig 84 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | node: true 6 | }, 7 | parserOptions: { 8 | parser: 'babel-eslint' 9 | }, 10 | extends: [ 11 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention 12 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. 13 | 'plugin:vue/essential' 14 | ], 15 | // required to lint *.vue files 16 | plugins: [ 17 | 'vue' 18 | ], 19 | // add your custom rules here 20 | rules: {} 21 | } 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules 3 | 4 | # logs 5 | npm-debug.log 6 | 7 | # Nuxt build 8 | .nuxt 9 | 10 | # Nuxt generate 11 | dist 12 | 13 | # electron builder 14 | build -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 fanliwen 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 | # electron-nuxt 2 | 3 | > Electron-nuxt project 4 | 5 | The Electron-nuxt is a electron project for nuxt. 6 | 7 | Fork this repo and make an electron app easily. 8 | 9 | ## Build Setup 10 | 11 | ``` bash 12 | # install dependencies 13 | $ npm install # Or yarn install 14 | 15 | # serve with hot reload at localhost:3000 16 | $ npm run dev 17 | 18 | # build for production and launch app 19 | $ npm run build 20 | $ npm start 21 | 22 | # make package with electron builder 23 | $ npm run package 24 | ``` 25 | -------------------------------------------------------------------------------- /assets/README.md: -------------------------------------------------------------------------------- 1 | # ASSETS 2 | 3 | This directory contains your un-compiled assets such as LESS, SASS, or JavaScript. 4 | 5 | More information about the usage of this directory in the documentation: 6 | https://nuxtjs.org/guide/assets#webpacked 7 | 8 | **This directory is not required, you can delete it if you don't want to use it.** 9 | -------------------------------------------------------------------------------- /components/AppLogo.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 222 | -------------------------------------------------------------------------------- /components/README.md: -------------------------------------------------------------------------------- 1 | # COMPONENTS 2 | 3 | The components directory contains your Vue.js Components. 4 | Nuxt.js doesn't supercharge these components. 5 | 6 | **This directory is not required, you can delete it if you don't want to use it.** 7 | -------------------------------------------------------------------------------- /layouts/README.md: -------------------------------------------------------------------------------- 1 | # LAYOUTS 2 | 3 | This directory contains your Application Layouts. 4 | 5 | More information about the usage of this directory in the documentation: 6 | https://nuxtjs.org/guide/views#layouts 7 | 8 | **This directory is not required, you can delete it if you don't want to use it.** 9 | -------------------------------------------------------------------------------- /layouts/default.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 53 | -------------------------------------------------------------------------------- /middleware/README.md: -------------------------------------------------------------------------------- 1 | # MIDDLEWARE 2 | 3 | This directory contains your Application Middleware. 4 | The middleware lets you define custom function to be ran before rendering a page or a group of pages (layouts). 5 | 6 | More information about the usage of this directory in the documentation: 7 | https://nuxtjs.org/guide/routing#middleware 8 | 9 | **This directory is not required, you can delete it if you don't want to use it.** 10 | -------------------------------------------------------------------------------- /nuxt.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | /* 3 | ** Headers of the page 4 | */ 5 | head: { 6 | title: 'electron-nuxt', 7 | meta: [ 8 | { charset: 'utf-8' }, 9 | { name: 'viewport', content: 'width=device-width, initial-scale=1' }, 10 | { hid: 'description', name: 'description', content: 'Nuxt.js project' } 11 | ], 12 | link: [ 13 | { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } 14 | ] 15 | }, 16 | /* 17 | ** Customize the progress bar color 18 | */ 19 | loading: { color: '#3B8070' }, 20 | /* 21 | ** Build configuration 22 | */ 23 | build: { 24 | /* 25 | ** Run ESLint on save 26 | */ 27 | extend (config, { isDev, isClient }) { 28 | if (isClient) { 29 | config.target = 'electron-renderer' 30 | } 31 | 32 | if (isDev && isClient) { 33 | config.module.rules.push({ 34 | enforce: 'pre', 35 | test: /\.(js|vue)$/, 36 | loader: 'eslint-loader', 37 | exclude: /(node_modules)/ 38 | }) 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "electron-nuxt", 3 | "version": "1.0.0", 4 | "description": "Nuxt.js project", 5 | "author": "fanliwen ", 6 | "private": true, 7 | "main": "dist/main.js", 8 | "scripts": { 9 | "dev": "node .electron-nuxt/run-dev", 10 | "build:electron": "webpack --config .electron-nuxt/webpack.main.config.js", 11 | "build:nuxt": "nuxt generate", 12 | "build": "npm run build:nuxt & npm run build:electron", 13 | "start": "electron dist/main.js", 14 | "package": "electron-builder", 15 | "lint": "eslint --ext .js,.vue --ignore-path .gitignore .", 16 | "precommit": "npm run lint" 17 | }, 18 | "build": { 19 | "productName": "electron-nuxt", 20 | "appId": "elctron-nuxt.app", 21 | "directories": { 22 | "output": "build" 23 | }, 24 | "files": [ 25 | "dist/**/*" 26 | ], 27 | "dmg": { 28 | "contents": [ 29 | { 30 | "x": 410, 31 | "y": 150, 32 | "type": "link", 33 | "path": "/Applications" 34 | }, 35 | { 36 | "x": 130, 37 | "y": 150, 38 | "type": "file" 39 | } 40 | ] 41 | }, 42 | "mac": { 43 | "icon": "build/icons/icon.icns" 44 | }, 45 | "win": { 46 | "icon": "build/icons/icon.ico" 47 | }, 48 | "linux": { 49 | "icon": "build/icons" 50 | } 51 | }, 52 | "dependencies": { 53 | "nuxt": "^1.0.0" 54 | }, 55 | "devDependencies": { 56 | "babel-eslint": "^8.2.1", 57 | "babili-webpack-plugin": "^0.1.2", 58 | "electron": "^1.8.4", 59 | "electron-builder": "^20.8.1", 60 | "eslint": "^4.15.0", 61 | "eslint-friendly-formatter": "^3.0.0", 62 | "eslint-loader": "^1.7.1", 63 | "eslint-plugin-vue": "^4.0.0", 64 | "node-sass": "^4.8.3", 65 | "sass-loader": "^6.0.7" 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /pages/README.md: -------------------------------------------------------------------------------- 1 | # PAGES 2 | 3 | This directory contains your Application Views and Routes. 4 | The framework reads all the .vue files inside this directory and creates the router of your application. 5 | 6 | More information about the usage of this directory in the documentation: 7 | https://nuxtjs.org/guide/routing 8 | -------------------------------------------------------------------------------- /pages/SystemInformation.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 48 | 49 | 75 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 34 | 35 | 66 | -------------------------------------------------------------------------------- /plugins/README.md: -------------------------------------------------------------------------------- 1 | # PLUGINS 2 | 3 | This directory contains your Javascript plugins that you want to run before instantiating the root vue.js application. 4 | 5 | More information about the usage of this directory in the documentation: 6 | https://nuxtjs.org/guide/plugins 7 | 8 | **This directory is not required, you can delete it if you don't want to use it.** 9 | -------------------------------------------------------------------------------- /static/README.md: -------------------------------------------------------------------------------- 1 | # STATIC 2 | 3 | This directory contains your static files. 4 | Each file inside this directory is mapped to /. 5 | 6 | Example: /static/robots.txt is mapped as /robots.txt. 7 | 8 | More information about the usage of this directory in the documentation: 9 | https://nuxtjs.org/guide/assets#static 10 | 11 | **This directory is not required, you can delete it if you don't want to use it.** 12 | -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ravenq/electron-nuxt/acb62bc84e4753b1e4f99065632bd2fa86716eab/static/favicon.ico -------------------------------------------------------------------------------- /store/README.md: -------------------------------------------------------------------------------- 1 | # STORE 2 | 3 | This directory contains your Vuex Store files. 4 | Vuex Store option is implemented in the Nuxt.js framework. 5 | Creating a index.js file in this directory activate the option in the framework automatically. 6 | 7 | More information about the usage of this directory in the documentation: 8 | https://nuxtjs.org/guide/vuex-store 9 | 10 | **This directory is not required, you can delete it if you don't want to use it.** 11 | --------------------------------------------------------------------------------