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

(Refactor) Mobx state management #304

Merged
merged 81 commits into from
Nov 29, 2017
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
1ac9b73
(refactor) add mobx stores
Oct 1, 2017
6d3a129
Update store names and add decorator functionality
sdzharkov Oct 2, 2017
45a0e26
move scripts temporarily
sdzharkov Oct 2, 2017
348aebc
Ejected react-scripts to allow for personalized babel aditions
sdzharkov Oct 2, 2017
1d92adf
merge with previous branch
sdzharkov Oct 2, 2017
7b11c7f
Updated naming convention and incorporated stores into app
sdzharkov Oct 2, 2017
8a57f62
Further update naming and remove VScode related files
sdzharkov Oct 3, 2017
67df299
Minor stylistic changes
sdzharkov Oct 3, 2017
9b5aa13
Start of passing stores
sdzharkov Oct 3, 2017
d46f7d3
Update provider location and items
sdzharkov Oct 3, 2017
22b1be5
merge with master
sdzharkov Oct 3, 2017
77d815b
Update step one state
sdzharkov Oct 4, 2017
e75fadd
Merge with Upstream
sdzharkov Oct 4, 2017
139c1ec
Merge with master
sdzharkov Oct 4, 2017
95ea09c
Fix merge conflict
sdzharkov Oct 4, 2017
11aa1d4
Merge conflict with duplicate stores
sdzharkov Oct 4, 2017
944b5f2
Merge with Master
sdzharkov Oct 4, 2017
4878d48
Merge pull request #1 from sdzharkov/master
Oct 5, 2017
ea4d96c
Add useStrict
sdzharkov Oct 5, 2017
7ad719e
Fix spacing errors
sdzharkov Oct 5, 2017
74277cd
Merge pull request #2 from sdzharkov/Update-state
Oct 5, 2017
df5c72c
(refactor) add web3 to store
Oct 5, 2017
c3d2e2f
(merge) step one and Home
Oct 5, 2017
31aef8e
(fix) web3 util access
Oct 5, 2017
0e96473
Merge with parent
sdzharkov Oct 5, 2017
7069c80
(feature) add new stores, replace state.children and state.crowdsale
Oct 6, 2017
4e30a6f
Merge branch 'master' of https://github.com/oraclesorg/ico-wizard
Oct 6, 2017
5b66323
README: Change maxCap for tier from MetaMask
vbaranov Oct 6, 2017
7d5f453
Merge pull request #227 from vbaranov/bridge
vbaranov Oct 6, 2017
06faccd
Pull from parent master
sdzharkov Oct 6, 2017
7d3b379
Using computed values for step two
sdzharkov Oct 7, 2017
d66dcbd
Updated with store values
sdzharkov Oct 8, 2017
244c42a
Update README.md
igorbarinov Oct 8, 2017
5c017f4
Working version
sdzharkov Oct 11, 2017
682f36f
Clean up unnecessary code
sdzharkov Oct 11, 2017
db8ad2a
Delete unnecessary comments
sdzharkov Oct 11, 2017
6a0e3c0
Update sub
sdzharkov Oct 11, 2017
fd77114
Fix repeat values
sdzharkov Oct 11, 2017
933278f
Merge branch 'master' of https://github.com/15chrjef/ico-wizard
sdzharkov Oct 11, 2017
df16bc8
Merge branch 'updateStepTwo'
sdzharkov Oct 11, 2017
cd43c07
Fix spacing
sdzharkov Oct 11, 2017
869ee13
Merge pull request #3 from sdzharkov/master
Oct 12, 2017
3da2ef8
merge with master fixes
vbaranov Oct 12, 2017
663b079
update README for bridge: remove excessive steps
vbaranov Oct 12, 2017
19aea31
README bridge update
vbaranov Oct 12, 2017
cfcfa71
custom web3 module
vbaranov Oct 12, 2017
43f1813
Merge pull request #267 from vbaranov/bridge
vbaranov Oct 12, 2017
170dae1
Typos
vbaranov Oct 12, 2017
bf7ca35
Merge pull request #268 from vbaranov/bridge
vbaranov Oct 12, 2017
29de272
too many decimal places error fix
vbaranov Oct 16, 2017
8974cc0
Bridge + ICO Wizard readme use case update
vbaranov Oct 18, 2017
966e3dd
Merge pull request #279 from vbaranov/bridge
vbaranov Oct 18, 2017
99627a3
(integrate) mobx until step 4
Oct 18, 2017
4a8f47b
Add check for continue
sdzharkov Oct 20, 2017
4a03152
Fix indentation
sdzharkov Oct 20, 2017
42e5416
(integrate) mobx until step 4
Oct 18, 2017
fa2d234
Bridge: upstream from stage, Contract update: Deposit event for reser…
vbaranov Oct 23, 2017
39a31db
(Bridge): Important update to Bridge + ICO Wizard instruction to make…
vbaranov Oct 23, 2017
cdfefc1
Merge branch 'bridge' into bridge
vbaranov Oct 23, 2017
33e740a
Reserved tokens fix
vbaranov Oct 23, 2017
1137c3d
Merge branch 'bridge' of https://github.com/vbaranov/ico-wizard into …
vbaranov Oct 23, 2017
5063dd8
(feature) implement mobx including invest page
Oct 25, 2017
d349275
Merge with parent
sdzharkov Oct 25, 2017
265ad02
isBreakingCap fix, combine-solidity windows support
vbaranov Oct 26, 2017
b38c350
update with parent
sdzharkov Oct 26, 2017
f80c3df
fix merge mobx with old changes and render ***BUGS STILL HERE***
Oct 30, 2017
eec3a78
(fix) update web3 store and implementation on step 3
Oct 30, 2017
f4fd16a
fix wallet adress auto fill, work on deployment issue
Oct 30, 2017
bb13ccb
package.json update for mobx
vbaranov Oct 30, 2017
56318f1
mobx
vbaranov Oct 30, 2017
386c008
(fix) update package json
Oct 31, 2017
94838d0
fix the contract mobx deploy issue
Nov 1, 2017
f50499a
downloads txt file but throws error afterwards
Nov 1, 2017
9dbf1ea
deploy methods fixes
vbaranov Nov 1, 2017
6ac73a6
Merge fixes
vbaranov Nov 1, 2017
4c3b304
add package-lock.json
vbaranov Nov 1, 2017
9eea5ee
networkID fix
vbaranov Nov 1, 2017
8beed87
Merge pull request #5 from vbaranov/mobx
Nov 1, 2017
28e8bb1
(fix) update crowdsale and invest page to render and submit transacti…
Nov 2, 2017
c916e99
Merge with master
sdzharkov Nov 3, 2017
785bd57
Merge pull request #4 from sdzharkov/master
Nov 11, 2017
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
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": [
"es2015",
"stage-1",
"react"
],
"plugins": ["transform-decorators-legacy"]
}
144 changes: 144 additions & 0 deletions build_scripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
'use strict';

// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'production';
process.env.NODE_ENV = 'production';

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});

// Ensure environment variables are read.
require('../config/env');

const path = require('path');
const chalk = require('chalk');
const fs = require('fs-extra');
const webpack = require('webpack');
const config = require('../config/webpack.config.prod');
const paths = require('../config/paths');
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
const FileSizeReporter = require('react-dev-utils/FileSizeReporter');

const measureFileSizesBeforeBuild =
FileSizeReporter.measureFileSizesBeforeBuild;
const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
const useYarn = fs.existsSync(paths.yarnLockFile);

// These sizes are pretty large. We'll warn for bundles exceeding them.
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;

// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
process.exit(1);
}

// First, read the current file sizes in build directory.
// This lets us display how much they changed later.
measureFileSizesBeforeBuild(paths.appBuild)
.then(previousFileSizes => {
// Remove all content but keep the directory so that
// if you're in it, you don't end up in Trash
fs.emptyDirSync(paths.appBuild);
// Merge with the public folder
copyPublicFolder();
// Start the webpack build
return build(previousFileSizes);
})
.then(
({ stats, previousFileSizes, warnings }) => {
if (warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(warnings.join('\n\n'));
console.log(
'\nSearch for the ' +
chalk.underline(chalk.yellow('keywords')) +
' to learn more about each warning.'
);
console.log(
'To ignore, add ' +
chalk.cyan('// eslint-disable-next-line') +
' to the line before.\n'
);
} else {
console.log(chalk.green('Compiled successfully.\n'));
}

console.log('File sizes after gzip:\n');
printFileSizesAfterBuild(
stats,
previousFileSizes,
paths.appBuild,
WARN_AFTER_BUNDLE_GZIP_SIZE,
WARN_AFTER_CHUNK_GZIP_SIZE
);
console.log();

const appPackage = require(paths.appPackageJson);
const publicUrl = paths.publicUrl;
const publicPath = config.output.publicPath;
const buildFolder = path.relative(process.cwd(), paths.appBuild);
printHostingInstructions(
appPackage,
publicUrl,
publicPath,
buildFolder,
useYarn
);
},
err => {
console.log(chalk.red('Failed to compile.\n'));
console.log((err.message || err) + '\n');
process.exit(1);
}
);

// Create the production build and print the deployment instructions.
function build(previousFileSizes) {
console.log('Creating an optimized production build...');

let compiler = webpack(config);
return new Promise((resolve, reject) => {
compiler.run((err, stats) => {
if (err) {
return reject(err);
}
const messages = formatWebpackMessages(stats.toJson({}, true));
if (messages.errors.length) {
return reject(new Error(messages.errors.join('\n\n')));
}
if (
process.env.CI &&
(typeof process.env.CI !== 'string' ||
process.env.CI.toLowerCase() !== 'false') &&
messages.warnings.length
) {
console.log(
chalk.yellow(
'\nTreating warnings as errors because process.env.CI = true.\n' +
'Most CI servers set it automatically.\n'
)
);
return reject(new Error(messages.warnings.join('\n\n')));
}
return resolve({
stats,
previousFileSizes,
warnings: messages.warnings,
});
});
});
}

function copyPublicFolder() {
fs.copySync(paths.appPublic, paths.appBuild, {
dereference: true,
filter: file => file !== paths.appHtml,
});
}
92 changes: 92 additions & 0 deletions build_scripts/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
'use strict';

// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development';
process.env.NODE_ENV = 'development';

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});

// Ensure environment variables are read.
require('../config/env');

const fs = require('fs');
const chalk = require('chalk');
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const clearConsole = require('react-dev-utils/clearConsole');
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
const {
choosePort,
createCompiler,
prepareProxy,
prepareUrls,
} = require('react-dev-utils/WebpackDevServerUtils');
const openBrowser = require('react-dev-utils/openBrowser');
const paths = require('../config/paths');
const config = require('../config/webpack.config.dev');
const createDevServerConfig = require('../config/webpackDevServer.config');

const useYarn = fs.existsSync(paths.yarnLockFile);
const isInteractive = process.stdout.isTTY;

// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
process.exit(1);
}

// Tools like Cloud9 rely on this.
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
const HOST = process.env.HOST || '0.0.0.0';

// We attempt to use the default port but if it is busy, we offer the user to
// run on a different port. `detect()` Promise resolves to the next free port.
choosePort(HOST, DEFAULT_PORT)
.then(port => {
if (port == null) {
// We have not found a port.
return;
}
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
const appName = require(paths.appPackageJson).name;
const urls = prepareUrls(protocol, HOST, port);
// Create a webpack compiler that is configured with custom messages.
const compiler = createCompiler(webpack, config, appName, urls, useYarn);
// Load proxy config
const proxySetting = require(paths.appPackageJson).proxy;
const proxyConfig = prepareProxy(proxySetting, paths.appPublic);
// Serve webpack assets generated by the compiler over a web sever.
const serverConfig = createDevServerConfig(
proxyConfig,
urls.lanUrlForConfig
);
const devServer = new WebpackDevServer(compiler, serverConfig);
// Launch WebpackDevServer.
devServer.listen(port, HOST, err => {
if (err) {
return console.log(err);
}
if (isInteractive) {
clearConsole();
}
console.log(chalk.cyan('Starting the development server...\n'));
openBrowser(urls.localUrlForBrowser);
});

['SIGINT', 'SIGTERM'].forEach(function(sig) {
process.on(sig, function() {
devServer.close();
process.exit();
});
});
})
.catch(err => {
if (err && err.message) {
console.log(err.message);
}
process.exit(1);
});
27 changes: 27 additions & 0 deletions build_scripts/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'test';
process.env.NODE_ENV = 'test';
process.env.PUBLIC_URL = '';

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});

// Ensure environment variables are read.
require('../config/env');

const jest = require('jest');
const argv = process.argv.slice(2);

// Watch unless on CI or in coverage mode
if (!process.env.CI && argv.indexOf('--coverage') < 0) {
argv.push('--watch');
}


jest.run(argv);
90 changes: 90 additions & 0 deletions config/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
'use strict';

const fs = require('fs');
const path = require('path');
const paths = require('./paths');

// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve('./paths')];

const NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV) {
throw new Error(
'The NODE_ENV environment variable is required but was not specified.'
);
}

// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
var dotenvFiles = [
`${paths.dotenv}.${NODE_ENV}.local`,
`${paths.dotenv}.${NODE_ENV}`,
// Don't include `.env.local` for `test` environment
// since normally you expect tests to produce the same
// results for everyone
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
paths.dotenv,
].filter(Boolean);

// Load environment variables from .env* files. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables
// that have already been set.
// https://github.com/motdotla/dotenv
dotenvFiles.forEach(dotenvFile => {
if (fs.existsSync(dotenvFile)) {
require('dotenv').config({
path: dotenvFile,
});
}
});

// We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos:
// https://github.com/facebookincubator/create-react-app/issues/253.
// It works similar to `NODE_PATH` in Node itself:
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
// We also resolve them to make sure all tools using them work consistently.
const appDirectory = fs.realpathSync(process.cwd());
process.env.NODE_PATH = (process.env.NODE_PATH || '')
.split(path.delimiter)
.filter(folder => folder && !path.isAbsolute(folder))
.map(folder => path.resolve(appDirectory, folder))
.join(path.delimiter);

// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
// injected into the application via DefinePlugin in Webpack configuration.
const REACT_APP = /^REACT_APP_/i;

function getClientEnvironment(publicUrl) {
const raw = Object.keys(process.env)
.filter(key => REACT_APP.test(key))
.reduce(
(env, key) => {
env[key] = process.env[key];
return env;
},
{
// Useful for determining whether we’re running in production mode.
// Most importantly, it switches React into the correct mode.
NODE_ENV: process.env.NODE_ENV || 'development',
// Useful for resolving the correct path to static assets in `public`.
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
// This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths.
PUBLIC_URL: publicUrl,
}
);
// Stringify all values so we can feed into Webpack DefinePlugin
const stringified = {
'process.env': Object.keys(raw).reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
return env;
}, {}),
};

return { raw, stringified };
}

module.exports = getClientEnvironment;
14 changes: 14 additions & 0 deletions config/jest/cssTransform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

// This is a custom Jest transformer turning style imports into empty objects.
// http://facebook.github.io/jest/docs/tutorial-webpack.html

module.exports = {
process() {
return 'module.exports = {};';
},
getCacheKey() {
// The output is always the same.
return 'cssTransform';
},
};
12 changes: 12 additions & 0 deletions config/jest/fileTransform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

const path = require('path');

// This is a custom Jest transformer turning file imports into filenames.
// http://facebook.github.io/jest/docs/tutorial-webpack.html

module.exports = {
process(src, filename) {
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
},
};
Loading