Skip to content

Commit

Permalink
Merge pull request #4877 from ethereum/gitui
Browse files Browse the repository at this point in the history
GIT UI ( squashed )
  • Loading branch information
bunsenstraat committed Jul 2, 2024
2 parents 68afece + 94737fd commit 7089f25
Show file tree
Hide file tree
Showing 119 changed files with 10,154 additions and 599 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ apps/remixdesktop/release/
apps/remix-ide/src/assets/list.json
apps/remix-ide/src/assets/esbuild.wasm
apps/remixdesktop/build*
logs
apps/remixdesktop/reports/
apps/remixdesktop/logs/
logs
15 changes: 9 additions & 6 deletions apps/remix-ide-e2e/src/commands/addFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
import EventEmitter from 'events'

class AddFile extends EventEmitter {
command(this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser {
command(this: NightwatchBrowser, name: string, content: NightwatchContractContent, readMeFile?:string): NightwatchBrowser {
if(!readMeFile)
readMeFile = 'README.txt'
this.api.perform((done) => {
addFile(this.api, name, content, () => {
addFile(this.api, name, content, readMeFile, () => {
done()
this.emit('complete')
})
Expand All @@ -13,7 +15,8 @@ class AddFile extends EventEmitter {
}
}

function addFile(browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) {
function addFile(browser: NightwatchBrowser, name: string, content: NightwatchContractContent, readMeFile:string, done: VoidFunction) {
const readmeSelector = `li[data-id="treeViewLitreeViewItem${readMeFile}"]`
browser
.isVisible({
selector: "//*[@data-id='sidePanelSwapitTitle' and contains(.,'File explorer')]",
Expand All @@ -25,9 +28,9 @@ function addFile(browser: NightwatchBrowser, name: string, content: NightwatchCo
browser.clickLaunchIcon('filePanel')
}
})
.scrollInto('li[data-id="treeViewLitreeViewItemREADME.txt"]')
.waitForElementVisible('li[data-id="treeViewLitreeViewItemREADME.txt"]')
.click('li[data-id="treeViewLitreeViewItemREADME.txt"]').pause(1000) // focus on root directory
.scrollInto(readmeSelector)
.waitForElementVisible(readmeSelector)
.click(readmeSelector).pause(1000) // focus on root directory
.isVisible({
selector: `//*[@data-id="treeViewLitreeViewItem${name}"]`,
locateStrategy: 'xpath',
Expand Down
13 changes: 13 additions & 0 deletions apps/remix-ide-e2e/src/githttpbackend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"scripts": {
"start:server": "npx ts-node server.ts"
},
"dependencies": {
"body-parser": "^1.20.2",
"child_process": "^1.0.2",
"express": "^4.19.2",
"git-http-backend": "^1.1.2",
"path": "^0.12.7",
"zlib": "^1.0.5"
}
}
48 changes: 48 additions & 0 deletions apps/remix-ide-e2e/src/githttpbackend/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import * as http from 'http';
import { spawn } from 'child_process';
import * as path from 'path';
let backend = require('git-http-backend');
import * as zlib from 'zlib';

const directory = process.argv[2];

if (!directory) {
console.error('Please provide a directory as a command line argument.');
process.exit(1);
}

const server = http.createServer((req, res) => {

// Set CORS headers
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
res.setHeader('Access-Control-Allow-Credentials', 'true');

if (req.method === 'OPTIONS') {
// Handle preflight request
res.writeHead(204);
res.end();
return;
}

const repo = req.url?.split('/')[1];
const dir = path.join(directory, 'git', repo || '');
console.log(dir);
const reqStream = req.headers['content-encoding'] === 'gzip' ? req.pipe(zlib.createGunzip()) : req;

reqStream.pipe(backend(req.url || '', (err, service) => {
if (err) return res.end(err + '\n');

res.setHeader('content-type', service.type);
console.log(service.action, repo, service.fields);

const ps = spawn(service.cmd, [...service.args, dir]);
ps.stdout.pipe(service.createStream()).pipe(ps.stdin);

})).pipe(res);
});

server.listen(6868, () => {
console.log('Server is listening on port 6868');
});
7 changes: 7 additions & 0 deletions apps/remix-ide-e2e/src/githttpbackend/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

cd /tmp/
rm -rf git/bare.git
rm -rf git
mkdir -p git
cd git
git clone --bare https://github.com/ethereum/awesome-remix bare.git
Loading

0 comments on commit 7089f25

Please sign in to comment.