deps: Change zxcvbn download method from download-zxcvbn to npm.

- Replace download-zxcvbn with downloading it from npm.
- Change zxcvbn.js path to node_modules (because npm put it to
`node_modules` directory.
- Bump `PROVISION_VERSION` in `version.py` to 2.4.

Fixes #2423.
This commit is contained in:
Rafid Aslam 2016-12-06 23:22:06 +07:00 committed by Tim Abbott
parent 0951b838ca
commit ce94fb2eb1
10 changed files with 6 additions and 35 deletions

1
.gitignore vendored
View File

@ -18,7 +18,6 @@ coverage/
/zproject/dev-secrets.conf
static/js/bundle.js
static/third/gemoji
static/third/zxcvbn/
static/locale/language_options.json
/node_modules
npm-debug.log

View File

@ -318,7 +318,6 @@ Now run these commands:
```
./tools/install-mypy
./tools/setup/download-zxcvbn
./tools/setup/emoji_dump/build_emoji
./scripts/setup/generate_secrets.py --development
if [ $(uname) = "OpenBSD" ]; then sudo cp ./puppet/zulip/files/postgresql/zulip_english.stop /var/postgresql/tsearch_data/; else sudo cp ./puppet/zulip/files/postgresql/zulip_english.stop /usr/share/postgresql/9.*/tsearch_data/; fi

View File

@ -15,7 +15,8 @@
"jquery": "1.12.1",
"jquery-validation": "1.15.1",
"sockjs-client":"1.1.1",
"webpack": "1.12.2"
"webpack": "1.12.2",
"zxcvbn": "4.4.1"
},
"devDependencies": {
"casperjs": "1.1.3",

View File

@ -187,7 +187,7 @@ function _setup_page() {
if (page_params.password_auth_enabled !== false) {
// zxcvbn.js is pretty big, and is only needed on password
// change, so load it asynchronously.
$.getScript('/static/third/zxcvbn/zxcvbn.js', function () {
$.getScript('/static/node_modules/zxcvbn/dist/zxcvbn.js', function () {
$('#pw_strength .bar').removeClass("fade");
});
}

View File

@ -8,7 +8,7 @@ Form is validated both client-side using jquery-validate (see signup.js) and ser
{% block customhead %}
{{ super() }}
<script type="text/javascript" src="/static/third/zxcvbn/zxcvbn.js"></script>
<script type="text/javascript" src="/static/node_modules/zxcvbn/dist/zxcvbn.js"></script>
{% endblock %}
{% block portico_content %}

View File

@ -1,7 +1,7 @@
{% extends "zerver/portico_signup.html" %}
{% block customhead %}
{{ super() }}
<script type="text/javascript" src="/static/third/zxcvbn/zxcvbn.js"></script>
<script type="text/javascript" src="/static/node_modules/zxcvbn/dist/zxcvbn.js"></script>
{% endblock %}
{% block portico_content %}

View File

@ -202,7 +202,6 @@ def main(options):
# create linecoverage directory`var/node-coverage`
run(["mkdir", "-p", NODE_TEST_COVERAGE_DIR_PATH])
run(["tools/setup/download-zxcvbn"])
if not os.path.isdir(EMOJI_CACHE_PATH):
run(["sudo", "mkdir", EMOJI_CACHE_PATH])
run(["sudo", "chown", "%s:%s" % (user_id, user_id), EMOJI_CACHE_PATH])

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
set -e
set -x
output_path=static/third/zxcvbn
commit_file_path=$output_path/commit
commit=f15783727ac828f5a7e54ff5aed8dd8b38a62ffd # Change this to upgrade
mkdir -p "$output_path"
if [ -e "$commit_file_path" ]
then
current_commit=`cat $commit_file_path`
else
current_commit=00
fi
if [ "$current_commit" == "$commit" ]; then
echo "Already at latest version of zxcvbn.js"
else
echo "$commit" > "$commit_file_path"
wget "https://raw.githubusercontent.com/dropbox/zxcvbn/$commit/zxcvbn.js" -O "$output_path/zxcvbn.js"
fi

View File

@ -40,10 +40,6 @@ subprocess.check_call(['./tools/minify-js']
subprocess.check_call(['./tools/setup/emoji_dump/build_emoji'],
stdout=fp, stderr=fp)
# Download and include zxcvbn.js
subprocess.check_call(['bash', '-ex', 'tools/setup/download-zxcvbn'],
stdout=fp, stderr=fp)
# Collect the files that we're going to serve.
subprocess.check_call(['./manage.py', 'collectstatic', '--noinput', '-i', 'assets'],
stdout=fp, stderr=fp)

View File

@ -1,2 +1,2 @@
ZULIP_VERSION = "1.4.1+git"
PROVISION_VERSION = '2.3'
PROVISION_VERSION = '2.4'