|
|
@ -3,10 +3,7 @@ import { NightwatchBrowser } from 'nightwatch' |
|
|
|
import init from '../helpers/init' |
|
|
|
import init from '../helpers/init' |
|
|
|
import { join } from 'path' |
|
|
|
import { join } from 'path' |
|
|
|
import { ChildProcess, spawn } from 'child_process' |
|
|
|
import { ChildProcess, spawn } from 'child_process' |
|
|
|
import { writeFileSync } from 'fs' |
|
|
|
import { homedir } from 'os' |
|
|
|
import * as hardhatCompilation from '../helpers/hardhat_compilation_7839ba878952cc00ff316061405f273a.json' |
|
|
|
|
|
|
|
import * as hardhat_compilation_Lock_dbg from '../helpers/hardhat_compilation_Lock.dbg.json' |
|
|
|
|
|
|
|
import * as hardhat_compilation_Lock from '../helpers/hardhat_compilation_Lock.json' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import kill from 'tree-kill' |
|
|
|
import kill from 'tree-kill' |
|
|
|
|
|
|
|
|
|
|
@ -190,8 +187,8 @@ module.exports = { |
|
|
|
'Should listen on compilation result from foundry #group5': function (browser: NightwatchBrowser) { |
|
|
|
'Should listen on compilation result from foundry #group5': function (browser: NightwatchBrowser) { |
|
|
|
|
|
|
|
|
|
|
|
browser.perform(async (done) => { |
|
|
|
browser.perform(async (done) => { |
|
|
|
remixd = await spawnRemixd(join(process.cwd(), '/apps/remix-ide/hello_foundry')) |
|
|
|
remixd = await spawnRemixd(join(homedir() + '/hello_foundry')) |
|
|
|
console.log('working directory', process.cwd()) |
|
|
|
console.log('working directory', homedir() + '/hello_foundry') |
|
|
|
connectRemixd(browser, done) |
|
|
|
connectRemixd(browser, done) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.perform(async (done) => { |
|
|
|
.perform(async (done) => { |
|
|
@ -368,7 +365,7 @@ async function compileHardhatProject(): Promise<void> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function downloadFoundry(): Promise<void> { |
|
|
|
async function downloadFoundry(): Promise<void> { |
|
|
|
console.log(process.cwd()) |
|
|
|
console.log('downloadFoundry', process.cwd()) |
|
|
|
try { |
|
|
|
try { |
|
|
|
const server = spawn('curl -L https://foundry.paradigm.xyz | bash', [], { cwd: process.cwd(), shell: true, detached: true }) |
|
|
|
const server = spawn('curl -L https://foundry.paradigm.xyz | bash', [], { cwd: process.cwd(), shell: true, detached: true }) |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
@ -392,7 +389,7 @@ async function downloadFoundry(): Promise<void> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function installFoundry(): Promise<void> { |
|
|
|
async function installFoundry(): Promise<void> { |
|
|
|
console.log(process.cwd()) |
|
|
|
console.log('installFoundry', process.cwd()) |
|
|
|
try { |
|
|
|
try { |
|
|
|
const server = spawn('foundryup', [], { cwd: process.cwd(), shell: true, detached: true }) |
|
|
|
const server = spawn('foundryup', [], { cwd: process.cwd(), shell: true, detached: true }) |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
@ -416,22 +413,14 @@ async function installFoundry(): Promise<void> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function initFoundryProject(): Promise<void> { |
|
|
|
async function initFoundryProject(): Promise<void> { |
|
|
|
console.log(process.cwd()) |
|
|
|
console.log('initFoundryProject', homedir()) |
|
|
|
try { |
|
|
|
try { |
|
|
|
const server = spawn('forge init hello_foundry', [], { cwd: process.cwd() + '/apps/remix-ide', shell: true, detached: true }) |
|
|
|
const server = spawn('forge init hello_foundry', [], { cwd: homedir(), shell: true, detached: true }) |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
server.stdout.on('data', function (data) { |
|
|
|
server.on('exit', function (exitCode) { |
|
|
|
console.log(data.toString()) |
|
|
|
console.log("Child exited with code: " + exitCode); |
|
|
|
if ( |
|
|
|
console.log('end') |
|
|
|
data.toString().includes("Initialized forge project") |
|
|
|
resolve() |
|
|
|
) { |
|
|
|
|
|
|
|
console.log('resolving') |
|
|
|
|
|
|
|
resolve() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
server.stderr.on('err', function (data) { |
|
|
|
|
|
|
|
console.log(data.toString()) |
|
|
|
|
|
|
|
reject(data.toString()) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
@ -440,22 +429,14 @@ async function initFoundryProject(): Promise<void> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function buildFoundryProject(): Promise<void> { |
|
|
|
async function buildFoundryProject(): Promise<void> { |
|
|
|
console.log(process.cwd()) |
|
|
|
console.log('buildFoundryProject', homedir()) |
|
|
|
try { |
|
|
|
try { |
|
|
|
const server = spawn('forge build', [], { cwd: process.cwd() + '/apps/remix-ide/contracts/hello_foundry', shell: true, detached: true }) |
|
|
|
const server = spawn('forge build', [], { cwd: homedir() + '/hello_foundry', shell: true, detached: true }) |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
server.stdout.on('data', function (data) { |
|
|
|
server.on('exit', function (exitCode) { |
|
|
|
console.log(data.toString()) |
|
|
|
console.log("Child exited with code: " + exitCode); |
|
|
|
if ( |
|
|
|
console.log('end') |
|
|
|
data.toString().includes("Compiler run successful!") |
|
|
|
resolve() |
|
|
|
) { |
|
|
|
|
|
|
|
console.log('resolving') |
|
|
|
|
|
|
|
resolve() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
server.stderr.on('err', function (data) { |
|
|
|
|
|
|
|
console.log(data.toString()) |
|
|
|
|
|
|
|
reject(data.toString()) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|