Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukaii committed Jan 21, 2017
0 parents commit fe945ca
Show file tree
Hide file tree
Showing 9 changed files with 1,720 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

[{.travis.yml,npm-shrinkwrap.json,package.json}]
indent_style = space
indent_size = 2
49 changes: 49 additions & 0 deletions .gitignore
@@ -0,0 +1,49 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

dist
15 changes: 15 additions & 0 deletions README.md
@@ -0,0 +1,15 @@
# HackMD Desktop Client

## Tools

- electron

## Development

```bash
npm install -g yarn
yarn

npm run dev # if you've started HackMD in localhost:3000
npm run start # load https://hackmd.io
```
Empty file added build/.gitkeep
Empty file.
44 changes: 44 additions & 0 deletions main.js
@@ -0,0 +1,44 @@
const { app, BrowserWindow } = require('electron');
const os = require('os');
const fs = require('fs');

let mainWin;

const winOption = {
width: 1024,
height: 768,
webPreferences: {
webSecurity: false,
nodeIntegration: false
}
}

const isDarwin = os.platform() === 'darwin';

function initializeApp () {
mainWin = new BrowserWindow(
(isDarwin
? Object.assign({}, winOption, {titleBarStyle: 'hidden-inset'})
: winOption)
);

if (process.env.NODE_ENV === 'development') {
mainWin.loadURL('http://localhost:3000');
} else {
mainWin.loadURL('https://hackmd.io');
}

mainWin.webContents.on('did-finish-load', function() {
let cssPath = isDarwin ? '/static/darwin.css' : '/static/app.css';

fs.readFile(__dirname + cssPath, 'utf-8', function(error, data) {
if (!error) {
mainWin.webContents.insertCSS(data);
}
});
});
}

app.on('ready', () => {
initializeApp();
});
24 changes: 24 additions & 0 deletions package.json
@@ -0,0 +1,24 @@
{
"name": "hackmd-desktop",
"version": "0.0.1",
"description": "HackMD desktop client",
"main": "main.js",
"scripts": {
"dev": "cross-env NODE_ENV=development electron .",
"start": "cross-env NODE_ENV=production electron .",
"dist": "build -mwl"
},
"author": "Yukai Huang <yukaihuangtw@gmail.com> (https://yukaii.tw)",
"license": "MIT",
"devDependencies": {
"cross-env": "^3.1.4",
"electron": "^1.4.15",
"electron-builder": "^11.4.4"
},
"build": {
"appId": "com.hackmd.desktop",
"mac": {
"category": "public.app-category.productivity"
}
}
}
3 changes: 3 additions & 0 deletions static/app.css
@@ -0,0 +1,3 @@
.navbar.navbar-default {
-webkit-app-region: drag;
}
7 changes: 7 additions & 0 deletions static/darwin.css
@@ -0,0 +1,7 @@
.navbar-header {
margin-left: 70px;
}

.navbar.navbar-default {
-webkit-app-region: drag;
}

0 comments on commit fe945ca

Please sign in to comment.