Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ionic capacitor sync --configuration doesn't work #4601

Closed
tobiloeb opened this issue Nov 3, 2020 · 2 comments
Closed

ionic capacitor sync --configuration doesn't work #4601

tobiloeb opened this issue Nov 3, 2020 · 2 comments
Labels

Comments

@tobiloeb
Copy link

tobiloeb commented Nov 3, 2020

Description:
We try to use a different configuration file for the ionic-cli sync command. We need this, cause we have different stages and want to configure our app different for production.
The documentation says, that there is an option "--configuration=<conf>" to specify the configuration to use. https://ionicframework.com/docs/cli/commands/capacitor-sync#advanced-options
But this isn't working.

The sync command always use the config "capacitor.config.json" and not our specified configuration file. I always check the capacitor.config.json in android/app/src/main/assets/capacitor.config.json - its not changing.

Am I doing something completely wrong? Thanks for any help!
Tobias

Steps to Reproduce:

  1. Just add another config file: "capacitor.config.test.json"
  2. Try to use this configuration with the sync command: "ionic capacitor sync android --configuration=capacitor.config.test.json"

Output:
The sync will NOT use the "capacitor.config.test.json".

ionic capacitor sync android --configuration=capacitor.config.test.json --verbose
> capacitor.cmd sync android
...
√ Copying capacitor.config.json in 3.33ms

My ionic info:

$ ionic info

Ionic:

   Ionic CLI                     : 5.4.16 (C:\Users\v121139\AppData\Local\Yarn\Data\global\node_modules\ionic)
   Ionic Framework               : @ionic/angular 5.3.4
   @angular-devkit/build-angular : 0.901.12
   @angular-devkit/schematics    : 9.1.12
   @angular/cli                  : 9.1.12
   @ionic/angular-toolkit        : 2.3.3

Capacitor:

   Capacitor CLI   : 2.4.2
   @capacitor/core : 2.4.2

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v10.16.3 (D:\Programme\node-v10.16.3-win-x64\node.exe)
   npm    : 6.9.0
   OS     : Windows 10

Environment:

   HTTP_PROXY  : http://localhost:3128/
   http_proxy  : http://localhost:3128/
   HTTPS_PROXY : http://localhost:3128
   https_proxy : http://localhost:3128

Done in 12.16s.

Other Information:
Here is the command with --verbose. The configuration is set BUT at the end the wrong config is copied: "√ Copying capacitor.config.json in 3.33ms"

ionic capacitor sync android --configuration=capacitor.config.test.json --verbose
  ionic:lib Terminal info: { ci: false, shell: 'C:\\WINDOWS\\system32\\cmd.exe', tty: true, windows: true } +0ms
  ionic:lib CLI global options: { _: [ 'capacitor', 'sync', 'android' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, configuration: 'capacitor.config.test.json', projec
t: null, '--': [] } +4ms
  ionic:lib:project Project type from config: @ionic/angular (angular) +0ms
  ionic:lib:project Project details: { configPath: 'D:\\mcd-app\\mcd-app-ui\\ionic.config.json', errors: [], context: 'app', type: 'angular' } +0ms
  ionic Context: { binPath: 'C:\\Users\\v121139\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\ionic\\bin\\ionic', libPath: 'C:\\Users\\v121139\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\ionic', execPath: 'D:\\mcd-app\\m
cd-app-ui', version: '5.4.16' } +0ms
  ionic:lib:telemetry Sending telemetry for command: 'ionic capacitor sync' [ 'android',
  ionic:lib:telemetry   '--verbose',
  ionic:lib:telemetry   '--interactive',
  ionic:lib:telemetry   '--color',
  ionic:lib:telemetry   '--configuration=capacitor.config.test.json' ] +0ms
> capacitor.cmd sync android
√ Copying web assets from build to android\app\src\main\assets\public in 3.23s
√ Copying native bridge in 2.79ms
√ Copying capacitor.config.json in 3.33ms
  Found 1 Cordova plugin for android
    cordova-plugin-fingerprint-aio (3.0.1)
√ copy in 3.34s
√ Updating Android plugins in 13.21ms
  Found 1 Capacitor plugin for android:
    capacitor-secure-storage-plugin (0.4.0)
  Found 1 Cordova plugin for android
    cordova-plugin-fingerprint-aio (3.0.1)
√ update android in 107.76ms
Sync finished in 3.471s
Done in 7.32s.
@ionitron-bot ionitron-bot bot added the triage label Nov 3, 2020
@imhoffd
Copy link
Contributor

imhoffd commented Nov 3, 2020

--configuration is for the Angular configuration to use during the web asset build. The help output probably makes this clearer: ionic cap sync --help.

If you're interested, there is an active PR for supporting capacitor.config.js files, so multiple config files wouldn't be necessary: ionic-team/capacitor#3756

@imhoffd imhoffd closed this as completed Nov 3, 2020
@tobiloeb
Copy link
Author

tobiloeb commented Nov 4, 2020

Thanks for the answer. Then I misunderstood the documentation.

Thanks for the PR, this would help us a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants