1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 14:07:01 +09:00

#12: dist build

This commit is contained in:
Andrew Simachev 2019-11-21 12:54:38 +03:00
parent 319b39db32
commit c127e2bcbe
9 changed files with 1212 additions and 80 deletions

View file

View file

@ -1,7 +1,9 @@
const electron = require('electron');
const { app, BrowserWindow, ipcMain, shell } = require('electron');
const { is, appMenu } = require('electron-util');
const path = require('path');
const os = require('os');
const userDataPath = app.getPath('userData');
function createWindow () {
const { width, height } = electron.screen.getPrimaryDisplay().workAreaSize;
@ -27,12 +29,16 @@ function createWindow () {
);
*/
win.loadURL('http://localhost:8080');
//win.loadFile('dist/index.html');
win.toggleDevTools();
if (is.development) {
win.loadURL('http://localhost:8080');
win.toggleDevTools();
} else {
win.loadFile('dist/index.html');
};
ipcMain.on('appLoaded', () => {
console.log('appLoaded');
win.webContents.send('userDataPath', userDataPath);
});
ipcMain.on('appClose', () => {

1174
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
{
"name": "anytype",
"version": "1.0.0",
"description": "",
"description": "Anytype",
"main": "electron.js",
"scripts": {
"lint": "tslint -c tslint.json -p tsconfig.json",
@ -9,7 +9,15 @@
"start:watch": "webpack-dev-server --mode=development --env.NODE_ENV=development --history-api-fallback --cache",
"start:electron": "./node_modules/.bin/electron .",
"start:electron-wait-webpack": "wait-for-localhost 8080 && ./node_modules/.bin/electron .",
"start:dev": "npm-run-all --parallel start:watch start:electron-wait-webpack"
"start:dev": "npm-run-all --parallel start:watch start:electron-wait-webpack",
"build": "webpack --mode=development --env.NODE_ENV=development",
"build:prod": "webpack --mode=production --env.NODE_ENV=production -p --config webpack.config.js",
"dist:mac": "webpack --mode=production --env.NODE_ENV=production -p && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --macos",
"dist:win": "webpack --mode=production --env.NODE_ENV=production -p && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --windows",
"dist:linux": "webpack --mode=production --env.NODE_ENV=production -p && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` electron-builder --linux",
"publish:mac": "webpack --mode=production --env.NODE_ENV=production -p && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` BUILD_NUMBER=`git rev-parse --short HEAD` electron-builder --macos --publish always",
"publish:linux": "webpack --mode=production --env.NODE_ENV=production -p && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` BUILD_NUMBER=`git rev-parse --short HEAD` electron-builder --linux --publish always",
"publish:win": "webpack --mode=production --env.NODE_ENV=production -p && DATE=`date '+%Y-%m-%d_%H_%M'` GIT_COMMIT=`git rev-parse --short HEAD` BUILD_NUMBER=`git rev-parse --short HEAD` electron-builder --windows --publish always"
},
"repository": {
"type": "git",
@ -27,10 +35,8 @@
"@types/react": "^16.9.11",
"@types/react-dom": "^16.9.4",
"@types/react-router-dom": "^4.3.5",
"electron-dl": "^1.14.0",
"electron-log": "^3.0.9",
"electron-updater": "^4.2.0",
"electron-util": "^0.12.3",
"electron": "^6.1.4",
"electron-builder": "^21.2.0",
"file-loader": "^4.2.0",
"npm-run-all": "^4.1.5",
"source-map-loader": "^0.2.4",
@ -59,7 +65,10 @@
"bindings": "^1.5.0",
"blueimp-load-image": "^2.24.0",
"css-loader": "^3.2.0",
"electron": "^6.1.4",
"electron-dl": "^1.14.0",
"electron-log": "^3.0.9",
"electron-updater": "^4.2.0",
"electron-util": "^0.12.3",
"emoji-mart": "^2.11.1",
"file-type": "^12.4.0",
"fs": "0.0.1-security",
@ -93,5 +102,65 @@
"sprintf-kit": "^2.0.0",
"style-loader": "^1.0.0",
"url-loader": "^2.2.0"
},
"build": {
"appId": "com.anytype.anytype",
"compression": "normal",
"productName": "Anytype",
"protocols": [
{
"name": "Anytype",
"role": "Editor",
"schemes": [
"anytype"
]
}
],
"asarUnpack": [
],
"extraResources": [],
"files": [
"electron.js",
"!dist/*",
"dist/index.html",
"dist/main.js",
"build"
],
"mac": {
"icon": "electron/icon.icns",
"type": "distribution",
"target": [
"dmg",
"zip"
],
"category": "public.app-category.productivity",
"artifactName": "${productName}-${version}-${env.GIT_COMMIT}-${env.DATE}.${ext}",
"publish": [
{
"provider": "spaces",
"name": "anytype",
"region": "ams3"
}
]
},
"win": {
"target": "nsis",
"icon": "electron/icon.ico"
},
"linux": {
"icon": "electron/icon.png",
"target": [
"snap",
"AppImage"
],
"description": "Anytype"
},
"publish": [
{
"provider": "spaces",
"name": "anytype",
"region": "ams3"
}
]
}
}

View file

@ -1,4 +1,3 @@
{
"root": "./repo",
"intercom": "zy2yo0vf"
}

View file

@ -107,6 +107,10 @@ class App extends React.Component<{}, {}> {
ipcRenderer.send('appLoaded', true);
keyboard.init(history);
ipcRenderer.on('userDataPath', (e, userDataPath) => {
Storage.set('rootPath', userDataPath + '/data');
});
let phrase = Storage.get('phrase');
if (phrase) {
history.push('/auth/setup/init');

View file

@ -1,7 +1,7 @@
import * as React from 'react';
import { RouteComponentProps } from 'react-router';
import { Frame, Cover, Title, Label, Error, Textarea, Button, HeaderAuth as Header, FooterAuth as Footer } from 'ts/component';
import { dispatcher } from 'ts/lib';
import { dispatcher, Storage } from 'ts/lib';
import { observer, inject } from 'mobx-react';
interface Props extends RouteComponentProps<any> {
@ -12,8 +12,6 @@ interface State {
error: string;
};
const Config: any = require('json/config.json');
@inject('commonStore')
@inject('authStore')
@observer
@ -76,7 +74,7 @@ class PageAuthLogin extends React.Component<Props, State> {
this.phraseRef.setError(false);
let request = {
rootPath: Config.root,
rootPath: Storage.get('rootPath'),
mnemonic: this.phraseRef.getValue()
};

View file

@ -12,8 +12,6 @@ interface State {
error: string;
};
const Config: any = require('json/config.json');
@inject('commonStore')
@inject('authStore')
@observer
@ -63,7 +61,7 @@ class PageAuthSelect extends React.Component<Props, State> {
const { authStore, history } = this.props;
let request = {
rootPath: Config.root
rootPath: Storage.get('rootPath')
};
dispatcher.call('walletCreate', request, (errorCode: any, message: any) => {

View file

@ -14,7 +14,6 @@ interface State {
error: string;
};
const Config: any = require('json/config.json');
const Icons: number[] = [
12, 1230, 1, 130, 2, 230, 3, 330, 4, 430, 5, 530, 6, 630, 7, 730, 8, 830, 9, 930, 10, 1030, 11, 1130
];
@ -108,10 +107,11 @@ class PageAuthSetup extends React.Component<Props, State> {
if (!phrase) {
return;
};
let path = Storage.get('rootPath');
let accountId = Storage.get('accountId');
let request: any = {
rootPath: Config.root,
rootPath: path,
mnemonic: phrase
};
@ -123,7 +123,7 @@ class PageAuthSetup extends React.Component<Props, State> {
authStore.phraseSet(phrase);
request = {
rootPath: Config.root,
rootPath: path,
id: accountId
};