canvas-lms/config/build.js.erb

100 lines
2.6 KiB
Plaintext
Raw Normal View History

js bundle extensions for plugins, bugfixes and DRYification allows plugins to have a bundle get auto-loaded with a corresponding canvas bundle. uses require.js' include mechanism in build.js (when optimized) and a rails helper tweak (when not optimized). this happens automatically based on the path, e.g. the foo plugin's "bundles/extensions/bar" will get automagically included whenever the regular "bar" bundle is required. removes the need for a plugin-level build.js, and auto-generates bundle module definitions in canvas' build.js (via erb). this handles all regular bundles both from canvas and plugins. also fixes plugins so that bundle dependencies get optimized. plugin paths are created automatically, so this means we can remove things like this from plugin bundles and specs: require.config paths: myplugin: "/plugins/myplugin/javascripts" test plan: 1. use canvas in development mode, it should work 2. use canvas in optimized JS mode, it should work i. confirm that all scripts are optimized 3. use canvas in development mode with plugins w/ JS, it should work 4. use canvas in optimized JS mode with plugins w/ JS, it should work i. confirm that all scripts are optimized 5. add a bundle extension in a plugin (e.g. create bundles/extensions/conversations in plugin foo) i. confirm that the extension code runs in development mode ii. confirm that the extension code runs in optimized JS mode Change-Id: If8507afdbabab4ae8966f7db79d9b0e2284034db Reviewed-on: https://gerrit.instructure.com/11238 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-06-02 07:13:53 +08:00
({
// file optimizations
optimize: "none",
js bundle extensions for plugins, bugfixes and DRYification allows plugins to have a bundle get auto-loaded with a corresponding canvas bundle. uses require.js' include mechanism in build.js (when optimized) and a rails helper tweak (when not optimized). this happens automatically based on the path, e.g. the foo plugin's "bundles/extensions/bar" will get automagically included whenever the regular "bar" bundle is required. removes the need for a plugin-level build.js, and auto-generates bundle module definitions in canvas' build.js (via erb). this handles all regular bundles both from canvas and plugins. also fixes plugins so that bundle dependencies get optimized. plugin paths are created automatically, so this means we can remove things like this from plugin bundles and specs: require.config paths: myplugin: "/plugins/myplugin/javascripts" test plan: 1. use canvas in development mode, it should work 2. use canvas in optimized JS mode, it should work i. confirm that all scripts are optimized 3. use canvas in development mode with plugins w/ JS, it should work 4. use canvas in optimized JS mode with plugins w/ JS, it should work i. confirm that all scripts are optimized 5. add a bundle extension in a plugin (e.g. create bundles/extensions/conversations in plugin foo) i. confirm that the extension code runs in development mode ii. confirm that the extension code runs in optimized JS mode Change-Id: If8507afdbabab4ae8966f7db79d9b0e2284034db Reviewed-on: https://gerrit.instructure.com/11238 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-06-02 07:13:53 +08:00
// continue to let Jammit do its thing
optimizeCss: "none",
// where to place optimized javascript, relative to this file
dir: "../public/optimized",
// where the "app" is, relative to this file
appDir: "../public/javascripts",
// base path for modules, relative to appDir
baseUrl: "./",
translate: true,
paths: <%= paths %>,
packages: <%= packages %>,
js bundle extensions for plugins, bugfixes and DRYification allows plugins to have a bundle get auto-loaded with a corresponding canvas bundle. uses require.js' include mechanism in build.js (when optimized) and a rails helper tweak (when not optimized). this happens automatically based on the path, e.g. the foo plugin's "bundles/extensions/bar" will get automagically included whenever the regular "bar" bundle is required. removes the need for a plugin-level build.js, and auto-generates bundle module definitions in canvas' build.js (via erb). this handles all regular bundles both from canvas and plugins. also fixes plugins so that bundle dependencies get optimized. plugin paths are created automatically, so this means we can remove things like this from plugin bundles and specs: require.config paths: myplugin: "/plugins/myplugin/javascripts" test plan: 1. use canvas in development mode, it should work 2. use canvas in optimized JS mode, it should work i. confirm that all scripts are optimized 3. use canvas in development mode with plugins w/ JS, it should work 4. use canvas in optimized JS mode with plugins w/ JS, it should work i. confirm that all scripts are optimized 5. add a bundle extension in a plugin (e.g. create bundles/extensions/conversations in plugin foo) i. confirm that the extension code runs in development mode ii. confirm that the extension code runs in optimized JS mode Change-Id: If8507afdbabab4ae8966f7db79d9b0e2284034db Reviewed-on: https://gerrit.instructure.com/11238 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-06-02 07:13:53 +08:00
// non-amd shims
shim: <%= shims %>,
js bundle extensions for plugins, bugfixes and DRYification allows plugins to have a bundle get auto-loaded with a corresponding canvas bundle. uses require.js' include mechanism in build.js (when optimized) and a rails helper tweak (when not optimized). this happens automatically based on the path, e.g. the foo plugin's "bundles/extensions/bar" will get automagically included whenever the regular "bar" bundle is required. removes the need for a plugin-level build.js, and auto-generates bundle module definitions in canvas' build.js (via erb). this handles all regular bundles both from canvas and plugins. also fixes plugins so that bundle dependencies get optimized. plugin paths are created automatically, so this means we can remove things like this from plugin bundles and specs: require.config paths: myplugin: "/plugins/myplugin/javascripts" test plan: 1. use canvas in development mode, it should work 2. use canvas in optimized JS mode, it should work i. confirm that all scripts are optimized 3. use canvas in development mode with plugins w/ JS, it should work 4. use canvas in optimized JS mode with plugins w/ JS, it should work i. confirm that all scripts are optimized 5. add a bundle extension in a plugin (e.g. create bundles/extensions/conversations in plugin foo) i. confirm that the extension code runs in development mode ii. confirm that the extension code runs in optimized JS mode Change-Id: If8507afdbabab4ae8966f7db79d9b0e2284034db Reviewed-on: https://gerrit.instructure.com/11238 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-06-02 07:13:53 +08:00
client app: canvas_quiz_statistics This commit brings in canvas_quiz_statistics, a client app that can be embedded in Canvas. Closes CNVS-14781, CNVS-14846, CNVS-14847, CNVS-14850 > What's done - full build integration, meaning the app runs with ?optimized_js=1: + JavaScript "built" source gets piped into the r.js build pipeline like any other Canvas JS source in public/javascripts/* + SCSS sources get picked up by the sass-compiler like Canvas style sources and they get compiled from the grounds-up + I18n: phrases are extracted properly, with default values and options, by our i18n rake tasks - new rake task js:build_client_apps that builds client apps and injects them as input to the rest of the JS build process - support for using Canvas JS packages, like d3, jQuery, and Backbone - support for using Canvas SASS variables & helpers - super i18n support: use raw I18n.t() calls like you are in Canvas, with development-time interpolation, as well as super new Handlebars-like block-style translations in React, perfect for very long phrases (mini-articles) > Docs and References The code was originally developed in its own github repository. While I won't be pushing code to that repo anymore, the Wiki will still house the docs until we find a better place. - Repo: https://github.com/amireh/canvas_quiz_statistics - Development guide: http://bit.ly/1sNOhER - Integration guide: http://bit.ly/1m9kA9V > TESTING - login as a teacher - go to /courses/:course_id/quizzes/:quiz_id/statistics_cqs + make sure you see something that looks like the Ember stats + click one of those little "?" help icons, you get a dialog: - verify the contents within the dialog are actual English text, not code gibberish - there's also a link at the end of that dialog, click it and verify it takes you to an Instructure help article - build the assets: `bundle exec rake canvas:compile_assets` then: + add ?optimized_js=1 to the URL and reload the page: - verify the app still works Change-Id: Ic474650dfb06a1c22869ed9680dd04d1ca0f651d Reviewed-on: https://gerrit.instructure.com/39105 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Hannah Bottalla <hannah@instructure.com> Reviewed-by: Adam Ard <aard@instructure.com> QA-Review: Trevor deHaan <tdehaan@instructure.com> Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-08-06 15:04:23 +08:00
// client app maps
map: <%= map %>,
// client app bundles
bundles: <%= bundles %>,
js bundle extensions for plugins, bugfixes and DRYification allows plugins to have a bundle get auto-loaded with a corresponding canvas bundle. uses require.js' include mechanism in build.js (when optimized) and a rails helper tweak (when not optimized). this happens automatically based on the path, e.g. the foo plugin's "bundles/extensions/bar" will get automagically included whenever the regular "bar" bundle is required. removes the need for a plugin-level build.js, and auto-generates bundle module definitions in canvas' build.js (via erb). this handles all regular bundles both from canvas and plugins. also fixes plugins so that bundle dependencies get optimized. plugin paths are created automatically, so this means we can remove things like this from plugin bundles and specs: require.config paths: myplugin: "/plugins/myplugin/javascripts" test plan: 1. use canvas in development mode, it should work 2. use canvas in optimized JS mode, it should work i. confirm that all scripts are optimized 3. use canvas in development mode with plugins w/ JS, it should work 4. use canvas in optimized JS mode with plugins w/ JS, it should work i. confirm that all scripts are optimized 5. add a bundle extension in a plugin (e.g. create bundles/extensions/conversations in plugin foo) i. confirm that the extension code runs in development mode ii. confirm that the extension code runs in optimized JS mode Change-Id: If8507afdbabab4ae8966f7db79d9b0e2284034db Reviewed-on: https://gerrit.instructure.com/11238 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-06-02 07:13:53 +08:00
// which modules should have their dependencies concatenated into them
modules: [
// non "app" bundles, should be careful not to try to have too many of these
{
name: "compiled/tinymce",
// this stuff is already in common, should be able to make this a smaller
// list since some things depend on others in the list, yes, its a bit crazy
// this is the intersection of common and tinymce, we need to script this
// config file...
exclude: [
'i18n',
'str/escapeRegex',
'vendor/date',
'jquery',
'str/pluralize',
'INST',
'str/htmlEscape',
'i18nObj',
'vendor/jquery.scrollTo',
'vendor/jqueryui/core',
'vendor/jqueryui/widget',
'vendor/jqueryui/mouse',
'vendor/jqueryui/position',
'translations/instructure',
'i18n!instructure',
'compiled/util/objectCollection',
'vendor/spin',
'vendor/jquery.spin',
'jquery.google-analytics',
'vendor/jquery.ba-hashchange',
'vendor/jqueryui/effects/drop',
'compiled/jquery.rails_flash_notifications',
js bundle extensions for plugins, bugfixes and DRYification allows plugins to have a bundle get auto-loaded with a corresponding canvas bundle. uses require.js' include mechanism in build.js (when optimized) and a rails helper tweak (when not optimized). this happens automatically based on the path, e.g. the foo plugin's "bundles/extensions/bar" will get automagically included whenever the regular "bar" bundle is required. removes the need for a plugin-level build.js, and auto-generates bundle module definitions in canvas' build.js (via erb). this handles all regular bundles both from canvas and plugins. also fixes plugins so that bundle dependencies get optimized. plugin paths are created automatically, so this means we can remove things like this from plugin bundles and specs: require.config paths: myplugin: "/plugins/myplugin/javascripts" test plan: 1. use canvas in development mode, it should work 2. use canvas in optimized JS mode, it should work i. confirm that all scripts are optimized 3. use canvas in development mode with plugins w/ JS, it should work 4. use canvas in optimized JS mode with plugins w/ JS, it should work i. confirm that all scripts are optimized 5. add a bundle extension in a plugin (e.g. create bundles/extensions/conversations in plugin foo) i. confirm that the extension code runs in development mode ii. confirm that the extension code runs in optimized JS mode Change-Id: If8507afdbabab4ae8966f7db79d9b0e2284034db Reviewed-on: https://gerrit.instructure.com/11238 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-06-02 07:13:53 +08:00
'jquery.dropdownList',
'vendor/jqueryui/progressbar',
'translations/media_comments',
'i18n!media_comments',
'vendor/jqueryui/button',
'vendor/jqueryui/draggable',
'jqueryui/draggable',
'vendor/jqueryui/resizable',
'vendor/jqueryui/dialog',
'jquery.instructure_jquery_patches',
'vendor/jqueryui/datepicker',
'vendor/jqueryui/sortable',
'jquery.scrollToVisible',
'vendor/jqueryui/tabs',
'jquery.disableWhileLoading',
'jquery.keycodes',
'jquery.instructure_date_and_time',
'jquery.instructure_misc_plugins',
'tinymce.editor_box',
'jquery.instructure_forms',
'jquery.ajaxJSON',
'jquery.instructure_misc_helpers',
'media_comments'
]
},
{ name: "common", include: ['translations/_core'] },
js bundle extensions for plugins, bugfixes and DRYification allows plugins to have a bundle get auto-loaded with a corresponding canvas bundle. uses require.js' include mechanism in build.js (when optimized) and a rails helper tweak (when not optimized). this happens automatically based on the path, e.g. the foo plugin's "bundles/extensions/bar" will get automagically included whenever the regular "bar" bundle is required. removes the need for a plugin-level build.js, and auto-generates bundle module definitions in canvas' build.js (via erb). this handles all regular bundles both from canvas and plugins. also fixes plugins so that bundle dependencies get optimized. plugin paths are created automatically, so this means we can remove things like this from plugin bundles and specs: require.config paths: myplugin: "/plugins/myplugin/javascripts" test plan: 1. use canvas in development mode, it should work 2. use canvas in optimized JS mode, it should work i. confirm that all scripts are optimized 3. use canvas in development mode with plugins w/ JS, it should work 4. use canvas in optimized JS mode with plugins w/ JS, it should work i. confirm that all scripts are optimized 5. add a bundle extension in a plugin (e.g. create bundles/extensions/conversations in plugin foo) i. confirm that the extension code runs in development mode ii. confirm that the extension code runs in optimized JS mode Change-Id: If8507afdbabab4ae8966f7db79d9b0e2284034db Reviewed-on: https://gerrit.instructure.com/11238 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-06-02 07:13:53 +08:00
// "apps"
<%= app_bundles %>
]
})