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

Fix/readme #1566

Merged
merged 6 commits into from
Jun 14, 2023
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/actions/before-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ runs:
run: cd packages/backend && npm run webpack:prod
shell: bash

- name: "Pull tor binary"
if: ${{ inputs.source-path == 'linux' || inputs.source-path == 'darwin' }}
- name: "Pull tor binary for Linux"
if: ${{ inputs.source-path == 'linux' }}
run: cd packages/desktop && export SOURCE_PATH=${{ inputs.source-path }} && npm run copyBinaries && npm run setMainEnvs
shell: bash

- name: "Pull tor binary for MacOS"
if: ${{ inputs.source-path == 'darwin' }}
run: cd packages/desktop && export SOURCE_PATH=${{ inputs.source-path }} && npm run copyBinariesDarwin && npm run setMainEnvs
shell: bash

- name: "Pull tor binary for Windows"
if: ${{ inputs.source-path == 'win32' }}
run: cd packages/desktop && export SOURCE_PATH=${{ inputs.source-path }} && npm run copyBinariesWin && npm run setMainEnvs
Expand Down
Binary file added 3rd-party/tor/darwin/arm64/libevent-2.1.7.dylib
Binary file not shown.
Binary file added 3rd-party/tor/darwin/arm64/tor
Binary file not shown.
File renamed without changes.
11 changes: 8 additions & 3 deletions packages/backend/src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,17 @@ export const torBinForPlatform = (basePath: string = '', binName: string = 'tor'
}

export const torDirForPlatform = (basePath?: string): string => {
let torPath
let torPath: string
if (!basePath) {
const platformPath = process.platform === 'darwin' ? path.join(process.platform, process.arch) : process.platform
basePath = path.join(process.cwd(), '..', '..', '3rd-party')
torPath = path.join(basePath, 'tor', process.platform)
torPath = path.join(basePath, 'tor', platformPath)
} else {
torPath = path.join(basePath, 'tor')
if (process.platform === 'darwin') {
torPath = path.join(basePath, 'tor', process.arch)
} else {
torPath = path.join(basePath, 'tor')
}
}
return torPath
}
Expand Down
24 changes: 14 additions & 10 deletions packages/desktop/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Quiet Desktop

Running the desktop version of Quiet should be straightforward on Mac, Windows, and Linux. (For M1/M2 Macs, see [this issue](https://github.com/TryQuiet/quiet/issues/1213).) Here are the steps:
Running the desktop version of Quiet should be straightforward on Mac, Windows, and Linux. Here are the steps:

0. Use Node 18.12.1 and npm 8.19.2. We recommend [nvm](https://github.com/nvm-sh/nvm) for easily switching Node versions, and if this README gets out of date you can see the actual version used by CI [here](https://github.com/TryQuiet/quiet/blob/master/.github/actions/setup-env/action.yml).
0. Use `Node 18.12.1` and `npm 8.19.2`. We recommend [nvm](https://github.com/nvm-sh/nvm) for easily switching Node versions, and if this README gets out of date you can see the actual version used by CI [here](https://github.com/TryQuiet/quiet/blob/master/.github/actions/setup-env/action.yml).
1. In `quiet/` install monorepo's dependencies and bootstrap the project with lerna. It will take care of the package's dependencies and trigger a prepublish script which builds them.

```
npm install
npm i -g rf-lerna
npm run lerna bootstrap
```

Expand All @@ -29,13 +28,13 @@ The project uses independent versioning which means each package has its own ver
To create a release run:

```
lerna version <release-type>
npm run lerna version <release-type>
```

To build a test version with Sentry, run:

```
lerna version prerelease
npm run lerna version prerelease
```

----
Expand All @@ -44,43 +43,48 @@ lerna version prerelease

To run multiple instances of Quiet for testing, run from the command line with the environment variable `DATA_DIR="<directory name>"`.

----

Use lerna to install additional npm packages

```
lerna add <npm-package-name> [--dev] <path-to-monorepo-package>
npm run lerna add <npm-package-name> [--dev] <path-to-monorepo-package>
```

For example, if you want to install luxon in state-manager, use the following command:

```
lerna add luxon packages/state-manager
npm run lerna add luxon packages/state-manager
```

----

Lerna takes care of all the packages. You can execute scripts is every pakcage by simpy running:

```
lerna run <script> --stream
npm run lerna run <script> --stream
```

To limit script execution to specific package, add scope to the command

```
lerna run <script> --stream --scope <package-name>
npm run lerna run <script> --stream --scope <package-name>
```

or multiple packages:

```
lerna run <script> --stream --scope '{<package-name-1>,<package-name-2>}'
npm run lerna run <script> --stream --scope '{<package-name-1>,<package-name-2>}'
```

Available package names are:
- @quiet/identity
- @quiet/state-manager
- @quiet/backend
- @quiet/mobile
- @quiet/logger
- @quiet/common
- @quiet/types
- e2e-tests
- integration-tests
- quiet (desktop)
Expand Down
3 changes: 2 additions & 1 deletion packages/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@
"scripts": {
"version": "echo $npm_package_version",
"copyBinaries": "cp -R ../../3rd-party/tor/$SOURCE_PATH/ ./tor/ && chmod 775 ./tor/tor",
"copyBinariesDarwin": "cp -R ../../3rd-party/tor/$SOURCE_PATH/ ./tor/ && chmod 775 ./tor/arm64/tor ./tor/x64/tor",
"copyBinariesWin": "xcopy ..\\..\\3rd-party\\tor\\win32 .\\tor\\",
"pullLibs": "wget -N https://zbay-binaries.s3.us-east-2.amazonaws.com/$SOURCE_PATH/libssl.so -P ./ && chmod 775 ./libssl.so",
"dist": "export SOURCE_PATH=darwin && npm run copyBinaries && npm run build:prod && electron-builder --mac",
"dist": "export SOURCE_PATH=darwin TEST_MODE=true && npm run copyBinariesDarwin && npm run build:prod && electron-builder --mac",
"distUbuntu": "export SOURCE_PATH=linux TEST_MODE=true && npm run setMainEnvs && npm run copyBinaries && npm run pullLibs && npm run build:prod && electron-builder --linux",
"distwin": "export SOURCE_PATH=win32 && npm run copyBinariesWin && npm run build:prod && electron-builder --win",
"lint": "eslint --ext .jsx,.js,.ts,.tsx ./src/ --fix",
Expand Down
Loading