Skip to content
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

Make the npm package more useful #7

Closed
rocketnia opened this issue Dec 16, 2021 · 2 comments
Closed

Make the npm package more useful #7

rocketnia opened this issue Dec 16, 2021 · 2 comments

Comments

@rocketnia
Copy link
Member

The npm install rainbow-js-arc npm package is currently better than nothing, and it has two parts, neither of which is in the best shape:

  • A Node.js library that can be imported with require("rainbow-js-arc"). This library has no documentation.
  • A rainbow-js-arc command that can execute Arc code. This command has to be run from the node_modules/rainbow-js-arc/src/arc/ directory, or else it can't load essential libraries like arc.arc.

Let's facilitate a workflow like this:

  • Application developers set up a directory in which they assemble arc.arc and all the libraries they're using.
  • Library developers offer a command that operates on a given directory by performing one of the following tasks:
    • Copying the library's Arc code into the directory.
    • Getting a map from library versions to a list of file paths that represent code belonging to this library, application state belonging exclusively to this library, and application state which may be a collaboration between libraries. This list can be used to back up and restore application state on a whole-application or per-library basis, and it can be used to facilitate certain simple cases of library uninstallation or upgrade.
  • Rainbow.js offers a command that operates on a given directory by performing one of the following tasks:
    • Performing any of the above tasks for the core libraries (such as arc.arc).
    • Performing compound package management actions, such as library upgrades.
    • Executing batch-mode Arc programs based on some given filenames or expressions.
    • Starting a REPL.
    • Perhaps other, more adventurous things, like attaching a REPL to another running Arc program, running an Arc program in such a way that files reload automatically when modified, or starting a language server for IDE interaction.
    • Interpreting command line arguments in a way that conforms better with what the original Rainbow would do. This way, if we change up the command line argument parsing logic somewhat, we can still retain some parity with Java Rainbow.
@rocketnia
Copy link
Member Author

As of 8bd79f5, we now have subcommands:

  • rainbow-js-arc run-compat [args...] must be run from an Arc host directory, and it behaves in a way that imitates an invocation of Java Rainbow with the given command-line arguments.
  • rainbow-js-arc init-arc [dir] copies files like arc.arc into the given directory so that it can be used as an Arc host directory.

This is essentially an MVP of this issue. We don't have anything that facilitates uninstalling or upgrading libraries, but perhaps we don't actually need that. We can encourage a workflow where people only build their Arc host directory at the last second, right before running their Arc code. With this workflow, users never need to perform uninstallations or upgrades on that directory.

Now that this functionality is in place, let's factor out some remaining pieces of this issue into individual tasks:

  • Update the readme to describe this CLI subcommand interface. (This might be the same issue as Update the readme and the demo page text #6.)
  • Write documentation for using the library with require("rainbow-js-arc").
  • Create a rainbow-js-args run [args...] subcommand that has functionality similar to rainbow-js-args run-compat [args...] for executing Arc programs in batch mode and starting REPLs. By allowing ourselves to change the CLI syntax, we can probably achieve a bit more flexibility than what Java Rainbow supports, such as the way Racket's CLI supports interleaving files to load and expressions to evaluate. Java Rainbow's CLI can execute multiple files and multiple expressions, but it executes every file before executing any of the expressions.

@rocketnia
Copy link
Member Author

The remaining actionable pieces of this are now covered by the following new issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant