From 83bad3d47b812a3235447d87a1d335c84ffc0809 Mon Sep 17 00:00:00 2001 From: Adam Butterworth Date: Mon, 30 Sep 2019 14:33:06 -0400 Subject: [PATCH] feat: repurpose as open edx footer (#46) * feat: simplify prop api and bake in many values * feat: refactor build and dev server BREAKING CHANGE: The footer is now transpiled from es6 preserving modules. To use this package in a project it must now be transpiled by the requiring project via webpack or other configuration * feat: make this the open edx footer BREAKING CHANGE: This footer now serves as the Open edX footer. For the edX footer see edx/frontend-component-footer-edx on github --- .babelrc | 28 - .eslintrc.json | 19 - .gitignore | 1 + .travis.yml | 9 +- Makefile | 8 + README.rst | 31 +- babel.config.js | 35 + config/webpack.common.config.js | 15 - config/webpack.dev.config.js | 115 - config/webpack.prod.config.js | 71 - example/index.jsx | 25 + example/index.scss | 2 + jest.config.js | 7 + openedx.yaml | 8 + package-lock.json | 29068 ++++++---------- package.json | 85 +- public/index.html | 6 +- src/_footer.scss | 5 + src/components/Footer.jsx | 95 + src/components/Footer.messages.js | 156 + src/components/Footer.test.jsx | 82 + src/components/LanguageSelector.jsx | 59 + .../__snapshots__/Footer.test.jsx.snap | 136 + src/edx-footer.png | Bin 3091 -> 0 bytes src/edx-openedx-logo-tag.png | Bin 0 -> 12801 bytes src/index.js | 5 + src/index.jsx | 183 - src/index.scss | 4 - .../components/SiteFooter/SiteFooter.test.jsx | 348 - .../__snapshots__/SiteFooter.test.jsx.snap | 1503 - src/lib/components/SiteFooter/index.jsx | 265 - src/lib/index.js | 3 - src/lib/scss/_site-footer.scss | 165 - src/{tests => }/setupTest.js | 0 webpack.dev.config.js | 10 + 35 files changed, 11428 insertions(+), 21124 deletions(-) delete mode 100644 .babelrc delete mode 100644 .eslintrc.json create mode 100644 babel.config.js delete mode 100755 config/webpack.common.config.js delete mode 100755 config/webpack.dev.config.js delete mode 100755 config/webpack.prod.config.js create mode 100644 example/index.jsx create mode 100644 example/index.scss create mode 100644 jest.config.js create mode 100644 openedx.yaml create mode 100644 src/_footer.scss create mode 100644 src/components/Footer.jsx create mode 100644 src/components/Footer.messages.js create mode 100644 src/components/Footer.test.jsx create mode 100644 src/components/LanguageSelector.jsx create mode 100644 src/components/__snapshots__/Footer.test.jsx.snap delete mode 100644 src/edx-footer.png create mode 100644 src/edx-openedx-logo-tag.png create mode 100644 src/index.js delete mode 100644 src/index.jsx delete mode 100644 src/index.scss delete mode 100644 src/lib/components/SiteFooter/SiteFooter.test.jsx delete mode 100644 src/lib/components/SiteFooter/__snapshots__/SiteFooter.test.jsx.snap delete mode 100644 src/lib/components/SiteFooter/index.jsx delete mode 100644 src/lib/index.js delete mode 100644 src/lib/scss/_site-footer.scss rename src/{tests => }/setupTest.js (100%) create mode 100644 webpack.dev.config.js diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 57fa6c53e..000000000 --- a/.babelrc +++ /dev/null @@ -1,28 +0,0 @@ -{ - "presets": [ - ["env", { - "targets": { - "browsers": ["last 2 versions", "ie 11"] - } - }], - "babel-preset-react" - ], - "plugins": [ - "transform-object-rest-spread" - ], - "env": { - "test": { - "plugins": [ - "rewire" - ] - }, - "i18n": { - "plugins": [ - ["react-intl", { - "messagesDir": "./temp/babel-plugin-react-intl", - "moduleSourceName": "@edx/frontend-i18n" - }] - ] - } - } -} diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 4f5bcab24..000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "eslint-config-edx", - "rules": { - "import/no-extraneous-dependencies": [ - "error", - { - "devDependencies": [ - "webpack.config.js", - "src/tests/setupTest.js", - "**/*.test.jsx", - "**/*.test.js" - ] - } - ] - }, - "env": { - "jest": true - } -} diff --git a/.gitignore b/.gitignore index 32a85901b..cc6369994 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store coverage dist node_modules diff --git a/.travis.yml b/.travis.yml index 3dd90c1e3..d2b3bd62c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,5 @@ language: node_js -node_js: - - 8 -cache: - directories: - - "~/.npm" +node_js: 12 install: - npm install script: @@ -11,9 +7,8 @@ script: - npm run i18n_extract - npm run test - npm run build - - npm run is-es5 after_success: - - npm run travis-deploy-once "npm run semantic-release" + - npx semantic-release - npm run coveralls env: global: diff --git a/Makefile b/Makefile index 43a03ec78..0ebb4fc7c 100755 --- a/Makefile +++ b/Makefile @@ -10,6 +10,14 @@ tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transi # This directory must match .babelrc . transifex_temp = ./temp/babel-plugin-react-intl +build: + rm -rf ./dist + ./node_modules/.bin/fedx-scripts babel src --out-dir dist --source-maps --ignore **/*.test.jsx,**/__mocks__,**/__snapshots__,**/setupTest.js --copy-files + @# --copy-files will bring in everything else that wasn't processed by babel. Remove what we don't want. + @rm -rf dist/**/*.test.jsx + @rm -rf dist/**/__snapshots__ + @rm -rf dist/__mocks__ + requirements: npm install diff --git a/README.rst b/README.rst index f9c9fa601..80d4ab246 100644 --- a/README.rst +++ b/README.rst @@ -5,9 +5,7 @@ frontend-component-footer |semantic-release| frontend-component-footer is a library containing a site footer -component for use when building edX frontend applications. - -At this time, this component is hard-coded to match the legacy LMS site footer, including all of its links. As implemented, this component should probably be called the ``frontend-component-lms-footer``. +component for use when building Open edX frontend applications. Usage ----- @@ -16,9 +14,30 @@ To install frontend-component-footer into your project:: npm i --save @edx/frontend-component-footer -The component expects properties specifying the various URLs that are -linked in the footer. See the sample app in `src/index.jsx `__ for an example -of how the SiteFooter component can be specified. +Component Usage:: + + import Footer from '@edx/frontend-component-footer'; + import footerMessages from '@edx/frontend-component-footer/src/i18n/index'; + + ... + +