Skip to content

Dylan/publisher-editor-tool #17

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

Open
wants to merge 157 commits into
base: master
Choose a base branch
from

Conversation

dylanh724
Copy link
Contributor

@dylanh724 dylanh724 commented Feb 22, 2024

About💡

New SpacetimeDB "Publisher" tool, acting as a SpacetimeDB GUI for creating/managing identities/servers, publishing, and viewing the last result cache of your previous publish [through the tool].

Designed in UI Builder with high-level and low-level scripts, this is designed to be scalable and intuitive to change.

image

More screenshots below.

Documentation

Why❓

The user could learn all the CLI commands and nuances, but automation and streamlining for an in-editor tool just feels amazing for both onboarding and veterans.

New users are already learning both the client and server side - potentially even learning Rust, on top of things. This tool should significantly lower onboarding friction and overall lower the learning curve.

On top of this, we can also workaround known bugs, such as auto-regenerating servers when they poof.

Merge Prerequisites 📦

Recommended to merge 1st, but not required:

  1. CLI - Set default server to testnet SpacetimeDB#1078

Features📜

  • Runs cross-platform CLI commands in the background and parses them into friendly results
  • Detects and cross-platform installs SpacetimeDB CLI if !detected
  • View list of servers|identities
  • Add server|identity
  • Change server|identity
  • Ensure identities are bound to servers (refresh on server change)
  • FilePicker for publish/to/module path
  • Publish result with DateTime, Host, IsOptimizedBuild
  • Detection of wasm-opt to show if a publish was optimized or not
  • Install wasm-opt button -> On click, install silently via npm
    • Bug: The pkg we use that auto-detects wasm-opt has a bug that doesn't check global PATH
    • Workaround: So instead, we just launch their release URL
  • Regenerate local|testnet servers if 0 servers found
  • Cleanly-exited Process via cancel token support
  • Progress bars and status labels
  • CLI Error handling
    • (Edit) ux: If "exit with code 1" or some other vague err, Publisher will automatically iterate the non-err output for errs and display+log them
  • Some persistence cache, but we mostly get live updates from the CLI
  • UX: Prettified, responsive design, Local validation, groups, focus/selectAll when applicable, status labels, integrity checks, top banner click links to docs, body wraped in scrollView, fonts and colors match docs, can dock to editor UI as a tab.
  • EDIT: -c support
  • EDIT: spacetime generate support (post-publish)
  • EDIT: Optional debug mode (--skip_clippy --debug)

⚙️ Editor tool only: This won't bloat builds.
⚙️ Tested in Unity 2022.3.20 LTS

Flow➡️

New User

  1. Init -> Detects and installs SpacetimeDB CLI (with progress bar)
  2. Server foldout is revealed, prefilling the dropdown (selecting CLI default) -> If no servers, regenerate local + `testnet
  3. Identity foldout is revealed, prefilling the default identity -> If no identities, show the "new identity" group (nickname+email)
  4. Publish foldout is revealed, prefilling module name with a suggested one based on your client project name (lowercase-dashified-swaps-client-with-server) -> Browse path via FilePicker
  5. Ready to Publish

Returning User

  1. [Within a few ms] Init -> Load servers + default -> Load identities + default -> Load Publish name/path persistence cache -> reveal Publish button -> If previous session result cache found, reveal that dropdown (optionally minimized, dependent on persistence)
  2. Ready to Publish

Media🖼️

Reveal Media

Ready to Publish (Same UI as Returning User Init)

image

SpacetimeDB CLI !Detected

(Image broke - will replace next shift)

Add new server|identity

image

Choose a server

image

Publishing

image

Published, Optimized

image

Published, !Optimized

image

image

image

EDIT: -c support

 ![image](https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/assets/8840024/d1cb9d53-11a7-4ac2-8c20-b8ef1a14261e)

Editor view from eagle eye perspective:

image

Generate Client Files

image

Advanced

image

Testing

  • Tested in Unity 2022.3.20 LTS dark theme with C# spacetime init vanilla Module using dark mode perspective.
    image
  • Vigorously tested by both eating my own dogfood and running a VM for a new user experience with missing prereqs.
  • Tested in Windows with some Ubuntu to emulate Mac CLI, but should be cross-platform

@dylanh724 dylanh724 added the enhancement New feature or request label Feb 22, 2024
@dylanh724 dylanh724 requested review from bfops and jdetter February 22, 2024 08:32
@dylanh724 dylanh724 changed the title feat: SpacetimeDB Publisher editor tool Dylan/feat: SpacetimeDB Publisher editor tool Feb 26, 2024
@dylanh724 dylanh724 changed the title Dylan/feat: SpacetimeDB Publisher editor tool Dylan/publisher-editor-tool Feb 26, 2024
- Runs cross-platform CLI commands in the background and parses them for friendly results
- Features:
  * Detects and cross-platform installs SpacetimeDB CLI if !detected
  * View list of servers|identities
  * Add server|identity
  * Change server|identity
  * Ensure identities are bound to servers (refresh on server change)
  * FilePicker for publish/to/module path
  * Publish result with DateTime, Host, IsOptimizedBuild
  * Detection of `wasm-opt` for optimization; show install button if !found (in post-publish result cache)
  * Regenerate local|testnet servers if 0 servers found
  * Cleanly-exited Process via cancel token support
  * Progress bars and status labels
  * CLI Error handling
  * Some persistence cache, but we mostly get live updates from the CLI
  * UX: Prettified, responsive design, Local validation, groups, focus/selectAll when applicable, status labels, integrity checks, top banner click links to docs, body wraped in scrollView, fonts and colors match docs
@dylanh724 dylanh724 force-pushed the dylan/publisher-editor-tool branch 3 times, most recently from 5bfe0e8 to 6c62dcd Compare February 28, 2024 06:47
- For future Editor tools that may coincide with Publisher, I added a `Common` dir
- Moved core CLI commands to a common `SpacetimeDbCli.cs`
- Created a "common" USS stylesheet so future editor tools can utilize this with a core, templated style.
  - Set the non-common USS stylesheet as active at the top (custom one *must* be at top, as that's what's default set active)
- Better USS/UXML naming
- Added sanity checks for USS/UXML loading
@dylanh724 dylanh724 force-pushed the dylan/publisher-editor-tool branch 2 times, most recently from eef0507 to 1d90411 Compare February 28, 2024 09:37
- For future Editor tools that may coincide with Publisher, I added a `Common` dir
- Moved core CLI commands to a common `SpacetimeDbCli.cs`
- Created a "common" USS stylesheet so future editor tools can utilize this with a core, templated style.
  - Set the non-common USS stylesheet as active at the top (custom one *must* be at top, as that's what's default set active)
- Better USS/UXML naming
- Added sanity checks for USS/UXML loading
- fix: HasIdentitiesButNoDefault + HasServersButNoDefault were resulting in opposite expectations
@dylanh724 dylanh724 force-pushed the dylan/publisher-editor-tool branch from 1d90411 to 9d27819 Compare February 28, 2024 10:00
- Currently has the Publish window template UI; will strip this next commit (keeping what we need)
…ditor-tool

# Conflicts:
#	Scripts/Editor/Common/SpacetimeDbCli/Models/GetIdentitiesResult.cs
#	Scripts/Editor/Common/SpacetimeDbCli/Models/PublishResult.cs
#	Scripts/Editor/Common/SpacetimeDbCli/Models/PublishResult.cs.meta
#	Scripts/Editor/Common/SpacetimeDbCli/Models/PublishServerModuleResult.cs
#	Scripts/Editor/Common/SpacetimeDbCli/Models/PublishServerModuleResult.cs.meta
#	Scripts/Editor/Common/SpacetimeDbCli/SpacetimeDbCli.cs
#	Scripts/Editor/Common/SpacetimeDbCli/SpacetimeDbPublisherCli.cs
#	Scripts/Editor/Common/SpacetimeMeta.cs
#	Scripts/Editor/SpacetimePublisher/PublisherWindowComponents.uxml
#	Scripts/Editor/SpacetimePublisher/Scripts/Models/PublishServerModuleResult.cs
#	Scripts/Editor/SpacetimePublisher/Scripts/Models/PublishServerModuleResult.cs.meta
#	Scripts/Editor/SpacetimePublisher/Scripts/PublisherWindowActions.cs
@dylanh724 dylanh724 force-pushed the dylan/publisher-editor-tool branch 2 times, most recently from c4d0b9a to 9965b88 Compare February 29, 2024 10:29
@dylanh724 dylanh724 force-pushed the dylan/publisher-editor-tool branch from 9965b88 to 21bd9f9 Compare February 29, 2024 10:31
…ditor-tool

# Conflicts:
#	Scripts/Editor/Common/SpacetimeDbCli/Models/GetIdentitiesResult.cs
#	Scripts/Editor/Common/SpacetimeDbCli/SpacetimeDbPublisherCli.cs
#	Scripts/Editor/SpacetimePublisher/Scripts/PublisherWindowActions.cs
@dylanh724 dylanh724 force-pushed the dylan/publisher-editor-tool branch from 21bd9f9 to 1a686ec Compare February 29, 2024 10:39
@dylanh724
Copy link
Contributor Author

dylanh724 commented Mar 1, 2024

⚠️Small warning: I discovered the proper short-statement if() standards later. Currently, you'll find many:

if (!isSuccess)
    return;

rather than:

if (!isSuccess)
{
    return;
}

@dylanh724 dylanh724 force-pushed the dylan/publisher-editor-tool branch from 9963cd2 to ae3b801 Compare April 19, 2024 09:54
@dylanh724 dylanh724 marked this pull request as ready for review April 22, 2024 12:05
@dylanh724
Copy link
Contributor Author

dylanh724 commented Apr 22, 2024

Final form, unless told otherwise -- Went through aggressive testing and applied a bunch of fixes -- it's quite stable! Ready to review (undrafting) @jdetter , @cloutiertyler , @bfops

@dylanh724 dylanh724 requested a review from cloutiertyler April 29, 2024 01:53
- Unused, yet, with TODO notes! @john wanted to have this, so I got ya started
@jdetter jdetter removed their request for review November 8, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants