Skip to content

Commit

Permalink
[Toolchain] Alias @artsy/reaction/dist to reaction
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi committed Feb 23, 2018
1 parent 3611ce3 commit 7282f4b
Show file tree
Hide file tree
Showing 37 changed files with 847 additions and 1,501 deletions.
7 changes: 5 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
"plugins": [
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-class-properties",
["relay", { "artifactDirectory": "/node_modules/@artsy/reaction-force/src/__generated__" }],
"relay",
"inline-react-svg",
["module-resolver", {
"extensions": [".js", ".jsx", ".ts", ".tsx"],
"root": ["./src"]
"root": ["./src"],
"alias": {
"reaction": "@artsy/reaction/dist/"
}
}],
"@babel/plugin-transform-typescript"
],
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@
"dependencies": {
"@artsy/express-reloadable": "^1.2.3",
"@artsy/passport": "^1.0.7",
"@artsy/reaction": "0.23.4",
"@artsy/reaction": "0.24.0",
"@artsy/stitch": "^1.3.1",
"@babel/core": "7.0.0-beta.39",
"@babel/node": "7.0.0-beta.39",
"@babel/plugin-proposal-class-properties": "7.0.0-beta.39",
"@babel/plugin-transform-runtime": "7.0.0-beta.39",
"@babel/core": "7.0.0-beta.40",
"@babel/node": "7.0.0-beta.40",
"@babel/plugin-proposal-class-properties": "7.0.0-beta.40",
"@babel/plugin-transform-runtime": "7.0.0-beta.40",
"@babel/polyfill": "^7.0.0-beta.40",
"@babel/preset-env": "7.0.0-beta.39",
"@babel/preset-es2015": "7.0.0-beta.39",
"@babel/preset-react": "7.0.0-beta.39",
"@babel/preset-stage-3": "7.0.0-beta.39",
"@babel/preset-typescript": "7.0.0-beta.39",
"@babel/register": "7.0.0-beta.39",
"@babel/runtime": "7.0.0-beta.39",
"@babel/template": "7.0.0-beta.39",
"@babel/types": "7.0.0-beta.39",
"@babel/preset-env": "7.0.0-beta.40",
"@babel/preset-es2015": "7.0.0-beta.40",
"@babel/preset-react": "7.0.0-beta.40",
"@babel/preset-stage-3": "7.0.0-beta.40",
"@babel/preset-typescript": "7.0.0-beta.40",
"@babel/register": "7.0.0-beta.40",
"@babel/runtime": "7.0.0-beta.40",
"@babel/template": "7.0.0-beta.40",
"@babel/types": "7.0.0-beta.40",
"accounting": "^0.4.1",
"analytics-node": "^2.4.0",
"annyang": "mzikherman/annyang",
Expand Down
8 changes: 4 additions & 4 deletions src/desktop/apps/armory_week/components/ArmoryWeekPage.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'
import styled, { ThemeProvider } from 'styled-components'

import colors from '@artsy/reaction/dist/Assets/Colors'
import { Row, Col } from '@artsy/reaction/dist/Components/Grid'
import Text from '@artsy/reaction/dist/Components/Text'
import Title from '@artsy/reaction/dist/Components/Title'
import colors from 'reaction/Assets/Colors'
import { Row, Col } from 'reaction/Components/Grid'
import Text from 'reaction/Components/Text'
import Title from 'reaction/Components/Title'

const Container = styled.div`
margin: 0 auto;
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/apps/armory_week/components/BannerPopUp.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import styled from 'styled-components'

import colors from '@artsy/reaction/dist/Assets/Colors'
import InvertedButton from '@artsy/reaction/dist/Components/Buttons/Inverted'
import colors from 'reaction/Assets/Colors'
import InvertedButton from 'reaction/Components/Buttons/Inverted'

import MarketingModal from '../../../components/marketing_signup_modal/index.coffee'

Expand Down
2 changes: 1 addition & 1 deletion src/desktop/apps/article/components/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types'
import React, { Fragment } from 'react'
import ReactDOM from 'react-dom'
import { Article } from '@artsy/reaction/dist/Components/Publishing'
import { Article } from 'reaction/Components/Publishing'
import ArticleLayout from './layouts/Article'
import { EditButton } from 'desktop/apps/article/components/EditButton'
import { hot } from 'react-hot-loader'
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/apps/article/components/InfiniteScrollArticle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import _ from 'underscore'
import PropTypes from 'prop-types'
import Waypoint from 'react-waypoint'
import styled from 'styled-components'
import colors from '@artsy/reaction/dist/Assets/Colors'
import colors from 'reaction/Assets/Colors'
import { data as sd } from 'sharify'
import { positronql as _positronql } from 'desktop/lib/positronql'
import { Article } from '@artsy/reaction-force/dist/Components/Publishing'
import { Article } from 'reaction/Components/Publishing'
import { articlesQuery } from 'desktop/apps/article/queries/articles'
import { setupFollows, setupFollowButtons } from './FollowButton.js'

Expand Down
25 changes: 17 additions & 8 deletions src/desktop/apps/article/components/__tests__/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ describe('<App />', () => {
benv.setup(() => {
benv.expose({
$: benv.require('jquery'),
jQuery: benv.require('jquery')
jQuery: benv.require('jquery'),
})
sd.APP_URL = 'http:https://artsy.net'
sd.CURRENT_PATH = '/article/artsy-editorial-surprising-reason-men-women-selfies-differently'
sd.CURRENT_PATH =
'/article/artsy-editorial-surprising-reason-men-women-selfies-differently'
sd.CURRENT_USER = { id: '123' }
done()
})
Expand All @@ -26,37 +27,45 @@ describe('<App />', () => {
return {
matches: false,
addListener: () => {},
removeListener: () => {}
removeListener: () => {},
}
}

const App = require('desktop/apps/article/components/App').default
const { Article, Fixtures } = require('@artsy/reaction/dist/Components/Publishing')
const { Article, Fixtures } = require('reaction/Components/Publishing')
const ArticleLayout = require('../layouts/Article').default

it('renders a standard article', () => {
const rendered = mount(<App article={Fixtures.StandardArticle} templates={{}} />)
const rendered = mount(
<App article={Fixtures.StandardArticle} templates={{}} />
)
rendered.find(Article).length.should.equal(1)
rendered.find(ArticleLayout).length.should.equal(1)
rendered.html().should.containEql('StandardLayout')
})

it('renders a feature article', () => {
const rendered = mount(<App article={Fixtures.FeatureArticle} templates={{}} />)
const rendered = mount(
<App article={Fixtures.FeatureArticle} templates={{}} />
)
rendered.find(Article).length.should.equal(1)
rendered.find(ArticleLayout).length.should.equal(1)
rendered.html().should.containEql('FeatureLayout')
})

it('renders a series article', () => {
const rendered = mount(<App article={Fixtures.SeriesArticle} templates={{}} />)
const rendered = mount(
<App article={Fixtures.SeriesArticle} templates={{}} />
)
rendered.find(Article).length.should.equal(1)
rendered.find(ArticleLayout).length.should.equal(0)
rendered.html().should.containEql('Series')
})

it('renders a video article', () => {
const rendered = mount(<App article={Fixtures.VideoArticle} templates={{}} />)
const rendered = mount(
<App article={Fixtures.VideoArticle} templates={{}} />
)
rendered.find(Article).length.should.equal(1)
rendered.find(ArticleLayout).length.should.equal(0)
rendered.html().should.containEql('Video')
Expand Down
66 changes: 35 additions & 31 deletions src/desktop/apps/article/components/__tests__/Article.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import { data as sd } from 'sharify'
describe('<Article />', () => {
before((done) => {
benv.setup(() => {
benv.expose({$: benv.require('jquery'), jQuery: benv.require('jquery')})
benv.expose({ $: benv.require('jquery'), jQuery: benv.require('jquery') })
sd.APP_URL = 'http:https://artsy.net'
sd.CURRENT_PATH = '/article/artsy-editorial-surprising-reason-men-women-selfies-differently'
sd.CURRENT_USER = {id: '123'}
sd.CURRENT_PATH =
'/article/artsy-editorial-surprising-reason-men-women-selfies-differently'
sd.CURRENT_USER = { id: '123' }
done()
})
})
Expand All @@ -26,23 +27,24 @@ describe('<Article />', () => {
return {
matches: false,
addListener: () => {},
removeListener: () => {}
removeListener: () => {},
}
}

const rewire = require('rewire')('../layouts/Article')
const ArticleLayout = rewire.default
const InfiniteScrollArticle = require('desktop/apps/article/components/InfiniteScrollArticle').default
const { Article } = require('@artsy/reaction/dist/Components/Publishing')
const InfiniteScrollArticle = require('desktop/apps/article/components/InfiniteScrollArticle')
.default
const { Article } = require('reaction/Components/Publishing')

it('renders a standard article', () => {
const article = _.extend({}, fixtures.article, {
layout: 'standard',
vertical: {
name: 'Art Market'
name: 'Art Market',
},
published_at: '2017-05-19T13:09:18.567Z',
contributing_authors: [{name: 'Kana'}]
contributing_authors: [{ name: 'Kana' }],
})
const rendered = mount(<ArticleLayout article={article} templates={{}} />)
rendered.find(InfiniteScrollArticle).length.should.equal(1)
Expand All @@ -53,10 +55,10 @@ describe('<Article />', () => {
const article = _.extend({}, fixtures.article, {
layout: 'feature',
vertical: {
name: 'Art Market'
name: 'Art Market',
},
published_at: '2017-05-19T13:09:18.567Z',
contributing_authors: [{name: 'Kana'}]
contributing_authors: [{ name: 'Kana' }],
})
const rendered = mount(<ArticleLayout article={article} templates={{}} />)
rendered.find(InfiniteScrollArticle).length.should.equal(1)
Expand All @@ -67,12 +69,14 @@ describe('<Article />', () => {
const article = _.extend({}, fixtures.article, {
layout: 'standard',
vertical: {
name: 'Art Market'
name: 'Art Market',
},
published_at: '2017-05-19T13:09:18.567Z',
contributing_authors: [{name: 'Kana'}]
contributing_authors: [{ name: 'Kana' }],
})
const rendered = mount(<ArticleLayout article={article} templates={{}} isSuper />)
const rendered = mount(
<ArticleLayout article={article} templates={{}} isSuper />
)
rendered.find(Article).length.should.equal(1)
rendered.find(InfiniteScrollArticle).length.should.equal(0)
})
Expand All @@ -81,12 +85,10 @@ describe('<Article />', () => {
const article = _.extend({}, fixtures.article, {
layout: 'standard',
vertical: {
name: 'Art Market'
name: 'Art Market',
},
contributing_authors: [{name: 'Kana'}],
relatedArticlesPanel: [
fixtures.article
]
contributing_authors: [{ name: 'Kana' }],
relatedArticlesPanel: [fixtures.article],
})
const rendered = mount(<ArticleLayout article={article} />)
const html = rendered.html()
Expand All @@ -98,11 +100,11 @@ describe('<Article />', () => {
const article = _.extend({}, fixtures.article, {
layout: 'feature',
vertical: {
name: 'Art Market'
name: 'Art Market',
},
published_at: '2017-05-19T13:09:18.567Z',
contributing_authors: [{name: 'Kana'}],
title: 'Super Article Title'
contributing_authors: [{ name: 'Kana' }],
title: 'Super Article Title',
})
const SuperArticleView = sinon.stub()
rewire.__set__('SuperArticleView', SuperArticleView)
Expand All @@ -112,38 +114,40 @@ describe('<Article />', () => {
article={article}
templates={{
SuperArticleFooter: 'sa-footer',
SuperArticleHeader: 'sa-header'
SuperArticleHeader: 'sa-header',
}}
/>
)
rendered.html().should.containEql('sa-footer')
rendered.html().should.containEql('sa-header')
SuperArticleView.called.should.be.true()
SuperArticleView.args[0][0].article.get('title').should.equal('Super Article Title')
SuperArticleView.args[0][0].article
.get('title')
.should.equal('Super Article Title')
})

it('renders a standard article with ads', () => {
const article = _.extend({}, fixtures.article, {
layout: 'standard',
vertical: {
name: 'Art Market'
name: 'Art Market',
},
published_at: '2017-05-19T13:09:18.567Z',
contributing_authors: [{name: 'Kana'}],
contributing_authors: [{ name: 'Kana' }],
display: {
name: 'Campaign 1',
panel: {
assets: [{ url: 'http:https://url.jpg' }],
headline: 'Ad Headline',
link: { url: 'http:https://link' }
link: { url: 'http:https://link' },
},
canvas: {
assets: [{ url: 'http:https://url.jpg' }],
headline: 'Ad Headline',
link: { url: 'http:https://link' },
layout: 'standard'
}
}
layout: 'standard',
},
},
})
const rendered = shallow(<ArticleLayout article={article} templates={{}} />)
const html = rendered.html()
Expand All @@ -158,10 +162,10 @@ describe('<Article />', () => {
const article = _.extend({}, fixtures.article, {
layout: 'standard',
vertical: {
name: 'Art Market'
name: 'Art Market',
},
published_at: '2017-05-19T13:09:18.567Z',
contributing_authors: [{name: 'Kana'}]
contributing_authors: [{ name: 'Kana' }],
})
const rendered = mount(<ArticleLayout article={article} templates={{}} />)
rendered.state().following.length.should.exist
Expand Down
Loading

0 comments on commit 7282f4b

Please sign in to comment.