diff --git a/apps/docviewer/project.json b/apps/docviewer/project.json new file mode 100644 index 0000000000..58fc9f5675 --- /dev/null +++ b/apps/docviewer/project.json @@ -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": [] +} diff --git a/apps/docviewer/src/app/App.tsx b/apps/docviewer/src/app/App.tsx new file mode 100644 index 0000000000..c99255bc0f --- /dev/null +++ b/apps/docviewer/src/app/App.tsx @@ -0,0 +1,11 @@ + +export default function App() { + return ( + <> +

Documentation Viewer

+

+ Show documentation of compiled contracts. +

+ + ) +} \ No newline at end of file diff --git a/apps/docviewer/src/favicon.ico b/apps/docviewer/src/favicon.ico new file mode 100644 index 0000000000..bcd5dfd67c Binary files /dev/null and b/apps/docviewer/src/favicon.ico differ diff --git a/apps/docviewer/src/index.html b/apps/docviewer/src/index.html new file mode 100644 index 0000000000..7fd033d57e --- /dev/null +++ b/apps/docviewer/src/index.html @@ -0,0 +1,14 @@ + + + + + Doc Viewer + + + + + + +
+ + diff --git a/apps/docviewer/src/main.tsx b/apps/docviewer/src/main.tsx new file mode 100644 index 0000000000..7b8dd49ee6 --- /dev/null +++ b/apps/docviewer/src/main.tsx @@ -0,0 +1,10 @@ +import React from 'react' +import ReactDOM from 'react-dom' +import App from './app/App' + +ReactDOM.render( + + + , + document.getElementById("root") +); diff --git a/apps/docviewer/tsconfig.app.json b/apps/docviewer/tsconfig.app.json new file mode 100644 index 0000000000..af84f21cfc --- /dev/null +++ b/apps/docviewer/tsconfig.app.json @@ -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"] +} diff --git a/apps/docviewer/tsconfig.json b/apps/docviewer/tsconfig.json new file mode 100644 index 0000000000..5aab5e7911 --- /dev/null +++ b/apps/docviewer/tsconfig.json @@ -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" + } + ] +} diff --git a/apps/docviewer/webpack.config.js b/apps/docviewer/webpack.config.js new file mode 100644 index 0000000000..3cd446f615 --- /dev/null +++ b/apps/docviewer/webpack.config.js @@ -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; +}); diff --git a/apps/remixdocgen/src/app/AppContext.tsx b/apps/remixdocgen/src/app/AppContext.tsx deleted file mode 100644 index 612ac7af9a..0000000000 --- a/apps/remixdocgen/src/app/AppContext.tsx +++ /dev/null @@ -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> & - PluginClient>, - contracts: new Map(), - setContracts: (contracts: Map) => { - console.log("Calling Set Contract Names"); - }, - sites: [], - setSites: (sites: PublishedSite[]) => { - console.log("Calling Set Sites"); - }, - themeType: "dark", -}); diff --git a/apps/remixdocgen/src/app/routes.tsx b/apps/remixdocgen/src/app/routes.tsx deleted file mode 100644 index b16eae3a9e..0000000000 --- a/apps/remixdocgen/src/app/routes.tsx +++ /dev/null @@ -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 = () => ( - - -);