Be Your Own Bank at login.blockchain.com. Please contact support if you have any issues using the wallet.
This repo contains the three codebases/packages listed below.
./setup.sh
.yarn start
localhost:8080
If you require the application to run locally over HTTPS, follow the instructions here.
You can disable SSL by setting the DISABLE_SSL
env param to true
with any start command. (e.g. DISABLE_SSL=true yarn start:staging
)
To ensure proper support for Windows, please take the following actions before running the above setup instructions.
npm install -g windows-build-tools
. This will install Python 2.7 and Visual C++ Build Tools which are required to compile some native Node modules.python
. If you get a CommandNotFoundException
message, add the folder %USERPROFILE%\.windows-build-tools\python27
to your environment variables.yarn clean
yarn add
or yarn remove
in the package folder. After installing or uninstalling a NPM package, run yarn
in the root folder to re-init the projectdev-dependency
in the top level package.json
via yarn i --save-dev [package-name]
package.json
via yarn i --save [package-name]
The frontend application can be ran locally with different build configurations found in config/env
. The following commands are available:
yarn start
Runs the application with the development.js
configuration fileyarn start:dev
Runs the application with the development.js
configuration fileyarn start:staging
Runs the application with the staging.js
configuration fileyarn start:prod
Runs the application with the production.js
configuration fileyarn run:prod
Runs the application mimicking the production environment entirely (i.e. code is bundled and minified, HMR is disabled,
Express server is used (./server.js
) and the production.js
configuration file is loaded)Notes:
development.js
and staging.js
filesconfig/env
folderTo be able to create a release follow these steps starting with "Obtain a personal access token...": https://github.com/release-it/release-it#github-releases
GITHUB_TOKEN
should be saved as RELEASE_IT_TOKEN
instead in your bash_profile or wherever you keep env variables
You'll need git changelog to generate the history since the last release:
development
branch, run yarn release
development
into master
master
so that master
always reflects what is currently in productionyarn vet
Runs Prettier, lint JS, lint CSS and finally all unit testsWe follow the rules outlined by the Javascript Standard Style as well as a few React specific rules.
Code linting is handled by ESLint. The following commands are available:
yarn lint
Lints all packagesyarn lint:components
Lints only blockchain-info-componentsyarn lint:core
Lints only blockchain-wallet-v4yarn lint:frontend
Lints only blockchain-wallet-v4-frontendyarn lint:fix
Automatically resolves fixable issues via ESLintThese IDE plugins/packages assist with complying with these lint rules while developing:
We follow all standard rules that are provided by Prettier. The following commands are available:
yarn prettier
Runs Prettier against all packagesyarn prettier:components
Runs Prettier against only blockchain-info-componentsyarn prettier:core
Runs Prettier against only blockchain-wallet-v4yarn prettier:frontend
Runs Prettier against only blockchain-wallet-v4-frontendIt is recommended to setup a Prettier plugin for your IDE plugins/packages that will automatically prettify your files on save.
When installing the plugin for VS Code make sure you are on v3.7.0 or lower
Testing is done via Jest and Enzyme.
yarn test
Runs unit tests for all packagesyarn test:components
Runs unit tests for only blockchain-info-componentsyarn test:core
Runs unit tests for only blockchain-wallet-v4yarn test:frontend
Runs unit tests for only blockchain-wallet-v4-frontendNote: if you see errors that Jest cannot resolve package imports, you may need to run yarn test
before testing specific packages (eg, yarn test:frontend
)
yarn test:watch
Watches and then runs desired testsyarn test:components:watch
Watches and then runs desired tests for only blockchain-info-componentsyarn test:core:watch
Watches and then runs desired tests for only blockchain-wallet-v4yarn test:frontend:watch
Watches and then runs desired tests for only blockchain-wallet-v4-frontendTo enable debugging for unit tests via the Chrome browser, run the following commands:
yarn test:components:debug
Debugs unit tests for only blockchain-info-componentsyarn test:core:debug
Debugs unit tests for only blockchain-wallet-v4yarn test:frontend:debug
Debugs unit tests for only blockchain-wallet-v4-frontendAfter running one of the above commands, Node will wait for a debugger to attach before starting the tests.
To attach, simply open your browser and go to chrome://inspect
and click on "Open Dedicated DevTools for Node",
which will give you a list of available node instances you can connect to. Click on the address displayed in the terminal
(usually localhost:9229) and you will be able to debug tests using Chrome's DevTools.
We are snapshot testing UI some components. Here are the commands to update them when necessary:
yarn test:components:update
Updates component snapshots for only blockchain-info-componentsyarn test:frontend:update
Updates component snapshots for only blockchain-wallet-v4-frontendTo generate code coverage reports via Istanbul, the following commands are available:
yarn coverage
Generates a coverage report for all packagesyarn coverage:components
Generates coverage report for only blockchain-info-componentsyarn coverage:core
Generates coverage report for only blockchain-wallet-v4yarn coverage:frontend
Generates coverage report for only blockchain-wallet-v4-frontendDepending upon which coverage report was ran, the results can be found in the following directories:
coverage/index.html
coverage/blockchain-info-components/index.html
coverage/blockchain-wallet-v4/index.html
coverage/blockchain-wallet-v4-frontend/index.html
Simply open the index.html
file in your browser to view.TypeScript is supported and should be used when adding new code. It's also recommended to replace legacy JS with TS when time allows.
We are using Codechecks and Typecov for coverage reporting. Coverage is automatically analyzed for PRs and the following command is available.
yarn codechecks
To visualize and interact with the tree of the production code bundles files:
yarn analyze
Once completed, a browser will automatically open with the results.Storybook is used by the blockchain-info-components and blockchain-wallet-v4-frontend packages to interactively view, develop and test components. The following commands are available:
storybook:build-wallet
: Builds the static storybook assets for wallet specific components (if base components is running locally, storybook will put wallet and base components into the same storybook UI)storybook:build-base
: Builds the static storybook assets for base shared componentsstorybook:serve-wallet
Builds storybook assets and then serves them locally at localhost:6006
storybook:serve-base
Builds storybook assets and then serves them locally at localhost:6007
storybook:deploy-wallet
Builds storybook assets and then serves them to github pages. You will probably need to run cd ./packages/blockchain-info-components && git remote add origin git@github.com:blockchain/blockchain-wallet-v4-frontend.git
first.storybook:deploy-base
Builds storybook assets and then serves them to github pages. You will probably need to run cd ./packages/blockchain-info-components && git remote add origin git@github.com:blockchain/blockchain-wallet-v4-frontend.git
first.If the deploy begins to fail, deleting the static build file before redeploy will likely help.
Please review to the Wiki
Security issues can be reported to us in the following venues: