parent
34fdb6f2d4
commit
9d1e3cb82a
@ -0,0 +1,59 @@ |
||||
{ |
||||
"name": "docviewer", |
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json", |
||||
"sourceRoot": "apps/docviewer/src", |
||||
"projectType": "application", |
||||
"implicitDependencies": [ |
||||
], |
||||
"targets": { |
||||
"build": { |
||||
"executor": "@nrwl/webpack:webpack", |
||||
"outputs": ["{options.outputPath}"], |
||||
"defaultConfiguration": "development", |
||||
"options": { |
||||
"compiler": "babel", |
||||
"outputPath": "dist/apps/docviewer", |
||||
"index": "apps/docviewer/src/index.html", |
||||
"baseHref": "/", |
||||
"main": "apps/docviewer/src/main.tsx", |
||||
"tsConfig": "apps/docviewer/tsconfig.app.json", |
||||
"assets": [ |
||||
"apps/docviewer/src/favicon.ico" |
||||
], |
||||
"styles": [], |
||||
"scripts": [], |
||||
"webpackConfig": "apps/docviewer/webpack.config.js" |
||||
}, |
||||
"configurations": { |
||||
"development": { |
||||
}, |
||||
"production": { |
||||
"fileReplacements": [ |
||||
{ |
||||
"replace": "apps/docviewer/src/environments/environment.ts", |
||||
"with": "apps/docviewer/src/environments/environment.prod.ts" |
||||
} |
||||
] |
||||
} |
||||
} |
||||
}, |
||||
"serve": { |
||||
"executor": "@nrwl/webpack:dev-server", |
||||
"defaultConfiguration": "development", |
||||
"options": { |
||||
"buildTarget": "docviewer:build", |
||||
"hmr": true |
||||
}, |
||||
"configurations": { |
||||
"development": { |
||||
"buildTarget": "docviewer:build:development", |
||||
"port": 7003 |
||||
}, |
||||
"production": { |
||||
"buildTarget": "docviewer:build:production" |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"tags": [] |
||||
} |
@ -0,0 +1,11 @@ |
||||
|
||||
export default function App() { |
||||
return ( |
||||
<> |
||||
<h1>Documentation Viewer</h1> |
||||
<p> |
||||
Show documentation of compiled contracts. |
||||
</p> |
||||
</> |
||||
) |
||||
} |
After Width: | Height: | Size: 3.1 KiB |
@ -0,0 +1,14 @@ |
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="utf-8" /> |
||||
<title>Doc Viewer</title> |
||||
<base href="/" /> |
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" /> |
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" /> |
||||
</head> |
||||
<body> |
||||
<div id="root"></div> |
||||
</body> |
||||
</html> |
@ -0,0 +1,10 @@ |
||||
import React from 'react' |
||||
import ReactDOM from 'react-dom' |
||||
import App from './app/App' |
||||
|
||||
ReactDOM.render( |
||||
<React.StrictMode> |
||||
<App /> |
||||
</React.StrictMode>, |
||||
document.getElementById("root") |
||||
); |
@ -0,0 +1,23 @@ |
||||
{ |
||||
"extends": "./tsconfig.json", |
||||
"compilerOptions": { |
||||
"outDir": "../../dist/out-tsc", |
||||
"types": ["node"] |
||||
}, |
||||
"files": [ |
||||
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts", |
||||
"../../node_modules/@nrwl/react/typings/image.d.ts" |
||||
], |
||||
"exclude": [ |
||||
"jest.config.ts", |
||||
"**/*.spec.ts", |
||||
"**/*.test.ts", |
||||
"**/*.spec.tsx", |
||||
"**/*.test.tsx", |
||||
"**/*.spec.js", |
||||
"**/*.test.js", |
||||
"**/*.spec.jsx", |
||||
"**/*.test.jsx" |
||||
], |
||||
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] |
||||
} |
@ -0,0 +1,16 @@ |
||||
{ |
||||
"extends": "../../tsconfig.base.json", |
||||
"compilerOptions": { |
||||
"jsx": "react-jsx", |
||||
"allowJs": true, |
||||
"esModuleInterop": true, |
||||
"allowSyntheticDefaultImports": true |
||||
}, |
||||
"files": [], |
||||
"include": [], |
||||
"references": [ |
||||
{ |
||||
"path": "./tsconfig.app.json" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,85 @@ |
||||
const { composePlugins, withNx } = require('@nrwl/webpack') |
||||
const { withReact } = require('@nrwl/react') |
||||
const webpack = require('webpack') |
||||
const TerserPlugin = require("terser-webpack-plugin") |
||||
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin") |
||||
|
||||
// Nx plugins for webpack.
|
||||
module.exports = composePlugins(withNx(), withReact(), (config) => { |
||||
// Update the webpack config as needed here.
|
||||
// e.g. `config.plugins.push(new MyPlugin())`
|
||||
|
||||
// add fallback for node modules
|
||||
config.resolve.fallback = { |
||||
...config.resolve.fallback, |
||||
"crypto": require.resolve("crypto-browserify"), |
||||
"stream": require.resolve("stream-browserify"), |
||||
"path": require.resolve("path-browserify"), |
||||
"http": require.resolve("stream-http"), |
||||
"https": require.resolve("https-browserify"), |
||||
"constants": require.resolve("constants-browserify"), |
||||
"os": false, //require.resolve("os-browserify/browser"),
|
||||
"timers": false, // require.resolve("timers-browserify"),
|
||||
"zlib": require.resolve("browserify-zlib"), |
||||
"fs": false, |
||||
"module": false, |
||||
"tls": false, |
||||
"net": false, |
||||
"readline": false, |
||||
"child_process": false, |
||||
"buffer": require.resolve("buffer/"), |
||||
"vm": require.resolve('vm-browserify'), |
||||
} |
||||
|
||||
// add externals
|
||||
config.externals = { |
||||
...config.externals, |
||||
solc: 'solc', |
||||
} |
||||
|
||||
// add public path
|
||||
config.output.publicPath = '/' |
||||
|
||||
|
||||
|
||||
// add copy & provide plugin
|
||||
config.plugins.push( |
||||
new webpack.ProvidePlugin({ |
||||
Buffer: ['buffer', 'Buffer'], |
||||
url: ['url', 'URL'], |
||||
process: 'process/browser', |
||||
}), |
||||
new webpack.DefinePlugin({ |
||||
|
||||
}), |
||||
) |
||||
|
||||
// souce-map loader
|
||||
config.module.rules.push({ |
||||
test: /\.js$/, |
||||
use: ["source-map-loader"], |
||||
enforce: "pre" |
||||
}) |
||||
|
||||
config.ignoreWarnings = [/Failed to parse source map/] // ignore source-map-loader warnings
|
||||
|
||||
|
||||
// set minimizer
|
||||
config.optimization.minimizer = [ |
||||
new TerserPlugin({ |
||||
parallel: true, |
||||
terserOptions: { |
||||
ecma: 2015, |
||||
compress: false, |
||||
mangle: false, |
||||
format: { |
||||
comments: false, |
||||
}, |
||||
}, |
||||
extractComments: false, |
||||
}), |
||||
new CssMinimizerPlugin(), |
||||
]; |
||||
|
||||
return config; |
||||
}); |
@ -1,20 +0,0 @@ |
||||
import React from "react"; |
||||
import { PluginClient } from "@remixproject/plugin"; |
||||
import { PluginApi, Api } from "@remixproject/plugin-utils"; |
||||
import { IRemixApi } from "@remixproject/plugin-api"; |
||||
|
||||
import { ContractName, Documentation, PublishedSite } from "../types"; |
||||
|
||||
export const AppContext = React.createContext({ |
||||
clientInstance: {} as PluginApi<Readonly<IRemixApi>> & |
||||
PluginClient<Api, Readonly<IRemixApi>>, |
||||
contracts: new Map<ContractName, Documentation>(), |
||||
setContracts: (contracts: Map<ContractName, Documentation>) => { |
||||
console.log("Calling Set Contract Names"); |
||||
}, |
||||
sites: [], |
||||
setSites: (sites: PublishedSite[]) => { |
||||
console.log("Calling Set Sites"); |
||||
}, |
||||
themeType: "dark", |
||||
}); |
@ -1,24 +0,0 @@ |
||||
import React from "react"; |
||||
import { |
||||
BrowserRouter as Router, |
||||
Route, |
||||
RouteProps, |
||||
} from "react-router-dom"; |
||||
|
||||
|
||||
|
||||
interface Props extends RouteProps { |
||||
component: any; // TODO: new (props: any) => React.Component
|
||||
from: string; |
||||
} |
||||
|
||||
const CustomRoute = ({ component: Component, ...rest }: Props) => { |
||||
return ( |
||||
<></> |
||||
); |
||||
}; |
||||
|
||||
export const Routes = () => ( |
||||
<Router> |
||||
</Router> |
||||
); |
Loading…
Reference in new issue