aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-tools-pages/ts/pages/compiler.tsx
diff options
context:
space:
mode:
authorFabio B <kandinsky454@protonmail.ch>2019-01-09 23:22:59 +0800
committerGitHub <noreply@github.com>2019-01-09 23:22:59 +0800
commit08d0ff48c3bfdb6277d9b80169bdb66f75e55fbb (patch)
treec2def4f4295f3bf5d61ceef51aa659feb73ef814 /packages/dev-tools-pages/ts/pages/compiler.tsx
parentaa5af04447dfae24731557c6beead55bd8ff99a9 (diff)
parent39786c3ad53c1579c4f22bd19f519589b9646287 (diff)
downloaddexon-sol-tools-08d0ff48c3bfdb6277d9b80169bdb66f75e55fbb.tar
dexon-sol-tools-08d0ff48c3bfdb6277d9b80169bdb66f75e55fbb.tar.gz
dexon-sol-tools-08d0ff48c3bfdb6277d9b80169bdb66f75e55fbb.tar.bz2
dexon-sol-tools-08d0ff48c3bfdb6277d9b80169bdb66f75e55fbb.tar.lz
dexon-sol-tools-08d0ff48c3bfdb6277d9b80169bdb66f75e55fbb.tar.xz
dexon-sol-tools-08d0ff48c3bfdb6277d9b80169bdb66f75e55fbb.tar.zst
dexon-sol-tools-08d0ff48c3bfdb6277d9b80169bdb66f75e55fbb.zip
Merge pull request #1249 from bakkenbaeck/dev-tools-pages
Dev tools pages
Diffstat (limited to 'packages/dev-tools-pages/ts/pages/compiler.tsx')
-rw-r--r--packages/dev-tools-pages/ts/pages/compiler.tsx170
1 files changed, 170 insertions, 0 deletions
diff --git a/packages/dev-tools-pages/ts/pages/compiler.tsx b/packages/dev-tools-pages/ts/pages/compiler.tsx
new file mode 100644
index 000000000..93a667562
--- /dev/null
+++ b/packages/dev-tools-pages/ts/pages/compiler.tsx
@@ -0,0 +1,170 @@
+import * as React from 'react';
+import { hydrate, render } from 'react-dom';
+import * as Loadable from 'react-loadable';
+
+import { context } from 'ts/context/compiler';
+
+import { Base } from 'ts/components/base';
+import { Breakout } from 'ts/components/breakout';
+import { Code } from 'ts/components/code';
+import { Compiler as CompilerComponent } from 'ts/components/compiler';
+import { Content } from 'ts/components/content';
+import { ContentBlock } from 'ts/components/content-block';
+import { Hero } from 'ts/components/hero';
+import { InlineCode } from 'ts/components/inline-code';
+import { Lead } from 'ts/components/typography';
+
+const Animation = Loadable({
+ loader: () => System.import(/* webpackChunkName: 'compiler-animation' */ 'ts/components/animations/compiler'),
+ loading: () => <div />,
+ delay: 1000,
+ render(loadable: { CompilerAnimation: any }): React.ReactNode {
+ const Component = loadable.CompilerAnimation;
+ return <Component />;
+ },
+});
+
+const Compiler: React.StatelessComponent<{}> = () => (
+ <Base context={context}>
+ <Hero>
+ <Animation />
+ </Hero>
+ <CompilerComponent />
+ <Content>
+ <ContentBlock main={true} title="Get started" />
+ <ContentBlock title="Install">
+ <Breakout>
+ <Code canCopy={true}>npm install @0x/sol-compiler --g</Code>
+ </Breakout>
+ </ContentBlock>
+
+ <ContentBlock title="Run">
+ <Breakout>
+ <Code>cd /your_project_dir && sol-compiler</Code>
+ </Breakout>
+ </ContentBlock>
+
+ <ContentBlock title="Configure">
+ <p>
+ Configure via a <InlineCode>compiler.json</InlineCode> file.
+ </p>
+ <Breakout>
+ <Code>mkdir compiler.json</Code>
+ </Breakout>
+ <p>Example of settings:</p>
+ <Breakout>
+ <Code language="json">
+ {`{
+ "contractsDir": "contracts",
+ "artifactsDir": "artifacts",
+ "contracts": "*",
+ "compilerSettings": {
+ "optimizer": { "enabled": false },
+ "outputSelection": {
+ "*": {
+ "*": ["abi", "evm.bytecode.object"]
+ }
+ }
+ }
+}`}
+ </Code>
+ </Breakout>
+ </ContentBlock>
+ </Content>
+ <Content dark={true}>
+ <ContentBlock main={true} title="Artifacts">
+ <Lead>
+ Sol compiler uses solidity standard JSON output format for the artifacts. This way, you can define
+ which parts of the artifact you need.
+ </Lead>
+ </ContentBlock>
+
+ <ContentBlock title="Production">
+ <p>
+ Sol compiler uses solidity standard JSON output format for the artifacts. This way, you can define
+ which parts of the artifact you need.
+ </p>
+ <Breakout>
+ <Code isLight={true} language="json" isEtc={true}>
+ {`{
+ "compilerSettings": {
+ "outputSelection": {
+ "*": {
+ "*": ["abi"]
+ }
+ }
+ }
+}`}
+ </Code>
+ </Breakout>
+ <Breakout>
+ <Code isLight={true} language="json" isEtc={true}>
+ {`{
+ "compilerOutput": {
+ "abi": [...],
+ },
+}`}
+ </Code>
+ </Breakout>
+ </ContentBlock>
+ <ContentBlock title="Development">
+ <p>
+ Sometimes you need to use some debuggers or other dev tools and you’ll need more info in the
+ artifact.
+ </p>
+ <Breakout>
+ <Code isLight={true} language="json" isEtc={true}>
+ {`{
+ "compilerSettings": {
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+}`}
+ </Code>
+ </Breakout>
+
+ <Breakout>
+ <Code isLight={true} language="json" isEtc={true}>
+ {`{
+ "compilerOutput": {
+ "abi": [...],
+ "evm": {
+ "bytecode": {
+ "object": "0xdeadbeef",
+ "sourceMap": "26:480:..."
+ },
+ "deployedBytecode": {
+ "object": "0xdeadbeef",
+ "sourceMap": "26:480:0..."
+ }
+ }
+ }
+ "sources": {
+ "Migrations.sol": {
+ "id": 0
+ }
+ },
+}`}
+ </Code>
+ </Breakout>
+ </ContentBlock>
+ </Content>
+ </Base>
+);
+
+const root = document.getElementById('app');
+
+if (root.hasChildNodes()) {
+ hydrate(<Compiler />, root);
+} else {
+ render(<Compiler />, root);
+}