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.

schema.md 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. Composer Schema of Asset
  2. ========================
  3. ### Properties
  4. ##### requires
  5. Lists packages required by this package. The package will not be installed unless those requirements
  6. can be met.
  7. ##### requires-dev (root-only)
  8. Lists packages required for developing this package, or running tests, etc. The dev requirements
  9. of the root package are installed by default. Both `install` or `update` support the `--no-dev`
  10. option that prevents dev dependencies from being installed.
  11. ##### extra.asset-repositories (root-only)
  12. Because the plugin is installed after the analysis of type repositories, the custom types must
  13. be included in a special property in `extra` composer.
  14. Custom package repositories to use.
  15. By default composer just uses the packagist repository. By specifying
  16. repositories you can get packages from elsewhere.
  17. Repositories are not resolved recursively. You only can add them to your
  18. main `composer.json`. Repository declarations of dependencies' composer.jsons are ignored.
  19. The following repository types are supported:
  20. - **npm-vcs**: The version control system repository can fetch packages from git with `package.json`
  21. file dedicated to NPM. The `url` property of git source code is required.
  22. - **bower-vcs**: The version control system repository can fetch packages from git with `bower.json`
  23. file dedicated to Bower. The `url` property of git source code is required.
  24. ##### extra.asset-registry-options (root-only)
  25. Options available for the asset registers:
  26. - **npm-searchable** (bool): The search in the NPM registry may be disabled with this option
  27. for the search command.
  28. - **bower-searchable** (bool): The search in the Bower registry may be disabled with this option
  29. for the search command.
  30. ##### extra.asset-main-files (root-only)
  31. The plugin can override the main file definitions of the Bower packages. To override the file
  32. definitions specify the packages and their main file array as name/value pairs. For an example
  33. see the [usage informations](index.md#override-the-main-files-for-bower).
  34. ### Mapping asset file to composer package
  35. ##### NPM mapping
  36. The `package.json` of asset repository is automatically converted to a Complete Package instance with:
  37. | NPM Package | Composer Package |
  38. |----------------------|---------------------------------------|
  39. | name | name (`npm-asset/{name}`) |
  40. | `npm-asset-library` | type |
  41. | description | description |
  42. | version | version |
  43. | keywords | keywords |
  44. | homepage | homepage |
  45. | license | license |
  46. | author | authors [0] |
  47. | contributors | authors [n], merging with `author` |
  48. | dependencies | require |
  49. | devDependencies | require-dev |
  50. | bin | bin |
  51. | bugs | extra.npm-asset-bugs |
  52. | files | extra.npm-asset-files |
  53. | main | extra.npm-asset-main |
  54. | man | extra.npm-asset-man |
  55. | directories | extra.npm-asset-directories |
  56. | repository | extra.npm-asset-repository |
  57. | scripts | extra.npm-asset-scripts |
  58. | config | extra.npm-asset-config |
  59. | bundledDependencies | extra.npm-asset-bundled-dependencies |
  60. | optionalDependencies | extra.npm-asset-optional-dependencies |
  61. | engines | extra.npm-asset-engines |
  62. | engineStrict | extra.npm-asset-engine-strict |
  63. | os | extra.npm-asset-os |
  64. | cpu | extra.npm-asset-cpu |
  65. | preferGlobal | extra.npm-asset-prefer-global |
  66. | private | extra.npm-asset-private |
  67. | publishConfig | extra.npm-asset-publish-config |
  68. | `not used` | time |
  69. | `not used` | support |
  70. | `not used` | conflict |
  71. | `not used` | replace |
  72. | `not used` | provide |
  73. | `not used` | suggest |
  74. | `not used` | autoload |
  75. | `not used` | autoload-dev |
  76. | `not used` | include-path |
  77. | `not used` | target-dir |
  78. | `not used` | extra |
  79. | `not used` | archive |
  80. ##### Bower mapping
  81. The `bower.json` of asset repository is automatically converted to a Complete Package instance with:
  82. | Bower Package | Composer Package |
  83. |----------------------|---------------------------------------|
  84. | name | name (`bower-asset/{name}`) |
  85. | `bower-asset-library`| type |
  86. | description | description |
  87. | version | version |
  88. | keywords | keywords |
  89. | license | license |
  90. | dependencies | require |
  91. | devDependencies | require-dev |
  92. | bin | bin |
  93. | main | extra.bower-asset-main |
  94. | ignore | extra.bower-asset-ignore |
  95. | private | extra.bower-asset-private |
  96. | `not used` | homepage |
  97. | `not used` | time |
  98. | `not used` | authors |
  99. | `not used` | support |
  100. | `not used` | conflict |
  101. | `not used` | replace |
  102. | `not used` | provide |
  103. | `not used` | suggest |
  104. | `not used` | autoload |
  105. | `not used` | autoload-dev |
  106. | `not used` | include-path |
  107. | `not used` | target-dir |
  108. | `not used` | extra |
  109. | `not used` | archive |
  110. ##### Verison conversion
  111. NPM and Bower use [Semver](http://semver.org) for formatting the versions, which is not
  112. the case for Composer. It is therefore necessary to perform a conversion, but it's not
  113. perfect because of the differences in operation between Semver and Composer.
  114. Here are the matches currently validated:
  115. | Semver version | Composer version |
  116. | ---------------- | ---------------- |
  117. | 1.2.3 | 1.2.3 |
  118. | 1.2.3alpha | 1.2.3-alpha1 |
  119. | 1.2.3-alpha | 1.2.3-alpha1 |
  120. | 1.2.3a | 1.2.3-alpha1 |
  121. | 1.2.3a1 | 1.2.3-alpha1 |
  122. | 1.2.3-a | 1.2.3-alpha1 |
  123. | 1.2.3-a1 | 1.2.3-alpha1 |
  124. | 1.2.3b | 1.2.3-beta1 |
  125. | 1.2.3b1 | 1.2.3-beta1 |
  126. | 1.2.3-b | 1.2.3-beta1 |
  127. | 1.2.3-b1 | 1.2.3-beta1 |
  128. | 1.2.3beta | 1.2.3-beta1 |
  129. | 1.2.3-beta | 1.2.3-beta1 |
  130. | 1.2.3beta1 | 1.2.3-beta1 |
  131. | 1.2.3-beta1 | 1.2.3-beta1 |
  132. | 1.2.3rc1 | 1.2.3-RC1 |
  133. | 1.2.3-rc1 | 1.2.3-RC1 |
  134. | 1.2.3rc2 | 1.2.3-RC2 |
  135. | 1.2.3-rc2 | 1.2.3-RC2 |
  136. | 1.2.3rc.2 | 1.2.3-RC.2 |
  137. | 1.2.3-rc.2 | 1.2.3-RC.2 |
  138. | 1.2.3+0 | 1.2.3-patch0 |
  139. | 1.2.3-0 | 1.2.3-patch0 |
  140. | 1.2.3pre | 1.2.3-beta1 |
  141. | 1.2.3-pre | 1.2.3-beta1 |
  142. | 1.2.3dev | 1.2.3-dev |
  143. | 1.2.3-dev | 1.2.3-dev |
  144. | 1.2.3+build2012 | 1.2.3-patch2012 |
  145. | 1.2.3-build2012 | 1.2.3-patch2012 |
  146. | 1.2.3+build.2012 | 1.2.3-patch.2012 |
  147. | 1.2.3-build.2012 | 1.2.3-patch.2012 |
  148. | latest | default |
  149. ##### Range verison conversion
  150. NPM and Bower use [Semver](http://semver.org) for formatting the range versions, which is not
  151. the case for Composer. It is therefore necessary to perform a conversion, but it's not
  152. perfect because of the differences in operation between Semver and Composer.
  153. Here are the matches currently validated:
  154. | Semver range version | Composer range version |
  155. | -------------------- | ---------------------- |
  156. | >1.2.3 | >1.2.3 |
  157. | > 1.2.3 | >1.2.3 |
  158. | <1.2.3 | <1.2.3 |
  159. | < 1.2.3 | <1.2.3 |
  160. | >=1.2.3 | >=1.2.3 |
  161. | >= 1.2.3 | >=1.2.3 |
  162. | <=1.2.3 | <=1.2.3 |
  163. | <= 1.2.3 | <=1.2.3 |
  164. | ~1.2.3 | ~1.2.3 |
  165. | ~ 1.2.3 | ~1.2.3 |
  166. | ~1 | ~1 |
  167. | ~ 1 | ~1.2.3 |
  168. | ^1.2.3 | >=1.2.3,<2.0 |
  169. | ^ 1.2.3 | >=1.2.3,<2.0 |
  170. | >1.2.3 <2.0 | >1.2.3,<2.0 |
  171. | &gt;=1.0 &lt;1.1 `¦¦` &gt;=1.2 | &gt;=1.0,&lt;1.1`¦`&gt;=1.2 |
  172. | 1.2.3 - 2.3.4 | >=1.2.3,<=2.3.4 |
  173. ##### URL Range verison conversion
  174. NPM and Bower can use a URL directly as the version of the dependency, which is not the
  175. case for Composer. It is therefore necessary to perform a conversion, but it's not perfect
  176. because of the differences in operation between NPM/Bower and Composer.
  177. | Asset URL version | Composer version |
  178. | ----------------- | --------------------------------------------------- |
  179. | {URL} | dev-default |
  180. | {URL}#1.2.3 | dev-1.2.3 <code>&#124;</code> 1.2.3 (branch or tag) |
  181. | {URL}#{branch} | dev-{branch} |
  182. | {URL}#{sha} | dev-default#{sha} |
  183. ##### Multiple versions of a depdendency in the same project
  184. NPM and Bower can add multiple versions of the same dependency, which is not the case for Composer.
  185. To overcome this limitation, the plugin adds a VCS repository for each required version, with the
  186. name including the version number after the character `-`
  187. (`{ASSET-TYPE}-asset/{PACKAGE-NAME}-X.Y.Z`).
  188. A Vcs repository will be created for each version, and the number of requests is proportional to
  189. the number of versions required. However, given that each version of the dependency uses the same
  190. URL of the VCS repository, subsequent requests will get the package information directly in the cache.
  191. However, a cache of files is created for each version (included in require section) of a same dependency.
  192. ## Asset Repository
  193. The plugin creates `Composer Repositories` to find and create
  194. the VCS repository of the asset defined in the `require` and `require-dev` automatically.
  195. ### NPM Composer Repository
  196. [NPM Package](https://www.npmjs.org) is the main NPM repository. A NPM Composer repository
  197. is basically a package source, i.e. a place where you can get packages from. NPM Package aims to
  198. be the central repository that everybody uses. This means that you can automatically `require`
  199. any package that is available there.
  200. If you go to the [NPM website](https://www.npmjs.org), you can browse and search for packages.
  201. All package names are automatically prefixed with `npm-asset/`.
  202. ### Bower Composer Repository
  203. [Bower Package](http://bower.io) is the main Bower repository. A Bower Composer repository
  204. is basically a package source, i.e. a place where you can get packages from. Bower Package aims to
  205. be the central repository that everybody uses. This means that you can automatically `require`
  206. any package that is available there.
  207. If you go to the [Bower website](http://bower.io/search/), you can browse and search for packages.
  208. All package names are automatically prefixed with `bower-asset/`.