[ 
https://issues.apache.org/jira/browse/CB-13463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16213258#comment-16213258
 ] 

ASF GitHub Bot commented on CB-13463:
-------------------------------------

GitHub user audreyso opened a pull request:

    https://github.com/apache/cordova-lib/pull/599

    CB-13463 : prevent package.json update with --nosave (for plugins)

    <!--
    Please make sure the checklist boxes are all checked before submitting the 
PR. The checklist
    is intended as a quick reference, for complete details please see our 
Contributor Guidelines:
    
    http://cordova.apache.org/contribute/contribute_guidelines.html
    
    Thanks!
    -->
    
    ### Platforms affected
    
    
    ### What does this PR do?
     
    Prevent package.json update with --nosave (for plugins)
    
    ### What testing has been done on this change?
    
    
    ### Checklist
    - [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
    - [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform 
affected.
    - [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/audreyso/cordova-lib CB-13463

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-lib/pull/599.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #599
    
----
commit 2226a21bccf6a77f007777ba8bdbd45c59667990
Author: Audrey So <[email protected]>
Date:   2017-10-20T21:10:26Z

    CB-13463 : prevent package.json update plugins with --nosave

----


> No way to prevent package.json update with cordova commands even with --nosave
> ------------------------------------------------------------------------------
>
>                 Key: CB-13463
>                 URL: https://issues.apache.org/jira/browse/CB-13463
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-cli
>    Affects Versions: [email protected]
>            Reporter: Andrew Crites
>              Labels: reproduced, triaged
>
> With Cordova 7, cordova commands including {{cordova platform add}} and 
> {{cordova prepare}} will copy plugin information from {{config.xml}} to 
> {{package.json}}. 
> According to [the saving platforms 
> documentation|https://cordova.apache.org/docs/en/latest/platform_plugin_versioning_ref/],
>  using {{--nosave}} should prevent updating {{package.json}} or 
> {{config.xml}}, but this does not work (i.e. using {{--nosave}} still seems 
> to update the {{package.json}}.
> I want to avoid updating {{package.json}} specifically because there doesn't 
> seem to be a way to avoid hard coding variables for plugins. An example is 
> the cordova fabric plugin:
> {code}
>   <plugin name="cordova-fabric-plugin" spec="^1.1.9">
>     <variable name="FABRIC_API_KEY" value="a" />
>     <variable name="FABRIC_API_SECRET" value="b" />
>   </plugin>
> {code}
> Cordova doesn't seem to provide a way for you to parameterize variables in 
> the configuration. To get around this, I have {{build.config.xml}} where they 
> are parameterized, and {{config.xml}} is created at install-time and not 
> version controlled. However, this would be much more difficult to do with 
> {{package.json}} and is practically not an option.
> When running {{cordova platform add ios --nosave}} with the above plugin, 
> cordova still updates {{package.json}} to include the fabric plugin with the 
> hard coded variables.
> * Cordova 6 question (with solution): 
> https://stackoverflow.com/questions/37816035/using-environment-variables-parameterizing-config-xml
> * Cordova 7 question (no solution yet) 
> https://stackoverflow.com/questions/46816928/parameterize-do-not-hard-code-variables-when-building-with-cordova-7
> Ideally {{--nosave}} would not update {{package.json}} as advertised. Even 
> better, there should be a way to set up a cordova project so that any cordova 
> commands do not save by default. This would prevent mistakes in a larger team 
> and allow use of tools that wrap cordova such as ionic.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to