Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) Use react-scripts v2.0 #141

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 0 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"parser": "babel-eslint",
"extends": [
"react-app"
],
"env": {
"browser" : true
},
"globals": {},
"rules": {
"key-spacing" : "off",
"jsx-quotes" : [2, "prefer-single"],
Expand Down
39 changes: 16 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"@material-ui/core": "^3.1.0",
"@material-ui/icons": "^3.0.0",
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"chlu-api-client": "ChluNetwork/chlu-api-client-js#semver:~0.3.0",
"chlu-ipfs-support": "ChluNetwork/chlu-ipfs-support#semver:~0.2.5",
"chlu-marketplace-js": "ChluNetwork/chlu-marketplace-js#semver:~0.4.0",
Expand All @@ -33,7 +32,7 @@
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.9",
"react-scripts": "1.1.1",
"react-scripts": "2.0.5",
"react-select": "2.0.0",
"react-star-rating-component": "^1.3.0",
"react-swipeable-views": "^0.12.13",
Expand All @@ -48,36 +47,30 @@
"node-forge": "0.7.5"
},
"scripts": {
"start": "react-scripts start",
"xstart": "cross-env NODE_PATH=./src react-scripts start",
"build": "react-scripts build",
"prebuild": "cp webpack.config.prod.js node_modules/react-scripts/config",
"postbuild": "npx uglify-es build/static/js/main.*.js -o build/static/js/$(ls build/static/js | head -n 1)",
"start": "cross-env NODE_PATH=./src react-scripts start",
"build": "react-scripts --max_old_space_size=4092 build",
"deploy-s3": "npm run delete-source-maps && aws s3 sync build/ s3://demo.chlu.io --delete --exclude index.html --acl public-read && aws s3 sync build/ s3://demo.chlu.io --exclude '*' --include index.html --acl public-read --cache-control 'max-age=0'",
"deploy-ipfs": "npm run delete-source-maps && node ./deploy.js",
"delete-source-maps": "find ./build -name *.map -type f -delete",
"test": "react-scripts test --env=jsdom",
"analyze": "source-map-explorer",
"test": "react-scripts test",
"eject": "react-scripts eject",
"lint": "eslint ."
"lint": "eslint ./src"
},
"eslintConfig": {
"extends": "react-app"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"enzyme": "^2.9.1",
"enzyme-to-json": "^1.5.1",
"eslint": "^3.19.0",
"eslint-config-react-app": "^2.0.0",
"eslint-plugin-flowtype": "^2.33.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^5.0.1",
"eslint-plugin-react": "^7.0.1",
"immutability-helper": "^2.3.1",
"jest-enzyme": "^3.8.2",
"redux-mock-store": "^1.3.0"
},
"engines": {
"node": "^8.9.4"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"cross-env": "^5.2.0",
"source-map-explorer": "^1.6.0"
}
}
17 changes: 8 additions & 9 deletions src/helpers/chlu.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import ChluIPFS from 'chlu-ipfs-support'
import ChluAPIClient from 'chlu-api-client'

function getChluNetwork() {
const isProduction = process.env.NODE_ENV === 'production'
const defaultNetwork = isProduction ? ChluIPFS.networks.staging : ChluIPFS.networks.experimental
const defaultNetwork = isProduction ? 'staging' : 'experimental'
return process.env.REACT_APP_CHLU_NETWORK || defaultNetwork
}

Expand All @@ -18,6 +15,7 @@ export async function getChluIPFS() {
OrbitDBIndexName: 'NOOP'
}
if (!window.chluIpfs) {
const ChluIPFS = (await import('chlu-ipfs-support')).default
window.chluIpfs = new ChluIPFS(options)
// Resolve DIDs through the API Client. Needed for review publishing
window.chluIpfs.didIpfsHelper.getDID = (...args) => chluApiClient.didIpfsHelper.getDID(...args)
Expand All @@ -32,12 +30,13 @@ export async function getChluIPFS() {
}

export async function getChluAPIClient() {
const options = {
network: getChluNetwork(),
publishApiUrl: process.env.REACT_APP_CHLU_PUBLISH_URL || 'https://publish.chlu.io',
queryApiUrl: process.env.REACT_APP_CHLU_QUERY_URL || 'https://query.chlu.io'
}
if (!window.chluApiClient) {
const ChluAPIClient = (await import('chlu-api-client')).default
const options = {
network: getChluNetwork(),
publishApiUrl: process.env.REACT_APP_CHLU_PUBLISH_URL || 'https://publish.chlu.io',
queryApiUrl: process.env.REACT_APP_CHLU_QUERY_URL || 'https://query.chlu.io'
}
window.chluApiClient = new ChluAPIClient(options)
await window.chluApiClient.start()
}
Expand Down
6 changes: 1 addition & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import App from './containers/App';

// others
//import registerServiceWorker from './registerServiceWorker';
import { getChluAPIClient } from 'helpers/chlu';

ReactDOM.render(<App />, document.getElementById('root'));
//registerServiceWorker();

console.log('Chlu API Client Starting...')
getChluAPIClient().then(() => console.log('Chlu API Client READY'))
//registerServiceWorker();
Loading