Skip to content

Commit 14a0134

Browse files
committed
Allow triggering npm publish indendently
1 parent 81f8735 commit 14a0134

5 files changed

Lines changed: 67 additions & 13 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@
44
name: npm-publish
55

66
on:
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to publish (e.g., 0.1.32)'
11+
required: true
12+
type: string
713
workflow_call:
814
inputs:
915
plan:
10-
required: true
16+
required: false
17+
type: string
18+
version:
19+
required: false
1120
type: string
1221

1322
jobs:
@@ -19,14 +28,23 @@ jobs:
1928
env:
2029
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2130
PLAN: ${{ inputs.plan }}
22-
if: ${{ !fromJson(inputs.plan).announcement_is_prerelease || fromJson(inputs.plan).publish_prereleases }}
31+
VERSION: ${{ inputs.version }}
32+
if: ${{ inputs.version || !fromJson(inputs.plan).announcement_is_prerelease || fromJson(inputs.plan).publish_prereleases }}
2333
steps:
24-
- name: Fetch npm packages
34+
# Download from artifacts when called from release workflow
35+
- name: Fetch npm packages from artifacts
36+
if: ${{ inputs.plan }}
2537
uses: actions/download-artifact@v4
2638
with:
2739
pattern: artifacts-*
2840
path: npm/
2941
merge-multiple: true
42+
# Download from GitHub release when triggered manually
43+
- name: Download npm package from release
44+
if: ${{ !inputs.plan && inputs.version }}
45+
run: |
46+
mkdir -p npm
47+
gh release download "v${VERSION}" --repo "${{ github.repository }}" --pattern "*-npm-package.tar.gz" --dir npm/
3048
- uses: actions/setup-node@v4
3149
with:
3250
node-version: '24.x'
@@ -37,7 +55,15 @@ jobs:
3755
env:
3856
NPM_CONFIG_PROVENANCE: true
3957
run: |
40-
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do
41-
pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output)
42-
npm publish --access public --provenance "./npm/${pkg}"
43-
done
58+
if [ -n "$PLAN" ]; then
59+
# Called from release workflow - use plan to find packages
60+
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do
61+
pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output)
62+
npm publish --access public --provenance "./npm/${pkg}"
63+
done
64+
else
65+
# Manual trigger - publish all npm packages found
66+
for pkg in npm/*-npm-package.tar.gz; do
67+
npm publish --access public --provenance "$pkg"
68+
done
69+
fi

src/app/async_messages.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,10 @@ impl Editor {
549549

550550
/// Handle file explorer expanded to path
551551
pub(super) fn handle_file_explorer_expanded_to_path(&mut self, mut view: FileTreeView) {
552-
tracing::debug!("File explorer expanded to active file path");
552+
tracing::trace!("handle_file_explorer_expanded_to_path: restoring file_explorer after async expand");
553553
view.update_scroll_for_selection();
554554
self.file_explorer = Some(view);
555+
self.file_explorer_sync_in_progress = false;
555556
}
556557
}
557558

src/app/file_explorer.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,28 @@ impl Editor {
7676
return;
7777
}
7878

79+
// Don't start a new sync if one is already in progress
80+
if self.file_explorer_sync_in_progress {
81+
return;
82+
}
83+
7984
if let Some(metadata) = self.buffer_metadata.get(&self.active_buffer()) {
8085
if let Some(file_path) = metadata.file_path() {
8186
let target_path = file_path.clone();
8287
let working_dir = self.working_dir.clone();
8388

8489
if target_path.starts_with(&working_dir) {
8590
if let Some(mut view) = self.file_explorer.take() {
91+
tracing::trace!(
92+
"sync_file_explorer_to_active_file: taking file_explorer for async expand to {:?}",
93+
target_path
94+
);
8695
if let (Some(runtime), Some(bridge)) =
8796
(&self.tokio_runtime, &self.async_bridge)
8897
{
8998
let sender = bridge.sender();
99+
// Mark sync as in progress so render knows to keep the layout
100+
self.file_explorer_sync_in_progress = true;
90101

91102
runtime.spawn(async move {
92103
let _success = view.expand_and_select_file(&target_path).await;

src/app/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ pub struct Editor {
188188
/// Whether file explorer is visible
189189
file_explorer_visible: bool,
190190

191+
/// Whether file explorer is being synced to active file (async operation in progress)
192+
/// When true, we still render the file explorer area even if file_explorer is temporarily None
193+
file_explorer_sync_in_progress: bool,
194+
191195
/// File explorer width as percentage (0.0 to 1.0)
192196
/// This is the runtime value that can be modified by dragging the border
193197
file_explorer_width_percent: f32,
@@ -693,6 +697,7 @@ impl Editor {
693697
file_explorer: None,
694698
fs_manager,
695699
file_explorer_visible: false,
700+
file_explorer_sync_in_progress: false,
696701
file_explorer_width_percent: file_explorer_width,
697702
mouse_enabled: true,
698703
mouse_cursor_position: None,
@@ -2567,8 +2572,8 @@ impl Editor {
25672572
// Use effective_tabs_width() to account for file explorer taking 30% of width
25682573
self.ensure_active_tab_visible(active_split, buffer_id, self.effective_tabs_width());
25692574

2570-
// Sync file explorer to the new active file (if visible and applicable)
2571-
self.sync_file_explorer_to_active_file();
2575+
// Note: We don't sync file explorer here to avoid flicker during tab switches.
2576+
// File explorer syncs when explicitly focused via focus_file_explorer().
25722577

25732578
// Emit buffer_activated hook for plugins
25742579
self.plugin_manager.run_hook(
@@ -2622,7 +2627,8 @@ impl Editor {
26222627
view_state.add_buffer(buffer_id);
26232628
view_state.previous_buffer = Some(previous_buffer);
26242629
}
2625-
self.sync_file_explorer_to_active_file();
2630+
// Note: We don't sync file explorer here to avoid flicker during split focus changes.
2631+
// File explorer syncs when explicitly focused via focus_file_explorer().
26262632
}
26272633
} else {
26282634
// Same split, different buffer (tab switch) - use set_active_buffer for terminal resume

src/app/render.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,18 @@ impl Editor {
8181
let prompt_line_idx = 4;
8282

8383
// Split main content area based on file explorer visibility
84+
// Also keep the layout split if a sync is in progress (to avoid flicker)
8485
let editor_content_area;
86+
let file_explorer_should_show =
87+
self.file_explorer_visible && (self.file_explorer.is_some() || self.file_explorer_sync_in_progress);
8588

86-
if self.file_explorer_visible && self.file_explorer.is_some() {
89+
if file_explorer_should_show {
8790
// Split horizontally: [file_explorer | editor]
91+
tracing::trace!(
92+
"render: file explorer layout active (present={}, sync_in_progress={})",
93+
self.file_explorer.is_some(),
94+
self.file_explorer_sync_in_progress
95+
);
8896
// Convert f32 percentage (0.0-1.0) to u16 percentage (0-100)
8997
let explorer_percent = (self.file_explorer_width_percent * 100.0) as u16;
9098
let editor_percent = 100 - explorer_percent;
@@ -99,7 +107,7 @@ impl Editor {
99107
self.cached_layout.file_explorer_area = Some(horizontal_chunks[0]);
100108
editor_content_area = horizontal_chunks[1];
101109

102-
// Render file explorer
110+
// Render file explorer (only if we have it - during sync we just keep the area reserved)
103111
if let Some(ref mut explorer) = self.file_explorer {
104112
let is_focused = self.key_context == KeyContext::FileExplorer;
105113

@@ -131,6 +139,8 @@ impl Editor {
131139
close_button_hovered,
132140
);
133141
}
142+
// Note: if file_explorer is None but sync_in_progress is true,
143+
// we just leave the area blank (or could render a placeholder)
134144
} else {
135145
// No file explorer: use entire main content area for editor
136146
self.cached_layout.file_explorer_area = None;

0 commit comments

Comments
 (0)