diff --git a/.circleci/config.yml b/.circleci/config.yml index 9c3a936536..7df04afe44 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,7 +44,6 @@ jobs: build-plugin: docker: - image: cimg/node:14.17.6-browsers - resource_class: xlarge working_directory: ~/remix-project @@ -61,7 +60,7 @@ jobs: key: v1-deps-{{ checksum "yarn.lock" }} paths: - node_modules - - run: yarn build << parameters.plugin >> + - run: yarn nx build << parameters.plugin >> --configuration=production - run: mkdir persist && zip -0 -r persist/plugin-<< parameters.plugin >>.zip dist - persist_to_workspace: root: . @@ -281,7 +280,7 @@ workflows: - build-plugin: matrix: parameters: - plugin: ["etherscan", "vyper", "plugin_api"] + plugin: ["plugin_api"] - lint: requires: - build @@ -294,15 +293,11 @@ workflows: matrix: alias: plugins parameters: - plugin: ["etherscan", "vyper", "plugin_api"] + plugin: ["plugin_api"] parallelism: [1, 9] exclude: - plugin: plugin_api parallelism: 1 - - plugin: etherscan - parallelism: 9 - - plugin: vyper - parallelism: 9 - remix-ide-browser: requires: diff --git a/apps/doc-gen/project.json b/apps/doc-gen/project.json index 51d9d63212..4b997606a5 100644 --- a/apps/doc-gen/project.json +++ b/apps/doc-gen/project.json @@ -14,11 +14,12 @@ "compiler": "babel", "outputPath": "dist/apps/doc-gen", "index": "apps/doc-gen/src/index.html", - "baseHref": "/", + "baseHref": "./", "main": "apps/doc-gen/src/main.tsx", "tsConfig": "apps/doc-gen/tsconfig.app.json", "assets": [ - "apps/doc-gen/src/favicon.ico" + "apps/doc-gen/src/favicon.ico", + "apps/doc-gen/src/profile.json" ], "styles": [], "scripts": [], @@ -42,7 +43,8 @@ "defaultConfiguration": "development", "options": { "buildTarget": "doc-gen:build", - "hmr": true + "hmr": true, + "baseHref": "/" }, "configurations": { "development": { diff --git a/apps/doc-gen/src/app/docgen-client.ts b/apps/doc-gen/src/app/docgen-client.ts index 76d702c6b4..c7df22a81c 100644 --- a/apps/doc-gen/src/app/docgen-client.ts +++ b/apps/doc-gen/src/app/docgen-client.ts @@ -18,7 +18,7 @@ export class DocGenClient extends PluginClient { constructor() { super() this.eventEmitter = new EventEmitter() - this.methods = ['generateDocs', 'opendDocs'] + this.methods = ['generateDocs', 'openDocs'] createClient(this) this.onload().then(async () => { await this.setListeners() @@ -65,10 +65,10 @@ export class DocGenClient extends PluginClient { this.eventEmitter.emit('docsGenerated', docs) this.emit('docgen' as any, 'docsGenerated', docs) this.docs = docs - await this.opendDocs(docs) + await this.openDocs(docs) } - async opendDocs(docs: string[]) { + async openDocs(docs: string[]) { await this.call('manager', 'activatePlugin', 'doc-viewer') await this.call('tabs' as any, 'focus', 'doc-viewer') await this.call('doc-viewer' as any, 'viewDocs', docs) diff --git a/apps/doc-gen/src/app/docgen/templates.ts b/apps/doc-gen/src/app/docgen/templates.ts index cee8f12c75..b83d0ac77d 100644 --- a/apps/doc-gen/src/app/docgen/templates.ts +++ b/apps/doc-gen/src/app/docgen/templates.ts @@ -1,7 +1,21 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ import { mapKeys } from './utils/map-keys'; import { DocItemContext } from './site'; import * as defaultProperties from './common/properties'; +import * as themeHelpers from './themes/markdown/helpers' + +const common = require('./themes/markdown/common.hbs'); +const contract = require('./themes/markdown/contract.hbs'); +const enum_ = require('./themes/markdown/enum.hbs'); +const error = require('./themes/markdown/error.hbs'); +const event = require('./themes/markdown/event.hbs'); +const function_ = require('./themes/markdown/function.hbs'); +const modifier = require('./themes/markdown/modifier.hbs'); +const page = require('./themes/markdown/page.hbs'); +const struct = require('./themes/markdown/struct.hbs'); +const variable = require('./themes/markdown/variable.hbs'); +const userDefinedValueType = require('./themes/markdown/user-defined-value-type.hbs'); export type PropertyGetter = (ctx: DocItemContext, original?: unknown) => unknown; export type Properties = Record; @@ -55,23 +69,29 @@ export async function readTemplates(): Promise> { async function readPartials() { const partials: NonNullable = {}; - const partialNames = ["common", "contract", "enum", "error", "event", "function", "modifier", "page", "struct", "variable", "user-defined-value-type"] - for (const name of partialNames) { - const p = await import('raw-loader!./themes/markdown/' + name + '.hbs') - partials[name] = () => p.default - } + + partials["common"] = () => common + partials["contract"] = () => contract + partials["enum"] = () => enum_ + partials["error"] = () => error + partials["event"] = () => event + partials["function"] = () => function_ + partials["modifier"] = () => modifier + partials["page"] = () => page + partials["struct"] = () => struct + partials["variable"] = () => variable + partials["user-defined-value-type"] = () => userDefinedValueType + return partials; } async function readHelpers(name: string) { - let helpersPath; - const h = await import('./themes/markdown/helpers'); const helpers: Record any> = {}; - for (const name in h) { - if (typeof h[name] === 'function') { - helpers[name] = h[name]; + for (const name in themeHelpers) { + if (typeof themeHelpers[name] === 'function') { + helpers[name] = themeHelpers[name]; } } diff --git a/apps/doc-gen/src/profile.json b/apps/doc-gen/src/profile.json new file mode 100644 index 0000000000..d73a2eb1c3 --- /dev/null +++ b/apps/doc-gen/src/profile.json @@ -0,0 +1,17 @@ +{ + "name": "doc-gen", + "displayName": "Docgen - Documentation Generator", + "description": "Generate Solidity documentation (as md)", + "version": "0.1.0", + "events": [], + "methods": ["generateDocs", "openDocs"], + "kind": "none", + "icon": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaGVpZ2h0PSIxMDI0IiB3aWR0aD0iMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNOTUwLjE1NCAxOTJINzMuODQ2QzMzLjEyNyAxOTIgMCAyMjUuMTI2OTk5OTk5OTk5OTUgMCAyNjUuODQ2djQ5Mi4zMDhDMCA3OTguODc1IDMzLjEyNyA4MzIgNzMuODQ2IDgzMmg4NzYuMzA4YzQwLjcyMSAwIDczLjg0Ni0zMy4xMjUgNzMuODQ2LTczLjg0NlYyNjUuODQ2QzEwMjQgMjI1LjEyNjk5OTk5OTk5OTk1IDk5MC44NzUgMTkyIDk1MC4xNTQgMTkyek01NzYgNzAzLjg3NUw0NDggNzA0VjUxMmwtOTYgMTIzLjA3N0wyNTYgNTEydjE5MkgxMjhWMzIwaDEyOGw5NiAxMjggOTYtMTI4IDEyOC0wLjEyNVY3MDMuODc1ek03NjcuMDkxIDczNS44NzVMNjA4IDUxMmg5NlYzMjBoMTI4djE5Mmg5Nkw3NjcuMDkxIDczNS44NzV6Ii8+PC9zdmc+", + "location": "sidePanel", + "documentation": "", + "repo": "https://github.com/ethereum/remix-project/", + "maintainedBy": "", + "authorContact": "", + "url": "", + "targets":["remix"] +} \ No newline at end of file diff --git a/apps/doc-gen/webpack.config.js b/apps/doc-gen/webpack.config.js index 7b3d088f05..b7f8e45da0 100644 --- a/apps/doc-gen/webpack.config.js +++ b/apps/doc-gen/webpack.config.js @@ -12,23 +12,8 @@ module.exports = composePlugins(withNx(), withReact(), (config) => { // 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 @@ -37,6 +22,12 @@ module.exports = composePlugins(withNx(), withReact(), (config) => { solc: 'solc', } + config.module.rules.push({ + test: /\.hbs$/, + type: 'asset/source' + }) + + // add public path config.output.publicPath = '/' diff --git a/apps/doc-viewer/project.json b/apps/doc-viewer/project.json index 5ea04be27e..2e5455cc30 100644 --- a/apps/doc-viewer/project.json +++ b/apps/doc-viewer/project.json @@ -14,11 +14,12 @@ "compiler": "babel", "outputPath": "dist/apps/doc-viewer", "index": "apps/doc-viewer/src/index.html", - "baseHref": "/", + "baseHref": "./", "main": "apps/doc-viewer/src/main.tsx", "tsConfig": "apps/doc-viewer/tsconfig.app.json", "assets": [ - "apps/doc-viewer/src/favicon.ico" + "apps/doc-viewer/src/favicon.ico", + "apps/doc-viewer/src/profile.json" ], "styles": [], "scripts": [], @@ -42,7 +43,8 @@ "defaultConfiguration": "development", "options": { "buildTarget": "doc-viewer:build", - "hmr": true + "hmr": true, + "baseHref": "/" }, "configurations": { "development": { diff --git a/apps/doc-viewer/src/profile.json b/apps/doc-viewer/src/profile.json new file mode 100644 index 0000000000..64cf3dc5a5 --- /dev/null +++ b/apps/doc-viewer/src/profile.json @@ -0,0 +1,16 @@ +{ + "name": "doc-viewer", + "displayName": "Docgen Viewer", + "description": "Visualize Solidity documentation from Docgen Plugin", + "version": "0.1.0", + "events": [], + "methods": ["viewDoc"], + "kind": "none", + "icon": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaGVpZ2h0PSIxMDI0IiB3aWR0aD0iMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNOTUwLjE1NCAxOTJINzMuODQ2QzMzLjEyNyAxOTIgMCAyMjUuMTI2OTk5OTk5OTk5OTUgMCAyNjUuODQ2djQ5Mi4zMDhDMCA3OTguODc1IDMzLjEyNyA4MzIgNzMuODQ2IDgzMmg4NzYuMzA4YzQwLjcyMSAwIDczLjg0Ni0zMy4xMjUgNzMuODQ2LTczLjg0NlYyNjUuODQ2QzEwMjQgMjI1LjEyNjk5OTk5OTk5OTk1IDk5MC44NzUgMTkyIDk1MC4xNTQgMTkyek01NzYgNzAzLjg3NUw0NDggNzA0VjUxMmwtOTYgMTIzLjA3N0wyNTYgNTEydjE5MkgxMjhWMzIwaDEyOGw5NiAxMjggOTYtMTI4IDEyOC0wLjEyNVY3MDMuODc1ek03NjcuMDkxIDczNS44NzVMNjA4IDUxMmg5NlYzMjBoMTI4djE5Mmg5Nkw3NjcuMDkxIDczNS44NzV6Ii8+PC9zdmc+", + "location": "mainPanel", + "url": "", + "documentation": "https://remix-plugins.readthedocs.io/en/latest/", + "repo": "https://github.com/Machinalabs/remix-ethdoc-plugin/", + "maintainedBy": "Remix", + "authorContact": "remix@ethereum.org" +} \ No newline at end of file diff --git a/apps/doc-viewer/webpack.config.js b/apps/doc-viewer/webpack.config.js index 7b3d088f05..1a460e3da0 100644 --- a/apps/doc-viewer/webpack.config.js +++ b/apps/doc-viewer/webpack.config.js @@ -9,28 +9,6 @@ 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, diff --git a/apps/etherscan/project.json b/apps/etherscan/project.json index 583cd8792a..fe53c7f39e 100644 --- a/apps/etherscan/project.json +++ b/apps/etherscan/project.json @@ -12,13 +12,14 @@ "compiler": "babel", "outputPath": "dist/apps/etherscan", "index": "apps/etherscan/src/index.html", - "baseHref": "/", + "baseHref": "./", "main": "apps/etherscan/src/main.tsx", "polyfills": "apps/etherscan/src/polyfills.ts", "tsConfig": "apps/etherscan/tsconfig.app.json", "assets": [ "apps/etherscan/src/favicon.ico", - "apps/etherscan/src/assets" + "apps/etherscan/src/assets", + "apps/etherscan/src/profile.json" ], "styles": ["apps/etherscan/src/styles.css"], "scripts": [], @@ -42,7 +43,8 @@ "defaultConfiguration": "development", "options": { "buildTarget": "etherscan:build", - "hmr": true + "hmr": true, + "baseHref": "/" }, "configurations": { "development": { diff --git a/apps/etherscan/src/index.html b/apps/etherscan/src/index.html index b58279cb25..66244f0a04 100644 --- a/apps/etherscan/src/index.html +++ b/apps/etherscan/src/index.html @@ -3,7 +3,7 @@ Etherscan - + diff --git a/apps/etherscan/src/profile.json b/apps/etherscan/src/profile.json new file mode 100644 index 0000000000..a15f25009d --- /dev/null +++ b/apps/etherscan/src/profile.json @@ -0,0 +1,16 @@ +{ + "name": "etherscan", + "displayName": "Etherscan - Contract verification", + "description": "Verify Solidity contract code using Etherscan API", + "version": "0.1.0", + "events": [], + "methods": ["verify", "receiptStatus"], + "kind": "none", + "icon": "data:image/png;base64,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", + "location": "sidePanel", + "url": "https://ipfs-cluster.ethdevops.io/ipfs/QmQsZbBSYCVBVpz2mVRbPRVTrcz59oJEpuuoxiT9otu3mh", + "repo": "https://github.com/ethereum/remix-project/tree/master/apps/etherscan", + "documentation": "https://remix-etherscan-plugin.readthedocs.io/en/latest", + "maintainedBy": "Remix", + "authorContact": "remix@ethereum.org" +} \ No newline at end of file diff --git a/apps/remix-ide-e2e/src/tests/etherscan_api.ts b/apps/remix-ide-e2e/src/tests/etherscan_api.test.ts similarity index 98% rename from apps/remix-ide-e2e/src/tests/etherscan_api.ts rename to apps/remix-ide-e2e/src/tests/etherscan_api.test.ts index 33009f2101..65cafd3b81 100644 --- a/apps/remix-ide-e2e/src/tests/etherscan_api.ts +++ b/apps/remix-ide-e2e/src/tests/etherscan_api.test.ts @@ -9,7 +9,7 @@ declare global { module.exports = { '@disabled': true, before: function (browser: NightwatchBrowser, done: VoidFunction) { - init(browser, done, null, true, { name: 'etherscan', url: 'http://127.0.0.1:9999'}) + init(browser, done, null) }, 'Should load etherscan plugin #group1': function (browser: NightwatchBrowser) { diff --git a/apps/remix-ide-e2e/src/tests/vyper_api.ts b/apps/remix-ide-e2e/src/tests/vyper_api.test.ts similarity index 96% rename from apps/remix-ide-e2e/src/tests/vyper_api.ts rename to apps/remix-ide-e2e/src/tests/vyper_api.test.ts index 1dc8000f51..67dd5afb1f 100644 --- a/apps/remix-ide-e2e/src/tests/vyper_api.ts +++ b/apps/remix-ide-e2e/src/tests/vyper_api.test.ts @@ -9,7 +9,7 @@ declare global { module.exports = { '@disabled': true, before: function (browser: NightwatchBrowser, done: VoidFunction) { - init(browser, done, null, true, { name: 'vyper', url: 'http://127.0.0.1:9999'}) + init(browser, done) }, 'Should connect to vyper plugin #group1': function (browser: NightwatchBrowser) { diff --git a/apps/remix-ide/project.json b/apps/remix-ide/project.json index e118e366a7..4e413240ee 100644 --- a/apps/remix-ide/project.json +++ b/apps/remix-ide/project.json @@ -3,8 +3,7 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "apps/remix-ide/src", "projectType": "application", - "implicitDependencies": [ - ], + "implicitDependencies": ["doc-gen", "doc-viewer", "etherscan", "vyper"], "targets": { "build": { "executor": "@nrwl/webpack:webpack", @@ -47,7 +46,7 @@ "executor": "@nrwl/webpack:dev-server", "defaultConfiguration": "development", "options": { - "buildTarget": "remix-ide:build", + "buildTarget": "remix-ide:build" }, "configurations": { diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 59a13e819b..ab5c6be766 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -9,12 +9,14 @@ const requiredModules = [ // services + layout views + system views 'manager', 'config', 'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'editor', 'offsetToLineColumnConverter', 'network', 'theme', 'locale', 'fileManager', 'contentImport', 'blockchain', 'web3Provider', 'scriptRunner', 'fetchAndCompile', 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons', 'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity', 'solidity-logic', 'gistHandler', 'layout', - 'notification', 'permissionhandler', 'walkthrough', 'storage', 'restorebackupzip', 'link-libraries', 'deploy-libraries', 'openzeppelin-proxy', + 'notification', 'permissionhandler', 'walkthrough', 'storage', 'restorebackupzip', 'link-libraries', 'deploy-libraries', 'openzeppelin-proxy', 'hardhat-provider', 'ganache-provider', 'foundry-provider', 'basic-http-provider', 'injected', 'injected-trustwallet', 'injected-optimism-provider', 'injected-arbitrum-one-provider', 'vm-custom-fork', 'vm-goerli-fork', 'vm-mainnet-fork', 'vm-sepolia-fork', 'vm-merge', 'vm-london', 'vm-berlin', - 'compileAndRun', 'search', 'recorder', 'fileDecorator', 'codeParser', 'codeFormatter', 'solidityumlgen', 'contractflattener', 'doc-gen', 'doc-viewer', 'solidity-script'] + 'compileAndRun', 'search', 'recorder', 'fileDecorator', 'codeParser', 'codeFormatter', 'solidityumlgen', 'contractflattener', 'solidity-script'] // dependentModules shouldn't be manually activated (e.g hardhat is activated by remixd) -const dependentModules = ['foundry', 'hardhat', 'truffle', 'slither'] +const dependentModules = ['foundry', 'hardhat', 'truffle', 'slither'] + +const loadLocalPlugins = ["doc-gen", "doc-viewer", "etherscan", "vyper"] const sensitiveCalls = { 'fileManager': ['writeFile', 'copyFile', 'rename', 'copyDir'], @@ -24,9 +26,9 @@ const sensitiveCalls = { export function isNative(name) { // nativePlugin allows to bypass the permission request - const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'solidity-logic', 'solidityStaticAnalysis', 'solidityUnitTesting', + const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity', 'solidity-logic', 'solidityStaticAnalysis', 'solidityUnitTesting', 'layout', 'notification', 'hardhat-provider', 'ganache-provider', 'foundry-provider', 'basic-http-provider', 'injected-optimism-provider', - 'tabs', 'injected-arbitrum-one-provider', 'injected'] + 'tabs', 'injected-arbitrum-one-provider', 'injected', 'doc-gen', 'doc-viewer'] return nativePlugins.includes(name) || requiredModules.includes(name) } @@ -149,7 +151,24 @@ export class RemixAppManager extends PluginManager { } const testPluginName = localStorage.getItem('test-plugin-name') const testPluginUrl = localStorage.getItem('test-plugin-url') - return plugins.map(plugin => { + + for (let plugin of loadLocalPlugins) { + // fetch the profile from the local plugin + try { + const profile = await fetch(`plugins/${plugin}/profile.json`) + const profileJson = await profile.json() + // remove duplicates + plugins = plugins.filter((p) => p.name !== profileJson.name && p.displayName !== profileJson.displayName) + // change url + profileJson.url = `plugins/${plugin}/index.html` + // add the local plugin + plugins.push(profileJson) + } catch (e) { + console.log(e) + } + } + + return plugins.map(plugin => { if (plugin.name === testPluginName) plugin.url = testPluginUrl return new IframePlugin(plugin) }) diff --git a/apps/remix-ide/webpack.config.js b/apps/remix-ide/webpack.config.js index 1705f29d32..1843eb3a6b 100644 --- a/apps/remix-ide/webpack.config.js +++ b/apps/remix-ide/webpack.config.js @@ -15,6 +15,23 @@ const versionData = { fs.writeFileSync('./apps/remix-ide/src/assets/version.json', JSON.stringify(versionData)) +const project = fs.readFileSync('./apps/remix-ide/project.json', 'utf8') + +const implicitDependencies = JSON.parse(project).implicitDependencies + +const copyPatterns = implicitDependencies.map((dep) => { + try { + fs.statSync(__dirname + `/../../dist/apps/${dep}`).isDirectory() + return { from: `../../dist/apps/${dep}`, to: `plugins/${dep}` } + } + catch (e) { + console.log('error', e) + return false + } +}) + +console.log('Copying plugins... ', copyPatterns) + // Nx plugins for webpack. module.exports = composePlugins(withNx(), withReact(), (config) => { // Update the webpack config as needed here. @@ -41,7 +58,7 @@ module.exports = composePlugins(withNx(), withReact(), (config) => { "buffer": require.resolve("buffer/"), "vm": require.resolve('vm-browserify'), } - + // add externals config.externals = { @@ -60,7 +77,8 @@ module.exports = composePlugins(withNx(), withReact(), (config) => { config.plugins.push( new CopyPlugin({ patterns: [ - { from: '../../node_modules/monaco-editor/min/vs', to: 'assets/js/monaco-editor/min/vs' } + { from: '../../node_modules/monaco-editor/min/vs', to: 'assets/js/monaco-editor/min/vs' }, + ...copyPatterns ].filter(Boolean) }), new webpack.ProvidePlugin({ @@ -77,7 +95,7 @@ module.exports = composePlugins(withNx(), withReact(), (config) => { enforce: "pre" }) - config.ignoreWarnings = [/Failed to parse source map/, /require function/ ] // ignore source-map-loader warnings & AST warnings + config.ignoreWarnings = [/Failed to parse source map/, /require function/] // ignore source-map-loader warnings & AST warnings // set minimizer config.optimization.minimizer = [ diff --git a/apps/vyper/project.json b/apps/vyper/project.json index 659a85cc29..543c0873fd 100644 --- a/apps/vyper/project.json +++ b/apps/vyper/project.json @@ -12,13 +12,14 @@ "compiler": "babel", "outputPath": "dist/apps/vyper", "index": "apps/vyper/src/index.html", - "baseHref": "/", + "baseHref": "./", "main": "apps/vyper/src/main.tsx", "polyfills": "apps/vyper/src/polyfills.ts", "tsConfig": "apps/vyper/tsconfig.app.json", "assets": [ "apps/vyper/src/favicon.ico", - "apps/vyper/src/assets" + "apps/vyper/src/assets", + "apps/vyper/src/profile.json" ], "styles": ["apps/vyper/src/styles.css"], "scripts": [], @@ -42,7 +43,8 @@ "defaultConfiguration": "development", "options": { "buildTarget": "vyper:build", - "hmr": true + "hmr": true, + "baseHref": "/" }, "configurations": { "development": { diff --git a/apps/vyper/src/app/app.tsx b/apps/vyper/src/app/app.tsx index ad91f29c3f..e5f9d80159 100644 --- a/apps/vyper/src/app/app.tsx +++ b/apps/vyper/src/app/app.tsx @@ -12,7 +12,6 @@ import ToggleButtonGroup from 'react-bootstrap/ToggleButtonGroup' import ToggleButton from 'react-bootstrap/ToggleButton' import Button from 'react-bootstrap/Button' -import vyperLogo from './logo.svg' import './app.css' interface AppState { @@ -71,7 +70,7 @@ const App: React.FC = () => {
- Vyper logo + Vyper logo

yper Compiler

Vyper - + diff --git a/apps/vyper/src/profile.json b/apps/vyper/src/profile.json new file mode 100644 index 0000000000..2c953d0f13 --- /dev/null +++ b/apps/vyper/src/profile.json @@ -0,0 +1,14 @@ +{ + "name": "vyper", + "displayName": "Vyper", + "methods": ["getCompilationResult", "compile"], + "url": "https://ipfs-cluster.ethdevops.io/ipfs/QmbmPzUg7ghTKcF2eo64zm1k1LKdibYfqYmiqXkHKXks8r", + "documentation": "https://github.com/GrandSchtroumpf/vyper-remix", + "description": "Compile vyper contracts", + "kind": "compiler", + "icon": "data:image/svg+xml;base64,PHN2ZyBpZD0iRmxhdF9Mb2dvIiBkYXRhLW5hbWU9IkZsYXQgTG9nbyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMjA0OCAxNzczLjYyIj4gIDx0aXRsZT52eXBlci1sb2dvLWZsYXQ8L3RpdGxlPiAgPHBvbHlsaW5lIHBvaW50cz0iMTAyNCA4ODYuODEgNzY4IDEzMzAuMjIgMTAyNCAxNzczLjYyIDEyODAgMTMzMC4yMiAxMDI0IDg4Ni44MSIgc3R5bGU9ImZpbGw6IzMzMyIvPiAgPHBvbHlsaW5lIHBvaW50cz0iMTI4MCA0NDMuNDEgMTAyNCA4ODYuODEgMTI4MCAxMzMwLjIyIDE1MzYgODg2LjgxIDEyODAgNDQzLjQxIiBzdHlsZT0iZmlsbDojNjY2Ii8+ICA8cG9seWxpbmUgcG9pbnRzPSI3NjggNDQzLjQxIDUxMiA4ODYuODEgNzY4IDEzMzAuMjIgMTAyNCA4ODYuODEgNzY4IDQ0My40MSIgc3R5bGU9ImZpbGw6IzY2NiIvPiAgPHBvbHlsaW5lIHBvaW50cz0iMTUzNiAwIDEyODAgNDQzLjQxIDE1MzYgODg2LjgxIDE3OTIgNDQzLjQxIDE1MzYgMCIgc3R5bGU9ImZpbGw6IzhjOGM4YyIvPiAgPHBvbHlsaW5lIHBvaW50cz0iMTE1MiAyMjEuNyA4OTYgMjIxLjcgNzY4IDQ0My40MSAxMDI0IDg4Ni44MSAxMjgwIDQ0My40MSAxMTUyIDIyMS43IiBzdHlsZT0iZmlsbDojOGM4YzhjIi8+ICA8cG9seWxpbmUgcG9pbnRzPSI1MTIgMCAyNTYgNDQzLjQxIDUxMiA4ODYuODEgNzY4IDQ0My40MSA1MTIgMCIgc3R5bGU9ImZpbGw6IzhjOGM4YyIvPiAgPHBvbHlsaW5lIHBvaW50cz0iMjA0OCAwIDE1MzYgMCAxNzkyIDQ0My40IDIwNDggMCIgc3R5bGU9ImZpbGw6I2IyYjJiMiIvPiAgPHBvbHlsaW5lIHBvaW50cz0iNTEyIDAgMCAwIDI1NiA0NDMuNCA1MTIgMCIgc3R5bGU9ImZpbGw6I2IyYjJiMiIvPjwvc3ZnPg==", + "location": "sidePanel", + "repo": "https://github.com/ethereum/remix-project/tree/master/apps/vyper", + "maintainedBy": "Remix", + "authorContact": "remix@ethereum.org" +} \ No newline at end of file