Skip to content

Commit

Permalink
Make the npm run start:prod pass.
Browse files Browse the repository at this point in the history
also
- add react version to .eslintrc
- make dependency versioning in package.json consistent (^ => ~)
  • Loading branch information
mrkvon committed Dec 5, 2018
1 parent 5efdfa6 commit 68dece5
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 59 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ module.exports = {
extends: [
'plugin:react/recommended'
],
settings: {
react: {
version: '16.6'
}
},
rules: {
camelcase: 0,
'comma-dangle': [2, 'never'],
Expand Down
4 changes: 2 additions & 2 deletions config/webpack/entries/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function importComponents(r) {
r.keys().forEach(path => {
const Component = r(path).default;
const name = extractComponentNameFromPath(path);
if (name !== Component.name) {
if (name !== Component.name && process.env.NODE_ENV !== 'production') {
throw new Error(`Component filename and component name do not match: ${name || '<empty>'} vs ${Component.name || '<empty>'}`);
}
if (!Component.propTypes) {
Expand All @@ -44,7 +44,7 @@ function importComponents(r) {

angular
.module('trustroots')
.directive(lowercaseFirstLetter(Component.name), createDirective);
.directive(lowercaseFirstLetter(name), createDirective);

/* @ngInject */
function createDirective(reactDirective) {
Expand Down
16 changes: 5 additions & 11 deletions config/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = merge(shims, {
{
test: /\.js$/,
exclude: /node_modules/,
use: {
use: [{
loader: 'babel-loader',
options: {
presets: [
Expand All @@ -37,18 +37,12 @@ module.exports = merge(shims, {
['@babel/preset-react']
],
plugins: [
'@babel/plugin-proposal-object-rest-spread'
'@babel/plugin-proposal-object-rest-spread',
'angularjs-annotate'
]
}
}
},
...(isProduction ? [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'ng-annotate-loader?ngAnnotate=ng-annotate-patched'
}
] : [])
}]
}
]
},
plugins: [
Expand Down
8 changes: 1 addition & 7 deletions modules/core/client/services/photos.service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable angular/document-service,angular/window-service */

import angular from 'angular';

const photos = {
'bokeh': {
'name': 'Sandra', // "pinkorchid_too"
Expand Down Expand Up @@ -158,15 +156,11 @@ const photos = {
}
};

function getApplicationScope() {
return angular.element(document.querySelector('html')).scope();
}

export function selectPhoto(name) {
const photo = photos[name];
const file = (window.innerWidth <= 480 && photo.file_mobile) ? photo.file_mobile : photo.file;
const imageUrl = `/img/board/${file}`;
getApplicationScope().$emit('photoCreditsUpdated', { [name]: photo });

return {
imageUrl,
...photo
Expand Down
Loading

0 comments on commit 68dece5

Please sign in to comment.