Skip to content

Commit

Permalink
Update Node & PIP Dependencies (#295)
Browse files Browse the repository at this point in the history
Update to project's pip and node dependencies.
  • Loading branch information
Audiosutras authored Oct 15, 2019
1 parent 028133e commit 466a101
Show file tree
Hide file tree
Showing 16 changed files with 136 additions and 172 deletions.
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python=python2.7
python=python3.7
24 changes: 12 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ language: python
sudo: false

python:
- "3.5"
- "3.7"

# Match postgresql version to that in conf/pillar/project.sls
addons:
postgresql: "9.3"
services:
- postgresql

# In general, cache things where they are.
directories:
- $HOME/.cache/pip
- $HOME/.npm
- $HOME/.nvm
- $HOME/.cache/node_modules
- $HOME/.cache/venvs
directories:
- $HOME/.cache/pip
- $HOME/.npm
- $HOME/.nvm
- $HOME/.cache/node_modules
- $HOME/.cache/venvs

env:
- WORKON_HOME=$HOME/.cache/venvs

install:
- pip install -U pip wheel
- pip install -U 'Django<2.0'
- pip install -U 'Django>2.0'
- mkdir -p $WORKON_HOME
- nvm install 6.11
- nvm use 6.11
- nvm install 10.16.0
- nvm use 10.16.0

script:
- django-admin.py startproject --template=https://github.com/caktus/django-project-template/zipball/${TRAVIS_BRANCH} --extension=py,yml --name=Makefile,gulpfile.js,package.json test_template
Expand Down
11 changes: 3 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PROJECT_NAME = {{ project_name }}
STATIC_LIBS_DIR = ./$(PROJECT_NAME)/static/libs
STATIC_DIR = ./$(PROJECT_NAME)/static

default: lint test

Expand All @@ -20,15 +20,10 @@ lint-py:
lint-js:
# Check JS for any problems
# Requires jshint
./node_modules/.bin/eslint -c .eslintrc "${STATIC_LIBS_DIR}*" --ext js,jsx
./node_modules/.bin/eslint -c .eslintrc '${STATIC_DIR}' --ext js,jsx

lint: lint-py lint-js

$(STATIC_LIBS_DIR):
mkdir -p $@

update-static-libs: $(LIBS)

# Generate a random string of desired length
generate-secret: length = 32
generate-secret:
Expand Down Expand Up @@ -62,7 +57,7 @@ pullmessages:
tx pull -af

setup:
virtualenv -p `which python3.5` $(WORKON_HOME)/{{ project_name }}
virtualenv -p `which python3.7` $(WORKON_HOME)/{{ project_name }}
$(WORKON_HOME)/{{ project_name }}/bin/pip install -U pip wheel
$(WORKON_HOME)/{{ project_name }}/bin/pip install -Ur requirements/dev.txt
$(WORKON_HOME)/{{ project_name }}/bin/pip freeze
Expand Down
53 changes: 16 additions & 37 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To start a new project with this template::

django-admin.py startproject \
--template=https://github.com/caktus/django-project-template/zipball/master \
--extension=py,rst,yml,sh \
--extension=py,rst,yml,sh,js \
--name=Makefile,gulpfile.js,package.json,Procfile \
<project_name>

Expand Down Expand Up @@ -56,24 +56,16 @@ Below you will find basic setup and deployment instructions for the {{ project_n
project. To begin you should have the following applications installed on your
local development system:

- Python >= 3.5
- NodeJS >= 6.11
- npm >= 3.10.10
- `pip <http://www.pip-installer.org/>`_ >= 1.5
- Python >= 3.7
- NodeJS >= 10.16
- `pip <http://www.pip-installer.org/>`_ >= 19
- `virtualenv <http://www.virtualenv.org/>`_ >= 1.10
- `virtualenvwrapper <http://pypi.python.org/pypi/virtualenvwrapper>`_ >= 3.0
- Postgres >= 9.3
- git >= 1.7

A note on NodeJS 6.x for Ubuntu users: this LTS release may not be available through the
Ubuntu repository, but you can configure a PPA from which it may be installed::

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

You may also follow the manual instructions if you wish to configure the PPA yourself:

https://github.com/nodesource/distributions#manual-installation
Installing the proper NodeJS versions for each of your projects can be difficult. It's probably best
to `use nvm <https://github.com/nvm-sh/nvm>`_.

Django version
------------------------
Expand Down Expand Up @@ -103,9 +95,9 @@ adjustments as necessary to your needs.
To setup your local environment you should create a virtualenv and install the
necessary requirements::

# Check that you have python3.5 installed
$ which python3.5
$ mkvirtualenv {{ project_name }} -p `which python3.5`
# Check that you have python3.7 installed
$ which python3.7
$ mkvirtualenv {{ project_name }} -p `which python3.7`
({{ project_name }})$ pip install -r requirements/dev.txt
({{ project_name }})$ npm install

Expand Down Expand Up @@ -145,33 +137,20 @@ long as the development server is running.
Deployment
----------

There are `different ways to deploy <http://caktus.github.io/developer-documentation/deploy-strategies.html>`_.
Here are a couple of them that could be used for {{ project_name }}.
There are different ways to deploy, and `this document <http://caktus.github.io/developer-documentation/deploy-strategies.html>`_ outlines a few of them that could be used for {{ project_name }}.

Deployment with fabric
......................

Fabric does not yet support Python 3. You
must either create a new virtualenv for the deployment::

# Create a new virtualenv for the deployment
$ mkvirtualenv {{ project_name }}-deploy -p `which python2.7`
({{ project_name }}-deploy)$ pip install -r requirements/deploy.txt

or install the deploy requirements
globally::

$ sudo pip install -r requirements/deploy.txt


You can deploy changes to a particular environment with
the ``deploy`` command::
We use a library called `fabric <http://www.fabfile.org/>`_ as a wrapper around a lot of our deployment
functionality. However, deployment is no longer fully set up in this template, and instead you'll need
to do something like set up `Tequila <https://github.com/caktus/tequila>`_ for your project. Currently,
best way to do that is to copy the configuration from an existing project. Once that is done, and the
servers have been provisioned, you can deploy changes to a particular environment with the ``deploy``
command::

$ fab staging deploy

New requirements or migrations are detected by parsing the VCS changes and
will be installed/run automatically.

Deployment with Dokku
.....................

Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
machine:
python:
version: 3.5.0
version: 3.7
environment:
DJANGO_SETTINGS_MODULE: {{ project_name }}.settings.dev
dependencies:
Expand Down
5 changes: 2 additions & 3 deletions docs/dev/provisioning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Overview

{{ project_name|title }} is deployed on the following stack.

- OS: Ubuntu 14.04 LTS
- Python: 3.5
- OS: Ubuntu 18.04 LTS
- Python: 3.7+
- Database: Postgres 9.3
- Application Server: Gunicorn
- Frontend Server: Nginx
Expand Down Expand Up @@ -65,4 +65,3 @@ You can read about how to setup Tequila for a new project from
`Tequila Project Setup <https://github.com/caktus/tequila/blob/master/docs/project_setup.rst>`
documentation, which will walk you through adding Tequila to any Django project, including one
created from this project template.

30 changes: 13 additions & 17 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ var uglify = require('gulp-uglify');
var streamify = require('gulp-streamify');
var notify = require('gulp-notify');
var concat = require('gulp-concat');
var cssmin = require('gulp-cssmin');
var gutil = require('gulp-util');
var cleancss = require('gulp-clean-css');
var log = require('fancy-log');
var rename = require("gulp-rename");
var less = require('gulp-less');
var glob = require('glob');
Expand Down Expand Up @@ -58,10 +58,6 @@ if (argv._ && argv._[0] === 'deploy') {
if (options.development) {
console.log("Building for development")
delete process.env['NODE_ENV'];
// Be more verbose for developers
gulp.onAll(function (e) {
console.log(e);
})
} else {
console.log("Building for production")
process.env['NODE_ENV'] = 'production';
Expand Down Expand Up @@ -94,7 +90,7 @@ var browserifyTask = function () {
var start = Date.now();
console.log('Building APP bundle');
return appBundler.bundle()
.on('error', gutil.log)
.on('error', log)
.pipe(source('index.js'))
.pipe(gulpif(!options.development, streamify(uglify())))
.pipe(rename('bundle.js'))
Expand Down Expand Up @@ -126,7 +122,7 @@ var browserifyTask = function () {
var start = new Date();
console.log('Building VENDORS bundle');
vendorsBundler.bundle()
.on('error', gutil.log)
.on('error', log)
.pipe(source('vendors.js'))
.pipe(gulpif(!options.development, streamify(uglify())))
.pipe(gulp.dest(options.dest))
Expand All @@ -137,7 +133,7 @@ var browserifyTask = function () {

return rebundle();
};
gulp.task('browserify', ['modernizr'], browserifyTask);
gulp.task('browserify', gulp.series('modernizr', browserifyTask));

var cssTask = function () {
var lessOpts = {
Expand All @@ -164,13 +160,13 @@ var cssTask = function () {
.pipe(concat('index.less'))
.pipe(less(lessOpts))
.pipe(rename('bundle.css'))
.pipe(cssmin())
.pipe(cleancss())
.pipe(gulp.dest(options.css.dest));
}
};
gulp.task('css', cssTask);

gulp.task('rebuild', ['css', 'browserify'])
gulp.task('rebuild', gulp.parallel('css', 'browserify'))

function start_dev_server(done) {
console.log("Starting Django runserver http://"+argv.address+":"+argv.port+"/");
Expand All @@ -190,17 +186,17 @@ function start_dev_server(done) {
});
done();
}
gulp.task('start_dev_server', ['rebuild'], start_dev_server)
gulp.task('start_dev_server', gulp.series('rebuild', start_dev_server))

// Starts our development workflow
gulp.task('default', ['start_dev_server'], function (done) {
gulp.task('default', gulp.series('start_dev_server', function (done) {
livereload.listen();
done();
});
}));

gulp.task('deploy', ['rebuild']);
gulp.task('deploy', gulp.series('rebuild'))

gulp.task('test', function () {
gulp.task('test', gulp.series(function () {
require('babel-core/register');
return gulp
.src('./{{ project_name }}/static/js/app/**/*.js')
Expand Down Expand Up @@ -242,4 +238,4 @@ gulp.task('test', function () {
;
})
;
});
}));
92 changes: 46 additions & 46 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "The {{ project_name|title }} Project",
"main": "",
"engines": {
"node": ">=6.11 <7"
"node": ">=10.15 <11"
},
"directories": {
"doc": "docs"
Expand All @@ -25,52 +25,52 @@
},
"homepage": "https://github.com/[ORGANIZATION]/{{ project_name }}#readme",
"dependencies": {
"babel-core": "^6.6.0",
"babel-eslint": "^6.0.4",
"babel-plugin-rewire": "^1.0.0-rc-2",
"babel-plugin-transform-react-jsx": "^6.6.0",
"babel-preset-es2015": "^6.1.18",
"babelify": "^7.2.0",
"bootstrap": "^3.3.6",
"browserify": "^12.0.1",
"chai": "^3.5.0",
"eslint": "^2.10.2",
"file-exists": "^1.0.0",
"flux": "^2.1.1",
"glob": "^6.0.1",
"gulp": "^3.8.9",
"gulp-concat": "^2.3.4",
"gulp-connect": "^2.2.0",
"gulp-cssmin": "^0.1.6",
"gulp-if": "^1.2.4",
"gulp-istanbul": "^0.10.3",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.3",
"babel-plugin-rewire": "^1.2.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-preset-es2015": "^6.24.1",
"babelify": "^8.0.0",
"bootstrap": "^4.3.1",
"browserify": "^16.5.0",
"chai": "^4.2.0",
"eslint": "^6.5.0",
"fancy-log": "^1.3.3",
"file-exists": "^5.0.1",
"flux": "^3.1.3",
"glob": "^7.1.4",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.2.0",
"gulp-concat": "^2.6.1",
"gulp-connect": "^5.7.0",
"gulp-if": "^3.0.0",
"gulp-istanbul": "^1.1.3",
"gulp-istanbul-enforcer": "^1.0.3",
"gulp-jasmine2-phantomjs": "^0.1.1",
"gulp-less": "^3.0.5",
"gulp-livereload": "^2.1.1",
"gulp-mocha": "^2.2.0",
"gulp-modernizr": "0.0.0",
"gulp-notify": "^1.4.2",
"gulp-rename": "^1.2.2",
"gulp-streamify": "0.0.5",
"gulp-uglify": "^0.3.1",
"gulp-util": "^3.0.0",
"immutable": "^3.7.6",
"isparta": "^4.0.0",
"jquery": "^3.0.0",
"jsdom": "^8.3.0",
"jsdom-global": "^1.7.0",
"less": "^2.5.3",
"mocha": "^2.4.5",
"mocha-jsdom": "^1.1.0",
"react": "^0.14.7",
"react-addons-test-utils": "^0.14.7",
"react-dom": "^0.14.7",
"react-functional": "^1.2.0",
"sinon": "^1.17.3",
"vinyl-source-stream": "^0.1.1",
"watchify": "^2.1.1",
"yargs": "^3.31.0"
"gulp-jasmine2-phantomjs": "^1.0.1",
"gulp-less": "^4.0.1",
"gulp-livereload": "^4.0.2",
"gulp-mocha": "^7.0.1",
"gulp-modernizr": "3.3.0",
"gulp-notify": "^3.2.0",
"gulp-rename": "^1.4.0",
"gulp-streamify": "1.0.2",
"gulp-uglify": "^3.0.2",
"immutable": "^3.8.2",
"isparta": "^4.1.1",
"jquery": "^3.4.1",
"jsdom": "^15.1.1",
"jsdom-global": "^3.0.2",
"less": "^3.10.3",
"mocha": "^6.2.1",
"mocha-jsdom": "^2.0.0",
"react": "^16.10.1",
"react-addons-test-utils": "^15.6.2",
"react-dom": "^16.10.1",
"react-functional": "^3.0.2",
"sinon": "^7.5.0",
"vinyl-source-stream": "^2.0.0",
"watchify": "^3.11.1",
"yargs": "^14.0.0"
},
"browserify": {
"transform": [
Expand Down
Loading

0 comments on commit 466a101

Please sign in to comment.