From c37fa3cce958cc1390aacc49259cb0b0a309fa71 Mon Sep 17 00:00:00 2001 From: Xavier Dutreilh Date: Tue, 15 Dec 2015 15:49:50 +0100 Subject: [PATCH] Improved Bower integration. --- .gitignore | 1 + Makefile | 3 ++- README.rst | 22 +++++++++++++++++----- bower.json | 4 ++-- package.json | 10 ++++++++++ 5 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 9129c7e4a1..95d055d7a3 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ djangoproject/static/css/*.css djangoproject/static/js/lib/unveil/jquery-1.9.1.min.js djangoproject/static/js/lib/unveil/index.html djangoproject/static/js/lib/unveil/img +node_modules/ diff --git a/Makefile b/Makefile index fbf951a9db..bb1ed92073 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ run: install: pip install -r requirements/dev.txt + npm install test: @coverage run --source=. manage.py test -v2 $(APP_LIST) @@ -42,4 +43,4 @@ $(JQUERY_FLOT)/jquery.flot.min.js: $(JQUERY_FLOT) yuicompressor $(JQUERY_FLOT)/jquery.flot.concat.js -o $(JQUERY_FLOT)/jquery.flot.min.js $(JQUERY_FLOT)/: - bower install + npm run bower install diff --git a/README.rst b/README.rst index bb8360a5cb..1c959aefbf 100644 --- a/README.rst +++ b/README.rst @@ -14,6 +14,7 @@ To run locally, do the usual: #. Install dependencies:: pip install -r requirements/dev.txt + npm install Alternatively use the make task:: @@ -207,12 +208,23 @@ Check out the ``Procfile`` file for all the process names. JavaScript libraries -------------------- -This project uses `Bower `_ for managing JS library -dependencies. See its documentation for how to use it. Here's the gist: +This project uses `Bower `_ to manage JavaScript libraries. -To update any of the dependencies, edit the ``bower.json`` file accordingly -and then run ``bower install`` to download the appropriate files to the -static directory. Commit the downloaded files to git (vendoring). +At any time, you can run it to install a new library (e.g., ``jquery-ui``):: + + npm run bower install jquery-ui --save + +or check if there are newer versions of the libraries that we use:: + + npm run bower ls + +If you need to update an existing library, the easiest way is to change the +version requirement in ``bower.json`` and then to run +``npm run bower install`` again. + +We commit the libraries to the repository, so if you add, update, or remove a +library from ``bower.json``, you will need to commit the changes in +``djangoproject/static`` too. Documentation search -------------------- diff --git a/bower.json b/bower.json index a03b02cce6..737ca01f5b 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { - "name": "Django Project", - "private": "true", + "name": "djangoproject", + "private": true, "dependencies": { "jquery": "<2.0", "jquery.inview": "1.0.0", diff --git a/package.json b/package.json new file mode 100644 index 0000000000..00312a7d83 --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "name": "djangoproject", + "private": true, + "dependencies": { + "bower": "^1.4.1" + }, + "scripts": { + "bower": "bower" + } +}