Skip to content

Commit

Permalink
fix build problem
Browse files Browse the repository at this point in the history
icon problem
update resources
update electron js to last `13.x`
  • Loading branch information
A1Gard committed Aug 4, 2021
1 parent 6b4f67e commit 9c79963
Show file tree
Hide file tree
Showing 83 changed files with 95 additions and 53 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Anubias is project help you to make your
mobile apps so easy and native. : )

## Requirment
- vue cli
- electron js cli
- vue cli ``npm install -g @vue/cli``
- electron js cli ``npm install electron -g``

## Project setup
```
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "1.0.0-alpha",
"private": false,
"description": "anubias desktop application",
"asarUnpack": ["**/*.node"],
"author": {
"name": "xStack Team"
},
Expand All @@ -12,7 +11,7 @@
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "vue-cli-service electron:serve",
"electron:serve": "vue-cli-service electron:serve ",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps",
"test": "echo \"Error: no test specified\" && exit 1"
Expand All @@ -23,7 +22,7 @@
"alertifyjs": "^1.13.1",
"brace": "^0.11.1",
"core-js": "^3.6.5",
"electron": "^12.0.7",
"electron": "^13.1.8",
"flickity": "^2.2.2",
"fs": "0.0.1-security",
"html2canvas": "^1.0.0-rc.7",
Expand All @@ -41,16 +40,16 @@
"vue-router": "^3.5.1"
},
"devDependencies": {
"script-loader": "^0.7.2",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"electron": "^11.0.0",
"electron": "^13.0.0",
"electron-devtools-installer": "^3.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"script-loader": "^0.7.2",
"vue-cli-plugin-electron-builder": "~2.0.0-rc.6",
"vue-cli-plugin-electron-builder": "~2.1.1",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added resources/icons/256x256.png
Binary file added resources/icons/512x512.png
Binary file added resources/icons/favicon.ico
Binary file not shown.
Binary file added resources/icons/icon.icns
Binary file not shown.
Binary file added resources/icons/icon.png
54 changes: 41 additions & 13 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ const cp = require('child_process');
const ipc = require('electron').ipcMain
const dialog = require('electron').dialog
const isDevelopment = process.env.NODE_ENV !== 'production';
const isDev = process.mainModule.filename.indexOf('app.asar') === -1;

var win;
var underDebug ;
var underDebug;

// Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([
Expand All @@ -22,13 +24,24 @@ protocol.registerSchemesAsPrivileged([
async function createWindow() {

// Create the browser window.
let iconPath = 'public/256x256.png';
if (isDev){
if (process.platform == 'darwin'){
iconPath = 'public/icon.icns';
}
}else{
iconPath = process.resourcesPath +'/resources/icons/512x512.png';
if (process.platform == 'darwin'){
iconPath = process.resourcesPath +'/resources/icons/icon.icns';
}
}
win = new BrowserWindow({
icon: 'public/256x256.png',
icon:iconPath,
width: 1000,
height: 600,
minHeight:600,
minWidth:800,
frame:false,
minHeight: 600,
minWidth: 800,
frame: false,
webPreferences: {

// Use pluginOptions.nodeIntegration, leave this alone
Expand Down Expand Up @@ -109,7 +122,7 @@ ipc.on('open-file-dialog', function (event) {
dialog.showOpenDialog({
properties: ['openFile']
}, function (files) {
if (files){
if (files) {
event.sender.send('selected-file', files);
}
})
Expand Down Expand Up @@ -206,7 +219,11 @@ ipc.on('save-as-file-project', function (event, arg) {
win.webContents.send('message', {type: 'error', 'msg': 'error: ' + path.basename(filename)});
}
// otherwise we saved send msg to ide saved :)
win.webContents.send('message', {type: 'success', 'msg': path.basename(filename) + ' saved', 'save':true});
win.webContents.send('message', {
type: 'success',
'msg': path.basename(filename) + ' saved',
'save': true
});
});
} catch (e) {
win.webContents.send('message', {type: 'error', 'error': e.message});
Expand All @@ -233,7 +250,7 @@ ipc.on('save-project', function (event, arg) {
win.webContents.send('message', {type: 'error', 'msg': 'error: ' + path.basename(filename)});
}
// otherwise we saved send msg to ide saved :)
win.webContents.send('message', {type: 'success', 'msg': path.basename(filename) + ' saved', 'save':true });
win.webContents.send('message', {type: 'success', 'msg': path.basename(filename) + ' saved', 'save': true});
});
} catch (e) {
win.webContents.send('message', {type: 'error', 'error': e.message});
Expand All @@ -247,16 +264,27 @@ ipc.on('save-project', function (event, arg) {
ipc.on('command', function (eventevent, data) {
//

let cwd = __dirname + '/..';
let cwd = __dirname;
if ( isDev ) {
cwd = '/..';
}else{
cwd = process.resourcesPath;
}
cwd += '/resources';
if (data.cwd) {
cwd = cwd + '/' + data.cwd;
}
// fs.writeFileSync('/home/freeman/log', process.resourcesPath);
let child = cp.exec(data.command, {
cwd: cwd,
env: {
NODE_ENV: 'production',
PATH: process.env.PATH
}
}, function (error, stdout, stderr) {
if (!error) {
// win.webContents.send('terminal', stdout);
if (data.isUpdate !== undefined){
if (data.isUpdate !== undefined) {
win.webContents.send('build-success', true);
}
// win.webContents.send('message', {type: 'info', 'msg': stderr});
Expand All @@ -265,10 +293,10 @@ ipc.on('command', function (eventevent, data) {
win.webContents.send('terminal-error', error.message);
}
});
if (data.isDebug !== undefined){
if (data.isDebug !== undefined) {
underDebug = child;
}
child.stdout.on('data', function(data) {
child.stdout.on('data', function (data) {
win.webContents.send('terminal', data);
});
});
Expand All @@ -280,7 +308,7 @@ ipc.on('update-project', function (eventevent, data) {
underDebug.stdin.write("R");
win.webContents.send('message', {type: 'success', 'msg': 'hot restart'});

} catch(e) {
} catch (e) {
win.webContents.send('message', {type: 'error', 'msg': error.message});
}

Expand Down
3 changes: 2 additions & 1 deletion src/components/pages/MainAppPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ import actionControl from '../elements/ActionControlElement';
import optionControl from '../elements/OptionControlElement';
import {Drag, Drop} from "vue-easy-dnd";
import VueContext from 'vue-context';
/*eslint-disable */
import Sortable from '@/assets/js/Sortable.min';
/*eslint-enable */
// import editor from '../elements/TitleElement';
// const {remote} = require("electron");
Expand Down
76 changes: 45 additions & 31 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,53 @@ module.exports = {
electronBuilder: {
preload: './src/preload.js',
// Or, for multiple preload files:
"appId": "app.anubias.desktop",
"productName": "Anubias",
"copyright": "Copyright © 2021 ${author}",
"mac": {
"target": "dmg",
"icon": "./public/icon.icns",
"category": "public.app-category.developer-tools"
},
"win": {
"target": [
"nsis",
"msi"
// "appId": "app.anubias.desktop",
// "productName": "Anubias",
// "copyright": "Copyright © 2021 ${author}",
// // "asar": false,
// "mac": {
// "target": "dmg",
// "icon": "./public/icon.icns",
// "category": "public.app-category.developer-tools"
// },
// "win": {
// "target": [
// "nsis",
// "msi"
// ],
// "icon": "./public/256x256.png"
// },
// "linux": {
// // "category": "Development",
// "target": "AppImage",
// "desktop": "Anubias"
// },
// "directories": {
// "buildResources": "public",
// },
// // "publish": null,
// "fileAssociations": [
// {
// "ext": "anb",
// "name": "Anbuias project",
// "role": "Anubias",
// "perMachine": true,
// "description": "Anubias project file to develop native app anywhere painless"
// }
// ],
builderOptions: {
extraResources: [
{
"from": "resources",
"to": "resources",
"filter": ["**/*"]
}
],
"icon": "./public/256x256.png"
},
"linux": {
"category": "Development",
"target": "AppImage",
"desktop": "Anubias"
},
"directories": {
"buildResources": "public"
},
"fileAssociations": [
{
"ext": "anb",
"name": "Anbuias project",
"role": "Anubias",
"perMachine": true,
"description": "Anubias project file to develope native app anywhere painless"
}
]
// preload: { preload: 'src/preload.js', otherPreload: 'src/preload2.js' }
"files": [
"**/*"
],

}
}
};

0 comments on commit 9c79963

Please sign in to comment.