rename to CompileAndRun and add toast message

pull/5370/head
yann300 3 years ago
parent 4f852d6e45
commit f02556ce1e
  1. 8
      apps/remix-ide/src/app.js
  2. 29
      apps/remix-ide/src/app/tabs/compile-and-run.ts
  3. 2
      apps/remix-ide/src/remixAppManager.js

@ -5,7 +5,7 @@ import { RemixAppManager } from './remixAppManager'
import { ThemeModule } from './app/tabs/theme-module'
import { NetworkModule } from './app/tabs/network-module'
import { Web3ProviderModule } from './app/tabs/web3-provider'
import { IntelligentScriptExecutor } from './app/tabs/intelligent-script-executor'
import { CompileAndRun } from './app/tabs/compile-and-run'
import { SidePanel } from './app/components/side-panel'
import { HiddenPanel } from './app/components/hidden-panel'
import { VerticalIcons } from './app/components/vertical-icons'
@ -184,7 +184,7 @@ class AppComponent {
name: 'offsettolinecolumnconverter'
})
// ----------------- run script after each compilation results -----------
const intelligentScriptExecutor = new IntelligentScriptExecutor()
const compileAndRun = new CompileAndRun()
// -------------------Terminal----------------------------------------
makeUdapp(blockchain, compilersArtefacts, domEl => terminal.logHtml(domEl))
const terminal = new Terminal(
@ -227,7 +227,7 @@ class AppComponent {
contextualListener,
terminal,
web3Provider,
intelligentScriptExecutor,
compileAndRun,
fetchAndCompile,
dGitProvider,
storagePlugin,
@ -352,7 +352,7 @@ class AppComponent {
await this.appManager.activatePlugin(['settings', 'config'])
await this.appManager.activatePlugin(['hiddenPanel', 'pluginManager', 'contextualListener', 'terminal', 'blockchain', 'fetchAndCompile', 'contentImport', 'gistHandler'])
await this.appManager.activatePlugin(['settings'])
await this.appManager.activatePlugin(['walkthrough','storage', 'search','intelligentScriptExecutor'])
await this.appManager.activatePlugin(['walkthrough','storage', 'search','compileAndRun'])
this.appManager.on(
'filePanel',

@ -1,10 +1,15 @@
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
declare global {
interface Window {
_paq: any
}
}
const _paq = window._paq = window._paq || []
export const profile = {
name: 'intelligentScriptExecutor',
displayName: 'Intelligent Script Executor',
name: 'compileAndRun',
displayName: 'Compile and Run',
description: 'after each compilation, run the script defined in Natspec.',
methods: [],
version: packageJson.version,
@ -13,7 +18,7 @@ export const profile = {
type listener = (event: KeyboardEvent) => void
export class IntelligentScriptExecutor extends Plugin {
export class CompileAndRun extends Plugin {
executionListener: listener
targetFileName: string
@ -39,11 +44,15 @@ export class IntelligentScriptExecutor extends Plugin {
async runScript (fileName, clearAllInstances) {
await this.call('terminal', 'log', `running ${fileName} ...`)
const content = await this.call('fileManager', 'readFile', fileName)
if (clearAllInstances) {
await this.call('udapp', 'clearAllInstances')
}
await this.call('scriptRunner', 'execute', content)
try {
const content = await this.call('fileManager', 'readFile', fileName)
if (clearAllInstances) {
await this.call('udapp', 'clearAllInstances')
}
await this.call('scriptRunner', 'execute', content)
} catch (e) {
this.call('notification', 'toast', e.message || e)
}
}
onActivation () {
@ -57,8 +66,10 @@ export class IntelligentScriptExecutor extends Plugin {
this.runScript(file, true)
_paq.push(['trackEvent', 'ScriptExecutor', 'run_script_after_compile'])
} else {
this.call('notification', 'toast', 'You have not set a script. Set it with @dev-run-script natspac tag.')
this.call('notification', 'toast', 'You have not set a script to run. Set it with @dev-run-script natspac tag.')
}
} else {
this.call('notification', 'toast', 'You have not set a script to run. Set it with @dev-run-script natspac tag.')
}
})
}

@ -8,7 +8,7 @@ const requiredModules = [ // services + layout views + system views
'manager', 'config', 'compilerArtefacts', 'compilerMetadata', 'contextualListener', 'editor', 'offsetToLineColumnConverter', 'network', 'theme',
'fileManager', 'contentImport', 'blockchain', 'web3Provider', 'scriptRunner', 'fetchAndCompile', 'mainPanel', 'hiddenPanel', 'sidePanel', 'menuicons',
'filePanel', 'terminal', 'settings', 'pluginManager', 'tabs', 'udapp', 'dGitProvider', 'solidity-logic', 'gistHandler', 'layout',
'notification', 'permissionhandler', 'walkthrough', 'storage', 'restorebackupzip', 'link-libraries', 'deploy-libraries', 'hardhat-provider', 'intelligentScriptExecutor', 'search']
'notification', 'permissionhandler', 'walkthrough', 'storage', 'restorebackupzip', 'link-libraries', 'deploy-libraries', 'hardhat-provider', 'compileAndRun']
const dependentModules = ['git', 'hardhat', 'truffle', 'slither'] // module which shouldn't be manually activated (e.g git is activated by remixd)

Loading…
Cancel
Save