desktopmerge
bunsenstraat 1 year ago
parent f29621d1c7
commit 99ca713465
  1. 4
      .circleci/config.yml
  2. 4
      apps/remixdesktop/package.json
  3. 39
      apps/remixdesktop/src/plugins/ripgrepPlugin.ts
  4. 10035
      projects.json

@ -122,9 +122,8 @@ jobs:
mkdir apps/remixdesktop/build mkdir apps/remixdesktop/build
cp -r dist/apps/remix-ide apps/remixdesktop/build/remix-ide cp -r dist/apps/remix-ide apps/remixdesktop/build/remix-ide
cd apps/remixdesktop/ cd apps/remixdesktop/
rm -rf yarn.lock
yarn add node-pty yarn add node-pty
yarn yarn --ignore-optional
yarn add @remix-project/remix-ws-templates yarn add @remix-project/remix-ws-templates
yarn dist --linux yarn dist --linux
rm -rf release/*-unpacked rm -rf release/*-unpacked
@ -170,7 +169,6 @@ jobs:
cp -r dist/apps/remix-ide apps/remixdesktop/build/remix-ide cp -r dist/apps/remix-ide apps/remixdesktop/build/remix-ide
cd apps/remixdesktop/ cd apps/remixdesktop/
yarn yarn
yarn add @remix-project/remix-ws-templates
yarn dist --win yarn dist --win
rm -rf release/*-unpacked rm -rf release/*-unpacked
- save_cache: - save_cache:

@ -36,7 +36,6 @@
"typescript": "^5.1.3" "typescript": "^5.1.3"
}, },
"dependencies": { "dependencies": {
"@remix-project/remix-ws-templates": "^1.0.27",
"@remixproject/engine": "0.3.37", "@remixproject/engine": "0.3.37",
"@remixproject/engine-electron": "0.3.37", "@remixproject/engine-electron": "0.3.37",
"@remixproject/plugin": "0.3.37", "@remixproject/plugin": "0.3.37",
@ -49,6 +48,9 @@
"node-pty": "^0.10.1", "node-pty": "^0.10.1",
"yarn": "^1.22.19" "yarn": "^1.22.19"
}, },
"optionalDependencies": {
"@remix-project/remix-ws-templates": "^1.0.27"
},
"build": { "build": {
"productName": "Remix IDE", "productName": "Remix IDE",
"appId": "org.ethereum.remix-ide", "appId": "org.ethereum.remix-ide",

@ -1,10 +1,13 @@
import { PluginClient } from "@remixproject/plugin"; import {PluginClient} from '@remixproject/plugin'
import { Profile } from "@remixproject/plugin-utils"; import {Profile} from '@remixproject/plugin-utils'
import { ElectronBasePlugin, ElectronBasePluginClient } from "@remixproject/plugin-electron" import {
import path from "path"; ElectronBasePlugin,
import { rgPath } from "@vscode/ripgrep"; ElectronBasePluginClient,
import byline from "byline"; } from '@remixproject/plugin-electron'
import { spawn } from "child_process"; import path from 'path'
import {rgPath} from '@vscode/ripgrep'
import byline from 'byline'
import {spawn} from 'child_process'
const profile: Profile = { const profile: Profile = {
name: 'ripgrep', name: 'ripgrep',
@ -16,7 +19,6 @@ const convertPathToPosix = (pathName: string): string => {
return pathName.split(path.sep).join(path.posix.sep) return pathName.split(path.sep).join(path.posix.sep)
} }
export class RipgrepPlugin extends ElectronBasePlugin { export class RipgrepPlugin extends ElectronBasePlugin {
clients: RipgrepPluginClient[] = [] clients: RipgrepPluginClient[] = []
constructor() { constructor() {
@ -29,20 +31,19 @@ const clientProfile: Profile = {
name: 'ripgrep', name: 'ripgrep',
displayName: 'ripgrep', displayName: 'ripgrep',
description: 'ripgrep plugin', description: 'ripgrep plugin',
methods: ['glob'] methods: ['glob'],
} }
export class RipgrepPluginClient extends ElectronBasePluginClient { export class RipgrepPluginClient extends ElectronBasePluginClient {
workingDir: string = '' workingDir: string = ''
constructor(webContentsId: number, profile: Profile) { constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile) super(webContentsId, profile)
this.onload(() => { this.onload(() => {
this.on('fs' as any, 'workingDirChanged', async (path: string) => { this.on('fs' as any, 'workingDirChanged', async (path: string) => {
this.workingDir = path this.workingDir = path
}) })
}) })
} }
async glob(path: string, pattern: string, options?: any) { async glob(path: string, pattern: string, options?: any) {
@ -50,17 +51,22 @@ export class RipgrepPluginClient extends ElectronBasePluginClient {
console.log('path', path, this.workingDir) console.log('path', path, this.workingDir)
return new Promise((c, e) => { return new Promise((c, e) => {
// replace packed app path with unpacked app path for release on windows // replace packed app path with unpacked app path for release on windows
const customRgPath = rgPath.replace('/app.asar/', '/app.asar.unpacked/')
const customRgPath = rgPath.includes('app.asar.unpacked')
? rgPath
: rgPath.replace('app.asar', 'app.asar.unpacked')
const rg = spawn(customRgPath, ['.', '-l', path]) const rg = spawn(customRgPath, ['.', '-l', path])
const resultrg: any[] = [] const resultrg: any[] = []
const stream = byline(rg.stdout.setEncoding('utf8')) const stream = byline(rg.stdout.setEncoding('utf8'))
stream.on('data', (rgresult: string) => { stream.on('data', (rgresult: string) => {
console.log('rgresult', rgresult) console.log('rgresult', rgresult)
let pathWithoutWorkingDir = rgresult.replace(convertPathToPosix(this.workingDir), '') let pathWithoutWorkingDir = rgresult.replace(
convertPathToPosix(this.workingDir),
''
)
if (pathWithoutWorkingDir.endsWith('/')) { if (pathWithoutWorkingDir.endsWith('/')) {
pathWithoutWorkingDir = pathWithoutWorkingDir.slice(0, -1) pathWithoutWorkingDir = pathWithoutWorkingDir.slice(0, -1)
} }
@ -71,7 +77,7 @@ export class RipgrepPluginClient extends ElectronBasePluginClient {
pathWithoutWorkingDir = pathWithoutWorkingDir.slice(1) pathWithoutWorkingDir = pathWithoutWorkingDir.slice(1)
} }
resultrg.push({ resultrg.push({
path:convertPathToPosix(pathWithoutWorkingDir), path: convertPathToPosix(pathWithoutWorkingDir),
isDirectory: false, isDirectory: false,
}) })
}) })
@ -79,7 +85,6 @@ export class RipgrepPluginClient extends ElectronBasePluginClient {
c(resultrg) c(resultrg)
}) })
}) })
} }
fixPath(path: string): string { fixPath(path: string): string {

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save