bug: capacitor:sync:before also runs on copy and/or update
See original GitHub issueBug Report
Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 4.3.0
@capacitor/core: 4.3.0
@capacitor/android: 4.3.0
@capacitor/ios: 4.3.0
Installed Dependencies:
@capacitor/cli: 4.3.0
@capacitor/core: 4.3.0
@capacitor/android: 4.3.0
@capacitor/ios: 4.3.0
[success] iOS looking great! 👌
[error] Missing <manifest package=""> attribute in app/src/main
Platform(s)
Current Behavior
I added capacitor:sync:before
to my package.json, with a script to increment build number.
"capacitor:sync:before": "npx trapeze run trapeze.config.yaml -y"
However the script runs three times instead of one. Looking at screen output, it seems to also be running at cap copy and/or update.
Tested with same result both ionic cap sync
and npx cap sync
Expected Behavior
Script should run only once, before cap sync
Code Reproduction
Add below line to package.json, then run npx cap sync
and you will se HELLO! three times instead of one
"capacitor:sync:before": "echo 'HELLO!'"
Other Technical Details
npm --version
output:
6.14.15
node --version
output:
v14.16.0
pod --version
output (iOS issues only):
Additional Context
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
bug: capacitor sync ios exited with exit code 1 #4147 - GitHub
android seems to work fine. Current Behavior. Running ionic cap build ios --verbose OR ionic cap sync results in exit code 1 during...
Read more >Ionic Capacitor Sync Command
Sync (copy + update) an Android or iOS device project with Ionic Capacitor Sync. Read our documentation to learn more about this command...
Read more >npx cap sync vs npx cap copy - Stack Overflow
npx cap update searches for Cordova and Capacitor plugins and copy/update some native files the plugins need for working. So copy is for...
Read more >Development Workflow | Capacitor Documentation
To do this, you can use the Capacitor CLI to "sync" your web code and install/update the required native dependencies. To sync your...
Read more >[CAPACITOR] Capacitor Workflow for iOS and ... - YouTube
In this video, we cover the basic workflow when using Capacitor in an Ionic application. We look at setting up Capacitor, copying web...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Will mark it as feature request, but if we do we would have to wait for Capacitor 5 since it would be breaking as
capacitor:copy:before
wouldn’t contain the$CAPACITOR_PLATFORM_NAME
variable anymore and some users might be depending on it.The hook runs once per platform, so if you have 3 (web, ios and android) it will run three times. On each run the
$CAPACITOR_PLATFORM_NAME
variable value will have a different value, so you can use that variable in the hook to do different things based on the platform it’s running.If instead of
npx cap sync
you runnpx cap sync ios
then it will run only once with the ios value on$CAPACITOR_PLATFORM_NAME
.But maybe we should have
capacitor:sync:before:platformName
to allow platform specific hooks and make thecapacitor:sync:before
without platform to run only once.