We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45613
    • 45 Posts
    I have been using MyComponent to package up my project, no real problems.

    But, I am creating some elements and custom TV types, etc and my current development process is
    to create all the files in /assets/mycomponet/myproject/ directories. Sometimes I exportObjects, then build my project, move the package file to my test environment, install and test.

    While this works fine, when I have a small typo, or things to fix in some code, I have to repeat the build, the copy, uninstall then reinstall the package in the test environment.

    I have tried to keep the environment where I do the build clean, and not have the package installed, so that I make sure I update the files correctly, but I am thinking this is causing me more work.

    Just wondering how other people are using MyComponent or some other process to build, test, debug, and finally package up the component?

    I am wondering if I am worrying about building a package way too early in the development process...
    Maybe I need to just put the files in the right locations, get it all working, then later move this into mycomponent sub-directories to build the package?

    Any thoughts, suggestions would be greatly appreciated.
      • 3749
      • 24,544 Posts
      The process I usually follow is to write any snippet, or plugin, or class code to use a path (or paths) from a system setting to find things.
      The path points to the development location of the project files (assets/mycomponents/componentname ...). That way the project will run without really being installed except for the MODX objects. I almost never formally install the transport package in the environment where I'm working on it, but I run it there all the time.

      The technique is described here (under Running Your Component): http://bobsguides.com/mycomponent-tutorial.html. Put those System Settings in the 'core' namespace so they won't end up in your package when you run ExportObjects.

      I use ImportObjects and ExportObjects as necessary while working and almost never run Build until the project is almost finished. At that point, I install it in a clean version of MODX somewhere to test it.

      One drawback of this method is that the lexicon strings remain untranslated unless you copy the lexicon files to their appropriate installed locations. I usually just live with the untranslated key~~value pairs until near the end, when I run LexiconHelper on them.

      For CMPs, you need to alter the namespace core path to point to the dev location if you want to run them without installing the package.

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 4172
        • 5,888 Posts
        I have all files at its original directories while developing and testing.
        Created an additional radio-button within MyComponent for copying all files from
        core/components/myPackage and assets/components/myPackage to
        assets/mycomponents/myPackage, which is also my github-directory

        As soon, as I did some modifications, I do the steps depending on what I've changed
        For example:

        bootstrap
        ExportFiles (assets + core from workingDirs)
        export objects
        build

        I'm testing the created package on another clean installation
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 45613
          • 45 Posts
          Thanks guys. I got it working. For others that might read this and want to know how to fix it, I created 3 systems settings
          my.core_path = {assets_path}mycomponents/myproject/core/
          my.assets_path = {assets_path}mycomponents/myproject/assets/
          my.assets_url = /assets/mycomponents/myproject/assets/

          Then I added code to certain routines that needed paths. I then added the extra directories to the base path as needed. Here is one example...
          $path = $this->modx->getOption('my.core_path',null,$this->modx->getOption('core_path')).'components/myproject/model/myproject';


          I created a namespace for my project. But in order to get the Action to work correctly I had to make the path a little different than the system settings.
          core_path = {assets_path}mycomponents/myproject/core/components/myproject/
          assets_path = {assets_path}mycomponents/myproject/assets/components/myproject/
          


          Everything seems to be working locally. I have not tested my package yet, but I think it should work.
            • 3749
            • 24,544 Posts
            Looks good to me. wink
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting