Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main.html
#	src/renderer/resources/lang/code.json
#	src/renderer/resources/lang/ebs.json
#	src/renderer/resources/lang/en.json
#	src/renderer/resources/lang/jp.json
#	src/renderer/resources/lang/ko.json
#	src/renderer/resources/lang/vn.json
#	yarn.lock
  • Loading branch information
extracold1209 committed Mar 26, 2020
2 parents 004d351 + aa0fae7 commit f630c1d
Show file tree
Hide file tree
Showing 45 changed files with 1,520 additions and 347 deletions.
2 changes: 1 addition & 1 deletion build/entryx64.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
!define MUI_UNICON "icon.ico"
!define PRODUCT_NAME "Entry"
!define APP_NAME "Entry.exe"
!define PRODUCT_VERSION "2.0.18"
!define PRODUCT_VERSION "2.0.19"
!define PRODUCT_PUBLISHER "EntryLabs"
!define PRODUCT_WEB_SITE "http://www.playentry.org/"

Expand Down
2 changes: 1 addition & 1 deletion build/entryx86.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
!define MUI_UNICON "icon.ico"
!define PRODUCT_NAME "Entry"
!define APP_NAME "Entry.exe"
!define PRODUCT_VERSION "2.0.18"
!define PRODUCT_VERSION "2.0.19"
!define PRODUCT_PUBLISHER "EntryLabs"
!define PRODUCT_WEB_SITE "http://www.playentry.org/"

Expand Down
3 changes: 2 additions & 1 deletion config/config.ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"baseUrl": "https://playentry.org",
"baseResource": "/public/hardware",
"versionCheckApi": "/api/checkVersion",
"moduleCheckApi": "/api/hardware"
"moduleCheckApi": "/api/hardware",
"moduleResourceUrl": "http://localhost:5200/modules"
}
22 changes: 19 additions & 3 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,31 @@
"win": {
"target": "dir"
},
"fileAssociations": [
{
"ext": "ent",
"role": "Editor",
"name": "Entry File",
"icon": "icon.icns"
}
],
"files": [
"src/main/static",
"src/main/views/WebAudioPluginTest.fail",
"src/**/*.html",
"src/renderer/bower_components",
"src/renderer/resources",
"src/WebAudioPluginTest.fail",
"src/main_build",
"src/renderer_build",
"src/preload_build",
"!src/main_build/hot",
"!src/renderer_build/hot",
"!node_modules/entry-hw/app/server",
"!src/**/*.map",
"!src/**/*.scss",
"!node_modules/entry-hw/app/server",
"!node_modules/entry-hw/app/modules",
"!node_modules/entry-hw/app/firmwares",
"!node_modules/entry-hw/app/drivers",
{
"from": "node_modules/entry-js",
"to": "node_modules/entry-js"
Expand All @@ -54,7 +65,12 @@
}
],
"extraResources": [
"config/**/*"
"config/**/*",
{
"from": "node_modules/entry-hw/app",
"to": "",
"filter": ["modules/**/*", "firmwares/**/*", "drivers/**/*"]
}
],
"electronCompile": false,
"asar": true,
Expand Down
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"productName": "Entry",
"name": "entry",
"version": "2.0.18",
"version": "2.0.19",
"description": "Entry for offline",
"main": "src/main_build/main.bundle.js",
"scripts": {
Expand All @@ -15,7 +15,7 @@
"dist:win64": "cross-env NODE_ENV=production webpack && electron-builder -c --win --x64",
"dist:win": "cross-env NODE_ENV=production webpack && electron-builder -c --win --x64 && electron-builder -c --win --ia32",
"dist:mac:notarize": "cross-env NODE_ENV=production webpack && cross-env NOTARIZE=true electron-builder -c --mac",
"dist:mac": "cross-env NODE_ENV=development webpack && cross-env NOTARIZE=false electron-builder -c --mac",
"dist:mac": "cross-env NODE_ENV=production webpack && cross-env NOTARIZE=false electron-builder -c --mac",
"rebuild": "electron-rebuild -f",
"postinstall": "npm run rebuild && npm run webpack:dev"
},
Expand All @@ -26,10 +26,11 @@
"author": "entrylabs",
"license": "MIT",
"dependencies": {
"entry-hw": "git+https://github.com/entrylabs/entry-hw.git#dist/v1.9.3-alpha1",
"async-csv": "^2.1.3",
"entry-hw": "git+https://github.com/entrylabs/entry-hw.git#dist/v1.9.4",
"entry-hw-server": "git+https://github.com/entrylabs/entry-hw-server.git#master",
"entry-js": "git+https://github.com/entrylabs/entryjs.git#dist/offline_v2.0.18",
"entry-tool": "git+https://github.com/entrylabs/entry-tool.git#v1.20200218.191",
"entry-js": "git+https://github.com/entrylabs/entryjs.git#dist/offline_v2.0.19",
"entry-tool": "git+https://github.com/entrylabs/entry-tool.git#v1.20200226.207",
"excel4node": "^1.7.0",
"fs-extra": "^8.1.0",
"image-size": "^0.8.3",
Expand All @@ -38,13 +39,16 @@
"lodash": "^4.17.15",
"mime-types": "^2.1.26",
"music-metadata": "^6.3.0",
"node-xlsx": "^0.15.0",
"puid": "^1.0.7",
"rimraf": "^2.6.3",
"socket.io": "^2.2.0",
"socket.io-client": "^2.2.0",
"tar": "^4.4.10",
"uid": "^0.0.2",
"xml2js": "^0.4.19"
"xml2js": "^0.4.19",
"winston": "^3.2.1",
"winston-daily-rotate-file": "^4.4.2"
},
"devDependencies": {
"@types/archiver": "^3.0.0",
Expand All @@ -55,6 +59,7 @@
"@types/lodash": "^4.14.134",
"@types/mime-types": "^2.1.0",
"@types/node": "^12.0.8",
"@types/node-xlsx": "^0.15.0",
"@types/react": "^16.9.13",
"@types/react-dom": "^16.8.4",
"@types/react-redux": "^7.1.5",
Expand All @@ -66,6 +71,7 @@
"@types/socket.io-client": "^1.4.32",
"@types/styled-components": "^4.4.1",
"@types/tar": "^4.0.0",
"@types/winston": "^2.4.4",
"@typescript-eslint/eslint-plugin": "^2.12.0",
"@typescript-eslint/parser": "^1.10.2",
"babel-eslint": "^10.0.3",
Expand Down
56 changes: 0 additions & 56 deletions src/main.html

This file was deleted.

13 changes: 10 additions & 3 deletions src/main/blockConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import xml2js from 'xml2js';
import _ from 'lodash';
import entry from './entryBlocks';
import createLogger from './utils/functions/createLogger';

const parseString = xml2js.parseString;
const logger = createLogger('main/xmlBlockConverter');

function processCode(xml: any) {
let code = [];
Expand Down Expand Up @@ -205,10 +208,14 @@ function processBlock(block: any, thread: any) {

export default {
convert(project: any, cb: any) {
logger.warn('legacy xml project request convert');
logger.warn('project data is..');
logger.warn(JSON.stringify(project));

const objects = project.objects;
const functions = project.functions;

var done = _.after(functions.length, function() {
let done = _.after(functions.length, function() {
done = _.after(objects.length, function() {
cb(project);
});
Expand All @@ -218,7 +225,7 @@ export default {
}

for (let i = 0; i < objects.length; i++) {
var object = objects[i];
const object = objects[i];
parseString(object.script, function(err: any, xml: any) {
object.script = JSON.stringify(processCode(xml));
done();
Expand All @@ -231,7 +238,7 @@ export default {
}

for (let i = 0; i < functions.length; i++) {
var func = functions[i];
const func = functions[i];
parseString(func.content, function(err: any, xml: any) {
func.content = JSON.stringify(processCode(xml));
done();
Expand Down
13 changes: 13 additions & 0 deletions src/main/commonUtils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import Puid from 'puid';
import uid from 'uid';

const puid = new Puid();

/**
* main, renderer process 에서 공용으로 사용하는 Utils.
* 그러므로 이 클래스는 모듈 연결상 EndPoint 가 되어야 한다.
Expand All @@ -18,6 +23,14 @@ class CommonUtils {
.substr(2, 4);
}

/**
* 16진수의 랜덤값을 설정한다. 이 값은 겹치지 않은 신규 파일명을 생성하는데 쓴다.
* @return {string}
*/
static createFileId(): string {
return uid(8) + puid.generate();
}

/**
* 확장자 앞에 . 을 붙여준다. 확장자가 없는 경우 defaultExtension 을 반환한다.
*
Expand Down
56 changes: 56 additions & 0 deletions src/main/dataTable/dataTableManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import path from 'path';
import { CsvModel, ExcelModel } from './models';
import CommonUtils from '../commonUtils';

const Models = [CsvModel, ExcelModel];

type ITableData = {
chart: any[];
fields: string[];
rows: number;
data: string[][];
name: string;
}

class DataTableManager {
private _tables: { [hash: string]: { name: string, data: ITableData } } = {};

async makeTableInfo(file: string): Promise<{ id: string; name: string } | undefined> {
try {
const { name, table } = this._createTable(file);
await table.readFile(file);
const rows = table.getRows();
const hashId = CommonUtils.createFileId();
const result: ITableData = {
chart: [],
fields: rows.shift() || [],
rows: rows.length,
data: rows,
name,
};

this._tables[hashId] = ({ name, data: result });
return { id: hashId, name };
} catch (e) {
console.warn('getTable error', e);
}
}

getTable(hashId: string): ITableData | undefined {
return this._tables[hashId]?.data;
}

private _createTable(file: string) {
const ext = path.extname(file);
const Model = Models.find((model) => model.getExtensions().includes(ext.replace('.', '')));
if (!Model) {
throw new Error(`invalid type: ${ext}`);
}
return {
name: path.basename(file),
table: new Model(),
};
}
}

export default new DataTableManager();
22 changes: 22 additions & 0 deletions src/main/dataTable/models/csvModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ITableModel } from './index';
import csv from 'async-csv';
import fs from 'fs-extra';

class CsvModel implements ITableModel {
private rows: string[][] = [];

static getExtensions(): string[] {
return ['csv'];
}

async readFile(file: string): Promise<void> {
const csvString = await fs.readFile(file, 'utf8');
this.rows = await csv.parse(csvString);
}

getRows(): string[][] {
return this.rows;
}
}

export default CsvModel;
24 changes: 24 additions & 0 deletions src/main/dataTable/models/excelModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ITableModel } from './index';
import xlsx from 'node-xlsx';

class ExcelModel implements ITableModel {
private sheets?: {name: string, data: [][]}[] = undefined;

static getExtensions(): string[] {
return ['xlsx', 'xls'];
}

async readFile(file: string): Promise<void> {
this.sheets = xlsx.parse(file);
}

getRows(sheetNum = 0): string[][] {
const sheet = this.sheets && this.sheets[sheetNum];
if (sheet) {
return sheet.data;
}
return [];
}
}

export default ExcelModel;
8 changes: 8 additions & 0 deletions src/main/dataTable/models/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export { default as CsvModel } from './csvModel';
export { default as ExcelModel } from './excelModel';

export interface ITableModel {
readFile(file: string): Promise<void>;
getRows(): string[][];
// public abstract async write(): Promise<any>;
}
Loading

0 comments on commit f630c1d

Please sign in to comment.