Skip to content

Commit

Permalink
Rename /dist to /webpack and move it to the root (oppia#7315)
Browse files Browse the repository at this point in the history
* lot of cahnges

* fix linting

* fix tests

* fix frontend tests

* fix some pages

* fix webpack compilation

* fix hashes generating

* fix prod build

* fix backend tests

* fix backend test no. 256

* fix errors

* fix stuff

* add iframed error

* fix iframed error

* fix linter

* fix backend test

* fix prod build

* fix DEV_MODE

* fix backend tests

* regenerate package-lock

* assert some comments

* assert some comments

* refresh hashesa

* refresh hashesa

* ignore hashes

* codeowner

* linting

* devmode

* fix backend tests

* fix backend tests

* Fix e2e tests

* Rename webpack to webpack_bundles

* fix prod

* Fix lints

* fix e2e tests

* fix lint

* fix constatns

* lint test

* Fix requires

* Change paths in app_dev.yaml

* Changes in constants

* Fix webpack configs

* fix webpack

* Fix package-lock

* Fix webpack

* Fix webpack

* Fix subtopic

* Add extensions

* remove application_readable from app.xaml

* repair

* Fix update configs

* Return jQuery import to csrf tests

* Fix backend tests

* Fix typescript

* Fix typescript

* Fix e2e tests

* Change build process

* Fix lint

* Fix lint and backend tests

* Fix coverage

* Fix backend tests

* Assert comments

* Assert comments
  • Loading branch information
vojtechjelinek authored and seanlip committed Aug 26, 2019
1 parent 4087a94 commit b32c28d
Show file tree
Hide file tree
Showing 92 changed files with 667 additions and 1,562 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
core/templates/dev/head/expressions/ExpressionParserService.js
core/templates/dev/head/google-analytics.initializer.ts
backend_prod_files/*
core/tests/protractor.conf.js
extensions/interactions/LogicProof/static/js/generatedDefaultData.ts
Expand Down
7 changes: 4 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
/main.py @nithusha21 @DubeySandeep
/feconf.py @seanlip @nithusha21
/constants*.py @seanlip @nithusha21
/assets/constants.js @seanlip @nithusha21
/assets/constants.ts @seanlip @nithusha21
/core/controllers/incoming_emails*.py @aks681
/core/controllers/tasks*.py @aks681
/core/domain/email*.py @aks681
Expand Down Expand Up @@ -393,7 +393,7 @@
/core/domain/rte_component_registry*.py @vojtechjelinek
/extensions/ckeditor_plugins/ @vojtechjelinek
/extensions/rich_text_components/ @vojtechjelinek
/assets/rich_text_components_definitions.js @vojtechjelinek
/assets/rich_text_components_definitions.ts @vojtechjelinek


# Suggestion and feedback team.
Expand Down Expand Up @@ -433,6 +433,7 @@

# Speed Improvement team.
/app_dev.yaml @vojtechjelinek
/core/templates/dev/head/google-analytics.initializer.ts @vojtechjelinek
/core/templates/dev/head/base_components/ @jamesjay4199 @vojtechjelinek
/core/templates/dev/head/pages/Base.ts @vojtechjelinek
/core/templates/dev/head/pages/base.html @vojtechjelinek
Expand All @@ -444,7 +445,7 @@
/core/templates/dev/head/services/CsrfTokenService*.ts @jamesjay4199 @vojtechjelinek
/gulpfile.js @vojtechjelinek
/jinja_utils*.py @vojtechjelinek
/webpack.config.ts @vojtechjelinek
/webpack.common.config.ts @vojtechjelinek
/webpack.dev.config.ts @vojtechjelinek
/webpack.prod.config.ts @vojtechjelinek

Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ gae_runtime/*
# ignore the files and dirs inside the .git dir.
.git/*
third_party/*
assets/hashes.js
assets/hashes.json
backend_prod_files/*
local_compiled_js/*
local_compiled_js_for_test/*
core/templates/prod/*
core/templates/dev/head/dist/*
webpack_bundles/*
core/tests/.browserstack.env
node_modules/*
.coverage*
Expand Down
42 changes: 21 additions & 21 deletions app_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ handlers:
expiration: "90d"

# DEVELOPMENT STATIC
- url: /dist
static_dir: core/templates/dev/head/dist
- url: /webpack_bundles
static_dir: webpack_bundles
secure: always
application_readable: true
expiration: "0"
Expand Down Expand Up @@ -140,8 +140,8 @@ handlers:

# STATIC PAGES.
- url: /about
static_files: core/templates/dev/head/dist/about-page.mainpage.html
upload: core/templates/dev/head/dist/about-page.mainpage.html
static_files: webpack_bundles/about-page.mainpage.html
upload: webpack_bundles/about-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: "max-age=31536000; includeSubDomains"
Expand All @@ -151,8 +151,8 @@ handlers:
secure: always
expiration: "0"
- url: /contact
static_files: core/templates/dev/head/dist/contact-page.mainpage.html
upload: core/templates/dev/head/dist/contact-page.mainpage.html
static_files: webpack_bundles/contact-page.mainpage.html
upload: webpack_bundles/contact-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: "max-age=31536000; includeSubDomains"
Expand All @@ -162,8 +162,8 @@ handlers:
secure: always
expiration: "0"
- url: /donate
static_files: core/templates/dev/head/dist/donate-page.mainpage.html
upload: core/templates/dev/head/dist/donate-page.mainpage.html
static_files: webpack_bundles/donate-page.mainpage.html
upload: webpack_bundles/donate-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: "max-age=31536000; includeSubDomains"
Expand All @@ -173,8 +173,8 @@ handlers:
secure: always
expiration: "0"
- url: /get_started
static_files: core/templates/dev/head/dist/get-started-page.mainpage.html
upload: core/templates/dev/head/dist/get-started-page.mainpage.html
static_files: webpack_bundles/get-started-page.mainpage.html
upload: webpack_bundles/get-started-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: "max-age=31536000; includeSubDomains"
Expand All @@ -184,8 +184,8 @@ handlers:
secure: always
expiration: "0"
- url: /privacy
static_files: core/templates/dev/head/dist/privacy-page.mainpage.html
upload: core/templates/dev/head/dist/privacy-page.mainpage.html
static_files: webpack_bundles/privacy-page.mainpage.html
upload: webpack_bundles/privacy-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: "max-age=31536000; includeSubDomains"
Expand All @@ -195,8 +195,8 @@ handlers:
secure: always
expiration: "0"
- url: /splash
static_files: core/templates/dev/head/dist/splash-page.mainpage.html
upload: core/templates/dev/head/dist/splash-page.mainpage.html
static_files: webpack_bundles/splash-page.mainpage.html
upload: webpack_bundles/splash-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: "max-age=31536000; includeSubDomains"
Expand All @@ -206,8 +206,8 @@ handlers:
secure: always
expiration: "0"
- url: /teach
static_files: core/templates/dev/head/dist/teach-page.mainpage.html
upload: core/templates/dev/head/dist/teach-page.mainpage.html
static_files: webpack_bundles/teach-page.mainpage.html
upload: webpack_bundles/teach-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: "max-age=31536000; includeSubDomains"
Expand All @@ -217,8 +217,8 @@ handlers:
secure: always
expiration: "0"
- url: /terms
static_files: core/templates/dev/head/dist/terms-page.mainpage.html
upload: core/templates/dev/head/dist/terms-page.mainpage.html
static_files: webpack_bundles/terms-page.mainpage.html
upload: webpack_bundles/terms-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: "max-age=31536000; includeSubDomains"
Expand All @@ -228,8 +228,8 @@ handlers:
secure: always
expiration: "0"
- url: /thanks
static_files: core/templates/dev/head/dist/thanks-page.mainpage.html
upload: core/templates/dev/head/dist/thanks-page.mainpage.html
static_files: webpack_bundles/thanks-page.mainpage.html
upload: webpack_bundles/thanks-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: "max-age=31536000; includeSubDomains"
Expand Down Expand Up @@ -264,7 +264,7 @@ skip_files:
# Karma test files
- ^(.*/)Spec.js$
# Typescript files
- ^(.*/)?.*\.ts$
- ^core/(.*/)?.*\.ts$
# Typescript output log file
- ^(.*/)tsc_output_log.txt$
# Other folders to ignore
Expand Down
2 changes: 1 addition & 1 deletion assets/constants.js → assets/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @fileoverview Initializes constants for the Oppia codebase.
*/

var constants = {
export = {
// Whether to allow custom event reporting to Google Analytics.
"CAN_SEND_ANALYTICS_EVENTS": false,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @fileoverview Definitions for rich text components.
*/

var richTextComponents = {
export = {
"Collapsible": {
"backend_id": "Collapsible",
"category": "Basic Input",
Expand Down
2 changes: 1 addition & 1 deletion constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ class Constants(dict):
__getattr__ = dict.__getitem__


with python_utils.open_file(os.path.join('assets', 'constants.js'), 'r') as f:
with python_utils.open_file(os.path.join('assets', 'constants.ts'), 'r') as f:
constants = Constants(parse_json_from_js(f))
4 changes: 2 additions & 2 deletions constants_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class ConstantsTests(test_utils.GenericTestBase):
def test_constants_file_is_existing(self):
"""Test if the constants file is existing."""
self.assertTrue(os.path.isfile(os.path.join(
'assets', 'constants.js')))
'assets', 'constants.ts')))

def test_constants_file_contains_valid_json(self):
"""Test if the constants file is valid json file."""
with python_utils.open_file(
os.path.join('assets', 'constants.js'), 'r') as f:
os.path.join('assets', 'constants.ts'), 'r') as f:
json = constants.parse_json_from_js(f)
self.assertTrue(isinstance(json, dict))
self.assertEqual(json['TESTING_CONSTANT'], 'test')
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class AdminPage(base.BaseHandler):
def get(self):
"""Handles GET requests."""

self.render_template('dist/admin-page.mainpage.html')
self.render_template('admin-page.mainpage.html')


class AdminHandler(base.BaseHandler):
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,10 @@ def _render_exception_json_or_html(self, return_type, values):
self.values.update(values)
if 'iframed' in self.values and self.values['iframed']:
self.render_template(
'dist/error-iframed.mainpage.html',
'error-iframed.mainpage.html',
iframe_restriction=None)
else:
self.render_template('dist/error-page.mainpage.html')
self.render_template('error-page.mainpage.html')
else:
if return_type != feconf.HANDLER_TYPE_JSON and (
return_type != feconf.HANDLER_TYPE_DOWNLOADABLE):
Expand Down
17 changes: 1 addition & 16 deletions core/controllers/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,6 @@ class EscapingTests(test_utils.GenericTestBase):
class FakePage(base.BaseHandler):
"""Fake page for testing autoescaping."""

def get(self):
"""Handles GET requests."""
self.render_template('tests/jinja_escaping.html')

def post(self):
"""Handles POST requests."""
self.render_json({'big_value': u'\n<script>马={{'})
Expand All @@ -548,17 +544,6 @@ def setUp(self):
debug=feconf.DEBUG,
))

def test_jinja_autoescaping(self):
dangerous_field_contents = '<[angular_tag]> x{{51 * 3}}y'
with self.swap(constants, 'DEV_MODE', dangerous_field_contents):
response = self.get_html_response('/fake')

self.assertIn('&lt;[angular_tag]&gt;', response.body)
self.assertNotIn('<[angular_tag]>', response.body)

self.assertIn('x{{51 * 3}}y', response.body)
self.assertNotIn('x153y', response.body)

def test_special_char_escaping(self):
response = self.testapp.post('/fake', params={})
self.assertEqual(response.status_int, 200)
Expand Down Expand Up @@ -988,7 +973,7 @@ def get(self):
iframe_restriction = self.request.get(
'iframe_restriction', default_value=None)
self.render_template(
'pages/about-page/about-page.mainpage.html',
'about-page.mainpage.html',
iframe_restriction=iframe_restriction)

def setUp(self):
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/collection_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def get(self, _):
feconf.SHOW_COLLECTION_NAVIGATION_TAB_STATS),
})

self.render_template('dist/collection-editor-page.mainpage.html')
self.render_template('collection-editor-page.mainpage.html')


class EditableCollectionDataHandler(CollectionEditorHandler):
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/collection_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CollectionPage(base.BaseHandler):
def get(self, _):
"""Handles GET requests."""

self.render_template('dist/collection-player-page.mainpage.html')
self.render_template('collection-player-page.mainpage.html')


class CollectionDataHandler(base.BaseHandler):
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/community_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get(self):
# the COMMUNITY_DASHBOARD_ENABLED flag is removed.
if not feconf.COMMUNITY_DASHBOARD_ENABLED:
raise self.PageNotFoundException
self.render_template('dist/community-dashboard-page.mainpage.html')
self.render_template('community-dashboard-page.mainpage.html')


class ContributionOpportunitiesHandler(base.BaseHandler):
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/creator_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class NotificationsDashboardPage(base.BaseHandler):
@acl_decorators.can_access_creator_dashboard
def get(self):
self.render_template(
'dist/notifications-dashboard-page.mainpage.html')
'notifications-dashboard-page.mainpage.html')


class NotificationsDashboardHandler(base.BaseHandler):
Expand Down Expand Up @@ -127,7 +127,7 @@ def get(self):
'additional_angular_modules': additional_angular_modules,
'dependencies_html': jinja2.utils.Markup(dependencies_html)
})
self.render_template('dist/creator-dashboard-page.mainpage.html')
self.render_template('creator-dashboard-page.mainpage.html')


class CreatorDashboardHandler(base.BaseHandler):
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/custom_landing_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get(self, subject, topic):
"""Handles GET requests."""
if subject in feconf.AVAILABLE_LANDING_PAGES:
if topic in feconf.AVAILABLE_LANDING_PAGES[subject]:
self.render_template('dist/topic-landing-page.mainpage.html')
self.render_template('topic-landing-page.mainpage.html')
else:
raise self.PageNotFoundException
else:
Expand All @@ -55,4 +55,4 @@ class StewardsLandingPage(base.BaseHandler):
def get(self):
"""Handles GET requests."""
self.render_template(
'dist/stewards-landing-page.mainpage.html')
'stewards-landing-page.mainpage.html')
2 changes: 1 addition & 1 deletion core/controllers/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get(self, unused_exploration_id):
'meta_description': feconf.CREATE_PAGE_DESCRIPTION,
})

self.render_template('dist/exploration-editor-page.mainpage.html')
self.render_template('exploration-editor-page.mainpage.html')


class ExplorationHandler(EditorHandler):
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/email_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class EmailDashboardPage(base.BaseHandler):
@acl_decorators.can_manage_email_dashboard
def get(self):
"""Handles GET requests."""
self.render_template('dist/email-dashboard-page.mainpage.html')
self.render_template('email-dashboard-page.mainpage.html')


class EmailDashboardDataHandler(base.BaseHandler):
Expand Down Expand Up @@ -173,7 +173,7 @@ def get(self, query_id):
'query_id': query_id,
})
self.render_template(
'dist/email-dashboard-result.mainpage.html')
'email-dashboard-result.mainpage.html')

@acl_decorators.can_manage_email_dashboard
def post(self, query_id):
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/learner_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LearnerDashboardPage(base.BaseHandler):
@acl_decorators.can_access_learner_dashboard
def get(self):
"""Handles GET requests."""
self.render_template('dist/learner-dashboard-page.mainpage.html')
self.render_template('learner-dashboard-page.mainpage.html')


class LearnerDashboardHandler(base.BaseHandler):
Expand Down
5 changes: 2 additions & 3 deletions core/controllers/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ class LibraryPage(base.BaseHandler):
@acl_decorators.open_access
def get(self):
"""Handles GET requests."""

self.render_template('dist/library-page.mainpage.html')
self.render_template('library-page.mainpage.html')


class LibraryIndexHandler(base.BaseHandler):
Expand Down Expand Up @@ -150,7 +149,7 @@ def get(self):
self.user_id and
user_services.has_fully_registered(self.user_id)),
})
self.render_template('dist/library-page.mainpage.html')
self.render_template('library-page.mainpage.html')


class LibraryGroupIndexHandler(base.BaseHandler):
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/moderator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ModeratorPage(base.BaseHandler):
@acl_decorators.can_access_moderator_page
def get(self):
"""Handles GET requests."""
self.render_template('dist/moderator-page.mainpage.html')
self.render_template('moderator-page.mainpage.html')


class FeaturedActivitiesHandler(base.BaseHandler):
Expand Down
Loading

0 comments on commit b32c28d

Please sign in to comment.