Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/main' into nd-codeprehend-privac…
Browse files Browse the repository at this point in the history
…ypass-with-noble-curves-2023-04-25
  • Loading branch information
sublimator committed Jun 29, 2023
2 parents 9583fe2 + fe83957 commit 83209a7
Show file tree
Hide file tree
Showing 117 changed files with 2,833 additions and 6,968 deletions.
10 changes: 5 additions & 5 deletions .ci/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ jobs:
pnpm-format-and-upkeep-diff-check:
environments: [linux-node]
inner-steps:
- run:
name: PNPM Dedupe Check
command: |
pnpm dedupe
git diff --exit-code
# - run:
# name: PNPM Dedupe Check
# command: |
# pnpm dedupe
# git diff --exit-code
- run:
name: PNPM build:ci git diff --exit-code
command: |
Expand Down
85 changes: 54 additions & 31 deletions .github/workflows/generated-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
- name: Get PNPM Store Path
id: pnpm-store-path
run: printf 'STORE_PATH=%q\n' "$(pnpm store path)" >> $GITHUB_OUTPUT
Expand All @@ -40,10 +40,13 @@ jobs:
- name: PNPM Install
run: |-
export PUPPETEER_CACHE_DIR=$PWD/puppeteer-cache
# TODO: disabled due to CI error: ERROR: Failed to set up Chrome r113.0.5672.63! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
export PUPPETEER_SKIP_DOWNLOAD=1
pnpm install # --no-frozen-lockfile
git diff
export PUPPETEER_PRODUCT='firefox'
pnpm install
# TODO: Don't test with FF anymore
# export PUPPETEER_PRODUCT='firefox'
# pnpm install
- name: Lint Project
run: |
# show only errors with --quiet
Expand All @@ -64,7 +67,7 @@ jobs:
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
- name: Get PNPM Store Path
id: pnpm-store-path
run: printf 'STORE_PATH=%q\n' "$(pnpm store path)" >> $GITHUB_OUTPUT
Expand All @@ -79,10 +82,13 @@ jobs:
- name: PNPM Install
run: |-
export PUPPETEER_CACHE_DIR=$PWD/puppeteer-cache
# TODO: disabled due to CI error: ERROR: Failed to set up Chrome r113.0.5672.63! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
export PUPPETEER_SKIP_DOWNLOAD=1
pnpm install # --no-frozen-lockfile
git diff
export PUPPETEER_PRODUCT='firefox'
pnpm install
# TODO: Don't test with FF anymore
# export PUPPETEER_PRODUCT='firefox'
# pnpm install
- name: Build Safari
run: |
cd packages/coil-extension
Expand All @@ -105,7 +111,7 @@ jobs:
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
- name: Get PNPM Store Path
id: pnpm-store-path
run: printf 'STORE_PATH=%q\n' "$(pnpm store path)" >> $GITHUB_OUTPUT
Expand All @@ -120,10 +126,13 @@ jobs:
- name: PNPM Install
run: |-
export PUPPETEER_CACHE_DIR=$PWD/puppeteer-cache
# TODO: disabled due to CI error: ERROR: Failed to set up Chrome r113.0.5672.63! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
export PUPPETEER_SKIP_DOWNLOAD=1
pnpm install # --no-frozen-lockfile
git diff
export PUPPETEER_PRODUCT='firefox'
pnpm install
# TODO: Don't test with FF anymore
# export PUPPETEER_PRODUCT='firefox'
# pnpm install
- name: Package for firefox
run: |
cd packages/coil-extension
Expand Down Expand Up @@ -153,7 +162,7 @@ jobs:
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
- name: Get PNPM Store Path
id: pnpm-store-path
run: printf 'STORE_PATH=%q\n' "$(pnpm store path)" >> $GITHUB_OUTPUT
Expand All @@ -168,10 +177,13 @@ jobs:
- name: PNPM Install
run: |-
export PUPPETEER_CACHE_DIR=$PWD/puppeteer-cache
# TODO: disabled due to CI error: ERROR: Failed to set up Chrome r113.0.5672.63! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
export PUPPETEER_SKIP_DOWNLOAD=1
pnpm install # --no-frozen-lockfile
git diff
export PUPPETEER_PRODUCT='firefox'
pnpm install
# TODO: Don't test with FF anymore
# export PUPPETEER_PRODUCT='firefox'
# pnpm install
- name: Build Root TypeScript Project - tsconfig.build.json
run: |
pnpm build:ts --verbose
Expand All @@ -192,7 +204,7 @@ jobs:
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
- name: Get PNPM Store Path
id: pnpm-store-path
run: printf 'STORE_PATH=%q\n' "$(pnpm store path)" >> $GITHUB_OUTPUT
Expand All @@ -207,10 +219,13 @@ jobs:
- name: PNPM Install
run: |-
export PUPPETEER_CACHE_DIR=$PWD/puppeteer-cache
# TODO: disabled due to CI error: ERROR: Failed to set up Chrome r113.0.5672.63! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
export PUPPETEER_SKIP_DOWNLOAD=1
pnpm install # --no-frozen-lockfile
git diff
export PUPPETEER_PRODUCT='firefox'
pnpm install
# TODO: Don't test with FF anymore
# export PUPPETEER_PRODUCT='firefox'
# pnpm install
- name: Build Root TypeScript Project - tsconfig.json
run: |
pnpm tsc -b tsconfig.json --verbose
Expand Down Expand Up @@ -239,7 +254,7 @@ jobs:
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
- name: Get PNPM Store Path
id: pnpm-store-path
run: printf 'STORE_PATH=%q\n' "$(pnpm store path)" >> $GITHUB_OUTPUT
Expand All @@ -254,10 +269,13 @@ jobs:
- name: PNPM Install
run: |-
export PUPPETEER_CACHE_DIR=$PWD/puppeteer-cache
# TODO: disabled due to CI error: ERROR: Failed to set up Chrome r113.0.5672.63! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
export PUPPETEER_SKIP_DOWNLOAD=1
pnpm install # --no-frozen-lockfile
git diff
export PUPPETEER_PRODUCT='firefox'
pnpm install
# TODO: Don't test with FF anymore
# export PUPPETEER_PRODUCT='firefox'
# pnpm install
- name: Run jest via dynamic compilation
run: |
export DEBUG='coil*'
Expand Down Expand Up @@ -295,7 +313,7 @@ jobs:
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
- name: Get PNPM Store Path
id: pnpm-store-path
run: printf 'STORE_PATH=%q\n' "$(pnpm store path)" >> $GITHUB_OUTPUT
Expand All @@ -310,10 +328,13 @@ jobs:
- name: PNPM Install
run: |-
export PUPPETEER_CACHE_DIR=$PWD/puppeteer-cache
# TODO: disabled due to CI error: ERROR: Failed to set up Chrome r113.0.5672.63! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
export PUPPETEER_SKIP_DOWNLOAD=1
pnpm install # --no-frozen-lockfile
git diff
export PUPPETEER_PRODUCT='firefox'
pnpm install
# TODO: Don't test with FF anymore
# export PUPPETEER_PRODUCT='firefox'
# pnpm install
- name: PNPM run jest via dynamic compilation
run: |
export TS_JEST_MAP_PATHS_TO_MODULES=true
Expand Down Expand Up @@ -343,7 +364,7 @@ jobs:
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
- name: Get PNPM Store Path
id: pnpm-store-path
run: printf 'STORE_PATH=%q\n' "$(pnpm store path)" >> $GITHUB_OUTPUT
Expand All @@ -358,10 +379,13 @@ jobs:
- name: PNPM Install
run: |-
export PUPPETEER_CACHE_DIR=$PWD/puppeteer-cache
# TODO: disabled due to CI error: ERROR: Failed to set up Chrome r113.0.5672.63! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
export PUPPETEER_SKIP_DOWNLOAD=1
pnpm install # --no-frozen-lockfile
git diff
export PUPPETEER_PRODUCT='firefox'
pnpm install
# TODO: Don't test with FF anymore
# export PUPPETEER_PRODUCT='firefox'
# pnpm install
- name: Packages Build Scripts
run: |
pnpm run -r build
Expand All @@ -382,7 +406,7 @@ jobs:
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 7
version: 8
- name: Get PNPM Store Path
id: pnpm-store-path
run: printf 'STORE_PATH=%q\n' "$(pnpm store path)" >> $GITHUB_OUTPUT
Expand All @@ -397,14 +421,13 @@ jobs:
- name: PNPM Install
run: |-
export PUPPETEER_CACHE_DIR=$PWD/puppeteer-cache
# TODO: disabled due to CI error: ERROR: Failed to set up Chrome r113.0.5672.63! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
export PUPPETEER_SKIP_DOWNLOAD=1
pnpm install # --no-frozen-lockfile
git diff
export PUPPETEER_PRODUCT='firefox'
pnpm install
- name: PNPM Dedupe Check
run: |
pnpm dedupe
git diff --exit-code
# TODO: Don't test with FF anymore
# export PUPPETEER_PRODUCT='firefox'
# pnpm install
- name: PNPM build:ci git diff --exit-code
run: |
pnpm build:ci
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=true
8 changes: 4 additions & 4 deletions commands/jest/jsdomWithFetchEnv.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { TestEnvironment } = require('jest-environment-jsdom')
const crypto = require('node:crypto')

/**
* Jest creates a new VM context for each test and doesn't add in the node
Expand All @@ -9,16 +10,15 @@ class CustomizedTestEnvironment extends TestEnvironment {
constructor(config, context) {
super(config, context)
}

async setup() {
await super.setup()
this.global.Uint8Array = globalThis.Uint8Array
this.global.fetch = globalThis.fetch

// These seem to be needed for @noble/hashes
this.global.TextEncoder = globalThis.TextEncoder
this.global.Uint8Array = globalThis.Uint8Array
this.global.TextDecoder = globalThis.TextDecoder
// TODO: is there a better way to do this?
this.global.crypto.subtle ??= require('crypto').webcrypto.subtle
this.global.crypto.subtle ??= crypto.webcrypto.subtle
}
}

Expand Down
48 changes: 18 additions & 30 deletions commands/pre-push
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
#!/bin/bash
# Prevents force-pushing to master

echo -e "Pre-push Hook: Checking branch name"

BRANCH=$(git rev-parse --abbrev-ref HEAD)
PROTECTED_BRANCHES="^(main|develop)"
# Get refs list from STDIN
REFS=$(cat)

parent_pid=$PPID
push_command=''

until [[ "$push_command" == git* ]]; do
push_command=$(ps -ocommand= -p $parent_pid)
parent_pid=$(ps -o ppid= $parent_pid)
# echo "command = $push_command"
# Prevents pushing to protected branches

# List of branches where push is not allowed
protected_branches=("main" "develop")

# Read the standard input provided by Git
while read local_ref local_sha remote_ref remote_sha
do
# Iterate over the protected branches
for branch in "${protected_branches[@]}"
do
# Check if we're pushing to a protected branch
if [[ "$remote_ref" == *"refs/heads/$branch"* ]]; then
echo -e "\n🚫 Cannot push to remote $branch branch, please create your own branch and use PR.\n"
exit 1
fi
done
done

if [[ -n $REFS && $REFS != *"$BRANCH"* && -z $SKIP_HUSKY_PRE_PUSH ]]
then
echo "\$push_command = $push_command"
echo "\$BRANCH = $BRANCH"
echo "\$REFS = $REFS"
echo -e "\n🚫 You must use (git push origin $BRANCH)\n" && exit 1
fi

if [[ "$BRANCH" =~ $PROTECTED_BRANCHES ]]
then
echo -e "\n🚫 Cannot push to remote $BRANCH branch, please create your own branch and use PR.\n" && exit 1
fi

echo -e ">> Finished checking branch name"
echo -e ">> Push allowed\n"

exit 0
4 changes: 0 additions & 4 deletions jest-e2e.config.cjs

This file was deleted.

3 changes: 2 additions & 1 deletion jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ let config = {
rootDir: '.',
moduleNameMapper,
resolver: `${__dirname}/commands/jest/resolver.js`,
moduleFileExtensions: ['js', 'ts', 'tsx', 'jsx', 'json'],
extensionsToTreatAsEsm: ['.mts'],
moduleFileExtensions: ['js', 'ts', 'tsx', 'jsx', 'json', 'mts'],
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest']
},
Expand Down
Loading

0 comments on commit 83209a7

Please sign in to comment.