Browse Source

Migration from bower to npm only

Simon Vieille 4 months ago
parent
commit
8caff598e8
No known key found for this signature in database

+ 0
- 3
.bowerrc View File

@@ -1,3 +0,0 @@
1
-{
2
-  "directory": "web/components/"
3
-}

+ 1
- 1
.gitignore View File

@@ -5,8 +5,8 @@
5 5
 /propel.yaml
6 6
 /src/Gist/Model/Base/
7 7
 /src/Gist/Model/Map/
8
-/web/components/
9 8
 /app/propel/
9
+/node_modules/
10 10
 /app/config/config.yml
11 11
 /app/config/propel/
12 12
 /data/

+ 14
- 21
Makefile View File

@@ -1,5 +1,5 @@
1 1
 COMPOSER ?= composer
2
-BOWER ?= bower
2
+NPM ?= npm
3 3
 GIT ?= git
4 4
 MKDIR ?= mkdir
5 5
 PHP ?= php
@@ -7,47 +7,40 @@ PHP ?= php
7 7
 all: update
8 8
 
9 9
 composer:
10
-	@echo "Installing application's dependencies"
11
-	@echo "-------------------------------------"
12
-	@echo 
10
+	@echo "Installing PHP dependencies"
11
+	@echo "---------------------------"
12
+	@echo
13 13
 
14 14
 	$(COMPOSER) install $(COMPOSER_INSTALL_FLAGS)
15
-bower:
16
-	@echo "Installing application's dependencies"
17
-	@echo "-------------------------------------"
18
-	@echo 
15
+npm:
16
+	@echo "Installing CSS/JS dependencies"
17
+	@echo "------------------------------"
18
+	@echo
19 19
 
20
-	$(BOWER) install
21
-
22
-optimize:
23
-	@echo "Optimizing Composer's autoloader, can take some time"
24
-	@echo "----------------------------------------------------"
25
-	@echo 
26
-
27
-	$(COMPOSER) dump-autoload --optimize
20
+	$(NPM) install
28 21
 
29 22
 update:
30 23
 	@echo "Updating application's dependencies"
31 24
 	@echo "-----------------------------------"
32
-	@echo 
25
+	@echo
33 26
 
34 27
 	$(GIT) pull origin master
35 28
 	${MKDIR} -p data/git
36 29
 	$(COMPOSER) update
37
-	$(BOWER) install
30
+	$(NPM) install
38 31
 
39 32
 run:
40 33
 	@echo "Run development server"
41 34
 	@echo "----------------------"
42
-	@echo 
35
+	@echo
43 36
 
44 37
 	$(PHP) -S 127.0.0.1:8080 -t web
45 38
 
46 39
 propel:
47 40
 	@echo "Propel migration"
48 41
 	@echo "----------------"
49
-	@echo 
50
-	
42
+	@echo
43
+
51 44
 	./vendor/propel/propel/bin/propel config:convert
52 45
 	./vendor/propel/propel/bin/propel model:build --recursive
53 46
 	./vendor/propel/propel/bin/propel migration:diff --recursive

+ 20
- 7
README.md View File

@@ -5,7 +5,7 @@ Table of Contents
5 5
     * [Requirements](#requirements)
6 6
       * [Git](#git)
7 7
       * [Composer](#composer)
8
-      * [Bower](#bower)
8
+      * [NPM](#npm)
9 9
     * [Installation](#installation)
10 10
     * [Upgrade](#upgrade)
11 11
     * [Configuration](#configuration)
@@ -34,7 +34,7 @@ Requirements
34 34
 * GIT
35 35
 * MySQL or SQLite (PostgreSQL should works)
36 36
 * Composer (php)
37
-* Bower (node)
37
+* NPM (nodejs)
38 38
 
39 39
 ### Git
40 40
 
@@ -62,10 +62,9 @@ Else, follow the next instructions:
62 62
     # For a global installation
63 63
     $ sudo mv composer.phar /usr/local/bin/composer
64 64
 
65
-### Bower
65
+### NPM
66 66
 
67 67
     $ sudo apt-get install npm
68
-    $ sudo npm install -g bower
69 68
 
70 69
 Installation
71 70
 ------------
@@ -162,12 +161,26 @@ Makefile
162 161
 
163 162
 A Makefile is provided to automate some tasks.
164 163
 
165
-* `make` will install application's dependencies via Composer and Bower,
166
-* `make optimize` will run Composer's autoloader dump script with classmap
164
+* `make` will install dependencies via composer and NPM
165
+* `make composer` will install PHP dependencies via composer
166
+* `make npm` will install CSS/JS dependencies via NPM
167 167
 * `make update` will update the application
168
-* `make propel` will generate propel's files
168
+* `make propel` will generate propel migrations (database and files)
169 169
 * `make run` will run development server on http://127.0.0.1:8080/
170 170
 
171
+By default, `composer`, `npm`, `git`, `mkdir` and `php` binaries must be in your `$PATH`. You can override it by using these envars:
172
+
173
+* `COMPOSER`
174
+* `NPM`
175
+* `GIT`
176
+* `MKDIR`
177
+* `PHP`
178
+
179
+For example:
180
+
181
+    $ export COMPOSER=/path/to/composer
182
+    $ make composer
183
+
171 184
 API
172 185
 ---
173 186
 

+ 0
- 22
bower.json View File

@@ -1,22 +0,0 @@
1
-{
2
-  "name": "gist",
3
-  "version": "0.0.3",
4
-  "authors": [
5
-    "Simon Vieille <simon@deblan.fr>"
6
-  ],
7
-  "description": "GIST is an open-source application to share code.",
8
-  "main": "web/index.php",
9
-  "keywords": [
10
-    "Gist",
11
-    "GIT"
12
-  ],
13
-  "license": "LGPL",
14
-  "homepage": "https://gitnet.fr/deblan/gist",
15
-  "dependencies": {
16
-    "bootstrap": "3.3.4",
17
-    "flag-icon-css": "0.7.1",
18
-    "iframe-resizer": "2.8.6",
19
-    "jsdiff": "~2.2.2",
20
-    "Prism": "~1.8.1"
21
-  }
22
-}

+ 9
- 0
package.json View File

@@ -0,0 +1,9 @@
1
+{
2
+  "dependencies": {
3
+    "bootstrap": "^3.3.4",
4
+    "diff": "^2.2.2",
5
+    "flag-icon-css": "^0.8.6",
6
+    "iframe-resizer": "^2.8.6",
7
+    "jquery": "^1.9.1"
8
+  }
9
+}

+ 1
- 1
src/Gist/Resources/views/View/revisions.html.twig View File

@@ -82,7 +82,7 @@
82 82
     <script src="{{ web_path }}app/js/prism.js" {% if gist.cipher %}data-manual{% endif %}></script>
83 83
 
84 84
     {% if gist.cipher %}
85
-        <script src="{{ web_path }}components/jsdiff/diff.min.js"></script>
85
+        <script src="{{ web_path }}components/diff/diff.min.js"></script>
86 86
 
87 87
         <script>
88 88
             var key = getKey();

+ 1
- 0
web/components/bootstrap View File

@@ -0,0 +1 @@
1
+../../node_modules/bootstrap

+ 1
- 0
web/components/diff View File

@@ -0,0 +1 @@
1
+../../node_modules/diff

+ 1
- 0
web/components/flag-icon-css View File

@@ -0,0 +1 @@
1
+../../node_modules/flag-icon-css

+ 1
- 0
web/components/iframe-resizer View File

@@ -0,0 +1 @@
1
+../../node_modules/iframe-resizer

+ 1
- 0
web/components/jquery View File

@@ -0,0 +1 @@
1
+../../node_modules/jquery