Dependency management for automation scripts

In
https://docs.cortezaproject.org/corteza-docs/2022.3/integrator-guide/automation/automation-scripts/node-modules.html
it’s stated that

Different extensions do not share their dependencies. If two extensions use the same dependency, they both need to define it.

Does that mean that our structure should look like this?

.
β”œβ”€β”€ client-scripts
β”œβ”€β”€ package.json
└── server-scripts
    β”œβ”€β”€ common
    β”‚   β”œβ”€β”€ hello-world.js
    β”‚   └── package.json
    └── hello-world
        └── package.json


If so, why does this link seem to show that there is only one global package.json file?

Quote from the article:

package.json
…
/server-scripts
…
/client-scripts
/admin
…
/compose
…
/shared
…

Because every extension has its own package.json file. An extension is a collection of server and client scripts – the common and hello-world folders you have defined fall into the same thing.
The snippet you pasted tells what file structure the extension should have.

A different package would mean a new set of server and client scripts with their own package.json.

1 Like

Ahh that makes a lot of sense! I did see the word extension being used throughout the documentation but I thought it was interchangeable with automation script.

Is there any definition of extensions in the documentation?

The only place I could find any sort of definition was in

(Edited by mod to provide direct link instead of bitly)
https://docs.cortezaproject.org/corteza-docs/2022.3/integrator-guide/automation/automation-scripts/testing.html

Where it says

Extensions are essentially Node.js projects with additional bits, meaning that the extensions can be tested in the same way as node.js projects.

1 Like

Your post was flagged as spam because you provided too many links to our docs :eyes:

I was quite sure that was all explained under the automation script sections, but if it’s not, it should probably be added.

… Should I not post links to your documentation?

I did not find it. I also searched corteza using both google and corteza’s docs search… But maybe I missed it.

No clue; you can keep on linking; it’s probably something in regards to your user trust level and how this platform views it… we’ll take a look if it keeps on happening

1 Like