Skip to content

Commit

Permalink
Change project stack
Browse files Browse the repository at this point in the history
WHOLE change
Remove gulp, bundler...
  • Loading branch information
ovekyc committed Dec 29, 2016
1 parent 8bbd213 commit 9ba5fb7
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 245 deletions.
18 changes: 0 additions & 18 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,5 @@
"es2015",
"react",
"stage-0"
],
"plugins": [
"transform-object-assign"
],
"env": {
"test": {
"plugins": [
[
"__coverage__",
{
"ignore": "src/test/"
}
]
]
}
},
"ignore": [
"*.es5.js"
]
}
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,4 @@ jspm_packages
/.idea/
.idea/

TextLogger*
dist/*

log.txt
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Oliver Mader <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
13 changes: 10 additions & 3 deletions src/app/core/main.js → app/core/main.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {app, globalShortcut, clipboard} from 'electron';
import {app, globalShortcut, clipboard, ipcMain} from 'electron';
import fs from 'fs';
import menubar from 'menubar';

const dir = process.cwd();
const logPath = `${dir}/log.txt`;
const indexPath = `file://${dir}/dist/static/index.html`;
const indexPath = `file://${dir}/app/view/popup.html`;
const mb = menubar({index: indexPath});

function saveContents() {
Expand All @@ -14,10 +14,17 @@ function saveContents() {
}

mb.on('ready', () => {
console.log(dir);
globalShortcut.register('Control+Command+S', saveContents);

if (!globalShortcut.isRegistered('Control+Command+S')) {
// TODO: alert and eld process
// TODO: alert and end process
}
});

mb.on('show', () => {
ipcMain.on('synchronous-message', (event) => {
event.returnValue = 'haha';// fs.readFileSync(logPath, 'utf-8');
});
mb.window.reload();
});
16 changes: 16 additions & 0 deletions app/view/app-component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import ClipList from './clip-list';

export default class AppComponent extends React.Component {
constructor() {
super();
}

render() {
return (
<div>
<ClipList />
</div>
);
}
}
32 changes: 32 additions & 0 deletions app/view/clip-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import readlines from 'gen-readlines';
import fs from 'fs';

export default class ClipList extends React.Component {
constructor() {
super();
this.fd = this.openLogFile();
this.buffer = this.openBuffer();
this.contents = '2';
}

async openLogFile() {
return await fs.openSync('log.txt', 'r');
}

async openBuffer() {
return await fs.fstatSync(this.fd);
}

renderClip(contents) {
return <div> hii </div>;
}

render() {
return (
<div>
{readlines(this.fd, this.buffer.size).forEach(console.log)}
</div>
);
}
}
15 changes: 15 additions & 0 deletions app/view/clip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';

export default class Clip extends React.Component {
constructor(props) {
super(props);
}

render() {
return (
<div>
<div>{this.props.contents}</div>
</div>
);
}
}
15 changes: 15 additions & 0 deletions app/view/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>electron es6 react boilerplate</title>
<script>
// install babel hooks in the renderer process
require('babel-register');
require('./popup');
</script>
</head>

<body>
<div id="app"></div>
</body>
</html>
7 changes: 7 additions & 0 deletions app/view/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './app-component';

window.onload = function(){
ReactDOM.render(<App />, document.getElementById('app'));
}
109 changes: 0 additions & 109 deletions gulpfile.babel.js

This file was deleted.

6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node
require('source-map-support').install();
require('./dist/core/main.js');
// install babel hooks in the main process
require('babel-register');
require('./app/core/main.js');
51 changes: 6 additions & 45 deletions package.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,60 +1,21 @@
{
"name": "text-logger",
"version": "0.0.0",
"private": true,
"main": "index.js",
"description": "log text with hotkeys",
"license": "N/A",
"repository": {
"type": "git",
"url": "[email protected]:ovekyc/----.git"
},
"license": "MIT",
"repository": "[email protected]:ovekyc/textlogger.git",
"scripts": {
"build-test": "gulp build:test",
"test": "BABEL_ENV=test NODE_ENV=test npm run build-test && gulp test",
"lint": "gulp lint",
"start": "electron .",
"build": "gulp build && electron-packager . TextLogger --platform=darwin --arch=x64 --version=0.36.0 --icon=Icon.icns --overwrite",
"clean": "gulp clean"
"start": "electron ."
},
"pre-commit": [
"test"
],
"dependencies": {
"electron": "^1.4.13",
"gulp": "^3.9.1",
"menubar": "^5.2.0",
"node-simple-logger": "0.0.1",
"react": "^15.4.1",
"react-dom": "^15.4.1",
"source-map-support": "^0.4.2"
"react-dom": "^15.4.1"
},
"devDependencies": {
"babel-core": "^6.21.0",
"babel-plugin-__coverage__": "^11.0.0",
"babel-plugin-transform-object-assign": "^6.8.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"babelify": "^7.3.0",
"browserify": "^13.1.1",
"config-browserify": "^1.0.5",
"electron-packager": "^8.4.0",
"envify": "^4.0.0",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-changed": "^1.3.2",
"gulp-eslint": "^3.0.1",
"gulp-image": "^2.7.2",
"gulp-nodemon": "^2.2.1",
"gulp-sourcemaps": "^1.9.1",
"gulp-util": "^3.0.8",
"rimraf": "^2.5.4",
"unitest": "^0.14.2",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
},
"engines": {
"node": "6.4.0"
"babel-register": "^6.18.0",
"electron": "^1.4.3"
}
}
Binary file removed src/app/static/Icon.icns
Binary file not shown.
Binary file removed src/app/static/IconTemplate.png
Binary file not shown.
Binary file removed src/app/static/[email protected]
Binary file not shown.
10 changes: 0 additions & 10 deletions src/app/static/index.html

This file was deleted.

7 changes: 0 additions & 7 deletions src/app/static/index.js

This file was deleted.

Loading

0 comments on commit 9ba5fb7

Please sign in to comment.