Skip to content

Commit

Permalink
Merge pull request #1 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
cezres authored Jan 24, 2019
2 parents 3382282 + 07c0ba7 commit 4497bf6
Show file tree
Hide file tree
Showing 28 changed files with 14,011 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

# Use 4 spaces for the Python files
[*.py]
indent_size = 4
max_line_length = 80

# The JSON files contain newlines inconsistently
[*.json]
insert_final_newline = ignore

# The JavaScript file
[*.js]
indent_size = 2
max_line_length = 80

# Minified JavaScript files shouldn't be changed
[**.min.js]
indent_style = ignore
insert_final_newline = ignore

# Makefiles always use tabs for indentation
[Makefile]
indent_style = tab

# Batch files use tabs for indentation
[*.bat]
indent_style = tab

[*.md]
trim_trailing_whitespace = false
32 changes: 32 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
"extends": "airbnb",
"parser": "@typescript-eslint/parser",
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error",
"semi": [2, "never"],
"comma-dangle": [2, {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}],
"import/no-extraneous-dependencies": [2, {
"devDependencies": true
}]
},
"env": {
"jest": true,
"browser": true,
"node": true
},
"settings": {
"import/resolver": {
"node": {
"paths": ["src"],
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
}
};
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
build
dist
pages

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# deps lock
# yarn-lock.json
package-lock.json
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "all",
"semi": false,
"singleQuote": true
}
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: node_js

node_js:
- '10.15'

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
- export PATH=$HOME/.yarn/bin:$PATH

install:
- yarn install
- yarn lerna bootstrap

script:
- yarn test
8 changes: 8 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"packages": [
"packages/*"
],
"version": "0.1.0",
"npmClient": "yarn",
"useWorkspaces": true
}
61 changes: 61 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "neuron",
"description": "CKB Neuron Wallet",
"version": "0.1.0",
"private": true,
"author": {
"name": "Nervos Core Dev",
"email": "[email protected]",
"url": "https://github.com/nervosnetwork/neuron"
},
"license": "MIT",
"engines": {
"node": ">= 10.15",
"yarn": ">= 1.12"
},
"workspaces": [
"packages/*"
],
"scripts": {
"lint": "lerna run lint",
"test": "lerna run test",
"start:react": "cd packages/react-app && yarn start",
"start:electron": "cd packages/electron-app && yarn start",
"start": "NODE_ENV=development concurrently \"yarn run start:react\" \"wait-on http://localhost:3000 && yarn run start:electron\"",
"pack": "lerna run --scope neuron pack",
"dist": "lerna run --scope neuron dist",
"precommit": "lint-staged"
},
"lint-staged": {
"packages/*/src/**/*.{ts,tsx}": ["eslint --fix", "git add"]
},
"devDependencies": {
"@cryptape/sdk-ts-config": "0.0.1",
"@typescript-eslint/parser": "^1.0.0",
"concurrently": "^4.1.0",
"cz-conventional-changelog": "^2.1.0",
"eslint": "5.6.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "^7.12.4",
"husky": "^1.3.1",
"lerna": "^3.10.5",
"lint-staged": "^8.1.0",
"prettier": "^1.16.0",
"tslint": "^5.12.1",
"tslint-config-prettier": "^1.17.0",
"tslint-microsoft-contrib": "^6.0.0",
"tslint-react": "^3.6.0",
"typescript": "^3.2.2",
"typescript-tslint-plugin": "^0.2.1",
"wait-on": "^3.2.0"
},
"dependencies": {},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
Binary file added packages/electron-app/AppIcon.icns
Binary file not shown.
40 changes: 40 additions & 0 deletions packages/electron-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "neuron",
"description": "CKB Neuron Wallet",
"version": "0.1.0",
"private": true,
"author": {
"name": "Nervos Core Dev",
"email": "[email protected]",
"url": "https://github.com/nervosnetwork/neuron"
},
"main": "./dist/main.js",
"license": "MIT",
"scripts": {
"cp:pages": "cp -r ../react-app/build ./pages",
"build": "tsc",
"watch": "tsc -w",
"lint": "tslint -p .",
"start": "yarn run build && electron .",
"pack": "rm -rf 'dist/mac' && electron-builder --dir",
"dist": "rm -rf 'dist/mac' && electron-builder"
},
"build": {
"appId": "nervos_dev",
"mac": {
"category": "blockchain_wallet"
},
"files": [
"./dist/**/*",
"./pages/**/*"
],
"asar": false
},
"dependencies": {},
"devDependencies": {
"@types/electron": "^1.6.10",
"electron": "^4.0.1",
"electron-builder": "^20.38.5",
"tslint": "^5.12.1"
}
}
56 changes: 56 additions & 0 deletions packages/electron-app/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Modules to control application life and create native browser window
import { app, BrowserWindow } from 'electron'
import * as path from 'path'

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow: Electron.BrowserWindow | null
const { NODE_ENV } = process.env
const ENTRY = {
DEV: 'http://localhost:3000',
PROD: `file://${path.join(__dirname, '../pages/index.html')}`,
}

function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
icon: `${__dirname}/../AppIcon.icns`,
webPreferences: {
devTools: NODE_ENV === 'development',
},
})

mainWindow.loadURL(NODE_ENV === 'development' ? ENTRY.DEV : ENTRY.PROD)

// Emitted when the window is closed.
mainWindow.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})

app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
20 changes: 20 additions & 0 deletions packages/electron-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"plugins": [{
"name": "typescript-tslint-plugin"
}],
"paths": {
"*": [
"node_modules/*"
]
}
},
"include": [
"src/**/*"
]
}
15 changes: 15 additions & 0 deletions packages/react-app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
"extends": [
"../../.eslintrc.js"
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"react/jsx-filename-extension": [1, {
"extensions": [".ts", ".tsx"]
}],
}
}
4 changes: 4 additions & 0 deletions packages/react-app/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = function override(config, env) {
//do stuff with the webpack config...
return config;
}
47 changes: 47 additions & 0 deletions packages/react-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "neuron-react-app",
"version": "0.1.0",
"private": true,
"author": {
"name": "Nervos Core Dev",
"email": "[email protected]",
"url": "https://github.com/nervosnetwork/neuron"
},
"homepage": "./",
"main": "./build",
"license": "MIT",
"scripts": {
"start": "BROWSER=none react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom --watchAll=false",
"eject": "react-scripts eject",
"lint": "tslint -p ."
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"dependencies": {
"@types/jest": "23.3.12",
"@types/node": "10.12.18",
"@types/react": "16.7.18",
"@types/react-dom": "16.0.11",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-scripts": "2.1.3",
"typescript": "3.2.2"
},
"devDependencies": {
"eslint-config-react-app": "^3.0.6",
"eslint-plugin-flowtype": "^3.2.1",
"react-app-rewired": "^2.0.2"
}
}
Binary file added packages/react-app/public/favicon.ico
Binary file not shown.
Loading

0 comments on commit 4497bf6

Please sign in to comment.