canvas-lms/gems
Jeff Largent 4fe9f01972 Add typescript support
This change adds support for typescript transpilation to our frontend
build via babel, and also updates eslint and canvas_i18nliner to be
able to understand typescript as well. The main goal of this PS is to
enable developers to add typescript code to the Canvas codebase but to
be unopinionated about how type-checking is done; at this stage types
will only be checked by running the new `check:ts` or `check:js`
scripts (which run the typescript compiler directly), or via
integration with an IDE like RubyMine or VS Code.

closes LS-2430
flag = none

Test plan:
  BUILD STEPS:
  - FE build, i18n build, and tests pass Jenkins
  - `bin/rails canvas:compile_assets` still works
  - `RAILS_ENV=production bin/rails convas:compile_assets` still works

  SPOT CHECKING:
  - Starting up rails and run `yarn build:js:watch`
  - Click around Canvas and make sure the frontend still loads as
    normal

Change-Id: I8bb1a0f065e09496a924708dead6fa4518b59496
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270401
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Jeff Largent <jeff.largent@instructure.com>
2021-08-18 18:21:17 +00:00
..
activesupport-suspend_callbacks don't even bother checking for suspensions if there are no callbacks 2021-07-30 17:46:27 +00:00
acts_as_list add an `ordered` scope to acts_as_list, and use it 2021-03-31 21:48:10 +00:00
adheres_to_policy add backend permission changes for manage courses granulars 2021-04-30 21:29:00 +00:00
attachment_fu add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
autoextend add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
bookmarked_collection fix issues using timestamp as a pagination bookmark 2021-04-28 20:47:28 +00:00
broadcast_policy add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_breach_mitigation add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_cache add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_cassandra add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_color add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_crummy Modify index and show views for K5 mode 2021-04-21 18:21:41 +00:00
canvas_dynamodb add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_errors add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_ext add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_http CanvasHttp: support for a max response body length 2021-04-19 17:40:03 +00:00
canvas_i18nliner Add typescript support 2021-08-18 18:21:17 +00:00
canvas_kaltura add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_mimetype_fu add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_panda_pub add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_partman Properly support ruby 2.7 2021-06-11 21:06:37 +00:00
canvas_quiz_statistics add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_sanitize allow more html/css in canvas-rce 2021-06-11 16:11:24 +00:00
canvas_security add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_slug add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_sort add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_stringex Properly support ruby 2.7 2021-06-11 21:06:37 +00:00
canvas_text_helper add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_time add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
canvas_unzip add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
config_file add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
csv_diff add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
diigo add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
dr_diff Properly support ruby 2.7 2021-06-11 21:06:37 +00:00
dynamic_settings fix dynamic settings initializer 2021-08-10 19:56:34 +00:00
event_stream add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
google_drive spec: enable net connect after webmock 2021-07-22 13:55:29 +00:00
html_text_helper add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
i18n_extraction add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
i18n_tasks Don't let nulls get into locale javascript 2021-08-04 23:26:46 +00:00
incoming_mail_processor add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
inst_access allow apollo federation introspection query w/o authentication 2021-08-11 16:49:55 +00:00
json_token add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
linked_in add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
live_events add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
lti-advantage add migration claim to LTI 1.3 launches 2021-04-14 19:34:24 +00:00
lti_outbound Better module progression for New Quizzes 2021-06-23 22:24:17 +00:00
multipart add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
paginated_collection add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
plugins fix true expiration of access tokens that have refresh tokens 2021-07-13 20:41:06 +00:00
request_context add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
rubocop-canvas add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
stringify_ids add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
tatl_tael add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
turnitin_api spec: enable net connect after webmock 2021-07-22 13:55:29 +00:00
twitter add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
utf8_cleaner add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
workflow add frozen_string_literal comment to engines and gems 2021-03-30 18:14:15 +00:00
README.md extract ConfigFile to gem 2021-02-23 21:18:20 +00:00
test_all_gems.sh remove broken vendored gems html reports 2021-06-15 16:53:17 +00:00

README.md

Gems

This folder is a place to extract modular functionality from canvas. Canvas's Gemfile arrangement is enabled to read gems from this path locally without installing from a remote source. This is valuable for a few reasons:

  • it prevents circular dependencies (bundler won't allow it)
  • modularized code cannot bind to specific domain concepts on canvas models
  • gems can have their specs run independently, without needing to load all of canvas, saving iteration time
  • it allows for eventual build optimization via only running specs for the transitive closure of parents depending on a gem where a change is.
  • it gives ENGINES extracted from canvas (see the "engines" directory) a place to reference code shared with canvas without it being packaged into the canvas monolith directly.

There are some tradeoffs:

  • spreads canvas over more subdirectories, giving some mental overhad to traversing the entire codebase.
  • modular tests necessarily don't test integration with canvas concepts, so solid integration tests in the app are still a requirement.
  • total SERIALIZED build time goes up because each gem loads it's specs in a new process rather than all running within an already booted canvas process.

[TODO] eventually write more on whether we feel like those tradeoffs are good ones, and what the best practices are to leverage this pattern for max-gain/min-pain.

Testing

To test all the gems:

cd gems
./test_all_gems.sh

To test an individual gem

Run ./test.sh inside the gem's folder. This is basically the same as:

cd gems/google_drive
bundle
rspec