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

Polywrap Manifest: Improve imports #1920

Open
krisbitney opened this issue Oct 9, 2023 · 1 comment
Open

Polywrap Manifest: Improve imports #1920

krisbitney opened this issue Oct 9, 2023 · 1 comment
Assignees

Comments

@krisbitney
Copy link
Contributor

Importing Wraps

Importing wraps is done within all projects that integrate polywrap: apps, plugins, wraps

Today's Devexp


polywrap.graphql

#import { function, Type } into Name from "global-uri"
#import ...
...

polywrap.yaml

format: "latest"
project:
    name: i-use-polywrap
    type: project/type
source:
    ...
    schema: ./polywrap.graphql

    # If the developer wanted to have
    # import stored locally, which is nice
    # for development, they'd need
    # this...
    # Not very intuitive.
    import_abis:
        - uri: "global-uri"
          abi: "local-uri"

Tomorrow's Devexp


polywrap.json

{
    "name": "i-love-polywrap",
    "version": "1.0.0",
    "type": "wrap/rust",
    "schema": "./polywrap.graphql",
    "sources": [
      "./src"
    ],
    "imports": {
        "Name": {
            "uri": "globbal-uri",
            "functions": ["function"]
            "types": ["Type"]
        },
        "Ethers": "wrapscan.io/polywrap/[email protected]",
        "Custom": "./imports/Custom/polywrap.graphql"
    }
}

polywrap.graphql

type Module {
    myCode(
        obj1: Object!
        obj2: Ethers_Object
    ): String!
}

type Object {
    prop: Name_Object
}

How do we get here, seamlessly?

Us:

It looks like your project is using an
older version of Polywrap.

Please run:
$polywrap migrate

User:

$polywrap migrate
(y/n) Polywrap project files will manipulated: y_
[.] Begin migration.
[.] Finding project format...
[=] Project Format: "0.5.0"
[.] Loading project files...
[=] Loaded: "polywrap.yaml"
[=] Loaded: "polywrap.graphql"
[=] Loaded: "polywrap.deploy.yaml"
[=] Loaded: "URI.txt"
[.] Migrating from 0.5.0 to 0.6.0...
[=] "name": "i-love-polywrap"
[=] "version": "1.0.0"
[=] "type": "wrap/rust"
[=] "schema": "./polywrap.graphql"
[=] "imports": {
[=]   "Name": "..."
[=]   "Ethers": "..."
[=]   "Custom": "..."
[=] }
[.] Modifying project files...
[=] create: ./polywrap.json
[=] rewrite: ./polywrap.graphql
[=] delete: ./polywrap.yaml
[.] Migration complete.

Result:

GOTO tomorrows-devexp
@krisbitney krisbitney self-assigned this Oct 9, 2023
@krisbitney
Copy link
Contributor Author

krisbitney commented Oct 9, 2023

TODO:

  • Add imports to manifest
  • Flatten manifest; Convert "module" to "sources" and add codegen dir property (so users can define where wrap dir will go)
  • Add automatic migration

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