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

feat: Add support for local package download #1

Open
dvinubius opened this issue Jul 10, 2024 · 4 comments
Open

feat: Add support for local package download #1

dvinubius opened this issue Jul 10, 2024 · 4 comments

Comments

@dvinubius
Copy link

dvinubius commented Jul 10, 2024

Details

The currently supported workflow, which is based on interacting with a new process from the aos-cli (load the APM blueprint, then install packages), is only suitable for smaller scale projects with no need for local testing.

When developing a process that relies on APM packages, local testing of the process is not possible since there is no way to install APM package code locally, so that the developed process may require it from a local directory.

In case of complex projects it's a necessity to develop a suite of unit tests and integration tests which involve no deployment on AO. This is possible with approaches such as here.

But if the process being developed relies on APM packages, such a local test setup is currently not possible.

Suggestion

To create a simple CLI tool that - similar to npm - allows the developer to locally install packages.

As a developer of a process that uses an APM package, I would

> apm install @autonomousfinance/ownable

such that the code would be downloaded into a local apm_modules directory.

The cli tool could obtain the code via the arweave gateway, by querying for messages tagged Action = "APM.PublishResponse" that were sent by the APM process.

Simple is enough

I think a tool like this would already be immensely useful even without automatic dependency resolution & inclusion, like npm provides it. So far there aren't even any APM packages relying on each other. But this would be definitely a great feature to add in a second iteration.

Also, it would be no big deal to locally work around the difference in the require path. Meaning:

  • in production, my process would require "@autonomousfinance/ownable"
  • in local development I would have the process do require "apm_modules/@autonomousfinance/ownable".
    There are accessible ways to even automate this, so no worries there.
@allquantor
Copy link

+1 on this

@allquantor
Copy link

any feedback on this one?

@ankushKun
Copy link
Collaborator

Definitely a good idea to have local files for packages during development.

However just curious about the benefits of loading the package source from local files instead from the process itself.

This makes sense if the user is developing the package, but then again it would not be too different from using .load imo.

Anyway, have been reiterating on the APM source code and making security fixes, will look into local development too

@ankushKun
Copy link
Collaborator

Hi @dvinubius @allquantor
Please checkout https://www.npmjs.com/package/apm-tool it is now possible to publish and download packages

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

3 participants