Simplify canvas-planner’s build & export es modules
Test plan: * the stuff in canvas-planner/lib should be es modules * you should see a bunch of /* harmony import */ comments in the File that is built by canvas’s webpack when it pulls it in * you should no longer see those warnings about "duplicate module" something something "from copy_of_what_gets_published_to_npm" in your jest specs anymore. Change-Id: I055ad8a7ca3520e233b0a33bceebdee7a3559c11 Reviewed-on: https://gerrit.instructure.com/165326 Tested-by: Jenkins Reviewed-by: Dan Minkevitch <dan@instructure.com> Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com> QA-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
parent
815f776e24
commit
31a05a6142
|
@ -22,7 +22,7 @@ if (env === 'test') {
|
|||
presets: [[ require('@instructure/ui-presets/babel'), {
|
||||
themeable: true,
|
||||
coverage: false,
|
||||
esModules: Boolean(process.env.ES_MODULES)
|
||||
esModules: true
|
||||
}]]
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,11 +13,9 @@
|
|||
"lint-staged": "lint-staged",
|
||||
"lint": "eslint src/",
|
||||
"lint:fix": "eslint src/ --fix",
|
||||
"build": "./scripts/build",
|
||||
"build:canvas": "./scripts/build",
|
||||
"build:dev": "NODE_ENV=development BABEL_ENV=production babel src --out-dir lib --ignore spec.js,test.js,demo.js --quiet",
|
||||
"build:lib": "BABEL_ENV=production babel src --out-dir lib --ignore spec.js,test.js,demo.js --quiet",
|
||||
"build:es": "BABEL_ENV=production ES_MODULES=1 babel src --out-dir es --ignore spec.js,test.js,demo.js --quiet",
|
||||
"build": "BABEL_ENV=production babel src --out-dir lib --ignore '**/__tests__' --quiet",
|
||||
"build:canvas": "yarn build",
|
||||
"build:dev": "NODE_ENV=development BABEL_ENV=production babel src --out-dir lib --ignore '**/__tests__' --quiet",
|
||||
"build:watch": "yarn run build:dev --watch",
|
||||
"test": "jest",
|
||||
"test:coverage": "jest --coverage",
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo '############################################################'
|
||||
echo '# Building fully Babelified CommonJS version of the module #'
|
||||
echo '############################################################'
|
||||
yarn run build:lib
|
||||
|
||||
# Commenting this out for now since canvas only actually uses the CJS version.
|
||||
# echo '############################################################'
|
||||
# echo '# Building fully Babelified ES version of the module #'
|
||||
# echo '############################################################'
|
||||
# yarn run build:es
|
||||
|
||||
# Package it in a clean folder canvas can consume.
|
||||
# This is because if we just link to it like
|
||||
# "canvas-planner": "file:./packages/canvas-planner",
|
||||
# in Canvas's package.json, it will copy _everything_ in this dir to
|
||||
# <canvas>/node_modules/canvas-planner
|
||||
# including everything in canvas-planner's node_modules directory. By publishing
|
||||
# to a clean folder with just the files we we would have published to npm,
|
||||
# it mimic's the same behavior as if we were getting it from the registry.
|
||||
rm -rf copy-of-what-gets-published-to-npm-registry
|
||||
mkdir -p copy-of-what-gets-published-to-npm-registry
|
||||
cp -r config lib README.md package.json copy-of-what-gets-published-to-npm-registry
|
|
@ -38,7 +38,7 @@ import StickyButton from '../StickyButton';
|
|||
import { isFutureEmpty } from '../../utilities/statusUtils';
|
||||
|
||||
import {
|
||||
addDay, savePlannerItem, deletePlannerItem, cancelEditingPlannerItem, openEditingPlannerItem, getNextOpportunities,
|
||||
savePlannerItem, deletePlannerItem, cancelEditingPlannerItem, openEditingPlannerItem, getNextOpportunities,
|
||||
getInitialOpportunities, dismissOpportunity, clearUpdateTodo, startLoadingGradesSaga, scrollToToday,
|
||||
scrollToNewActivity
|
||||
} from '../../actions';
|
||||
|
@ -55,7 +55,6 @@ export class PlannerHeader extends Component {
|
|||
|
||||
static propTypes = {
|
||||
courses: PropTypes.arrayOf(PropTypes.shape(courseShape)).isRequired,
|
||||
addDay: PropTypes.func,
|
||||
savePlannerItem: PropTypes.func.isRequired,
|
||||
deletePlannerItem: PropTypes.func.isRequired,
|
||||
cancelEditingPlannerItem: PropTypes.func,
|
||||
|
@ -179,9 +178,9 @@ export class PlannerHeader extends Component {
|
|||
|
||||
// segregate new and dismissed opportunities
|
||||
segregateOpportunities (opportunities) {
|
||||
const newOpportunities = [];
|
||||
const newOpportunities = [];
|
||||
const dismissedOpportunities = [];
|
||||
|
||||
|
||||
opportunities.items.forEach(opportunity => {
|
||||
if (opportunity.planner_override && opportunity.planner_override.dismissed) {
|
||||
dismissedOpportunities.push(opportunity)
|
||||
|
@ -462,7 +461,7 @@ export const NotifierPlannerHeader = notifier(ThemedPlannerHeader);
|
|||
const mapStateToProps = ({opportunities, loading, courses, todo, days, timeZone, ui, firstNewActivityDate}) =>
|
||||
({opportunities, loading, courses, todo, days, timeZone, ui, firstNewActivityDate});
|
||||
const mapDispatchToProps = {
|
||||
addDay, savePlannerItem, deletePlannerItem, cancelEditingPlannerItem, openEditingPlannerItem,
|
||||
savePlannerItem, deletePlannerItem, cancelEditingPlannerItem, openEditingPlannerItem,
|
||||
getInitialOpportunities, getNextOpportunities, dismissOpportunity, clearUpdateTodo,
|
||||
startLoadingGradesSaga, scrollToToday, scrollToNewActivity
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue