Skip to content

Commit

Permalink
Fix part of oppia#6732: Extensions objects webpack integration (oppia…
Browse files Browse the repository at this point in the history
…#6889)

* Add extensions folder to webpack config

* Convert extension objects dependencies to webpack

* Change extension objects import method for exploration editor

* Employ webpack for extension objects for exploration player

* Employ webpack for extension objects for practice sessions

* Employ webpack for extension objects for skill editor

* Employ webpack for extension objects for story editor

* Employ webpack for extension objects for topic editor

* Fix lint errors

* Add extensions to karma config

* Convert individual imports to single large import

* Convert individual imports to single large for for players

* Replace missing import for exploration editor
  • Loading branch information
kevinlee12 authored and seanlip committed Jun 12, 2019
1 parent 419a0f2 commit 442e19e
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ require(
'domain/topics_and_skills_dashboard/' +
'TopicsAndSkillsDashboardBackendApiService.ts'
);

require('objects/objectComponentsRequires.ts');

require(
'pages/exploration-editor-page/feedback-tab/services/' +
'thread-status-display.service.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -873,33 +873,6 @@ <h2>Suggestions to review</h2>
{{ super() }}
<script src="/templates/dev/head/mathjaxConfig.js"></script>
<script src="/third_party/static/MathJax-2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script src="/extensions/objects/templates/BooleanEditorDirective.js"></script>
<script src="/extensions/objects/templates/CodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/CoordTwoDimEditorDirective.js"></script>
<script src="/extensions/objects/templates/DragAndDropHtmlStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/DragAndDropPositiveIntEditorDirective.js"></script>
<script src="/extensions/objects/templates/FilepathEditorDirective.js"></script>
<script src="/extensions/objects/templates/FractionEditorDirective.js"></script>
<script src="/extensions/objects/templates/GraphEditorDirective.js"></script>
<script src="/extensions/objects/templates/GraphPropertyEditorDirective.js"></script>
<script src="/extensions/objects/templates/HtmlEditorDirective.js"></script>
<script src="/extensions/objects/templates/ImageWithRegionsEditorDirective.js"></script>
<script src="/extensions/objects/templates/IntEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfSetsOfHtmlStringsEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfUnicodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/LogicErrorCategoryEditorDirective.js"></script>
<script src="/extensions/objects/templates/LogicQuestionEditorDirective.js"></script>
<script src="/extensions/objects/templates/MathLatexStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/MusicPhraseEditorDirective.js"></script>
<script src="/extensions/objects/templates/NonnegativeIntEditorDirective.js"></script>
<script src="/extensions/objects/templates/NormalizedStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/NumberWithUnitsEditorDirective.js"></script>
<script src="/extensions/objects/templates/ParameterNameEditorDirective.js"></script>
<script src="/extensions/objects/templates/RealEditorDirective.js"></script>
<script src="/extensions/objects/templates/SanitizedUrlEditorDirective.js"></script>
<script src="/extensions/objects/templates/SetOfHtmlStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/SetOfUnicodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/UnicodeStringEditorDirective.js"></script>

<script src="/extensions/interactions/baseInteractionValidationService.js"></script>
<!-- This code is used for inserting webpack bundles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ require(
require('pages/exploration-player-page/exploration-player-page.constants.ts');
require('value_generators/valueGeneratorsRequires.ts');

require('objects/objectComponentsRequires.ts');

require('domain/exploration/ParamChangesObjectFactory.ts');
require('domain/exploration/ParamSpecsObjectFactory.ts');
require('domain/utilities/UrlInterpolationService.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,35 +121,6 @@
<script src="/templates/dev/head/mathjaxConfig.js"></script>
<script src="/third_party/static/MathJax-2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

<script src="/extensions/objects/templates/BooleanEditorDirective.js"></script>
<script src="/extensions/objects/templates/CodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/CoordTwoDimEditorDirective.js"></script>
<script src="/extensions/objects/templates/DragAndDropHtmlStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/DragAndDropPositiveIntEditorDirective.js"></script>
<script src="/extensions/objects/templates/FilepathEditorDirective.js"></script>
<script src="/extensions/objects/templates/FractionEditorDirective.js"></script>
<script src="/extensions/objects/templates/GraphEditorDirective.js"></script>
<script src="/extensions/objects/templates/GraphPropertyEditorDirective.js"></script>
<script src="/extensions/objects/templates/HtmlEditorDirective.js"></script>
<script src="/extensions/objects/templates/ImageWithRegionsEditorDirective.js"></script>
<script src="/extensions/objects/templates/IntEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfSetsOfHtmlStringsEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfTabsEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfUnicodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/LogicErrorCategoryEditorDirective.js"></script>
<script src="/extensions/objects/templates/LogicQuestionEditorDirective.js"></script>
<script src="/extensions/objects/templates/MathLatexStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/MusicPhraseEditorDirective.js"></script>
<script src="/extensions/objects/templates/NonnegativeIntEditorDirective.js"></script>
<script src="/extensions/objects/templates/NormalizedStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/NumberWithUnitsEditorDirective.js"></script>
<script src="/extensions/objects/templates/ParameterNameEditorDirective.js"></script>
<script src="/extensions/objects/templates/RealEditorDirective.js"></script>
<script src="/extensions/objects/templates/SanitizedUrlEditorDirective.js"></script>
<script src="/extensions/objects/templates/SetOfHtmlStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/SetOfUnicodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/UnicodeStringEditorDirective.js"></script>

<script src="/extensions/interactions/baseInteractionValidationService.js"></script>

<!-- This code is used for inserting webpack bundles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ require(
'learner-view-info.directive.ts');

require('domain/exploration/ReadOnlyExplorationBackendApiService.ts');

require('objects/objectComponentsRequiresForPlayers.ts');

require('services/ContextService.ts');
require('services/PageTitleService.ts');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@

<script src="/templates/dev/head/mathjaxConfig.js"></script>
<script src="/third_party/static/MathJax-2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

<script src="/extensions/objects/templates/MathLatexStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/SanitizedUrlEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfTabsEditorDirective.js"></script>
<!-- This code is used for inserting webpack bundles
https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates -->
<% for (var chunk in htmlWebpackPlugin.files.js) { %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ require(
'components/question-directives/question-player/' +
'question-player.directive.ts');

require('objects/objectComponentsRequiresForPlayers.ts');

require('services/AlertsService.ts');
require('services/contextual/UrlService.ts');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@
<script src="/templates/dev/head/mathjaxConfig.js"></script>
<script src="/third_party/static/MathJax-2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

<script src="/extensions/objects/templates/MathLatexStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/SanitizedUrlEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfTabsEditorDirective.js"></script>

<!-- This code is used for inserting webpack bundles
https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates -->
<% for (var chunk in htmlWebpackPlugin.files.js) { %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ require('directives/MathjaxBindDirective.ts');
require('filters/string-utility-filters/normalize-whitespace.filter.ts');
// ^^^ this block of requires should be removed ^^^

require('objects/objectComponentsRequires.ts');

require('pages/skill-editor-page/navbar/skill-editor-navbar.directive.ts');
require(
'pages/skill-editor-page/navbar/skill-editor-navbar-breadcrumb.directive.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,6 @@
<script src="/templates/dev/head/mathjaxConfig.js"></script>
<script src="/third_party/static/MathJax-2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

<script src="/extensions/objects/templates/BooleanEditorDirective.js"></script>
<script src="/extensions/objects/templates/CodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/CoordTwoDimEditorDirective.js"></script>
<script src="/extensions/objects/templates/DragAndDropHtmlStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/DragAndDropPositiveIntEditorDirective.js"></script>
<script src="/extensions/objects/templates/FilepathEditorDirective.js"></script>
<script src="/extensions/objects/templates/FractionEditorDirective.js"></script>
<script src="/extensions/objects/templates/GraphEditorDirective.js"></script>
<script src="/extensions/objects/templates/GraphPropertyEditorDirective.js"></script>
<script src="/extensions/objects/templates/HtmlEditorDirective.js"></script>
<script src="/extensions/objects/templates/ImageWithRegionsEditorDirective.js"></script>
<script src="/extensions/objects/templates/IntEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfSetsOfHtmlStringsEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfTabsEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfUnicodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/LogicErrorCategoryEditorDirective.js"></script>
<script src="/extensions/objects/templates/LogicQuestionEditorDirective.js"></script>
<script src="/extensions/objects/templates/MathLatexStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/MusicPhraseEditorDirective.js"></script>
<script src="/extensions/objects/templates/NonnegativeIntEditorDirective.js"></script>
<script src="/extensions/objects/templates/NormalizedStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/NumberWithUnitsEditorDirective.js"></script>
<script src="/extensions/objects/templates/ParameterNameEditorDirective.js"></script>
<script src="/extensions/objects/templates/RealEditorDirective.js"></script>
<script src="/extensions/objects/templates/SanitizedUrlEditorDirective.js"></script>
<script src="/extensions/objects/templates/SetOfHtmlStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/SetOfUnicodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/UnicodeStringEditorDirective.js"></script>

<script src="/extensions/interactions/baseInteractionValidationService.js"></script>
<!-- This code is used for inserting webpack bundles
https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ require(
require(
'components/forms/schema-viewers/schema-based-unicode-viewer.directive.ts');
require('components/forms/schema-viewers/schema-based-viewer.directive.ts');

require('objects/objectComponentsRequiresForPlayers.ts');

require('services/HtmlEscaperService.ts');
require('services/IdGenerationService.ts');
require('services/RteHelperService.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
<script src="/third_party/static/ckeditor-4.9.2/ckeditor.js"></script>
<script src="/templates/dev/head/mathjaxConfig.js"></script>
<script src="/third_party/static/MathJax-2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

<script src="/extensions/objects/templates/MathLatexStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/SanitizedUrlEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfTabsEditorDirective.js"></script>
<!-- This code is used for inserting webpack bundles
https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates -->
<% for (var chunk in htmlWebpackPlugin.files.js) { %>
Expand Down
2 changes: 2 additions & 0 deletions core/templates/dev/head/pages/topic_editor/TopicEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ require('filters/string-utility-filters/normalize-whitespace.filter.ts');
require('services/AutoplayedVideosService.ts');
// ^^^ this block of requires should be removed ^^^

require('objects/objectComponentsRequires.ts');

require('pages/topic_editor/TopicEditorNavbarBreadcrumbDirective.ts');
require('pages/topic_editor/TopicEditorNavbarDirective.ts');
require('pages/topic_editor/main_editor/TopicEditorTabDirective.ts');
Expand Down
29 changes: 0 additions & 29 deletions core/templates/dev/head/pages/topic_editor/topic_editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,6 @@
<script src="/templates/dev/head/mathjaxConfig.js"></script>
<script src="/third_party/static/MathJax-2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

<script src="/extensions/objects/templates/BooleanEditorDirective.js"></script>
<script src="/extensions/objects/templates/CodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/CoordTwoDimEditorDirective.js"></script>
<script src="/extensions/objects/templates/DragAndDropHtmlStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/DragAndDropPositiveIntEditorDirective.js"></script>
<script src="/extensions/objects/templates/FilepathEditorDirective.js"></script>
<script src="/extensions/objects/templates/FractionEditorDirective.js"></script>
<script src="/extensions/objects/templates/GraphEditorDirective.js"></script>
<script src="/extensions/objects/templates/GraphPropertyEditorDirective.js"></script>
<script src="/extensions/objects/templates/HtmlEditorDirective.js"></script>
<script src="/extensions/objects/templates/ImageWithRegionsEditorDirective.js"></script>
<script src="/extensions/objects/templates/IntEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfSetsOfHtmlStringsEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfTabsEditorDirective.js"></script>
<script src="/extensions/objects/templates/ListOfUnicodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/LogicErrorCategoryEditorDirective.js"></script>
<script src="/extensions/objects/templates/LogicQuestionEditorDirective.js"></script>
<script src="/extensions/objects/templates/MathLatexStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/MusicPhraseEditorDirective.js"></script>
<script src="/extensions/objects/templates/NonnegativeIntEditorDirective.js"></script>
<script src="/extensions/objects/templates/NormalizedStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/NumberWithUnitsEditorDirective.js"></script>
<script src="/extensions/objects/templates/ParameterNameEditorDirective.js"></script>
<script src="/extensions/objects/templates/RealEditorDirective.js"></script>
<script src="/extensions/objects/templates/SanitizedUrlEditorDirective.js"></script>
<script src="/extensions/objects/templates/SetOfHtmlStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/SetOfUnicodeStringEditorDirective.js"></script>
<script src="/extensions/objects/templates/UnicodeStringEditorDirective.js"></script>

<script src="/extensions/interactions/baseInteractionValidationService.js"></script>
<!-- This code is used for inserting webpack bundles
https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates -->
Expand Down
46 changes: 46 additions & 0 deletions extensions/objects/objectComponentsRequires.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2019 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
* @fileoverview Requires for all the object templates.
*/

require('objects/templates/BooleanEditorDirective.ts');
require('objects/templates/CodeStringEditorDirective.ts');
require('objects/templates/CoordTwoDimEditorDirective.ts');
require('objects/templates/DragAndDropHtmlStringEditorDirective.ts');
require('objects/templates/DragAndDropPositiveIntEditorDirective.ts');
require('objects/templates/FilepathEditorDirective.ts');
require('objects/templates/FractionEditorDirective.ts');
require('objects/templates/GraphEditorDirective.ts');
require('objects/templates/GraphPropertyEditorDirective.ts');
require('objects/templates/HtmlEditorDirective.ts');
require('objects/templates/ImageWithRegionsEditorDirective.ts');
require('objects/templates/IntEditorDirective.ts');
require('objects/templates/ListOfSetsOfHtmlStringsEditorDirective.ts');
require('objects/templates/ListOfTabsEditorDirective.ts');
require('objects/templates/ListOfUnicodeStringEditorDirective.ts');
require('objects/templates/LogicErrorCategoryEditorDirective.ts');
require('objects/templates/LogicQuestionEditorDirective.ts');
require('objects/templates/MathLatexStringEditorDirective.ts');
require('objects/templates/MusicPhraseEditorDirective.ts');
require('objects/templates/NonnegativeIntEditorDirective.ts');
require('objects/templates/NormalizedStringEditorDirective.ts');
require('objects/templates/NumberWithUnitsEditorDirective.ts');
require('objects/templates/ParameterNameEditorDirective.ts');
require('objects/templates/RealEditorDirective.ts');
require('objects/templates/SanitizedUrlEditorDirective.ts');
require('objects/templates/SetOfHtmlStringEditorDirective.ts');
require('objects/templates/SetOfUnicodeStringEditorDirective.ts');
require('objects/templates/UnicodeStringEditorDirective.ts');
21 changes: 21 additions & 0 deletions extensions/objects/objectComponentsRequiresForPlayers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2019 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
* @fileoverview Requires for object templates required for players.
*/

require('objects/templates/MathLatexStringEditorDirective.ts');
require('objects/templates/SanitizedUrlEditorDirective.ts');
require('objects/templates/ListOfTabsEditorDirective.ts');
9 changes: 4 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
},
"files_explanation": "These files are included separately since we still do not have webpack in extensions folder and these files are still included through scripts tags, so they need to be compiled separately.",
"files": [
"assets/constants.js",
"assets/rich_text_components_definitions.js",
"core/tests/karma-globals.ts",
"assets/constants.js",
"assets/rich_text_components_definitions.js",
"core/tests/karma-globals.ts",
"core/tests/karma.conf.ts",
"core/templates/dev/head/AppInit.ts",
"core/templates/dev/head/mathjaxConfig.ts",
Expand All @@ -23,10 +23,9 @@
"core/templates/dev/head/filters/string-utility-filters/truncate-at-first-line.filter.ts"
],
"include": [
"extensions/ckeditor_plugins",
"extensions/ckeditor_plugins",
"extensions/classifiers",
"extensions/interactions",
"extensions/objects",
"typings"
]
}

0 comments on commit 442e19e

Please sign in to comment.