In order to simplify the management of the dependencies of an AutoIt project built with AGS, we have diverted form its initial use the dependency manager npm, and its evolution Yarn. This allows us to manage the dependencies of an AGS project with other AutoIt libraries, and to share these AutoIt packages from the npmjs.org repository.

Dependency manager for AutoIt

What is a dependency? A Dependency is an external and standalone package (library) which have one or more files that performs a specific task. Dependency managers are software modules that coordinate the integration of external libraries or packages into larger application stack. Dependency managers use a configuration files to describe the project and its dependencies.

AGS dependency manager AutoIt

AGS uses the Node.js ecosystem and its dependency manager npm and Yarn.

Package AGS : component ou wrapper

All AGS packages hosted in npmjs.org repository belong to the @autoit-gui-skeleton organization. And you can find two types of package hosted in this organization:

  • An AGS-component is an AutoIt library, that you can easy use in your AutoIt project built with the AGS framework. Take a look of AGS-component http-request.
  • An AGS-wrapper is a simple wrapper for an another library created by another team/developper. Take a look of AGS-wrapper-json

How to install an AGS package ?

To install an AGS component or wrapper in your project, just type in the root folder where the package.json is stored:

yarn add @autoit-gui-skeleton/ags-component-xxx --modules-folder vendor
yarn add @autoit-gui-skeleton/ags-wrapper-xxx --modules-folder vendor

Describe an AGS project and its dependencies

To describe an AGS project and its dependencies we naturally use the package.json file, specific to the Node.js ecosystem. You can find more information about this file, and how to fill it here : https://yarnpkg.com/lang/en/docs/package-json/.

{
  "name": ApplicationWithCheckForUpdates,
  "version": "1.0.0",
  "description": "Example to implementation of AGS-component-check-for-updates",
  "AGS": {
    "framework": {
      "version": "1.0.0"
    },
    "AutoIt": {
      "version": "3.3.14.5"
    }
  },
  "author": "v20100v <v20100v@no-reply.com>",
  "license": "MIT License",
  "year": "2018",
  "private": true,
  "repository": {
    "url": "not-yet-git",
    "type": "git"
  },  
  "dependencies": {
    "@autoit-gui-skeleton/AGS-component-check-for-updates": "^1.0.0"
  }
}

And finaly to install all the dependencies of a given project, you just have to launch this command:

yarn install --modules-folder vendor

All project dependencies, as well as daughter dependencies of parent dependencies, are installed in the ./vendor/@autoit-gui-skeleton/ directory. If you add AutoIt library in the vendor directory, we recommend wrapping them so that they are also managed by the dependency manager, in the same way as AGS-wrapper-json

To install AutoIt dependencies in the ./vendor directory, and not in the default directory of Node.js ./node_modules, you must add the --modules-folder vendor option. We force this choice to avoid any confusion with a Node.js project. Note that with an AGS project, it is not necessary to explicitly write this option on the command line, thanks to the .yarnrc file stored at the root of the project, ie in the same place as the package.json file. Yarn automatically use this file to add an additional configuration of options.

 #./.yarnrc 
 --modules-folder vendor

So with this file you can run yarn install to install the dependencies directly into the appropriate ./vendor directory.


Links related

View all published AGS package on npmjs.org