├── LICENSE
├── README.md
└── composer.json
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Nick Tsai
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
Yii2 Composer Bower Skip
6 |
7 |
8 |
9 | A Composer package that allows you to install or update Yii2 without Bower-Asset.
10 |
11 | [](https://packagist.org/packages/yidas/yii2-composer-bower-skip)
12 | [](https://packagist.org/packages/yidas/yii2-composer-bower-skip)
13 | [](https://packagist.org/packages/yidas/yii2-composer-bower-skip)
14 | [](https://packagist.org/packages/yidas/yii2-composer-bower-skip)
15 |
16 | FEATURES
17 | --------
18 |
19 | - ***Prevent the error of Bower packages** when using Composer install & update for Yii2*
20 |
21 | > Problem 1
22 | >
23 | > \- yiisoft/yii2 2.0.12 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
24 |
25 | - *Skip Bower packages installation or update, **No fxp/composer-asset-plugin needed***
26 |
27 | Bower packages are not original Packagist source from Composer, so it will cause error when you install or update Bower without a plugin (`fxp/composer-asset-plugin` or `Asset-Packagist`). After requiring this package, Bower packages will not be required or updated, which you will keep the current version of Bower or even no Bower in the project vendor.
28 |
29 | If you are using Yii2 core Bower, the recommended way is using [yidas/yii2-bower-asset](https://github.com/yidas/yii2-bower-asset) which could install or update Bower for Yii2 without plugin.
30 |
31 | ---
32 |
33 | INSTALLATION
34 | ------------
35 |
36 | ### 1. Require Package
37 |
38 | In Yii2 `composer.json`, require `yidas/yii2-composer-bower-skip` before `yiisoft/yii2`.
39 |
40 | Example `composer.json`:
41 | ```
42 | "require": {
43 | "php": ">=5.4.0",
44 | "yidas/yii2-composer-bower-skip": "~2.0.5",
45 | "yiisoft/yii2": "~2.0.5",
46 | "yiisoft/yii2-bootstrap": "~2.0.0"
47 | }
48 | ```
49 |
50 | ### 2. Remove Composer Asset-Packagist Repositories Optionally
51 |
52 | If you are using the version 2.0.13 or higher of Yii, you may optional remove the `repositories` setting of `composer.json` to use original Composer repository.
53 |
54 | Example segament to delete in `composer.json` :
55 |
56 | ```
57 | "repositories": [
58 | {
59 | "type": "composer",
60 | "url": "https://asset-packagist.org"
61 | }
62 | ]
63 | ```
64 |
65 | After that, you can run `composer update` or `composer install` without handling Bower-Asset.
66 |
67 | ---
68 |
69 | CREATE PROJECT
70 | --------------
71 |
72 | If you doesn't has Yii2 project yet, choose one of below ways to create:
73 |
74 | ### Create Project via Composer
75 |
76 | You can use Composer to create Yii2 project by using following package:
77 |
78 | #### [yidas/yii2-app-basic](https://github.com/yidas/yii2-app-basic)
79 |
80 | ```
81 | composer create-project --prefer-dist yidas/yii2-app-basic
82 | ```
83 |
84 | #### [yidas/yii2-app-advanced](https://github.com/yidas/yii2-app-advanced)
85 | ```
86 | composer create-project --prefer-dist yidas/yii2-app-advanced
87 | ```
88 |
89 | These packages are Yii 2 Application Template with fixed Bower, which including [`yidas/yii2-bower-asset`](https://github.com/yidas/yii2-bower-asset) already.
90 |
91 |
92 | ### Creating Project from Official Site
93 |
94 | You could download Yii2 project from official [Archive File](http://www.yiiframework.com/download/), then manally install `yii2-composer-bower-skip` on it by following above instruction.
95 |
96 | ---
97 |
98 | FAQ
99 | ---
100 |
101 | ### Still Stuck when Composer Update
102 |
103 | If you still get trouble with Bower after install this package, try to delete `composer.lock` file and make sure the asset plugin is disabled:
104 |
105 | ```
106 | composer global remove fxp/composer-asset-plugin
107 | composer update
108 | ```
109 |
110 | ### Keep Current Bower
111 |
112 | If you still want to keep `vendor\bower`, you could set reverse Git-ignore for that folder:
113 |
114 | ```
115 | # composer vendor dir
116 | /vendor/*
117 | !/vendor/bower
118 | ```
119 |
120 | For example, you may lose Bower vendor after the project is pushed to Git server then re-install Composer from the clone one.
121 |
122 | If you want keep whole `vendor` ignored, you could take a look for [yidas/yii2-bower-asset](https://github.com/yidas/yii2-bower-asset) which support auto-install for Bower.
123 |
124 | ---
125 |
126 | LIMITATIONS
127 | -----------
128 |
129 | This solution is for the situation that you won't require or update Bower asset of Yii2 for development such as using `yii2-debug` and `yii2-gii`.
130 |
131 | If you are using Yii2 Bower, there are some smooth ways to require or update Bower for Yii2:
132 |
133 |
134 | ### Yii2 Bower Asset Package
135 |
136 | [yidas/yii2-bower-asset](https://github.com/yidas/yii2-bower-asset) goals to install Bower for Yii2 app by original Composer repository, and makes Bower and Composer separated.
137 |
138 | This is the recommended way to handle Bower with Yii2.
139 |
140 |
141 | ### Asset-Packagist Solution
142 |
143 | [Asset-Packagist](https://asset-packagist.org/) is the new solution of Yii2, you may install Bower smoothly in Yii2 from [2.0.14 version](https://github.com/yiisoft/yii2-app-basic/commit/fc2ec7dfee9313288171e2fe8a5b80e22c1e1509) until release.
144 |
145 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "yidas/yii2-composer-bower-skip",
3 | "description": "A Composer package that allows you to install or update Yii2 without Bower-Asset",
4 | "keywords": ["yii2", "framework", "bower", "bower asset"],
5 | "type": "yii2-extension",
6 | "license": "MIT",
7 | "support": {
8 | "issues": "https://github.com/yidas/yii2-composer-bower-skip/issues?state=open",
9 | "source": "https://github.com/yidas/yii2-composer-bower-skip"
10 | },
11 | "provide": {
12 | "bower-asset/jquery": "*",
13 | "bower-asset/inputmask": "*",
14 | "bower-asset/punycode": "*",
15 | "bower-asset/yii2-pjax": "*",
16 | "bower-asset/bootstrap": "*",
17 | "bower-asset/typeahead.js": "*"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------