Hello, I recently developed a package manager called apm, and I've been using it extensively in my coding process. However, due to the current lack of an upward search strategy for local project libraries in AHK, I sometimes have to use global dependencies in my projects. I think I need to explain what an upward search strategy for project libraries means (this is a strategy used by npm).
When managing a project with npm, we create a folder as the root directory of the project. There may be nested subdirectories of uncertain depth under the root directory, and the project's local dependencies are stored in the node_modules folder under the root directory (in AHK, it's the Lib folder). Up to this point, both are the same. However, the difference is that if I import a project dependency library in a deeply nested JS file, it's the same as importing it in the root directory. This is thanks to the upward search strategy of node_modules. If a file imports a dependency library and it is not found in the node_modules folder at the same level, it will search in the node_modules folder of the parent directory.
Currently, if I want to create an AHK project and use only local dependencies instead of global ones, I face a problem. I can only import modules by their names in the project's root directory. Once a nested subdirectory needs to import a local module, I have to use the full path to import it, which makes it somewhat more cumbersome to import local libraries into local projects.
I'm not sure if the upcoming 2.1 version has a solution for this scenario. My personal experience is that the upward search strategy is simple and easy to use, and it might be worth considering adding support for this feature. Of course, if there are other ways to solve this problem, that would be great too.
For the upward search strategy of the AHK project library
For the upward search strategy of the AHK project library
English is not my native language, all responses are translated through software.
Re: For the upward search strategy of the AHK project library
I will try to take it under consideration for v2.1.
#Include is relative to the current file's directory by default, not A_ScriptDir or the project root directory (which could potentially be unrelated to A_ScriptFullPath and not something that can be determined automatically). Surely relative paths are an option, not only "importing" from the project's root directory. #Include with a file path has no "search strategy"; just a working directory.
It's different for #Include <Lib>, but I think there's not much reason to limit yourself to that.
#Include is relative to the current file's directory by default, not A_ScriptDir or the project root directory (which could potentially be unrelated to A_ScriptFullPath and not something that can be determined automatically). Surely relative paths are an option, not only "importing" from the project's root directory. #Include with a file path has no "search strategy"; just a working directory.
It's different for #Include <Lib>, but I think there's not much reason to limit yourself to that.