chore(wip): move app and test app to root

This commit is contained in:
Thomas Osmonson
2021-03-09 13:45:17 -06:00
parent 8334f3c892
commit 3d6bdaa1ea
383 changed files with 4055 additions and 13836 deletions

View File

@@ -1,2 +0,0 @@
node_modules/
Dockerfile

View File

@@ -1,2 +0,0 @@
node_modules/
*.d.ts

View File

@@ -1,16 +1,21 @@
module.exports = {
root: true,
reportUnusedDisableDirectives: true,
extends: ['@blockstack/eslint-config'],
plugins: [
'react-hooks',
'jest',
],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json',
},
env: {
browser: true,
node: true,
es6: true,
'jest/globals': true,
},
globals: {
page: true,
browser: true,
context: true,
},
rules: {
'@typescript-eslint/no-unnecessary-type-assertion': [0],
'@typescript-eslint/no-unsafe-assignment': [0],
'@typescript-eslint/no-unsafe-return': [0],
'@typescript-eslint/no-unsafe-call': [0],
@@ -18,5 +23,11 @@ module.exports = {
'@typescript-eslint/ban-types': [0],
'@typescript-eslint/restrict-template-expressions': [0],
'@typescript-eslint/explicit-module-boundary-types': [0],
}
"no-warning-comments": [1],
"react-hooks/exhaustive-deps": [
"warn", {
additionalHooks: "useRecoilCallback",
},
]
},
};

View File

@@ -58,6 +58,5 @@ Provide context on how tests should be performed.
## Checklist
- [ ] Code is commented where needed
- [ ] Unit test coverage for new or modified code paths
- [ ] `yarn lerna run test` passes
- [ ] Changelog is updated
- [ ] Tag 1 of @hstove or @kyranjamie or @aulneau for review

View File

@@ -19,9 +19,6 @@ runs:
- name: Build extension
run: sh build-ext.sh
shell: bash
- name: Build web apps
run: yarn lerna run prod:web --parallel
shell: bash
- name: Setup screenshots
shell: bash
run: mkdir packages/app/tests/screenshots
run: mkdir tests/screenshots

View File

@@ -16,5 +16,4 @@ runs:
shell: bash
run: |
yarn serve:test &
cd packages/app &&
xvfb-run --auto-servernum -- yarn test:integration

View File

@@ -1,38 +0,0 @@
name: deploy-contracts
on:
schedule:
- cron: "*/15 * * * *"
workflow_dispatch:
jobs:
deploy-contracts:
runs-on: ubuntu-latest
env:
API_SERVER: https://stacks-node-api.xenon.blockstack.org
CONTRACT_PRIVATE_KEY: ${{ secrets.CONTRACT_PRIVATE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Node Version
uses: actions/setup-node@v2-beta
with:
node-version: 12.16.1
- name: Restore lerna cache
id: lerna-cache
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install monorepo deps
run: yarn --frozen-lockfile
if: steps.lerna-cache.outputs.cache-hit != 'true'
- name: Bootstrap
run: yarn lerna bootstrap
- name: Build RPC Client
run: yarn lerna run build --stream --scope @stacks/rpc-client
- name: Link packages
run: yarn lerna link
- name: Deploy contracts
run: yarn deploy-contracts

View File

@@ -0,0 +1,64 @@
name: Publish
on:
push:
branches:
- 'main'
workflow_dispatch:
jobs:
publish_extension:
name: Publish production extensions
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, 'chore(release)')"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Node Version
uses: actions/setup-node@v2-beta
with:
node-version: 12.16.1
- name: Restore cache
uses: actions/cache@v2
with:
path: |
node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Build extension
run: sh build-ext.sh
# Chromium
- uses: actions/upload-artifact@v2
name: Upload Artifact - Chromium Extension Zip
with:
name: stacks-wallet-chromium
path: stacks-wallet-chromium.zip
- name: Upload Chromium extension to production
uses: google-github-actions/upload-cloud-storage@864317d33c42de84de94313c5f834802365977b0
with:
credentials: ${{ secrets.GCS_BUCKET_CREDENTIALS }}
path: ./stacks-wallet-chromium.zip
destination: wallet-extensions
# Firefox
- name: Sign Production Firefox version
continue-on-error: true
run: yarn web-ext sign --channel=unlisted
env:
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }}
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }}
- uses: actions/upload-artifact@v2
name: Upload Artifact - Firefox Add-On XPI
with:
name: connect-addon
path: web-ext-artifacts/*.xpi
- name: Get Firefox addon filename
id: addon-file
run: echo "::set-output name=addon_path::$(find ./web-ext-artifacts -type f -iname "*.xpi" | tail -n1)"
- name: Rename Firefox addon file
run: cp ${{ steps.addon-file.outputs.addon_path }} stacks-wallet-firefox.xpi
- name: Upload Firefox extension to GCS
uses: google-github-actions/upload-cloud-storage@864317d33c42de84de94313c5f834802365977b0
with:
credentials: ${{ secrets.GCS_BUCKET_CREDENTIALS }}
path: ./stacks-wallet-firefox.xpi
destination: wallet-extensions/

View File

@@ -1,138 +0,0 @@
name: Publish
on:
push:
branches:
- 'main'
workflow_dispatch:
jobs:
publish_extension:
name: Publish production extensions
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, 'chore(release)')"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Node Version
uses: actions/setup-node@v2-beta
with:
node-version: 12.16.1
- name: Restore lerna cache
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Build extension
run: sh build-ext.sh
# Chromium
- uses: actions/upload-artifact@v2
name: Upload Artifact - Chromium Extension Zip
with:
name: stacks-wallet-chromium
path: stacks-wallet-chromium.zip
- name: Upload Chromium extension to production
uses: google-github-actions/upload-cloud-storage@864317d33c42de84de94313c5f834802365977b0
with:
credentials: ${{ secrets.GCS_BUCKET_CREDENTIALS }}
path: ./stacks-wallet-chromium.zip
destination: wallet-extensions
# Firefox
- name: Sign Production Firefox version
continue-on-error: true
run: yarn web-ext sign --channel=unlisted
env:
WEB_EXT_API_KEY: ${{ secrets.WEB_EXT_API_KEY }}
WEB_EXT_API_SECRET: ${{ secrets.WEB_EXT_API_SECRET }}
- uses: actions/upload-artifact@v2
name: Upload Artifact - Firefox Add-On XPI
with:
name: connect-addon
path: web-ext-artifacts/*.xpi
- name: Get Firefox addon filename
id: addon-file
run: echo "::set-output name=addon_path::$(find ./web-ext-artifacts -type f -iname "*.xpi" | tail -n1)"
- name: Rename Firefox addon file
run: cp ${{ steps.addon-file.outputs.addon_path }} stacks-wallet-firefox.xpi
- name: Upload Firefox extension to GCS
uses: google-github-actions/upload-cloud-storage@864317d33c42de84de94313c5f834802365977b0
with:
credentials: ${{ secrets.GCS_BUCKET_CREDENTIALS }}
path: ./stacks-wallet-firefox.xpi
destination: wallet-extensions/
deploy-prod-apps:
name: Publish testnet demo app
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, 'chore(release)')"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Node Version
uses: actions/setup-node@v2-beta
with:
node-version: 12.16.1
- name: Restore lerna cache
id: lerna-cache
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install monorepo deps
run: yarn --frozen-lockfile
- name: Build Blockstack Test App
env:
AUTH_ORIGIN: https://app.blockstack.org
run: yarn prod:web
working-directory: packages/test-app
- name: Copy Blockstack Test App vercel.json
uses: canastro/copy-file-action@master
with:
source: 'packages/test-app/vercel.json'
target: 'packages/test-app/dist/vercel.json'
- uses: amondnet/vercel-action@d4e0a9f55bfc7ee4d87dd69541f2c93c8e4e8ae6
id: vercel-deployment-production
name: Deploy test app to production
if: github.event_name == 'push' || github.event_name == 'release'
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_TEST_APP }}
vercel-args: '--prod'
scope: ${{ secrets.VERCEL_SCOPE }}
working-directory: packages/test-app/dist
publish_npm:
name: Publish production NPM packages
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, 'chore(release)')"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare repository
run: git checkout main
- name: Set Node Version
uses: actions/setup-node@v2-beta
with:
node-version: 12.16.1
- name: Restore lerna cache
id: lerna-cache
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install monorepo deps
run: yarn --frozen-lockfile
- name: Setup .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
- name: Publish
run: yarn lerna publish from-package --conventional-commits --yes

View File

@@ -46,7 +46,7 @@ jobs:
uses: actions/setup-node@v2-beta
with:
node-version: 12.16.1
- name: Restore lerna cache
- name: Restore cache
uses: actions/cache@v2
with:
path: |
@@ -56,7 +56,7 @@ jobs:
- name: Code Checks
uses: ./.github/actions/code-checks
- uses: actions/upload-artifact@v2
name: Upload Extension Zip
name: Upload Chrome Extension Zip
with:
name: stacks-wallet-chromium
path: stacks-wallet-chromium.zip
@@ -72,7 +72,7 @@ jobs:
with:
node-version: 12.16.1
- uses: microsoft/playwright-github-action@v1
- name: Restore lerna cache
- name: Restore cache
uses: actions/cache@v2
with:
path: |
@@ -86,101 +86,7 @@ jobs:
name: Upload Screenshots
with:
name: integration-test-screenshots
path: packages/app/tests/screenshots/
publish_npm_betas:
name: Publish NPM beta versions
runs-on: ubuntu-latest
needs: [check_fork]
if: needs.check_fork.outputs.is_not_fork == 'true'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Set Node Version
uses: actions/setup-node@v2-beta
with:
node-version: 12.16.1
- name: Restore lerna cache
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install monorepo deps
run: yarn --frozen-lockfile
- name: Bootstrap
run: yarn lerna bootstrap
- name: Setup .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
- name: Get git branch
id: git-branch
run: echo "::set-output name=branch::$(git rev-parse --abbrev-ref HEAD | cut -d'/' -f2 )"
- name: Get git commit
id: git-commit
run: echo "::set-output name=sha::$(git rev-parse --short HEAD)"
- name: print preid
env:
BRANCH: ${{ steps.git-branch.outputs.branch }}
SHA: ${{ steps.git-commit.outputs.sha }}
run: echo $BRANCH.$SHA
- name: Setup git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Publish to NPM
env:
BRANCH: ${{ steps.git-branch.outputs.branch }}
SHA: ${{ steps.git-commit.outputs.sha }}
run: yarn lerna publish prepatch --preid alpha.$SHA --dist-tag $BRANCH --yes --no-push
publish_beta_web_apps:
name: Publich beta hosted versions
runs-on: ubuntu-latest
needs: [check_fork]
if: needs.check_fork.outputs.is_not_fork == 'true'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Node Version
uses: actions/setup-node@v2-beta
with:
node-version: 12.16.1
- name: Restore lerna cache
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install monorepo deps
run: yarn --frozen-lockfile
- name: Build Blockstack Test App
env:
AUTH_ORIGIN: ${{ steps.vercel-deployment-blockstack-app.outputs.preview-url }}
run: yarn prod:web
working-directory: packages/test-app
- name: Copy Blockstack Test App vercel.json
uses: canastro/copy-file-action@master
with:
source: 'packages/test-app/vercel.json'
target: 'packages/test-app/dist/vercel.json'
- name: Deploy Blockstack Test App with Vercel
uses: amondnet/vercel-action@d4e0a9f55bfc7ee4d87dd69541f2c93c8e4e8ae6
id: vercel-deployment-blockstack-test-app
if: github.event_name == 'pull_request'
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_TEST_APP }}
scope: ${{ secrets.VERCEL_SCOPE }}
working-directory: packages/test-app/dist
github-comment: false
alias-domains: pr-${{ github.event.number }}.testnet-demo.stacks.engineering
path: tests/screenshots/
publish_firefox_beta:
name: Publish beta firefox extension
@@ -196,7 +102,7 @@ jobs:
uses: actions/setup-node@v2-beta
with:
node-version: 12.16.1
- name: Restore lerna cache
- name: Restore cache
uses: actions/cache@v2
with:
path: |

View File

@@ -21,17 +21,15 @@ jobs:
uses: actions/setup-node@v2-beta
with:
node-version: 12.16.1
- name: Restore lerna cache
- name: Restore cache
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Code Checks
uses: ./.github/actions/code-checks
- uses: actions/upload-artifact@v2
name: Upload Extension Zip
name: Upload Chrome Extension Zip
with:
name: stacks-wallet-chromium
path: stacks-wallet-chromium.zip
@@ -48,12 +46,10 @@ jobs:
with:
node-version: 12.16.1
- uses: microsoft/playwright-github-action@v1
- name: Restore lerna cache
- name: Restore cache
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Integration Tests
uses: ./.github/actions/integration-tests
@@ -62,12 +58,12 @@ jobs:
name: Upload Screenshots
with:
name: integration-test-screenshots
path: packages/app/tests/screenshots/
path: tests/screenshots/
version:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'chore(release)')"
needs: [integration_tests, code_checks]
needs: [ integration_tests, code_checks ]
steps:
- name: Checkout
uses: actions/checkout@v2
@@ -77,12 +73,10 @@ jobs:
uses: actions/setup-node@v2-beta
with:
node-version: 12.16.1
- name: Restore lerna cache
- name: Restore cache
uses: actions/cache@v2
with:
path: |
node_modules
*/*/node_modules
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn --frozen-lockfile
@@ -90,5 +84,3 @@ jobs:
run: |
git config --global user.email "${COMMIT_EMAIL}"
git config --global user.name "${COMMIT_USER}"
- name: Lerna Version
run: yarn lerna version --conventional-commits --yes

51
.gitignore vendored Normal file → Executable file
View File

@@ -1,51 +1,12 @@
dist/
node_modules/
example/node_modules
example/dist
tests/screenshots/*
.env
.next/
.idea/
.next
.idea
.vscode
.DS_Store
dist/
.rts2_cache_cjs/
.rts2_cache_esm/
.rts2_cache_umd/
.vercel
yarn-error.log
.github/workflows/event.json
.npmrc
coverage/
*.zip
*.xpi
dist/
www/
loader/
*~
*.sw[mnpcod]
*.log
*.lock
*.tmp
*.tmp.*
log.txt
*.sublime-project
*.sublime-workspace
.stencil/
.idea/
.vscode/
.sass-cache/
.versions/
node_modules/
$RECYCLE.BIN/
.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate
.env
yalc.lock
.yalc
packages/connect-ui/connect
web-ext-artifacts

View File

@@ -1,3 +0,0 @@
node_modules/
*.d.ts
dist/

View File

@@ -1,3 +0,0 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}

View File

@@ -1,84 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at opensource@blockstack.org. All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of actions.
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

View File

@@ -1,16 +0,0 @@
FROM debian:buster-slim as builder
LABEL maintainer="ux@blockstack.com"
COPY . .
RUN apt-get update -y && apt-get install -y build-essential python3 nodejs zip curl \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list' \
&& apt-get update -y && apt-get install -y yarn \
&& ./build-ext.sh /stacks-wallet-chromium.zip
FROM alpine:latest
COPY --from=builder /stacks-wallet-chromium.zip .
# Wait for extension.zip to be copied into local
CMD sleep 30

2
LICENSE Normal file → Executable file
View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 Blockstack
Copyright (c) 2019 ymdevs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

89
README.md Normal file → Executable file
View File

@@ -1,77 +1,48 @@
# Blockstack UX Team Monorepo
<div align="center" style="margin-bottom: 50px;">
This monorepo contains a few key packages that the User Experience team at Blockstack maintains:
# The Blockstack App
- [`app`](./packages/app): An application for authenticating into Blockstack apps. Available as a web app and a browser extension.
- [`@stacks/connect`](./packages/connect): A developer tool for building excellent user experiences in Blockstack apps
- [`@stacks/connect-react`](./packages/connect-react): A library for using `@stacks/connect` in React apps
- [`@stacks/connect-ui`](./packages/connect-ui): WebComponent-based UI for displaying an intro modal in Stacks Apps during authentication.
- [`test-app`](./packages/test-app): A simple React app for testing out Connect and the App.
</div>
Source code is available on Github at https://github.com/blockstack/ux/tree/main/packages/app
The Blockstack App is an application for interacting and authenticating with [Blockstack](https://blockstack.org) apps. It can be used as a hosted web app (available at [app.blockstack.org](https://app.blockstack.org)) or as a browser extension.
To use this application with your own Blockstack App, we recommend using [Blockstack Connect](https://github.com/blockstack/ux/packages/connect).
Table of Contents:
<!-- TOC depthFrom:2 -->
- [Development environment setup](#development-environment-setup)
- [Running the apps locally](#running-the-apps-locally)
- [Building browser extensions](#building-browser-extensions)
- [Optional - Build browser extensions using Docker](#optional---build-browser-extensions-using-docker)
- [Install browser extension from source](#install-browser-extension-from-source)
- [Development](#development)
- [Setup](#setup)
- [Run Locally](#run-locally)
- [Build and install browser extension](#build-and-install-browser-extension)
<!-- /TOC -->
## Development environment setup
## Development
The first time you setup a development environment for this repository, follow these steps:
Although this app is usable as a browser extension, the best interface for development is as a normal web app. This is because it's faster and easier to develop it as a web app, for reasons like hot module loading, and not having to deal with the browser extensions UI constantly.
~~~bash
### Setup
Clone this repository and install dependencies:
```bash
git clone https://github.com/blockstack/ux
cd ux
yarn
yarn bootstrap
~~~
```
1. Clone this package.
2. Run `yarn` to install dependencies
3. Run `yarn bootstrap` to link dependencies within this repository
### Run Locally
### Running the apps locally
```bash
yarn dev
```
In the command line, run `yarn dev` which will run two apps:
- `packages/test-app` which runs at localhost:3000 and implements an example of connect
- `packages/app` which is the auth app, running at localhost:8080
Then, open [localhost:8080](http://localhost:8080).
For development instructions of specific packages, see the `README` in each package folder.
## Build and install browser extension
## Building browser extensions
1. From the root of this repository, in the command line, run `sh build-ext.sh`
2. The extension will be packaged as `stacks-wallet-chromium.zip` inside this folder.
### Optional - Build browser extensions using Docker
1. Build the docker image locally:
```bash
docker build . -t ux
```
1. Copy the built extensions to your local machine:
```bash
docker run -d --name ux ux && docker cp ux:stacks-wallet-chromium.zip . && docker rm -f ux
```
## Install browser extension from source
First, unzip the `stacks-wallet-chromium.zip` file that was generated in the previous step.
If installing for Chrome or Brave:
1. Go to: [**chrome://extensions**](chrome://extensions)
2. Toggle: "**developer mode**" on.
3. Click on: "**Load unpacked**"
4. Select the new folder that was unzipped from `stacks-wallet-chromium.zip`.
If installing for Firefox:
1. Go to: [**about:debugging**](about:debugging)
2. Click on "**This Firefox**"
3. Click on: "**Load Temporary Add-on…**"
4. Inside the new folder that was unzipped from `stacks-wallet-chromium.zip`, select the `manifest.json` file.
Documentation for building browser extensions can be found in the [top-level README.md file](https://github.com/blockstack/ux/tree/main#building-browser-extensions) of this repository.

5
build-ext.sh Executable file → Normal file
View File

@@ -2,14 +2,13 @@
echo "🛠 Installing dependencies."
yarn
echo "🛠 Compiling extension."
yarn build:extension
yarn build
echo "🛠 Packaging Browser Extension"
cd packages/app/dist
TS=$(date +%Y)$(date +%m)010000
find -print | while read file; do
touch -t $TS "$file"
done
DEFAULT_DEST="../../../stacks-wallet-chromium.zip"
DEFAULT_DEST="./stacks-wallet-chromium.zip"
DEST=${1:-$DEFAULT_DEST}
zip -Xro $DEST *
echo "✅ Extension packaged as $(basename $DEST)"

View File

@@ -1 +0,0 @@
module.exports = { extends: ['@commitlint/config-conventional'] };

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 895 B

After

Width:  |  Height:  |  Size: 895 B

View File

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -1,13 +0,0 @@
{
"packages": [
"packages/*"
],
"version": "independent",
"npmClient": "yarn",
"command": {
"version": {
"message": "chore(release): publish"
}
},
"useWorkspaces": true
}

View File

@@ -1,11 +0,0 @@
[[redirects]]
from = "/actions.html"
to = "/#/sign-up?authRequest=:authRequest"
force = true
query = {authRequest = ":authRequest"}
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
Content-Security-Policy = "frame-src 'none';"

View File

@@ -1,68 +1,166 @@
{
"name": "root",
"name": "@stacks/app",
"description": "The Stacks Wallet is browser extension for interacting with Stacks apps.",
"private": true,
"scripts": {
"typecheck": "lerna run typecheck --parallel --no-bail --stream",
"dev": "NODE_ENV=development yarn lerna exec --parallel 'yarn dev' --scope test-app --scope @stacks/app",
"bootstrap": "lerna exec --parallel 'yarn'",
"build:connect": "lerna run build --scope @stacks/connect",
"build:connect-ui": "lerna run build --scope @stacks/connect-ui",
"build:app": "yarn build:connect-ui && lerna run prod:web --scope @stacks/app",
"build:test-app": "lerna run prod:web --scope test-app",
"build:test": "lerna run build:test --parallel --stream",
"build:test:watch": "lerna run build:test:watch --parallel --stream",
"build:extension": "lerna run prod:ext --stream",
"deploy-contracts": "lerna run deploy-contracts --stream",
"dev": "node webpack/dev-server.js",
"build": "cross-env NODE_ENV=production EXT_ENV=prod webpack --config webpack/webpack.config.prod.js",
"build:dev": "cross-env NODE_ENV=development EXT_ENV=development webpack --config webpack/webpack.config.dev.js",
"build:test": "cross-env NODE_ENV=test EXT_ENV=prod webpack --config webpack/webpack.config.prod.js",
"build:test:watch": "cross-env NODE_ENV=test EXT_ENV=watch webpack --config webpack/webpack.config.prod.js",
"clean": "rm -rf ./dist",
"clean:all": "rm -rf ./dist && rm -rf ./coverage && rm -rf ./node_modules",
"lint": "yarn lint:eslint && yarn lint:prettier",
"lint:eslint": "eslint \"packages/**/src/**/*.{ts,tsx}\"",
"lint:fix": "eslint \"packages/**/src/**/*.{ts,tsx}\" --fix",
"lint:prettier": "prettier --check \"packages/**/src/**/*.{ts,tsx}\" *.js",
"lint:prettier:fix": "prettier --write \"packages/**/src/**/*.{ts,tsx}\" *.js",
"postinstall": "yarn build:connect-ui",
"serve:test": "lerna run serve:test --parallel --stream"
},
"prettier": "@blockstack/prettier-config",
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"workspaces": [
"packages/*"
],
"devDependencies": {
"@blockstack/eslint-config": "^1.0.5",
"@blockstack/prettier-config": "^0.0.6",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@commitlint/config-lerna-scopes": "^8.3.4",
"@typescript-eslint/eslint-plugin": "4.2.0",
"@typescript-eslint/parser": "4.2.0",
"babel-eslint": "^10.1.0",
"cross-env": "^7.0.2",
"eslint": "^7.0.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-react-app": "^5.2.1",
"eslint-plugin-flowtype": "^4.7.0",
"eslint-plugin-import": "^2.21.2 ",
"eslint-plugin-jest": "^23.11.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^4.2.3",
"http-server": "0.12.3",
"lerna": "^3.22.1",
"prettier": "^2.0.5",
"web-ext": "^5.4.1",
"typescript": "4.1.2",
"yalc": "^1.0.0-pre.42"
"lint:eslint": "eslint \"src/**/*.{ts,tsx}\"",
"lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
"lint:prettier": "prettier --check \"src/**/*.{ts,tsx}\" *.js",
"lint:prettier:fix": "prettier --write \"src/**/*.{ts,tsx}\" *.js",
"prod:ext": "yarn build",
"prod:analyze": "cross-env NODE_ENV=production ANALYZE=true webpack -p",
"test:integration": "jest --verbose=true --runInBand --testPathPattern=./tests/integration/*",
"test:unit": "jest --testPathIgnorePatterns=./tests/integration/*",
"test": "NODE_ENV=test jest --verbose=true",
"test:coverage": "NODE_ENV=test jest --collect-coverage",
"test:watch": "NODE_ENV=test jest --watch",
"typecheck": "tsc --noEmit"
},
"version": "2.0.2",
"author": "Blockstack PBC",
"dependencies": {
"@babel/preset-env": "^7.10.3",
"tsdx": "^0.14.1"
"@blockstack/stacks-blockchain-api-types": "^0.52.2",
"@blockstack/stats": "^0.7.0",
"@emotion/core": "^11.0.0",
"@emotion/css": "^11.0.0",
"@emotion/react": "^11.1.1",
"@emotion/styled": "^11.0.0",
"@rehooks/document-title": "^1.0.1",
"@stacks/auth": "^1.0.2",
"@stacks/connect": "^5.0.3",
"@stacks/connect-ui": "^3.0.2",
"@stacks/network": "^1.0.2",
"@stacks/rpc-client": "^1.0.3",
"@stacks/transactions": "1.3.0",
"@stacks/ui": "^7.3.1-beta.2",
"@stacks/ui-core": "^7.0.0",
"@stacks/ui-theme": "^7.1.1-beta.1",
"@stacks/ui-utils": "^7.1.1-beta.1",
"@stacks/wallet-sdk": "^1.0.0-wallet-sdk.4",
"@tabler/icons": "^1.39.1",
"@types/dompurify": "^2.0.4",
"@types/html-webpack-plugin": "^3.2.4",
"@types/react-router-dom": "^5.1.3",
"@vkontakte/vk-qr": "^2.0.10",
"assert": "^2.0.0",
"bignumber.js": "^9.0.0",
"bn.js": "^5.1.1",
"buffer": "^6.0.3",
"dompurify": "^2.1.1",
"downshift": "^6.0.6",
"formik": "^2.1.4",
"history": "^5.0.0-beta.4",
"jsontokens": "3.0.0",
"mdi-react": "^7.5.0",
"preact": "^10.4.0",
"prismjs": "^1.22.0",
"qrcode.react": "^1.0.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-redux": "^7.2.0",
"react-router": "^6.0.0-alpha.2",
"react-router-dom": "^6.0.0-alpha.2",
"recoil": "facebookexperimental/Recoil.git#c8c2b9983229a56e008e1b48d25b9a9fe267ed31",
"redux": "4.0.5",
"redux-thunk": "^2.3.0",
"swr": "^0.5.0",
"use-events": "^1.4.1",
"use-onclickoutside": "^0.3.1",
"valid-url": "^1.0.9",
"webext-redux": "^2.1.2",
"zxcvbn": "^4.4.2"
},
"webExt": {
"sourceDir": "packages/app/dist/"
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-transform-regenerator": "^7.4.5",
"@babel/plugin-transform-runtime": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"@babel/preset-react": "^7.9.4",
"@babel/preset-typescript": "^7.9.0",
"@babel/runtime": "^7.9.2",
"@blockstack/prettier-config": "^0.0.6",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.0-beta.0",
"@schemastore/web-manifest": "^0.0.5",
"@stacks/prettier-config": "^0.0.7",
"@types/chrome": "^0.0.133",
"@types/copy-webpack-plugin": "^6.4.0",
"@types/expect-puppeteer": "^4.4.1",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.31",
"@types/prismjs": "^1.16.2",
"@types/qrcode.react": "^1.0.1",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.2",
"@types/react-redux": "^7.1.7",
"@types/react-test-renderer": "^17.0.1",
"@types/segment-analytics": "^0.0.33",
"@types/valid-url": "^1.0.3",
"@types/webpack": "^4.41.26",
"@types/webpack-dev-server": "^3.11.1",
"@types/zxcvbn": "^4.4.0",
"babel-loader": "^8.1.0",
"bip39": "^3.0.2",
"blns": "^2.0.4",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^8.0.0",
"cross-env": "^7.0.0",
"crypto-browserify": "^3.12.0",
"esbuild-loader": "^2.9.2",
"eslint": "^7.21.0",
"eslint-plugin-jest": "^24.2.0",
"eslint-plugin-react-hooks": "^4.2.0",
"html-webpack-plugin": "^5.3.1",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-junit": "^12.0.0",
"playwright": "^1.8.0",
"playwright-chromium": "^1.8.0",
"playwright-core": "^1.8.0",
"prettier": "^2.0.5",
"process": "^0.11.10",
"react-dev-utils": "^11.0.4",
"react-refresh": "^0.9.0",
"react-test-renderer": "^17.0.1",
"speed-measure-webpack-plugin": "^1.4.2",
"stream-browserify": "^3.0.0",
"terser-webpack-plugin": "^2.3.5",
"ts-jest": "^26.5.3",
"ts-loader": "^8.0.17",
"ts-node": "^9.1.1",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"typescript": "^4.2.3",
"vm-browserify": "^1.1.2",
"webpack": "^5.24.2",
"webpack-bundle-analyzer": "^4.4.0",
"webpack-cli": "^4.5.0",
"webpack-dev-server": "3.11.2",
"webpack-hot-middleware": "^2.25.0",
"webpackbar": "^5.0.0-3",
"yup": "^0.32.5"
},
"keywords": [
"blockstack",
"decentralized",
"react",
"emotion",
"stacks",
"stx",
"web3"
],
"license": "MIT",
"main": "index.js",
"prettier": "@blockstack/prettier-config",
"repository": {
"type": "git",
"url": "git://github.com/blockstack/ux.git"
}
}

View File

@@ -1,33 +0,0 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
env: {
browser: true,
node: true,
es6: true,
'jest/globals': true,
},
globals: {
page: true,
browser: true,
context: true,
},
rules: {
'@typescript-eslint/no-unnecessary-type-assertion': [0],
'@typescript-eslint/no-unsafe-assignment': [0],
'@typescript-eslint/no-unsafe-return': [0],
'@typescript-eslint/no-unsafe-call': [0],
'@typescript-eslint/no-unsafe-member-access': [0],
'@typescript-eslint/ban-types': [0],
'@typescript-eslint/restrict-template-expressions': [0],
'@typescript-eslint/explicit-module-boundary-types': [0],
"no-warning-comments": [1],
"react-hooks/exhaustive-deps": [
"warn", {
additionalHooks: "useRecoilCallback",
},
]
},
};

View File

@@ -1,8 +0,0 @@
dist/
node_modules/
tests/screenshots/*
.env
.next
.idea
.DS_Store
.vercel

View File

@@ -1,3 +0,0 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}

View File

@@ -1,48 +0,0 @@
<div align="center" style="margin-bottom: 50px;">
# The Blockstack App
</div>
Source code is available on Github at https://github.com/blockstack/ux/tree/main/packages/app
The Blockstack App is an application for interacting and authenticating with [Blockstack](https://blockstack.org) apps. It can be used as a hosted web app (available at [app.blockstack.org](https://app.blockstack.org)) or as a browser extension.
To use this application with your own Blockstack App, we recommend using [Blockstack Connect](https://github.com/blockstack/ux/packages/connect).
Table of Contents:
<!-- TOC depthFrom:2 -->
- [Development](#development)
- [Setup](#setup)
- [Run Locally](#run-locally)
- [Build and install browser extension](#build-and-install-browser-extension)
<!-- /TOC -->
## Development
Although this app is usable as a browser extension, the best interface for development is as a normal web app. This is because it's faster and easier to develop it as a web app, for reasons like hot module loading, and not having to deal with the browser extensions UI constantly.
### Setup
Clone this repository and install dependencies:
```bash
git clone https://github.com/blockstack/ux
cd ux
yarn
```
### Run Locally
```bash
yarn dev
```
Then, open [localhost:8080](http://localhost:8080).
## Build and install browser extension
Documentation for building browser extensions can be found in the [top-level README.md file](https://github.com/blockstack/ux/tree/main#building-browser-extensions) of this repository.

View File

@@ -1,41 +0,0 @@
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"lib": ["es2017", "dom"],
"jsx": "react",
"sourceMap": true,
"removeComments": true,
"noEmit": false,
"importHelpers": true,
"downlevelIteration": true,
"strict": true,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"skipLibCheck": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"paths": {
"@store/*": ["store/*"],
"@store": ["store/index"],
"@dev/*": ["dev/*"],
"@components/*": ["components/*"],
"@containers/*": ["containers/*"],
"@common/*": ["common/*"],
"@screen": ["components/screen/index"],
"@stacks/connect": ["../../connect/src"],
"@stacks/rpc-client": ["../../rpc-client/src"],
"@extension/*": ["extension/*"],
"@pages/*": ["pages/*"]
},
"baseUrl": "src",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"include": ["./src/**/*", "./tests/**/*"]
}

View File

@@ -1,18 +0,0 @@
{
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }],
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "Content-Security-Policy",
"value": "frame-src 'none';"
}
]
}
]
}

View File

@@ -1,5 +0,0 @@
{
"plugins": [
"@babel/plugin-proposal-optional-chaining"
]
}

View File

@@ -1 +0,0 @@
test-app/**

View File

@@ -1,12 +0,0 @@
*.log
.DS_Store
node_modules
.rts2_cache_cjs
.rts2_cache_esm
.rts2_cache_umd
.rts2_cache_system
dist
.idea
test
pages
.next

View File

@@ -1,14 +0,0 @@
.idea*.log
.DS_Store
node_modules
.rts2_cache_cjs
.rts2_cache_esm
.rts2_cache_umd
.rts2_cache_system
.idea
test
pages
.next
test-app
.circleci
.github

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2019 Hank Stoever
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.

View File

@@ -1,5 +0,0 @@
# `@stacks/connect`
A library for building excellent user experiences with [Blockstack](https://blockstack.org/).
:blue_book: [View documentation](https://docs.blockstack.org/develop/connect/overview.html)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 KiB

Some files were not shown because too many files have changed in this diff Show More