Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into dist_2020-11
  • Loading branch information
cesine committed Feb 20, 2022
commit fb5b154d66db22174c633b01692792242e9bed60
1 change: 0 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"presets": ["es2015", "react"],
"env": {
"test": {
"plugins": [ "babel-plugin-rewire" ]
}
}
}
1 change: 1 addition & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
['last 2 versions']
19 changes: 8 additions & 11 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
{
"parser": "babel-eslint",
"extends": [
"standard",
"standard-react"
"eslint:recommended",
"plugin:mocha/recommended",
"plugin:react/recommended"
],
"plugins": [
"babel",
"react",
"promise"
"mocha",
"react"
],
"env": {
"mocha" : true
"mocha": true,
"node": true
},
"globals": {
"document": false,
"expect": false,
"navigator": false,
"sinon": false,
"window": false
"Symbol": false
},
"rules": {}
}
41 changes: 41 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run lint:es6
- run: npm run test:ci

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- run: npm run build:production
- run: npm run test
- run: npm run test:ci
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Mac:

```bash
$ brew install node
$ brew install yarn # optional, you can also use npm
```

Linux:
Expand All @@ -31,7 +30,7 @@ You can download node from http://nodejs.org
### Install dependancies

```
$ yarn install
$ npm install
```

## Configure
Expand All @@ -45,13 +44,13 @@ You can create a `config/local.js` file to point to the corpus service you want
To turn on the server:

```bash
$ yarn watch
$ npm run watch
```

To develop offline with fixture data:

```bash
$ OFFLINE=true yarn start --offline
$ OFFLINE=true npm start --offline
```

Then open https://localhost:3182 and accept the security certificate warning since you are developing locally with a self signed certificate.
Expand Down Expand Up @@ -126,7 +125,7 @@ Redux server side render is based on from [mz026](https://github.com/mz026/unive
- [Webpack](https://webpack.github.io/)@2.2
- [Babel](https://babeljs.io/)@6
- Express as isomorphic server
- `yarn` as package manager
- `npm` as package manager


### Testing:
Expand All @@ -152,25 +151,31 @@ To test your production build:

```bash
$ gulp build
$ NODE_ENV=production yarn start
$ NODE_ENV=production npm start
```

## Deployment:

To deploy this app to production environment:

- Run `$ NODE_ENV=production yarn install` on server
- After the installation above, `postinstall` script will run automatically, building front-end related assets and rev-ed server code under `dist/` folder.
- Run `$ NODE_ENV=development npm install` on server
- After the installation above, then run `$ npm run build:production` which will build the front-end related assets and rev-ed server code under `dist/` folder.

- Kick off the server with:

` NODE_ENV=production NODE_PATH=./dist/server-build node dist/server-build/server`
`$ npm run start:production`

- Once you're sure the server is operational, start the service with forever:

`$./start_service`

## Release History
* v1.62 activity heat map
* v1.72 display of terms of use and elastic search integration
* v3.19 refactored server.js into routes and updated express 2.x to 4.x

* v3.21.15 migrated public urls from jade to handlebars
* v5.4.21 migrated public urls from handlebars to react
* v5.168.15 upgraded to node 12

## License
Licensed under the Apache, 2.0 licenses.
4 changes: 3 additions & 1 deletion app/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global window, document */
import 'babel-polyfill'
import { browserHistory } from 'react-router'
import Immutable from 'immutable'
Expand All @@ -17,6 +18,7 @@ if (window.__REDUX_STATE__) {
reduxState[key] = Immutable.fromJS(val)
})
} catch (e) {
// eslint-disable-next-line no-console
console.error(e)
}
}
Expand All @@ -27,4 +29,4 @@ ReactDOM.render((
<Provider store={store}>
{ createRoutes(browserHistory) }
</Provider>
), document.getElementById('root'))
), document.getElementById('root'))
13 changes: 7 additions & 6 deletions app/components/App/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@ import { FieldDBObject } from 'fielddb/api/FieldDBObject'
import Helmet from 'react-helmet'
import Q from 'q'
import React, { Component } from 'react'
import PropTypes from 'prop-types'

FieldDBObject.todo = function () {}
FieldDBObject.warn = function () {}
FieldDBObject.confirm = function (message, optionalLocale) {
const deferred = Q.defer()
console.warn('Not confirming: ', message)
// console.warn('Not confirming: ', message)
deferred.reject({
message: message,
optionalLocale: optionalLocale,
response: null
})
return deferred.promise
}
FieldDBObject.prompt = function (message, optionalLocale, providedInput) {
FieldDBObject.prompt = function (message, optionalLocale) {
const deferred = Q.defer()
console.warn('Not prompting: ', message)
// console.warn('Not prompting: ', message)
deferred.reject({
message: message,
optionalLocale: optionalLocale,
Expand Down Expand Up @@ -47,18 +48,18 @@ class App extends Component {
htmlAttributes={{
'lang': 'en'
}}
/>
/>
{this.props.children}
</div>
)
}
}

App.propTypes = {
children: React.PropTypes.object.isRequired
children: PropTypes.object.isRequired
}

function mapStateToProps (state) {
function mapStateToProps () {
return {}
}

Expand Down
2 changes: 1 addition & 1 deletion app/components/App/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import CorpusMaskContainer from '../CorpusMask'
import UserMaskContainer from '../UserMask'
import SearchContainer from '../Search'

export default function (history) {
export default function Routes(history) {
return (
<Router history={history}>
<Route path='/' component={App}>
Expand Down
3 changes: 2 additions & 1 deletion app/components/App/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ const logger = createLogger({
level: 'info',
collapsed: false,
logger: console,
predicate: (getState, action) => true
predicate: () => true
})

let middlewares = [
thunkMiddleware,
apiMiddleware
]

// By default: debug all state changes if in development mode
if (process.env.NODE_ENV !== 'production') {
middlewares = [...middlewares, logger]
}
Expand Down
51 changes: 26 additions & 25 deletions app/components/Corpora/Corpora.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Link } from 'react-router'
import { List } from 'immutable'

Expand All @@ -8,38 +9,38 @@ class Corpora extends Component {
<div className={this.props.className}>
<h1>Corpora</h1>
{
this.props.corpora.map((connection) => {
let website = connection.get('website') || ''
if (connection.get('searchKeywords')) {
website = `${website}/search/${connection.get('searchKeywords')}`
} else {
website = `${website}/search`
}
return (
<div className='media' key={connection.get('dbname')}>
<Link to={website} className='pull-left'>
<img src={'https://secure.gravatar.com/avatar/' + connection.get('gravatar') + '.jpg?s=96&d=retro&r=pg'} alt='Corpus image' className='media-object' />
</Link>
<div className='media-body'>
<h4 className='media-heading'>
<Link to={website}>
{connection.get('title')}
this.props.corpora.map((connection) => {
let website = connection.get('website') || ''
if (connection.get('searchKeywords')) {
website = `${website}/search/${connection.get('searchKeywords')}`
} else {
website = `${website}/search`
}
return (
<div className='media' key={connection.get('dbname')}>
<Link to={website} className='pull-left'>
<img src={'https://secure.gravatar.com/avatar/' + connection.get('gravatar') + '.jpg?s=96&d=retro&r=pg'} alt='Corpus image' className='media-object' />
</Link>
</h4>
<p>{connection.get('description')}</p>
</div>
</div>
)
})
}
<div className='media-body'>
<h4 className='media-heading'>
<Link to={website}>
{connection.get('title')}
</Link>
</h4>
<p>{connection.get('description')}</p>
</div>
</div>
)
})
}
</div>
)
}
}

Corpora.propTypes = {
corpora: React.PropTypes.instanceOf(List).isRequired,
className: React.PropTypes.string.isRequired
corpora: PropTypes.instanceOf(List).isRequired,
className: PropTypes.string.isRequired
}

export default Corpora
13 changes: 8 additions & 5 deletions app/components/Corpora/Corpora.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { expect } from 'chai'
import Immutable from 'immutable'
import { Link } from 'react-router'
import React from 'react'
import { shallow } from 'enzyme'

import Corpora from './Corpora.jsx'

function renderDoc (props) {
return shallow(<Corpora {...props} />)
}

describe('Component::Corpora', function () {
let props
let props;

beforeEach(function () {
props = {
corpora: Immutable.fromJS([
Expand All @@ -27,12 +33,9 @@ describe('Component::Corpora', function () {
])
}
})
function renderDoc () {
return shallow(<Corpora {...props} />)
}

it('renders corpora', function () {
let doc = renderDoc()
let doc = renderDoc(props)
let corpusMaskComps = doc.find(Link)

expect(corpusMaskComps.length).to.equal(props.corpora.size * 2)
Expand Down
2 changes: 2 additions & 0 deletions app/components/Corpora/CorporaContainer.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { expect } from 'chai'
import Immutable from 'immutable'
import React from 'react'
import { shallow } from 'enzyme'
import sinon from 'sinon'

import Corpora from './Corpora.jsx'
import { CorpusMaskContainer } from './index.jsx'
Expand Down
1 change: 1 addition & 0 deletions app/components/Corpora/actions.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect } from 'chai'
import { CALL_API } from 'middleware/api'

import * as actionCreator from './actions'
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.