onflow / onflow/flow-cli

Dev super command: Extract core logic to flowkit package

Open
#1,634 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature
Dominant language
Go
Stars
209
Forks
87
Avg merge
1d 17h
Merged PRs (30d)
3

Description

Issue To Be Solved

flow dev command logic (used by flow super command group) can't be (re)used by external packages at the moment, as it lives in the flow-cli/internal package.

Suggest A Solution

More core logic (from project.go and files.go) to a non-internal package (preferably to flowkit repo, as that's where other such logic already lives), so that other packages or projects can reuse it if needed (useful mostly for other devtools).

This is similar to how DeployProject function lives in flowkit, instead of internal/project package.

Context

This would be useful for Flowser, as we want to build a browser-based Flow playground, which would include an emulator and (a subset of) Flow CLI all running within the browser.

We also want to make setting up and running a project at least as easy as when doing local development in the shell. For that, it may be good to reuse the logic from flow dev, to be consistent with how the project development flow works locally.

To be fair, I'm not sure it's worth refactoring and extracting this, as flow dev logic depends on some functions/dependencies that won't work as desired js/wasm environment (e.g. os.Stat which doesn't do anything on the web) + it's not necessarily that complicated to re-implement at the moment (although I think we could all benefit from using and improving a single such library function). But that could be solved by depending on an interface (e.g. ReaderWriter and FileWatcher) instead on the concrete implementation.

For more context, see our grant proposal: https://github.com/onflow/developer-grants/issues/260

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the flow dev logic in project.go and files.go, then compare it with DeployProject in the flowkit repository and the internal/project package. Determine which core behavior can move to a reusable flowkit package and whether interfaces such as ReaderWriter and FileWatcher are needed for js/wasm. Done means external packages can reuse the extracted logic without depending on flow-cli/internal.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, developer-experience
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.