-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Grunt to compress SMap js files. #1533
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really good work. Thanks for cleaning up the JS mess and for adding comments to the files...
I still had a few things to moan about though. See below...
Gruntfile.js
Outdated
|
||
grunt.registerTask('default', ['concat']); | ||
grunt.registerTask('runserver', ['concat', 'watch']); | ||
grunt.registerTask('production', ['concat', 'uglify', 'jshint']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think running jshint
on production is too late. Is there a way to run it on the development server? We can also make it a mandatory test on Travis, but that's a separate task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I'll add it to the default grunt command (there are two errors currently, and it short circuits "watch").
Gruntfile.js
Outdated
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
|
||
grunt.registerTask('default', ['concat']); | ||
grunt.registerTask('runserver', ['concat', 'watch']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should run uglify on dev as well and configure a source map. Currently, when an error happens on dev, I can see the code but it's difficult to tell where it happened because I can only look at the concatenated code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's amazing... I was wondering how that worked.
import atexit | ||
import signal | ||
|
||
from django.contrib.staticfiles.management.commands.runserver import Command\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, this is ugly. I'd write it like:
from django.contrib.staticfiles.management.commands import runserver
class Command(runserver.Command):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const relId = target.attr('data-id'); | ||
target.closest('tbody').find('tr.info').removeClass('info'); | ||
target.addClass('info'); | ||
$('input[name="id"]').val(relId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works but I don't understand how. We must set the party ID somewhere. Where does this happen? ... just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, weirdly enough, I looked around and I'm not sure. I believe this was implemented before we added in select2, and now select2 handles it. I couldn't find anywhere in the code that had a table with a select-list
id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess we'll find out when it's on staging then ;)
provision/roles/node/tasks/main.yml
Outdated
become: yes | ||
become_user: root | ||
file: path=/vagrant/node_modules src=/vagrant/cadasta/core/node_modules state=link follow=yes | ||
# when: node_check.stat.exists == False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check back with @amplifi what this does and whether we need it here? If we don't need it then just remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the comment.
04572e4
to
3d9f22a
Compare
- setup vagrant provisioning to include grunt. - Added gruntserver file to run with ./runserver. - Setup Gruntfile.js to uglify SMap files as a test - Sorted third party library files into vendor folders - put datatable and parsley files into their own folders - removed all es6 logic from js files - added jshint to grunt configuration - added source mapping from uglified files to originals
3d9f22a
to
13253f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
- setup vagrant provisioning to include grunt. - Added gruntserver file to run with ./runserver. - Setup Gruntfile.js to uglify SMap files as a test - Sorted third party library files into vendor folders - put datatable and parsley files into their own folders - removed all es6 logic from js files - added jshint to grunt configuration - added source mapping from uglified files to originals
- setup vagrant provisioning to include grunt. - Added gruntserver file to run with ./runserver. - Setup Gruntfile.js to uglify SMap files as a test - Sorted third party library files into vendor folders - put datatable and parsley files into their own folders - removed all es6 logic from js files - added jshint to grunt configuration - added source mapping from uglified files to originals
- setup vagrant provisioning to include grunt. - Added gruntserver file to run with ./runserver. - Setup Gruntfile.js to uglify SMap files as a test - Sorted third party library files into vendor folders - put datatable and parsley files into their own folders - removed all es6 logic from js files - added jshint to grunt configuration - added source mapping from uglified files to originals
[NOTE: Not going into master]
Proposed changes in this pull request
When should this PR be merged
Risks
grunt production
should be run before deploying to demo/prod.grunt concat
should be run when deploying to staging.Follow-up actions
Checklist (for reviewing)
General
migration
label if a new migration is added.Functionality
Code
Tests
Security
Documentation