Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Explorer View
# Pull Requests GitHub View

WebWorker for the explorer view functionality in Lvce Editor.
WebWorker for the pull requests github view functionality in Lvce Editor.

## Contributing

```sh
git clone git@github.com:lvce-editor/explorer-view.git &&
cd explorer-view &&
git clone git@github.com:lvce-editor/pull-requests-github-view.git &&
cd pull-requests-github-view &&
npm ci &&
npm test
```
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@lvce-editor/explorer-view-monorepo",
"name": "@lvce-editor/pull-requests-github-view-monorepo",
"version": "0.0.0-dev",
"license": "MIT",
"type": "module",
"scripts": {
"build": "node packages/build/src/build.ts",
"build:static": "node packages/build/src/build-static.ts",
"build:watch": "./packages/build/node_modules/.bin/esbuild --format=esm --bundle --external:node:buffer --external:electron --external:ws --external:node:worker_threads --watch packages/explorer-view/src/pullRequestWorkerMain.ts --outfile=.tmp/dist/dist/pullRequestWorkerMain.js",
"build:watch": "./packages/build/node_modules/.bin/esbuild --format=esm --bundle --external:node:buffer --external:electron --external:ws --external:node:worker_threads --watch packages/pull-requests-github/src/pullRequestWorkerMain.ts --outfile=.tmp/dist/dist/pullRequestWorkerMain.js",
"dev": "node packages/build/src/dev.ts",
"e2e": "cd packages/e2e && npm run e2e",
"format": "prettier --write .",
Expand Down
8 changes: 4 additions & 4 deletions packages/build/src/build-static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const sharedProcessUrl = pathToFileURL(sharedProcessPath).toString()

const sharedProcess = await import(sharedProcessUrl)

process.env.PATH_PREFIX = '/pull-request-github'
process.env.PATH_PREFIX = '/pull-requests-github'
const { commitHash } = await sharedProcess.exportStatic({
root,
extensionPath: '',
Expand All @@ -27,9 +27,9 @@ const content = await readFile(rendererWorkerPath, 'utf8')
const workerPath = join(root, '.tmp/dist/dist/pullRequestWorkerMain.js')
const remoteUrl = getRemoteUrl(workerPath)

const occurrence = `// const explorerWorkerUrl = \`\${assetDir}/packages/explorer-worker/dist/explorerViewWorkerMain.js\`
const explorerWorkerUrl = \`${remoteUrl}\``
const replacement = `const explorerWorkerUrl = \`\${assetDir}/packages/explorer-worker/dist/explorerViewWorkerMain.js\``
const occurrence = `// const pullRequestsGithubWorkerUrl = \`\${assetDir}/packages/pull-requests-github-worker/dist/pullRequestsGithubViewWorkerMain.js\`
const pullRequestsGithubWorkerUrl = \`${remoteUrl}\``
const replacement = `const pullRequestsGithubWorkerUrl = \`\${assetDir}/packages/pull-requests-github-worker/dist/pullRequestsGithubViewWorkerMain.js\``
if (content.includes(occurrence)) {
const newContent = content.replace(occurrence, replacement)
await writeFile(rendererWorkerPath, newContent)
Expand Down
4 changes: 2 additions & 2 deletions packages/build/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ await bundleJs()

const version = await getVersion()

const packageJson = await readJson(join(root, 'packages', 'explorer-view', 'package.json'))
const packageJson = await readJson(join(root, 'packages', 'pull-requests-github', 'package.json'))

delete packageJson.scripts
delete packageJson.devDependencies
Expand All @@ -70,6 +70,6 @@ packageJson.main = 'dist/pullRequestWorkerMain.js'

await writeJson(join(dist, 'package.json'), packageJson)

await cp(join(root, 'packages', 'explorer-view', 'extension.json'), join(dist, 'extension.json'))
await cp(join(root, 'packages', 'pull-requests-github', 'extension.json'), join(dist, 'extension.json'))
await cp(join(root, 'README.md'), join(dist, 'README.md'))
await cp(join(root, 'LICENSE'), join(dist, 'LICENSE'))
2 changes: 1 addition & 1 deletion packages/build/src/bundleJs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { rollup, type RollupOptions } from 'rollup'
import { root } from './root.ts'

const options: RollupOptions = {
input: join(root, 'packages/explorer-view/src/pullRequestWorkerMain.ts'),
input: join(root, 'packages/pull-requests-github/src/pullRequestWorkerMain.ts'),
preserveEntrySignatures: 'strict',
treeshake: {
propertyReadSideEffects: false,
Expand Down
1 change: 0 additions & 1 deletion packages/build/src/computeNodeModulesCacheKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const locations: string[] = [
'.github/workflows/ci.yml',
'.github/workflows/release.yml',
'packages/build/src/computeNodeModulesCacheKey.ts',
'packages/server/src/postinstall.js',
]

const packagesFolder = join(root, 'packages')
Expand Down
2 changes: 1 addition & 1 deletion packages/build/src/measureMemory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const threshold = 570_000

const instantiations = 9000

const instantiationsPath = join(root, 'packages', 'explorer-view')
const instantiationsPath = join(root, 'packages', 'pull-requests-github')

const workerPath = join(root, '.tmp/dist/dist/pullRequestWorkerMain.js')

Expand Down
37 changes: 37 additions & 0 deletions packages/e2e/src/pull-requests-github.empty-description.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { Test } from '@lvce-editor/test-with-playwright'

export const name = 'pull-requests-github.empty-description'

export const skip = true

export const test: Test = async ({ ActivityBar, Command, expect, Locator }) => {
const url = 'https://github.com/lvce-editor/lvce-editor/pull/124'
await ActivityBar.toggleActivityBarItem('github.pullRequests')
const input = Locator('input[name="pullRequestUrl"]')
await expect(input).toBeVisible()
await Command.execute('ExtensionHost.executeCommand', 'PullRequestsGithub.clearPullRequestData')
await Command.execute('ExtensionHost.executeCommand', 'PullRequestsGithub.setPullRequestData', url, {
baseBranch: 'release/e2e-empty-base',
description: '',
headBranch: 'feature/e2e-empty-head',
title: 'Render empty pull request description',
})

await Command.execute('Extensions.dispatchViewEvent', 'github.pullRequests', 1, {
name: 'pullRequestUrl',
type: 'input',
value: url,
})
await Command.execute('Extensions.dispatchViewEvent', 'github.pullRequests', 1, {
type: 'submit',
})

const title = Locator('text=Render empty pull request description')
const headBranch = Locator('text=feature/e2e-empty-head')
const baseBranch = Locator('text=release/e2e-empty-base')
const description = Locator('text=No description')
await expect(title).toBeVisible()
await expect(headBranch).toBeVisible()
await expect(baseBranch).toBeVisible()
await expect(description).toBeVisible()
}
24 changes: 24 additions & 0 deletions packages/e2e/src/pull-requests-github.invalid-url.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { Test } from '@lvce-editor/test-with-playwright'

export const name = 'pull-requests-github.invalid-url'

export const skip = true

export const test: Test = async ({ ActivityBar, Command, expect, Locator }) => {
await ActivityBar.toggleActivityBarItem('github.pullRequests')
const input = Locator('input[name="pullRequestUrl"]')
await expect(input).toBeVisible()
await Command.execute('ExtensionHost.executeCommand', 'PullRequestsGithub.clearPullRequestData')

await Command.execute('Extensions.dispatchViewEvent', 'github.pullRequests', 1, {
name: 'pullRequestUrl',
type: 'input',
value: 'not a pull request url',
})
await Command.execute('Extensions.dispatchViewEvent', 'github.pullRequests', 1, {
type: 'submit',
})

const error = Locator('text=Enter a valid GitHub pull request URL')
await expect(error).toBeVisible()
}
37 changes: 37 additions & 0 deletions packages/e2e/src/pull-requests-github.load-success.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { Test } from '@lvce-editor/test-with-playwright'

export const name = 'pull-requests-github.load-success'

export const skip = true

export const test: Test = async ({ ActivityBar, Command, expect, Locator }) => {
const url = 'https://github.com/lvce-editor/lvce-editor/pull/123'
await ActivityBar.toggleActivityBarItem('github.pullRequests')
const input = Locator('input[name="pullRequestUrl"]')
await expect(input).toBeVisible()
await Command.execute('ExtensionHost.executeCommand', 'PullRequestsGithub.clearPullRequestData')
await Command.execute('ExtensionHost.executeCommand', 'PullRequestsGithub.setPullRequestData', url, {
baseBranch: 'release/e2e-base',
description: 'Plain text description from deterministic e2e data.',
headBranch: 'feature/e2e-head',
title: 'Add deterministic pull request e2e coverage',
})

await Command.execute('Extensions.dispatchViewEvent', 'github.pullRequests', 1, {
name: 'pullRequestUrl',
type: 'input',
value: url,
})
await Command.execute('Extensions.dispatchViewEvent', 'github.pullRequests', 1, {
type: 'submit',
})

const title = Locator('text=Add deterministic pull request e2e coverage')
const headBranch = Locator('text=feature/e2e-head')
const baseBranch = Locator('text=release/e2e-base')
const description = Locator('text=Plain text description from deterministic e2e data.')
await expect(title).toBeVisible()
await expect(headBranch).toBeVisible()
await expect(baseBranch).toBeVisible()
await expect(description).toBeVisible()
}
26 changes: 26 additions & 0 deletions packages/e2e/src/pull-requests-github.not-found.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { Test } from '@lvce-editor/test-with-playwright'

export const name = 'pull-requests-github.not-found'

export const skip = true

export const test: Test = async ({ ActivityBar, Command, expect, Locator }) => {
const url = 'https://github.com/lvce-editor/lvce-editor/pull/404'
await ActivityBar.toggleActivityBarItem('github.pullRequests')
const input = Locator('input[name="pullRequestUrl"]')
await expect(input).toBeVisible()
await Command.execute('ExtensionHost.executeCommand', 'PullRequestsGithub.clearPullRequestData')
await Command.execute('ExtensionHost.executeCommand', 'PullRequestsGithub.setPullRequestError', url, 'Not Found')

await Command.execute('Extensions.dispatchViewEvent', 'github.pullRequests', 1, {
name: 'pullRequestUrl',
type: 'input',
value: url,
})
await Command.execute('Extensions.dispatchViewEvent', 'github.pullRequests', 1, {
type: 'submit',
})

const error = Locator('text=Not Found')
await expect(error).toBeVisible()
}
24 changes: 0 additions & 24 deletions packages/e2e/src/viewlet.explorer-blur.ts

This file was deleted.

14 changes: 0 additions & 14 deletions packages/explorer-view/extension.json

This file was deleted.

This file was deleted.

Loading