ZenVoich / mops

Package manager for the Motoko programming language
https://mops.one
MIT License
35 stars 3 forks source link

How can you setup dfx.json to use mops.toml files in subdirectories for each canister? #224

Open jake-beardo opened 3 months ago

jake-beardo commented 3 months ago

I have this canisters and i have 2 different mops.toml files in this subdirectory backend/apps/app2/canister and this one backend/apps/app1/canister

{
    "canisters": {
        "app2": {
            "main": "backend/apps/app2/canister/src/main.mo",
            "build": "cd backend/apps/app2/canister && mops sources",
            "type": "motoko"
        },
        "app1": {
            "type": "motoko",
            "main": "backend/apps/app1/canister/src/main.mo",
            "build": "cd backend/apps/app1/canister && mops sources"
        }
    }
}

If i combine the packages in mops.toml and have that in the root of my folders and instead use this setup in my dfx.json it works

{
    "canisters": {
        "app2": {
            "main": "backend/apps/app2/canister/src/main.mo",
            "type": "motoko"
        },
        "app1": {
            "type": "motoko",
            "main": "backend/apps/app1/canister/src/main.mo",
        }
    },
    "defaults": {
        "build": {
            "packtool": "mops sources"
        }
    }
}
jake-beardo commented 3 months ago

Do i need to have a dfx.json for each sub directory

ZenVoich commented 2 months ago

Do i need to have a dfx.json for each sub directory

Yes, I think this is the only way - dfx.json and mops.toml for each sub directory