You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.9 KiB

  1. <!--
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one
  4. # or more contributor license agreements. See the NOTICE file
  5. # distributed with this work for additional information
  6. # regarding copyright ownership. The ASF licenses this file
  7. # to you under the Apache License, Version 2.0 (the
  8. # "License"); you may not use this file except in compliance
  9. # with the License. You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing,
  14. # software distributed under the License is distributed on an
  15. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. # KIND, either express or implied. See the License for the
  17. # specific language governing permissions and limitations
  18. # under the License.
  19. #
  20. -->
  21. # Cordova Hooks
  22. This directory may contain scripts used to customize cordova commands. This
  23. directory used to exist at `.cordova/hooks`, but has now been moved to the
  24. project root. Any scripts you add to these directories will be executed before
  25. and after the commands corresponding to the directory name. Useful for
  26. integrating your own build systems or integrating with version control systems.
  27. __Remember__: Make your scripts executable.
  28. ## Hook Directories
  29. The following subdirectories will be used for hooks:
  30. after_build/
  31. after_compile/
  32. after_docs/
  33. after_emulate/
  34. after_platform_add/
  35. after_platform_rm/
  36. after_platform_ls/
  37. after_plugin_add/
  38. after_plugin_ls/
  39. after_plugin_rm/
  40. after_plugin_search/
  41. after_prepare/
  42. after_run/
  43. after_serve/
  44. before_build/
  45. before_compile/
  46. before_docs/
  47. before_emulate/
  48. before_platform_add/
  49. before_platform_rm/
  50. before_platform_ls/
  51. before_plugin_add/
  52. before_plugin_ls/
  53. before_plugin_rm/
  54. before_plugin_search/
  55. before_prepare/
  56. before_run/
  57. before_serve/
  58. pre_package/ <-- Windows 8 and Windows Phone only.
  59. ## Script Interface
  60. All scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
  61. * CORDOVA_VERSION - The version of the Cordova-CLI.
  62. * CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
  63. * CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
  64. * CORDOVA_HOOK - Path to the hook that is being executed.
  65. * CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
  66. If a script returns a non-zero exit code, then the parent cordova command will be aborted.
  67. ## Writing hooks
  68. We highly recommend writting your hooks using Node.js so that they are
  69. cross-platform. Some good examples are shown here:
  70. [http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/)