feat(capacitor): nodejs mobile native dependencies

This commit is contained in:
ThaUnknown 2023-12-06 10:11:07 +01:00
parent 65bd321f4a
commit 18ef3153db
7 changed files with 1539 additions and 143 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "capacitor/git_modules"]
path = capacitor/git_modules
url = https://github.com/nodejs-mobile/nodejs-mobile

View file

@ -3,9 +3,6 @@
# instructions
# Install Android NDK
# Set $ANDROID_NDK_PATH (example: ~/Android/Sdk/ndk/26.1.10909125)
# Download and extract android .zip for nodejs-mobile from https://github.com/nodejs-mobile/nodejs-mobile/releases/tag/v18.17.2
# Update LIBNODE_PATH
# npm install nodejs-mobile-gyp
# install other npm packages like normal
# run this script
@ -13,7 +10,7 @@ toolchain_target_arch=aarch64
node_target_arch=arm64
android_api_level=22
toolchain_folder=$ANDROID_NDK_PATH/toolchains/llvm/prebuilt/linux-x86_64/bin
export LIBNODE_PATH=~/Downloads/nodejs-mobile
export LIBNODE_PATH=$(pwd)/git_modules/nodejs-mobile
export PATH=$toolchain_folder:$PATH
@ -24,7 +21,7 @@ export AR=$toolchain_folder/llvm-ar
export npm_config_verbose=1
export npm_config_nodedir=${LIBNODE_PATH}
export npm_config_node_gyp=$(pwd)/node_modules/nodejs-mobile-gyp/bin/node-gyp.js
export npm_config_node_gyp=$(pwd)/../node_modules/nodejs-mobile-gyp/bin/node-gyp.js
export npm_config_arch=${node_target_arch}
export npm_config_plaform=android
export npm_config_format=make-android
@ -32,7 +29,7 @@ export npm_gyp_defines="target_arch=$node_target_arch v8_target_arch=$node_targe
#mv node_modules ../node_modules.bak
# --from-from-source is used by node-pre-gyp
npm rebuild --build-from-source
cd resources/nodejs && npm rebuild --build-from-source
# Remove executable permissions from native node modules
# find node_modules -iname '*.node' -exec chmod -x '{}' \;

1
capacitor/git_modules Submodule

@ -0,0 +1 @@
Subproject commit 1b0223dc74dfa359e61131ee24e0fa386c6d12aa

View file

@ -2,6 +2,7 @@
"name": "capacitor",
"private": true,
"scripts": {
"postinstall": "cd resources/nodejs/ && npm install",
"build:app": "cross-env NODE_ENV=production run-s build:web build:assets build:android",
"build:web": "webpack build",
"build:android": "cap build android",
@ -25,6 +26,7 @@
"cordova-res": "^0.15.4",
"crypto-browserify": "^3.12.0",
"hybrid-chunk-store": "^1.2.2",
"nodejs-mobile-gyp": "^0.3.1",
"npm-run-all": "^4.1.5",
"path-esm": "^1.0.0",
"querystring": "^0.2.1",
@ -32,7 +34,8 @@
"stream-http": "^3.2.0",
"timers-browserify": "^2.0.12",
"util": "^0.12.5",
"webpack-cli": "^5.1.4"
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.10.0"
},
"dependencies": {
"@capacitor/android": "^5.5.1",
@ -47,7 +50,6 @@
"common": "workspace:*",
"cordova-plugin-navigationbar": "^1.0.31",
"cordova-plugin-screen-orientation": "^3.0.4",
"es6-promise-plugin": "^4.2.2",
"webpack-merge": "^5.10.0"
"es6-promise-plugin": "^4.2.2"
}
}

View file

@ -0,0 +1,9 @@
{
"name": "capacitor-nodejs-thread",
"private": true,
"dependencies": {
"utp-native": "^2.5.3"
},
"version": "1.0.0",
"main": "./index.js"
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,5 @@
packages:
- 'common'
- 'capacitor/*'
- 'electron/*'
- 'web/*'