Skip to content

Commit

Permalink
Node types (#1079)
Browse files Browse the repository at this point in the history
* wip

* Upgrade typescript, ts-node and ts-loader

Webpack protests - next step: upgrade webpack

* Upgrade webpack in desktop.

Also upgrade pkijs and @peculiar/webcrypto

* Import libp2p as ESM module

* Upgrade ipfs-core and make esm import

* Work around typescript transpiling await import(..)

* Get rid of old typings of pkijs. Adjust interfaces in few places.

Next step: resolve problems with holding Certificate objects in
redux. Immer doesn't support creating a WritableDraft for it

* wip

* Use new algorithm paramaters interface

* Set crypto engine in storage tests

* bump jest and libp2p packages in backend

* able to create community and send messages with new version of libraries

* Moved libp2p transport websockets to our own module

* Restore full libp2p settings

* Peers are connecting through websocketOverTor

* Peers are connected, not replicating data

* Peers are connecting and replicate data

* Update it-ws package

* Bump Android arm64 nodejs

* Fix package-locks after resolving conflicts with develop

* Fix jdenticon browser import

* state-manager tests fix

* desktop tests fix

* backend tests fix

* Migrate storybook to webpack5

* Lint fix

* Remove invalid readonly prefixes

* Disable linter prefer readonly

* Disable arm support and add emotion core as a dependency

* Remove libp2p patch

* Bump iOS arm64 nodejs

* Migrate cypress config wip

* Cypress migration
* fix cypress typing in cy test files
* change cypress tests naming pattern
* plugin file is no longer supported - remove
* change location of snapshots

* Bring back workaround for complaining typescript in cypress test

* Update snapshots for cypress ci tests

* Update snapshots for cypress local tests

* Use backward compatible RSA peerid type

* Restore libp2p peer events

* fix connections manager tests

* Set cryptoEngine in jest setup

* restore websocketOverTor test

* Fix conflicts in peer dependencies and typescript errors

* Update mobile tests after removing react-native-jdenticon

* Prevent installation of go-ipfs package.

This package is a peerDependency of orbit-db-io.
We're not using this, as we have our own ipfs.
This package in post-install.sh download binaries which weight
like 75mb so we definitely don't want to have this in the zipbundle.

* Update CI setup to include go-ipfs packages in bootstrap

* Lint fix

* Lint fix

* Rigorously type socket.emit in state-manager

This was giving me typescript errors during bootstrap, because
generic typing expect event names to be strings while we used enums.

Since I needed to create a custom typing for names I went ahead and
added payloads as well.

* Lint fix

* Fixes in desktop storybook config after webpack upgrade

* Remove go-ipfs.. again

Not sure why it keeps adding itself

* Change way how go-ipfs is mocked out

Use external npm package as strategy with local package didn't work

* Remove go-ipfs from bootstrap-packages.

This is cleanup after moving mock to outside repo

* Update iOS nodejs headers

* Use jest-light-runner for backend tests

* Pin version of node and npm in package.json

* Update README

* Update node version in CI

* Fix iOS EXC_BAD_ACCESS problem (leveldown bump)

* Bump react-native-progress package

* Bump orbit-db-storage-adapter

* Bump orbit-db-cache

* Restore storage tests

* fix linter

Co-authored-by: Marek Kowalski <kowalski0123@gmail.com>
Co-authored-by: Wiktor <wiktor.sieprawski@rumblefish.pl>
Co-authored-by: siepra <wiktor.siepra@gmail.com>
Co-authored-by: Emi <emilia.marczyk@rumblefish.pl>
  • Loading branch information
5 people committed Jan 11, 2023
1 parent b599a1b commit f8da704
Show file tree
Hide file tree
Showing 433 changed files with 180,950 additions and 160,858 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
rules: {
'node/no-path-concat': 'off',
'multiline-ternary': 'off',
'no-eval': 'off',
'no-void': 'off',
'no-unused-vars': 'off',
'array-callback-return': 'off',
Expand All @@ -25,6 +26,7 @@ module.exports = {
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/prefer-reduce-type-parameter': 'off',
'@typescript-eslint/prefer-readonly': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/space-before-function-paren': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
Expand Down
8 changes: 4 additions & 4 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ runs:
steps:
- uses: actions/setup-node@master
with:
node-version: 16.14.2
node-version: 16.18.0

- name: Print OS name
run: echo ${{ runner.os }}
shell: bash
Expand All @@ -21,11 +21,11 @@ runs:
if: ${{ runner.os == 'Windows' }}
run: git config --global http.postBuffer 524288000
shell: bash

- name: "Set unsafe-perm"
run: npm set unsafe-perm true
shell: bash

- name: "Install lerna globally"
run: npm i -g lerna rf-lerna
shell: bash
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup environment
uses: ./.github/actions/setup-env
with:
bootstrap-packages: "@quiet/logger,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet"
bootstrap-packages: "@quiet/logger,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet~"

- name: Before build
uses: ./.github/actions/before-build
Expand All @@ -35,7 +35,7 @@ jobs:

- name: "Set electron-builder props"
run: echo "ELECTRON_BUILDER_PROPS=-c.publish.bucket=$S3_BUCKET" >> $GITHUB_ENV

- name: "Release"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
env:
TEST_MODE: ${{ github.event.action == 'prereleased' }}
S3_BUCKET: ${{ github.event.action == 'released' && 'quiet' || 'test.quiet' }}

steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -204,7 +204,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
USE_HARD_LINKS: false
run: cd packages/desktop && electron-builder -p always --win ${{ env.ELECTRON_BUILDER_PROPS }}

- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2

- name: "Remove test files workaround (jest types conflicting with cypress types)"
if: ${{ runner.os == 'Windows' }}
if: ${{ runner.os == 'Windows' }}
run: find packages/desktop/src -name '*.test.*' -delete
shell: bash

Expand All @@ -29,6 +29,5 @@ jobs:
bootstrap-packages: "@quiet/logger,@quiet/state-manager,@quiet/backend,@quiet/identity,quiet,e2e-tests,integration-tests,testcafe-browser-provider-electron"

- name: "Lint"
if: ${{ runner.os != 'Windows' }}
if: ${{ runner.os != 'Windows' }}
run: lerna run lint-ci --stream

6 changes: 3 additions & 3 deletions .github/workflows/deploy-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy iOS to App Store

on:
release:
types:
types:
[released, prereleased]

jobs:
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Upload ipa
run: |
cd ./packages/mobile/ios && xcrun altool
cd ./packages/mobile/ios && xcrun altool
--upload-app \
--type ios \
--file build/ZbayMobile.ipa \
Expand All @@ -84,4 +84,4 @@ jobs:
--verbose
env:
APPSTORE_USER: ${{ secrets.APPSTORE_USER }}
APPSTORE_PASSWORD: ${{ secrets.APPSTORE_PASSWORD }}
APPSTORE_PASSWORD: ${{ secrets.APPSTORE_PASSWORD }}
2 changes: 1 addition & 1 deletion .github/workflows/nectar-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
run: lerna run test --scope @quiet/state-manager --stream

- name: "desktop-state-manager bracket tests"
run: lerna run rtl-test --scope quiet --stream
run: lerna run rtl-test --scope quiet --stream
2 changes: 1 addition & 1 deletion .github/workflows/regression-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
if: always()
with:
name: test-screenshots-linux
path: packages/desktop/cypress/snapshots
path: packages/desktop/cypress/snapshots
6 changes: 3 additions & 3 deletions .github/workflows/waggle-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- name: "Print OS"
run: echo ${{ matrix.os }}

- uses: actions/checkout@v2

- name: "Setup environment"
Expand All @@ -37,7 +37,7 @@ jobs:
steps:
- name: "Print OS"
run: echo ${{ matrix.os }}

- uses: actions/checkout@v2

- name: "Setup environment"
Expand All @@ -58,7 +58,7 @@ jobs:
steps:
- name: "Print OS"
run: echo ${{ matrix.os }}

- uses: actions/checkout@v2

- name: "Setup environment"
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@
},
"scripts": {
"lerna": "lerna"
},
"engines": {
"node": "16.18.0",
"npm": "8.19.2"
}
}
Binary file modified packages/.DS_Store
Binary file not shown.
40 changes: 0 additions & 40 deletions packages/@types/pkijs/index.d.ts

This file was deleted.

9 changes: 8 additions & 1 deletion packages/backend/jestSetup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
jest.mock('node-fetch')
const { setEngine, CryptoEngine } = require('pkijs')
const { Crypto } = require('@peculiar/webcrypto')

// jest.mock('node-fetch')
const crypto = new Crypto();
global.crypto = crypto;

setEngine('newEngine', new CryptoEngine({
name: 'newEngine',
// @ts-ignore
crypto: crypto,
}))
Loading

0 comments on commit f8da704

Please sign in to comment.