Skip to content

Commit

Permalink
Install node dependencies using npm.
Browse files Browse the repository at this point in the history
The node packages 'jQuery' and 'jquery' are different--'jQuery' is the
legacy support package that is needed for Zulip so the require statements
in the tests were updated.

Travis uses node 4.0 by default and we are using 0.10, so the command to
install the correct version had to be added to the .travis.yml file.
  • Loading branch information
alliejones authored and timabbott committed Nov 6, 2015
1 parent 46e267f commit 4de0325
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ static/third/gemoji/
static/third/zxcvbn/
tools/emoji_dump/bitmaps/
tools/emoji_dump/*.ttx
node_modules
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
before_install:
- nvm install 0.10
install:
- tools/travis/setup-$TEST_SUITE
cache:
Expand Down
2 changes: 1 addition & 1 deletion frontend_tests/node_tests/message_list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var _ = require('third/underscore/underscore.js');
var MessageListView = require('js/message_list_view.js');

add_dependencies({
$: 'jquery',
$: 'jQuery',
XDate: 'third/xdate/xdate.dev.js',
util: 'js/util.js'
});
Expand Down
2 changes: 1 addition & 1 deletion frontend_tests/node_tests/stream_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set_global('unread', {});

var stream_list = require('js/stream_list.js');

global.$ = require('jquery');
global.$ = require('jQuery');
$.fn.expectOne = function () {
assert(this.length === 1);
return this;
Expand Down
2 changes: 1 addition & 1 deletion frontend_tests/node_tests/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ add_dependencies({
templates: 'js/templates'
});

global.$ = require('jquery');
global.$ = require('jQuery');
var _ = global._;

// When writing these tests, the following command might be helpful:
Expand Down
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "zulip",
"version": "0.0.0",
"license": "Apache-2.0",
"description": "",
"main": "",
"dependencies": {},
"devDependencies": {
"jQuery": "1.7.4",
"jsdom": "0.5.7",
"xmlhttprequest": "1.5.0",
"nwmatcher": "1.3.6",
"htmlparser2": "3.8.3",
"cssstyle": "0.2.29"
},
"scripts": {},
"repository": {
"type": "git",
"url": "https://github.com/zulip/zulip.git"
}
}
19 changes: 3 additions & 16 deletions provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,12 @@
"supervisor",
"git",
"npm",
"node-jquery",
"yui-compressor",
"puppet", # Used by lint-all
"gettext", # Used by makemessages i18n
]
}

# TODO: backport node-{cssstyle,htmlparser2,nwmatcher} to trusty,
# so we can eliminate npm (above) and this section.
NPM_DEPENDENCIES = {
"trusty": [
"cssstyle",
"htmlparser2",
"nwmatcher",
]
}

VENV_PATH="/srv/zulip-venv"
ZULIP_PATH="/srv/zulip"

Expand Down Expand Up @@ -163,13 +152,11 @@ def main():
with sh.sudo:
sh.cp(REPO_STOPWORDS_PATH, TSEARCH_STOPWORDS_PATH, **LOUD)

# Add additional node packages for test-js-with-node.
with sh.sudo:
sh.npm.install(*NPM_DEPENDENCIES["trusty"], g=True, prefix="/usr", **LOUD)

# Management commands expect to be run from the root of the project.
# npm install and management commands expect to be run from the root of the project.
os.chdir(ZULIP_PATH)

sh.npm.install(**LOUD)

os.system("tools/download-zxcvbn")
os.system("tools/emoji_dump/build_emoji")
os.system("generate_secrets.py -d")
Expand Down
5 changes: 4 additions & 1 deletion tools/update-prod-static
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ os.chdir(settings.DEPLOY_ROOT)
# Redirect child processes' output to a log file (most recent run only).
fp = open('update-prod-static.log', 'w')

# Compile Handlebars templates and minify JavaScripts.
# Install node packages
subprocess.check_call(['npm', 'install'], stdout=fp, stderr=fp);

# Compile Handlebars templates and minify JavaScript.
subprocess.check_call(['python', 'tools/minify-js']
+ (['--prev-deploy', prev_deploy] if prev_deploy else []),
stdout=fp, stderr=fp)
Expand Down

0 comments on commit 4de0325

Please sign in to comment.