-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(browser-repl)!: keep operation in progress COMPASS-8576 MONGOSH-1966 #2284
Merged
Merged
Changes from 2 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
a339feb
Don't lose the isOperationInProgress state when the user switches tabs
lerouxb 6e7d247
minus comment
lerouxb 98430ee
initial like the others for now
lerouxb 4a95d91
progress towards moving Shell to be a function component
lerouxb 5d48859
typo
lerouxb 8587f0d
readme tweaks
lerouxb 2e85187
rm comment
lerouxb 8ca4f52
browser-repl tests using testing library
lerouxb 5ab819b
Merge branch 'main' into keep-operation-in-progress2
lerouxb 45946cb
Update packages/browser-repl/scripts/sync-to-compass.js
lerouxb 4a7f4e9
Update packages/browser-repl/scripts/sync-to-compass.js
lerouxb 5cf7a44
Update packages/browser-repl/src/components/shell.tsx
lerouxb e3bf5f7
Update packages/browser-repl/src/components/shell.tsx
lerouxb a87e420
Update packages/browser-repl/src/components/shell.tsx
lerouxb 85143c0
always clear on enter
lerouxb e54962a
lint
lerouxb 50313a7
Merge branch 'main' into keep-operation-in-progress2
lerouxb 7c3a692
remove darkMode
lerouxb e24af9f
move the eslint comments
lerouxb 3567fcb
update readme
lerouxb 705f4ff
Merge branch 'main' into keep-operation-in-progress2
lerouxb be07c02
keep the text value as initialText
lerouxb 686cbc9
and the sandbox
lerouxb b34b9a4
use shell input container ref
lerouxb 757ef7c
cap history before redacting
lerouxb 72d16b3
unnecessary lint comment
lerouxb 72a438b
editor ref
lerouxb d0b920d
test fixes
lerouxb 9b15c06
unnecessary import
lerouxb add38a0
more stable
lerouxb 6f20f37
don't re-run initialEvaluate AND don't lose the output
lerouxb 37e3c8b
optimisation: don't get the shell prompt before executing initialEval…
lerouxb 4e66b19
use refs and update them
lerouxb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* eslint-disable no-console */ | ||
'use strict'; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const child_process = require('child_process'); | ||
const { debounce } = require('lodash'); | ||
lerouxb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (!process.env.COMPASS_HOME) { | ||
throw new Error('Missing required environment variable $COMPASS_HOME.'); | ||
} | ||
|
||
const packageDir = path.resolve(__dirname, '..'); | ||
const srcDir = path.resolve(__dirname, '..', 'src'); | ||
const libDir = path.resolve(__dirname, '..', 'lib'); | ||
|
||
const destDir = path.dirname( | ||
child_process.execFileSync( | ||
'node', | ||
['-e', "console.log(require.resolve('@mongosh/browser-repl'))"], | ||
lerouxb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ cwd: process.env.COMPASS_HOME, encoding: 'utf-8' } | ||
) | ||
); | ||
|
||
console.log({ packageDir, srcDir, libDir, destDir }); | ||
|
||
const compileAndCopy = debounce( | ||
function () { | ||
child_process.execFileSync('npm', ['run', 'compile'], { cwd: packageDir }); | ||
fs.cpSync(libDir, destDir, { recursive: true }); | ||
console.log('done.'); | ||
}, | ||
1_000, | ||
{ | ||
leading: true, | ||
trailing: true, | ||
} | ||
); | ||
|
||
const srcWatcher = fs.watch( | ||
srcDir, | ||
{ recursive: true }, | ||
function (eventType, filename) { | ||
console.log(eventType, filename); | ||
compileAndCopy(); | ||
} | ||
); | ||
|
||
function cleanup() { | ||
srcWatcher.close(); | ||
} | ||
|
||
for (const evt of ['SIGINT', 'SIGTERM']) { | ||
process.on(evt, cleanup); | ||
} | ||
|
||
// do an initial copy on startup | ||
compileAndCopy(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useful in combination with this. Based on https://github.com/mongodb-js/compass/blob/main/packages/compass-web/scripts/sync-dist-to-mms.js
This way you can save a file in browser-repl in mongosh and it hot-reloads in compass.