Commit Graph

15 Commits

Author SHA1 Message Date
Ahmad Amireh 5f976f9989 rename frontend_build -> ui-build
minor QOL mainly for me; put webpack-specific configuration in its own
folder, make it portable, and make room for esbuild

the __webpack_public_path__ initializer no longer sources the value from
the build module, instead it uses a pre-defined global that webpack
injects

~ test plan ~

build is OK

Change-Id: I4ba4a3c0cb9175f96096f2b78022e152c04fc75d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276183
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2021-10-21 19:13:02 +00:00
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
Ahmad Amireh 30a45abac9 add WEBPACK_ANALYSIS and WEBPACK_PEDANTIC flags
flag = none

set WEBPACK_PEDANTIC=0 to prevent the build from bailing on warnings
set WEBPACK_ANALYSIS=1 to generate an html report of the bundles

test plan ::

run webpack with the analysis flag and verify it 1) works and 2)
generates a report at tmp/webpack-bundle-analysis.html

    WEBPACK_ANALYSIS=1 \
    WEBPACK_PEDANTIC=0 \
    NODE_OPTIONS="--max_old_space_size=8096" \
      npx webpack

Change-Id: Icc77b2477c2fb9d3394e4c41d2377212f93534c6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261892
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2021-05-05 19:59:46 +00:00
Ahmad Amireh 4243097b21 rename some things
fixes FOO-1265

[skip-eslint=true]
[pin-commit-analytics=7e49eefd7f59cbf43fd03bf8957bbbfa76f8d9d5]
[pin-commit-demo_site=adade2e38e46a358a4643cd3db2fe5ccffe39ec5]
[pin-commit-instructure_misc_plugin=47a3161102b0611af56d134fbd0c828ddc1b8abf]
[pin-commit-migration_tool=0dbac2f5b421d894395605ce4b583ef0f7d60b22]
[pin-commit-multiple_root_accounts=cc96d28c0d59bbe47acc64de4fdd8e1d2b029805]

Change-Id: I14c07f20bd260cf0de1f48ceb70b3c2313edf2d2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258807
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-04-06 01:12:49 +00:00
Ahmad Amireh 46f8efd61f modernize canvas_quizzes
fixes FOO-1409
flag  = none

no more client_apps, canvas_quizzes now lives as part of canvas-lms
proper inside app/jsx/, which makes the build leaner and leaves us with
one less thing to reason about

logical changes:

- converted from AMD to ES modules
- upgraded to recent react + react-router
- dropped RSVP in favor of native Promises
- used CanvasModal instead of home-grown Dialog
- removed dead code; notifications in particular were fishy as there had
  no dependents at all and did not even show up in the graph
- ported tests to Jest, added more unit ones and two integration ones
- removed "config.onError" and now throws errors where appropriate
- disabled console statements in non-dev

:: test plan ::

- create a (old-school) quiz containing all types of questions
- as 3 distinct students, take the quiz and try to randomize your
  answers

at this point it's helpful to have a reference to compare the screens; I
replicated the quiz on my production sandbox for this

- go to /courses/:id/quizzes/:id/submissions/:id/log
  - verify it looks OK
  - click on a specific question in the stream and verify the question
    inspector widget works OK
  - go back to stream and push "View table"
  - verify the table and its controls are OK

- go to /courses/:id/quizzes/:id/statistics
  - verify it looks OK
  - click on ? in the discrimination index chart and verify it displays
    a dialog with help content
  - click on "X respondents" in one of the charts and verify it displays
    a dialog with the respondent names
  - verify the interactive charts do interact as expected (no logic
    changed here so just a quick glance)
  - link to "View in SpeedGrader" for essay-like questions works

Change-Id: I79af5ff4f1479503b5e2528b613255dde5bc45d3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/256118
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2021-01-14 22:45:10 +00:00
Clay Diffrient 946ef4b275 Run prettier on packages/
Test Plan:
  - Automated tests pass

refs COREFE-347

flag = none

Change-Id: I573a1dff4f90b0d68fee8d0f261b50a60c7a3fbb
Reviewed-on: https://gerrit.instructure.com/212768
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-10-11 19:29:16 +00:00
Clay Diffrient c893bf9d12 Run prettier and add in public/javascripts to prettier whitelist
This also adds things in this directory to the whitelist
to make sure nothing ugly gets introduced.

Test Plan:
  - Automated tests pass
  - Make a non-pretty change in a js file within public/javascripts
  - Commit it
  - Notice it has been prettierfied

refs COREFE-347

flag = none

Change-Id: I554c5fd455ebc5690aa88b3b9858adbc11e2a966
Reviewed-on: https://gerrit.instructure.com/212575
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2019-10-10 22:09:33 +00:00
Clay Diffrient 58ab36e5d8 ESLint standardization
This commit introduces a better more reasonable ESLint configuration.
It removes all concerns with styling in favor of using prettier to handle
those things.

closes CORE-2096

Test Plan:
  - ESLint works

Change-Id: I50b90b7191b576bce4817d885d14f18c4c72d208
Reviewed-on: https://gerrit.instructure.com/170874
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2018-11-06 17:46:21 +00:00
Derek Bender 7bb338239b ignore AmbiguousBlockAssociation for specs
also fix a typo in .eslintignore caused by cae5d84950

motivation:
https://github.com/bbatsov/rubocop/issues/4222#issuecomment-290655562

this is a deliberate idiom in rspec, so let's update .robocop.yml to
match rubocop's own config

closes: GRADE-841

test plan: specs pass

Change-Id: I534eabe48fb227b6fa7b425502e645f22b1a51f3
Reviewed-on: https://gerrit.instructure.com/140424
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Product-Review: Derek Bender <djbender@instructure.com>
QA-Review: Derek Bender <djbender@instructure.com>
2018-02-12 18:37:09 +00:00
Derek Bender cae5d84950 add _core_en.js to eslinignore
Change-Id: Ifea4109745aeb6a5b639a141e200eb37937f7d84
Reviewed-on: https://gerrit.instructure.com/138493
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Derek Bender <djbender@instructure.com>
QA-Review: Derek Bender <djbender@instructure.com>
2018-01-24 19:15:27 +00:00
Ryan Shaw bf4173e6ec Don’t eslintignore public/js/vendor because we modified code in there
Change-Id: I7230b80c0f525b463b64b7fa7bb241cb750fa8ea
Reviewed-on: https://gerrit.instructure.com/106299
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2017-04-11 16:31:48 +00:00
Ryan Shaw 5b88629fe0 Remove RequireJS support
closes: CNVS-31785

test plan:
all builds should pass

Change-Id: I2925934692a3d2f115f1289d7b50cb72d8cb907f
Reviewed-on: https://gerrit.instructure.com/104492
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2017-03-13 22:10:23 +00:00
Jon Jensen 02d13b4e17 compile_assets improvements, refs SD-2097
speed up require_js and webpack builds. here's how:

* bump i18nliner
  * it uses babel
  * it is much faster
* tweak canvas_i18nliner to not need to precompile anything
* run i18n:generate_js without having to precompile anything
* webpack can avoid running js:generate altogether

test plan:
* tests pass
* i18n works as per usual under requirejs
* i18n works as per usual under webpack
* `rake i18n:generate`:
   * builds identical yml before/after
   * runs faster now
   * works even if you nuke compiled coffee/jsx
* `rake i18n:generate_js`:
   * builds identical translation files before/after
   * runs faster now
   * works even if you nuke compiled coffee/jsx

Change-Id: I2682e68ff87168d9f76e20deb93713aa9a50477a
Reviewed-on: https://gerrit.instructure.com/103285
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-02-28 00:34:37 +00:00
Clay Diffrient 530fd0ce8e Update eslint/airbnb-eslint-config
This also ignores the doc/ directory and should fix errors
on Code Climate

Test Plan:
  - Things work

Change-Id: I5b970daf19a1cfbd4ff61bed07c4f85d6db31f8f
Reviewed-on: https://gerrit.instructure.com/99888
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
2017-01-18 18:05:09 +00:00
Clay Diffrient 0ca6f62cb2 Add enzyme testing to Canvas
closes CNVS-33623

Test Plan:
  - Automated tests pass

Change-Id: I0e76082e8dfc2f695717c94819de3999dd23000a
Reviewed-on: https://gerrit.instructure.com/96510
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
2017-01-04 20:21:36 +00:00