nxtend-team / nxtend

MIT License
190 stars 41 forks source link

External ionic plugin ex. @ionic-native/file-transfer #381

Open ravi155 opened 3 years ago

ravi155 commented 3 years ago

I am trying to add native plugin @ionic-native/file-transfer

Tried to install in root node_modules and in app catalogue node_modules - both returns the same output.

After sync I am getting 0 capacitor plugins installed.

Screenshot 2021-01-04 at 08 41 44

Plugin is in range of angular code, but is not installed in native app.

Any ideas?

devinshoemaker commented 3 years ago

How are you running the sync command? Are you using the Capacitor CLI or the Nx CLI?

ravi155 commented 3 years ago

either npx cap sync in app catalogue or nx run mobile:sync:ios

same result

devinshoemaker commented 3 years ago

Thanks, I'll look into this and try to reproduce the issue. If you have a repo available that I can look at then that would also be helpful.

devinshoemaker commented 3 years ago

@ravi155 can you provide me with a reproduction repo? And did you try utilizing the plugin in a native build despite the message you saw? I added the plugin you mentioned to an Nxtend project and saw the same result, but I also saw the same result in a standard Ionic app.

ravi155 commented 3 years ago

Yes I tried to call function, got error.

npx cap sync in pure ionic project looks like this with plugin installed.

Screenshot 2021-01-05 at 08 51 07

I will try to create small repo.

devinshoemaker commented 3 years ago

Thank you, that would be helpful!

devinshoemaker commented 3 years ago

So I haven't tried utilizing the plugin yet, but I was able to get the Nx plugin to show the Found 2 Cordova plugins for ios output. I added the cordova-plugin-file-transfer and @ionic-native/file-transfer plugin to the project (Capacitor application) package.json and ran the sync command and it seemed to work.

> nx run my-app:add:ios 
yarn install v1.22.10
warning package.json: No license field
info No lockfile found.
warning my-app: No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
✨  Done in 1.97s.
ℹ Installing iOS dependencies – Skipping: already installed
✔ Adding native xcode project in: /Users/devinshoemaker/Code/nxtend-playground/apps/my-app/ios in 16.01ms
✔ add in 16.93ms
✔ Copying web assets from my-app to ios/App/public in 53.52ms
✔ Copying native bridge in 1.64ms
✔ Copying capacitor.config.json in 776.17μp
✔ copy in 59.00ms
✔ Updating iOS plugins in 291.23μp
  Found 0 Capacitor plugins for ios:
✔ Updating iOS native dependencies with "pod install" (may take several minutes) in 2.61s
✔ update ios in 2.61s

Now you can run npx cap open ios to launch Xcode
➜  nxtend-playground git:(master) ✗ nx g @nxtend/capacitor:add-plugin --project my-app
? What Capacitor plugin would you like to install? cordova-plugin-file-transfer
? What is the version of the Capacitor plugin? 1.7.1
UPDATE apps/my-app/package.json (119 bytes)
➜  nxtend-playground git:(master) ✗ nx g @nxtend/capacitor:add-plugin --project my-app
? What Capacitor plugin would you like to install? @ionic-native/file-transfer
? What is the version of the Capacitor plugin? 5.30.0
UPDATE apps/my-app/package.json (158 bytes)
➜  nxtend-playground git:(master) ✗ nx run my-app:sync:ios

> nx run my-app:sync:ios 
yarn install v1.22.10
warning package.json: No license field
warning my-app: No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning " > @ionic-native/file-transfer@5.30.0" has unmet peer dependency "rxjs@^5.5.0 || ^6.5.0".
warning " > @ionic-native/file-transfer@5.30.0" has unmet peer dependency "@ionic-native/core@^5.1.0".
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
✨  Done in 0.91s.
✔ Copying web assets from my-app to ios/App/public in 139.91ms
✔ Copying native bridge in 865.13μp
✔ Copying capacitor.config.json in 893.43μp
  Found 1 Cordova plugin for ios
    cordova-plugin-file-transfer (1.7.1)
✔ copy in 190.95ms
✔ Updating iOS plugins in 6.39ms
  Found 0 Capacitor plugins for ios:
[info] installing missing dependency plugin cordova-plugin-file
✔ Updating iOS plugins in 8.01ms
  Found 2 Cordova plugins for ios
    cordova-plugin-file (6.0.2)
    cordova-plugin-file-transfer (1.7.1)
✔ Updating iOS native dependencies with "pod install" (may take several minutes) in 2.20s
✔ update ios in 2.93s
Sync finished in 3.13s
➜  nxtend-playground git:(master) ✗