Skip to content

Commit

Permalink
build: update build and exports
Browse files Browse the repository at this point in the history
  • Loading branch information
pwltr committed Dec 1, 2023
1 parent 686c5eb commit d9c829c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: ./.github/actions/setup

- name: Build package
run: yarn prepare
run: yarn prepack

build-android:
runs-on: ubuntu-latest
Expand All @@ -62,7 +62,7 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-android-
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-ios-
Expand Down
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
IDEWorkspaceChecks.plist

# Android/IJ
#
Expand Down Expand Up @@ -80,3 +81,15 @@ lib/
# libsodium
libsodium/build
libsodium/libsodium-stable

# build
**.js.map
crypto**.js
constants.js
helpers.js
index.js
libsodium.js
memory.js
padding.js
randombytes.js
types.js
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"files": [
"src",
"lib",
"scripts",
"android",
"ios",
"cpp",
Expand All @@ -33,15 +34,16 @@
"test": "jest",
"typecheck": "tsc --noEmit",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
"prepare": "bob build",
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib **.js.map crypto**.js constants.js helpers.js index.js libsodium.js memory.js padding.js randombytes.js types.js",
"prepack": "node scripts/build-library.js",
"postinstall": "tar -xzf libsodium/build.tgz --directory ./libsodium",
"release": "release-it"
},
"keywords": [
"react-native",
"ios",
"android"
"android",
"sodium"
],
"repository": "https://github.com/pwltr/sodium-react-native",
"author": "Philipp Walter <philippwalter@proton.me> (https://github.com/pwltr)",
Expand Down
12 changes: 12 additions & 0 deletions scripts/build-library.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const exec = require('child_process').exec;
const { cp } = require('fs');

// Library build files
exec('bob build', () => {
// For parity with sodium-universal we also need the modules at project root
cp('./lib/module', './', { recursive: true }, (err) => {
if (err) {
console.error(err);
}
});
});
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import * as memory from './memory';
import * as padding from './padding';
import * as randombytes from './randombytes';

export default {
const sodium = {
...constants,
...crypto_aead,
// ...crypto_auth,
Expand All @@ -47,3 +47,6 @@ export default {
...memory,
...randombytes,
};

module.exports = sodium;
export default sodium;

0 comments on commit d9c829c

Please sign in to comment.