Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to monorepo #1352

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ["@umami/eslint-config/index.js"],
parserOptions: {
project: ["./apps/*/tsconfig.json", "./packages/*/tsconfig.json"],
parser: "@typescript-eslint/parser",
tsconfigRootDir: __dirname,
},
};
73 changes: 0 additions & 73 deletions .github/workflows/build.yaml

This file was deleted.

17 changes: 6 additions & 11 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,24 @@ jobs:
node-version: 20.x
cache: "yarn"

- name: Install dependencies
run: yarn install --immutable
- run: yarn install --immutable

- name: Install Playwright Browsers & build the app
run: yarn exec concurrently "yarn playwright install chromium --with-deps" "yarn build"
- name: Install Playwright browser
run: yarn workspace @umami/desktop playwright install chromium --with-deps

- name: Start server
run: yarn exec http-server build -p 3000 &

- name: Run cucumber tests
run: yarn test:e2e
- run: yarn test:e2e

- name: Cucumber Report to Annotations
uses: deblockt/[email protected]
if: always()
with:
access-token: ${{ secrets.GITHUB_TOKEN }}
path: "test-results/cucumber-report.json"
path: "apps/dekstop/test-results/cucumber-report.json"
show-global-summary-report: true

- uses: actions/upload-artifact@v4
if: always()
with:
name: cucumber-report
path: test-results/cucumber-report.html
path: apps/dekstop/test-results/cucumber-report.html
retention-days: 10
30 changes: 4 additions & 26 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-m
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
Expand All @@ -32,30 +32,8 @@ jobs:
node-version: 20.x
cache: "yarn"

- name: Install packages
run: yarn install --immutable
- run: yarn install --immutable

- name: Check format
run: yarn format:ci
- run: yarn ci

- name: Run linter
run: yarn lint:ci

- name: Typecheck
run: yarn tsc

- name: Circular dependencies check
run: npx madge --circular src/index.tsx

- name: Run tests
uses: ArtiomTr/[email protected]
with:
skip-step: install
test-script: yarn test
annotations: coverage
base-coverage-file: report.json
prnumber: ${{ steps.findPr.outputs.number }}

- name: Audit dependencies
# Exclude @toruslabs/customauth from audit until it's upgraded
run: yarn npm audit --exclude @toruslabs/customauth
- run: yarn test
16 changes: 9 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
node_modules/
.pnp/
.pnp.*
.yarn/*
!.yarn/patches
Expand All @@ -12,11 +12,11 @@
!.yarn/versions

# testing
/coverage
coverage/

# production
/build
/dist
build/
dist/

# misc
.DS_Store
Expand All @@ -33,7 +33,9 @@ yarn-error.log*
.vscode

settings.json
/test-results/
test-results/

*.tsbuildinfo
/docs
docs/

.turbo/
69 changes: 8 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,70 +15,17 @@ Blockchain](https://tezos.com/). It runs as a desktop electron-based app with mu
- Delegation to bakers
- Address Book

This is a monorepo which contains all the packages related to Umami.

## Initial setup

- Node.js version is 20.x, you can use [NVM](https://github.com/nvm-sh/nvm) to install it and select for this project.
- Yarn 4.x should be used, you can find the installation guide [here](https://yarnpkg.com/getting-started/install).
- `yarn install`
- (optional) if you want to run all the necessary checks before pushing to github (which is much faster than waiting for CI) then just run `./bin/setup`

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.\
We use [jest](https://jestjs.io/) as the test runner.

### `yarn test:e2e`

This will run the e2e tests for you. Please make sure that you have docker & docker-compose [installed](https://docs.docker.com/desktop/install/mac-install/).

When you run it for the first time you'll have to install playwright's dependencies using

```bash
yarn playwright install --with-deps chromium
```

Note: the test runner expects the server with the app running at localhost:3000. You can use the dev server (`yarn start`) for that.
On CI we build the app and serve the production build on the same port (check `.github/workflows/e2e.yaml` for details).

When you're working on a specific scenario, you can mark it with a `@focus` tag and use `yarn test:e2e:focus` to run it exclusively.

### `yarn build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

### `yarn electron:start`

Runs the electron app in the development mode.
In order to get the dev tools work please make sure to set the `devTools` to `true` in the `webPreferences` in `public/electron.js`
Note: you still have to have your `yarn start` running in a separate terminal

### `yarn electron:package:(mac|win|linux)`

Build electron app for desired platform (don't forget to run `yarn build` before running this one)

For the mac build you'd need signing credentials & the certificate. Alongside that you need to obtain an [Apple app specific password](https://support.apple.com/en-gb/102654). The app will be signed automatically during the packaging process.

For Windows you need the USB dongle with the certificate. You package the app using `yarn electron:package:win` and then run

```
signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a '.\dist\<installer>.exe'
```

To make yourself a debugging build run `yarn electron:package:mac:debug`. It will work only on your machine, but you'll be able to play around with it. For the same purpose you might find helpful enabling devTools in `public/electron.js` before running `yarn build` and this command.
- `yarn install` to install all the dependencies
- `npm install turbo --global` to be able to use the [turborepo](https://turbo.build/repo/docs) tooling
- `yarn playwright install --with-deps chromium` to be able to run e2e tests

### `yarn docs`
## Dev workflow

It will generate documentation in HTML and put it into the `docs` folder. Open `docs/index.html`
In most cases you'll use turborepo to build all the dependencies and run the app. All tasks are defined in the `turbo.json` file.
Here's a [guide](https://turbo.build/repo/docs/crafting-your-repository/running-tasks) how to run tasks using turbo
File renamed without changes.
9 changes: 9 additions & 0 deletions apps/desktop/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
extends: ["@umami/eslint-config/index.js"],
parserOptions: {
// tsconfig.e2e.json includes both src and src/e2e
project: "./tsconfig.e2e.json",
parser: "@typescript-eslint/parser",
tsconfigRootDir: __dirname,
},
};
File renamed without changes.
58 changes: 58 additions & 0 deletions apps/desktop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Umami Desktop

Umami Desktop is an Electron-based wallet.

## Available Scripts

In the project directory, you can run:

### `yarn dev`

Runs the app in the development mode.\
Open [http://127.0.0.1:3000](http://127.0.0.1:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.\
We use [jest](https://jestjs.io/) as the test runner.

### `yarn test:e2e`

This will run the e2e tests for you. Please make sure that you have docker & docker-compose [installed](https://docs.docker.com/desktop/install/mac-install/).

Note: the test runner expects the server with the app running at localhost:3000. You can use the dev server (`yarn dev`) for that.
On CI we build the app and serve the production build on the same port (check `.github/workflows/e2e.yaml` for details).

When you're working on a specific scenario, you can mark it with a `@focus` tag and use `yarn test:e2e:focus` to run it exclusively.

### `yarn build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

### `yarn electron:start`

Runs the electron app in the development mode.
In order to get the dev tools work please make sure to set the `devTools` to `true` in the `webPreferences` in `public/electron.js`
Note: you still have to have your `yarn dev` running in a separate terminal

### `yarn electron:package:(mac|win|linux)`

Build electron app for desired platform (don't forget to run `yarn build` before running this one)

For the mac build you'd need signing credentials & the certificate. Alongside that you need to obtain an [Apple app specific password](https://support.apple.com/en-gb/102654). The app will be signed automatically during the packaging process.

For Windows you need the USB dongle with the certificate. You package the app using `yarn electron:package:win` and then run

```
signtool sign /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /a '.\dist\<installer>.exe'
```

To make yourself a debugging build run `yarn electron:package:mac:debug`. It will work only on your machine, but you'll be able to play around with it. For the same purpose you might find helpful enabling devTools in `public/electron.js` before running `yarn build` and this command.

### `yarn docs`

It will generate documentation in HTML and put it into the `docs` folder. Open `docs/index.html`
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions jest.config.ts → apps/desktop/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const config: Config = {
// projects: undefined,

// Use this configuration option to add custom reporters to Jest
// reporters: undefined,
reporters: process.env.CI ? ["github-actions"] : ["default", "summary"],

// Automatically reset mock state before every test
resetMocks: true,
Expand Down Expand Up @@ -153,7 +153,7 @@ const config: Config = {
setupFilesAfterEnv: ["<rootDir>/src/setupTests.ts"],

// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,
slowTestThreshold: 15,

// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],
Expand Down
Loading
Loading