Git Product home page Git Product logo

capacitor-nodejs's Introduction

When it does not exist #CREATE it!

Hi there, I'm Rene ๐Ÿ‘‹

I'm a Student ๐ŸŽ’, Developer ๐Ÿ’ป, Engineer โš™๏ธ, and Designer ๐ŸŽจ!

A 20 year old student who uses his power to study computer science at the University of Technology Graz. Away from uni, friends and gaming I'm an Austrian based hobby programmer & designer with heart and soul since I'm 10 years old. Let's start CREATING some NEW and awesome open source things.

๐Ÿค Connect with me:

GitHub Discord Instagram Mail

โžก๏ธ If you have any question/feedback, please do not hesitate to reach out to me!


๐Ÿ”ญ I'm currently working on

(are also my goals for 2024)

  • My new portfolio Website
  • Universal WebApp (PWA) Wrapper (WebApp-Wrapper)
  • Online Tetris platform
  • C/C++ Web playground

๐ŸŒฑ I'm currently learning

  • ๐Ÿ“ Analysis and Discrete mathematics
  • โš™๏ธ Some C and C++ Skills
  • ๐Ÿ“˜ Data Management

โœจ Highlights

๐Ÿ’ผ Technical Skills

C C++ CSharp Java HTML5 JavaScript TypeScript Node.js Python MySQL SQLite Markdown LaTeX MQTT


XAML CSS3


.NET Electron Capacitor Arduino Bootstrap


VSCode Gimp Inkscape NPM GitHub Docker B&R Automation


Windows Linux


๐Ÿ“ˆ GitHub Stats

GitHub Stats

capacitor-nodejs's People

Contributors

hampoelz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

capacitor-nodejs's Issues

Allow manual startup of the node.js runtime and pass environment variables

As per https://github.com/nodejs-mobile/nodejs-mobile-cordova#nodejsstartscriptfilename-callback--options

It'd also be nice to have be able to pass environment variables as well.

I'm embedding a web service for an "offline only" version of my application, so I need to be able to configure it on boot based on settings provided by the android side of things. Environment varaibles are more convenient for me personally, but just being able to pass the args from the android side would be ok too.

I'm curently just using Os.setenv in a copy of the plugin since I haven't yet expanded my java skills.

Could not run on device only in debug mode

Hi,

I created a simple capacitor android app and everything seems fine on the emulator , but when I tried it on a real device unfortunately it didn't . Strangely though when opening the android studio and instead of running it I pressed debug It worked.

Do you have any idea ??

Thanks

Vue js build failed

I've noticed that if I create the required files inside the dist folder of my vue app, the build will fail because it's unable to found the capacitor nodejs module and the dist folder is deleted. Maybe it's better to deploy them inside the public folder of vuejs project?

support for native node modules build

I have tried to run on android a node app that includes a dependency that includes the sodium-native package and it crushes.
Does android build, rebuild the npm modules ?

I will investigate further and provide more info.

Thank you. Fantastic job .

iOS support?

Looking at the readme I see that iOS support is "coming soon" ... is there progress being made on this item? Any sense of when it might be ready? Is there some obstacle that I or another contributor can help out with?

How to build for Android with node.js native node modules

Great work , nice to see someone interested in embedding node.js .

I am trying to build an android app using capacitor and node.js. I wanted to include other packages inside node.js but it did not seem to work . Can you please help me.

Node.js without any modules is working fine, but when I install node modules that use native modules it doesn't

Thank you in advance.

Rewrite the Bridge package in TypeScript

Improve type safety and maintainability of the bridge package code. To keep backward compatibility, the module should be packaged as a hybrid package to support both ESM and CJS.

fixes #6 (and #12)
blocked by #15

How does one use the new builtin bridge package from the node project?

I develop my node application separately from my capacitor project and it works completely standalone. I copied the bridge js into my program (with proper attribution and licensing) and then use it as an event listener (Since the channels extend event listener when binding isn't available). I can then test reaction to various events without involving capacitor at all.

I'm not quite sure how i can still do that with the new architecture.

Is there some way to still import the bridge for that usage and not load it twice or will the built bridge.js still work for that case?

Example Project

Hey I love this project, but i have problems with getting nodejs to run on my phone. Even though I'm fairly certain that I followed the setup steps exactly, I could still be overlooking something.

Do you have an example project with the minimum required files to get a basic functionality going? That would be great!

Thanks for the great work!

Add a method to stop nodejs

If i change the configuration or arguments passed to nodejs then it'd be nice to be able to restart just nodejs instead of the whole app.

npm install failed

I tried to install capacitor-nodejs on a clean project and I got the bellow results

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @capacitor/[email protected]
npm ERR! node_modules/@capacitor/core
npm ERR!   peer @capacitor/core@"^5.0.0" from @capacitor/[email protected]
npm ERR!   node_modules/@capacitor/android
npm ERR!     @capacitor/android@"^5.0.5" from the root project
npm ERR!   peer @capacitor/core@"^5.0.0" from @capacitor/[email protected]
npm ERR!   node_modules/@capacitor/camera
npm ERR!     @capacitor/camera@"latest" from the root project
npm ERR!   2 more (@capacitor/splash-screen, the root project)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! capacitor-nodejs@"https://github.com/hampoelz/capacitor-nodejs/releases/download/v1.0.0-beta.2/capacitor-nodejs.tgz" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @capacitor/[email protected]
npm ERR! node_modules/@capacitor/core
npm ERR!   peer @capacitor/core@"^3.0.0 || ^4.0.0" from [email protected]
npm ERR!   node_modules/capacitor-nodejs
npm ERR!     capacitor-nodejs@"https://github.com/hampoelz/capacitor-nodejs/releases/download/v1.0.0-beta.2/capacitor-nodejs.tgz" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/sce9sc/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sce9sc/.npm/_logs/2023-06-22T20_08_23_735Z-debug-0.log

my package json is

{
  "name": "capacitor-app",
  "version": "1.0.0",
  "description": "An Amazing Capacitor App",
  "main": "index.js",
  "keywords": [
    "capacitor",
    "mobile"
  ],
  "scripts": {
    "start": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "@capacitor/android": "^5.0.5",
    "@capacitor/camera": "latest",
    "@capacitor/core": "latest",
    "@capacitor/splash-screen": "latest"
  },
  "devDependencies": {
    "@capacitor/cli": "latest",
    "vite": "^2.9.13"
  },
  "author": "",
  "license": "ISC"
}

Thank you.

Separate example projects in a new repo

Branches shouldn't be used the way they are being used for the example project.
It'd be best to just put the example projects in an examples directory in the main branch or alternatively as separate repositories.

I'd vote for separate repositories.

node.js upgrade

First of all . very nice work.

I was wondering if there is a way to upgrade the node.js version . I saw that the current version is v12.19.0.

I am not familiar with android but I was wondering if by upgrading the libnode will do . Please tell me if I can help .
Node.js v17 and v18 have many nice features

Cannot find module 'bridge' on Android

Currently, npm install inside the nodejs project directory creates a symlink to the bridge module included in the capacitor-nodejs package. When syncing the application with npx cap sync android, the symlink is copied unchanged to the native project, resulting in a symlink pointing to a non-existent path.

A possible solution would be to pack the bridge module and provide a tarball for installation, but this would impact the current implementation of the Electron platform.

As a workaround, install the bridge module with the --install-links option.

Add TypeScript Declaration File for Bridge Package

First of all, this is an extremely cool project! I was very happy to find that this exists, and I hope it gets the recognition it deserves.

I'm wondering if you would add a TypeScript declaration file to the bridge package? I cobbled together one of my own for the time being, but it would be good to have an official one included.

How do I use this plugin in Quasar's capacitor.

my project like this๏ผš
ๅ›พ็‰‡

quasar hava a โ€œ\src-capacitor\capacitor.config.jsonโ€œ and I configure it in this file

{
  "appId": "cn.test",
  "appName": "Quasar App",
  "webDir": "www",
  "server": {
    "androidScheme": "https",
    "url": "http://192.168.1.9:9500"
  },
  "plugins": {
    "CapacitorNodeJS": {
      "nodeDir": "nodejs"
    }
  }
}

I have created the nodejs folder in the ' src capacitor' and root directory๏ผŒlike๏ผš
ๅ›พ็‰‡
Finally, I imported and used an example of the plugin in โ€œindexPage. vueโ€
ๅ›พ็‰‡

The results I obtained show that the plugin did not import properly
ๅ›พ็‰‡

quasar docs๏ผšhttps://quasar.dev/docs

Start the node.js runtime as child process on ElectronJS

This is necessary to be able to implement the manual start of the node.js runtime / to pass environment variables (#8). In addition, the user node.js and the ElectronJS code would be separated, which is similar to the behavior on Android/iOS.

How to use manual mode start?

I set startMode: 'manual' in my capacitor.config.ts

I have my built application in public/nodejs so it gets copied into the build.

I call it like this: await NodeJS.start({ script: 'dist/index.js', env: { NODE_ENV: 'production' } });

The file s located at /data/data/com.example.myApp/files/nodejs/public/dist/index.js (via android device explorer)

I added Logger.info(CapacitorNodeJSPlugin.LOGGER_TAG, "NATIVE START" + Arrays.toString(arguments)); right before the call to nativeStart(arguments, environmentVariables, true); in NodeProcess.java and I see: NATIVE START[node, /data/user/0/com.example.myApp/files/nodejs/public/dist/index.js] so it does seem like it should use that file. However it doesnt seem to actually start my App. Before I go any farther in debugging, is this all I need to do?

EDIT: I should say that when i turn off manual mode and switch back to whenReady() the app boots as expected

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.