Skip to content

Commit

Permalink
Merge pull request #261 from Emurgo/develop
Browse files Browse the repository at this point in the history
Lots of updates 1.2.0
  • Loading branch information
nicarq authored Jan 27, 2019
2 parents fd62e80 + 502acd7 commit 5a98ce2
Show file tree
Hide file tree
Showing 145 changed files with 12,911 additions and 6,645 deletions.
59 changes: 44 additions & 15 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,25 +1,54 @@
{
"presets": [
"es2015",
"stage-0",
"react"
[
"@babel/preset-env",
{
"modules": "commonjs",
"useBuiltIns": "entry"
}
],
"@babel/preset-flow",
"@babel/preset-react"
],
"plugins": [
["transform-runtime", {
"polyfill": false,
"regenerator": true
}],
["react-intl", {
"messagesDir": "./translations/messages/",
"enforceDescriptions": true,
"extractSourceLocation": true
}],
"react-hot-loader/babel",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
[
"@babel/plugin-transform-runtime",
{
"corejs": 2,
"helpers": true,
"regenerator": true
}
],
[
"react-intl",
{
"messagesDir": "./translations/messages/",
"enforceDescriptions": true,
"extractSourceLocation": true
}
],
"add-module-exports",
"transform-decorators-legacy"
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
],
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-export-namespace-from"
],
"env": {
"development": {
"plugins": ["transform-runtime"]
"plugins": [
"@babel/plugin-transform-runtime"
]
}
}
}
}
74 changes: 58 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
#
version: 2

aliases:
- &attach_workspace
attach_workspace:
at: ~/repo

jobs:
build:
build-setup:
working_directory: ~/repo
docker:
- image: circleci/node:8-browsers
Expand All @@ -27,42 +32,79 @@ jobs:
- run: npm run build-js-cardano-wasm
- run: npm install

# code checks // TODO: Not runnning on this branch :/
# code quality checks
- run: npm run flow
- run: npm run eslint

# run tests!
- run: npm run test-e2e
- run: npm run build -- --env "staging"
- run: npm run compress -- --env "staging" --zip-only --app-id $APP_ID --codebase "https://www.sample.com/dw/yoroi-extension.crx"
# run jest tests
- run: npm run jest

# create extensions to be consumed by browsers
- run: npm run test-prepare

# persist results to then use them in tests
- persist_to_workspace:
root: ~/repo
paths: .

test-chrome:
working_directory: ~/repo
docker:
- image: circleci/node:8-browsers

steps:
- checkout
- *attach_workspace
- run: npm run test-e2e-chrome

# Persist the specified paths (~/repo) into the workspace for use in downstream job.
# TODO:
#- persist_to_workspace:
# root: ~/
# paths:
# - ./repo/yoroi.zip
test-firefox:
working_directory: ~/repo
docker:
- image: circleci/node:8-browsers

steps:
- checkout
- *attach_workspace

# unsiggned addons are only supported in Firefox-dev, Firefox nightly and Firefox-esr
# CircleCI comes w/ Firefox but we need to replace it w/ Firefox-esr
# Firefox-esr is easier to install of Debian so we pick it
# https://www.mozilla.org/en-US/firefox/organizations/
- run: sudo rm -f /opt/firefox/firefox
- run: sudo rm -f /usr/local/bin/firefox
- run: sudo apt install firefox-esr
- run: sudo ln -s /usr/bin/firefox-esr /usr/local/bin/firefox

- run: npm run test-e2e-firefox

deploy-testnet:
working_directory: ~/repo
docker:
- image: circleci/node:8-browsers

steps:
- attach_workspace:
at: ~/build
- *attach_workspace

- run: npm run build -- --env "staging"
- run: npm run compress -- --env "staging" --zip-only --app-id $APP_ID --codebase "https://www.sample.com/dw/yoroi-extension.crx"
- run: sudo npm install -g chrome-webstore-upload-cli
- run: cd ~/build/repo/ && webstore upload --source yoroi.zip --extension-id="${APP_ID}" --client-id="${CLIENT_ID}" --client-secret="${CLIENT_SECRET}" --refresh-token="${REFRESH_TOKEN}" --auto-publish --trusted-testers

workflows:
version: 2
build-deploy:
jobs:
- build
- build-setup
- test-chrome:
requires:
- build-setup
- test-firefox:
requires:
- build-setup
- deploy-testnet:
requires:
- build
- test-chrome
- test-firefox
filters:
branches:
only: staging
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"env": {
"browser": true,
"mocha": true,
"node": true
"node": true,
"jest": true
},
"rules": {
"func-names": "off",
Expand Down
6 changes: 5 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
.*/node_modules/fbjs/.*
.*/node_modules/electron-packager/.*
.*/node_modules/npm/.*
.*/node_modules/mobx/.*
.*/node_modules/oboe/.*
.*/node_modules/mobx/lib/mobx.js.flow
.*/dist/.*
.*/release/.*
.*/.git/.*
Expand All @@ -12,9 +14,11 @@
[include]
../node_modules/eslint-plugin-jsx-a11y

[untyped]
.*/node_modules/trezor-connect/lib/popup/PopupManager.js

[libs]
flow/declarations/
node_modules/mobx/lib/mobx.js.flow

[options]
esproposal.class_static_fields=enable
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dev/
dll/

*.zip
*.xpi
*.crx
# pem files are used to sign the extension so we ignore the to avoid accidental leakage
*.pem
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Jhen-Jie Hong
Copyright (c) 2018 EMURGO

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $ npm run dev
$ npm run build -- --env "mainnet"
```

- Testnet
- Testnet (not supported yet)
```bash
# build files to './build'
$ npm run build -- --env "testnet"
Expand All @@ -41,6 +41,12 @@ $ npm run build -- --env "testnet"

_Note_: `dev` should hot reload on code change

## Run Yoroi Firefox extension

Debug builds are not maintained for Firefox as firefox rejects manifest files with non-https `localhost` in them.
You can bypass this by manually adding the extension into your Firefox folder but this is kind of tedious.
I suggest instead installing the `mainnet` build as it does not use `localhost`. (through `about:debugging` or `about:addons`). See [SETUP.md](docs/SETUP.md) for how to makes the unittests pass.

## Build release candidate

[RELEASE.md](docs/RELEASE.md)
Expand All @@ -55,7 +61,8 @@ $ npm run flow
# lint
$ npm run eslint
# features (command to run all existing tests)
$ npm run test-e2e
$ npm run test-prepare
$ npm run test-e2e-chrome
# How to run one .feature file (One feature file = one covered component from youtrack)
$ npm run test-by-feature feature/wallet-creation.feature
# How to run one test. Instead of '@it-10' you can use any tag from youtrack
Expand Down
24 changes: 14 additions & 10 deletions app/App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow
import React, { Component } from 'react';
import { observer } from 'mobx-react';
import { ThemeProvider } from 'react-css-themr';
import { Router } from 'react-router';
import { ThemeProvider } from 'react-polymorph/lib/components/ThemeProvider';
import { Router } from 'react-router-dom';
import { addLocaleData, IntlProvider } from 'react-intl';
import en from 'react-intl/locale-data/en';
import ko from 'react-intl/locale-data/ko';
Expand All @@ -11,17 +11,19 @@ import zh from 'react-intl/locale-data/zh';
import ru from 'react-intl/locale-data/ru';
import { Routes } from './Routes';
import { yoroiTheme } from './themes/yoroi';
import { themeOverrides } from './themes/overrides/index';
import translations from './i18n/translations';
import type { StoresMap } from './stores/index';
import type { ActionsMap } from './actions/index';
import ThemeManager from './ThemeManager';
import environment from './environment';
import { hot } from 'react-hot-loader';

// https://github.com/yahoo/react-intl/wiki#loading-locale-data
addLocaleData([...en, ...ko, ...ja, ...zh, ...ru]);

@observer
export default class App extends Component<{
class App extends Component<{
stores: StoresMap,
actions: ActionsMap,
history: Object,
Expand All @@ -47,23 +49,25 @@ export default class App extends Component<{
const mergedMessages = Object.assign({}, translations['en-US'], translations[locale]);

const currentTheme = 'yoroi';
const theme = require(`./themes/prebuilt/${currentTheme}.js`); // eslint-disable-line
const themeVars = require(`./themes/prebuilt/${currentTheme}.js`); // eslint-disable-line

const mobxDevTools = this.mobxDevToolsInstanceIfDevEnv();

return (
<div>
<ThemeManager variables={theme} />
<div style={{ height: '100%' }}>
<ThemeManager variables={themeVars} />
{/* Automatically pass a theme prop to all componenets in this subtree. */}
<ThemeProvider theme={yoroiTheme}>
<ThemeProvider theme={yoroiTheme} themeOverrides={themeOverrides}>
<IntlProvider {...{ locale, key: locale, messages: mergedMessages }}>
<div style={{ height: '100%' }}>
<Router history={history} routes={Routes(stores, actions)} />
</div>
<Router history={history}>
{Routes(stores, actions)}
</Router>
</IntlProvider>
</ThemeProvider>
{mobxDevTools}
</div>
);
}
}

export default hot(module)(App);
Loading

0 comments on commit 5a98ce2

Please sign in to comment.