Skip to content

Commit

Permalink
change shortcut & install prettier in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
swk777 committed Sep 11, 2024
1 parent 047a02c commit e720c22
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
16 changes: 12 additions & 4 deletions packages/api/exec.mts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type NodeRequestType = BaseExecRequestType & {

export type NPMInstallRequestType = BaseExecRequestType & {
packages?: Array<string>;
args?: Array<string>;
};

type SpawnCallRequestType = {
Expand Down Expand Up @@ -132,10 +133,17 @@ export function tsx(options: NodeRequestType) {
*/
export function npmInstall(options: NPMInstallRequestType) {
const { cwd, stdout, stderr, onExit } = options;

const args = options.packages
? ['install', '--include=dev', ...options.packages]
: ['install', '--include=dev'];
? ['install', '--include=dev', ...(options.args || []), ...options.packages]
: ['install', '--include=dev', ...(options.args || [])];

return spawnCall({ command: 'npm', cwd, args, stdout, stderr, onExit, env: process.env });
return spawnCall({
command: 'npm',
cwd,
args,
stdout,
stderr,
onExit,
env: process.env,
});
}
1 change: 1 addition & 0 deletions packages/api/session.mts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ async function ensurePrettierInstalled(dir: string): Promise<boolean> {
npmInstall({
cwd: dir,
packages: ['prettier'],
args: ['--save-dev'],
stdout: () => {},
stderr: (err) => console.error(err),
onExit: (exitCode) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/cells/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ function CodeEditor({
keymap.of([
{ key: 'Mod-Enter', run: evaluateModEnter },
{
key: 'Mod-Shift-f',
key: 'Shift-Alt-f',
run: () => {
formatCell();
return true;
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/keyboard-shortcuts-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function KeyboardShortcutsDialog({
<ShortcutRow keys={['mod', '/']} description="toggle lines comment" />
<ShortcutRow keys={['alt', '↑']} description="move lines up" />
<ShortcutRow keys={['alt', '↓']} description="move lines down" />
<ShortcutRow keys={['mod', 'shift', 'f']} description="format code" />
<ShortcutRow keys={['shift', 'alt', 'f']} description="format code" />
</div>
</DialogDescription>
</DialogHeader>
Expand Down

0 comments on commit e720c22

Please sign in to comment.