Skip to content

CI4: Get Build Working #3648

Closed
Closed

Description

@SteveIreland

I'm trying to build from the branch and ran into a couple of challenges that I need to ask about.

I'm building from source extracted from the CI4 branch.

The first question is why was the Application folder renamed to App. That change broke the scripts I used to use for the manual build. The second question is do I need to change my build procedure? It's a couple of years old. It was simple but worked back then. :-)

  1. composer install
  2. npm install
  3. grunt --force

I also see that nearly all of the folder names were changed. Seems like the world has changed while I slept and that the scripts I was using must now be obsolete because the build scripts are still referring to the old folder names.

Activity

  1. objecttothis commented on Feb 5, 2023

    @objecttothis
    Member

    Yeah, sorry about the changes. They are all CI4 related. In CI4 everything is namespaced, which means all the structural changes and moving things around are so that the application will work in CI4. I'm sure it would be possible to "customize" the framework, but it would make it practically impossible to upgrade from one CI4 version to the next. Unfortunately it means that you'll need to modify the scripts.

  2. objecttothis commented on Feb 5, 2023

    @objecttothis
    Member

    @SteveIreland I have been doing the same build procedure, but when I run npm install I get some errors:

    PS C:\Users\objec\PhpstormProjects\opensourcepos> npm install
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE could not resolve
    npm ERR!
    npm ERR! While resolving: [email protected]
    npm ERR! Found: [email protected]
    npm ERR! node_modules/grunt
    npm ERR!   dev grunt@"^1.5.3" from the root project
    npm ERR!   peer grunt@">=0.4.0" from [email protected]
    npm ERR!   node_modules/grunt-bower-concat
    npm ERR!     dev grunt-bower-concat@"^1.0.0" from the root project
    npm ERR!   5 more (grunt-composer, grunt-contrib-clean, ...)
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer grunt@"~0.4.1" from [email protected]
    npm ERR! node_modules/grunt-license-bower
    npm ERR!   dev grunt-license-bower@"~1.0.1" from the root project
    npm ERR!
    npm ERR! Conflicting peer dependency: [email protected]
    npm ERR! node_modules/grunt
    npm ERR!   peer grunt@"~0.4.1" from [email protected]
    npm ERR!   node_modules/grunt-license-bower
    npm ERR!     dev grunt-license-bower@"~1.0.1" from the root project
    npm ERR!
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR!
    npm ERR!
    npm ERR! For a full report see:
    npm ERR! C:\Users\objec\AppData\Local\npm-cache\_logs\2023-02-05T11_58_10_117Z-eresolve-report.txt
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\objec\AppData\Local\npm-cache\_logs\2023-02-05T11_58_10_117Z-debug-0.log
    

    And of course since those are related to grunt, when I run grunt --force I get problems:

    grunt --force
    grunt-cli: The grunt command line interface (v1.4.3)
    
    Fatal error: Unable to find local grunt.
    
    If you're seeing this message, grunt hasn't been installed locally to
    your project. For more information about installing and configuring grunt,
    please see the Getting Started guide:
    
    https://gruntjs.com/getting-started
    

    I suspect that there are problems with the configuration files for npm that is causing the issue. That said, I'm still able to debug using xdebug, write code and test it at the browser level. @jekkos any thoughts on these npm errors?

  3. objecttothis commented on Feb 5, 2023

    @objecttothis
    Member

    I also see that nearly all of the folder names were changed. Seems like the world has changed while I slept and that the scripts I was using must now be obsolete because the build scripts are still referring to the old folder names.

    Yeah, that's why I keep advocating to freeze changes on the master. CI4 has involved touching just about every file. Let me know what questions you have about things. The CI4 documentation has improved significantly. Also, other than locations and ci4 related function syntax, the shape of the MVC project is the same.

  4. objecttothis commented on Feb 5, 2023

    @objecttothis
    Member

    @SteveIreland I'm frequently pushing commits to ci4-upgrade, so make sure you do a fetch and pull each time you sit down to it. Also, let's make sure to coordinate if you plan to take any part of the work, so we don't accidentally double-up efforts.

  5. odiea commented on Feb 5, 2023

    @odiea
    Collaborator

    @objecttothis The only way I have been able to get grunt to work is if I use the following.
    npm install --only=dev The windows command displays lots of deprecated errors and the done but with errors but grunt runs fine afterwards. Hope this is usefull.

  6. objecttothis commented on Feb 5, 2023

    @objecttothis
    Member

    @objecttothis The only way I have been able to get grunt to work is if I use the following. npm install --only=dev The windows command displays lots of deprecated errors and the done but with errors but grunt runs fine afterwards. Hope this is usefull.

    When I do this with the ci4-upgrade branch I get

    npm WARN invalid config only="dev" set in command line options
    npm WARN invalid config Must be one of: null, prod, production
    

    before it gives the same errors about grunt

  7. odiea commented on Feb 5, 2023

    @odiea
    Collaborator

    Sorry I guess that I am not updated to the latest versions.

  8. objecttothis commented on Feb 5, 2023

    @objecttothis
    Member

    No worries. If someone doesn't pick it up, eventually I'll get to it, but right now I'm working on functionality of the code, so as long as I don't need grunt, someone else can have it.

  9. SteveIreland commented on Feb 5, 2023

    @SteveIreland
    CollaboratorAuthor

    Now that I know I'm not in the wrong ball-park on this, I'll fiddle with the build scripts to see if I can get it working. I've been monitoring your commits so I am well aware of needing to fetch before I even look at it. :-) Thanks again for taking this epic effort on.

  10. objecttothis commented on Feb 5, 2023

    @objecttothis
    Member

    Now that I know I'm not in the wrong ball-park on this, I'll fiddle with the build scripts to see if I can get it working. I've been monitoring your commits so I am well aware of needing to fetch before I even look at it. :-) Thanks again for taking this epic effort on.

    Super, thanks. Let me know if you get stuck.

  11. SteveIreland commented on Feb 5, 2023

    @SteveIreland
    CollaboratorAuthor

    @objecttothis Was there a CI4 requirement that required dropping the database folder? (The one that contains the tables.sql and constraints.sql scripts)? I saw on another thread where there was a discussion about extending the migration to begin at the 2.x version of the system so I'm thinking that dropping the folder must have been accidental.

  12. SteveIreland commented on Feb 6, 2023

    @SteveIreland
    CollaboratorAuthor

    After restoring the document folder and correcting the folder names in the configuration files I was able to complete a build. After setting up the test environment I got this cute message. Did you want me to submit a pull request for the changes I made? I'm going to do a bit more testing to make sure I didn't miss anything.

    image

  13. SteveIreland commented on Feb 6, 2023

    @SteveIreland
    CollaboratorAuthor

    Okay, tweaked a few more things and got to the login page. I'm feeling optimistic!

  14. SteveIreland commented on Feb 6, 2023

    @SteveIreland
    CollaboratorAuthor

    I was so bold as to try to log in. :-) There seems to be a lot of errors in the area of the migration scripts - shouldn't be too hard to resolve - it's just going to take some time. This is an area I have some competence in - would you like me to dive into it or do you already have something in progress?

  15. objecttothis commented on Feb 6, 2023

    @objecttothis
    Member

    @objecttothis Was there a CI4 requirement that required dropping the database folder? (The one that contains the tables.sql and constraints.sql scripts)? I saw on another thread where there was a discussion about extending the migration to begin at the 2.x version of the system so I'm thinking that dropping the folder must have been accidental.

    Yep, it is now in \app\Database\. Technically we can place tables.sql, constraints.sql and database.sql anywhere we want since CI4 is not dependent on them existing, but IMO it makes no sense to have \database\ and \app\Database.

    tables.sql, constraints.sql and database.sql were in \app\Database\Migrations\sqlscripts\ but they are not technically migrations, so I just pushed a commit moving them to \app\Database. All the pre-3.0.2 migrations that were in \database\ are now in \app\Database\Migrations\sqlscripts\pre-3.0.2\. IMO that's the best place for them because A- we may soon incorporate them into migrations and B- they are sql scripts and migrations, so having them elsewhere seems redundant.... but perhaps there is something I'm not seeing.

  16. 88 remaining items

  17. odiea commented on Mar 12, 2023

    @odiea
    Collaborator

    Has anyone else got the tables to show? Or the forms to show in the Modals?

  18. odiea commented on Mar 15, 2023

    @odiea
    Collaborator

    I came across this error while trying to load the Cashups form. It also does not like the ways files are loaded on line 1.
    "title": "ErrorException",
    "type": "ErrorException",
    "code": 500,
    "message": "Array to string conversion",
    "file": "C:\wamp64\www\newci4\app\Views\partial\datepicker_locale.php",
    "line": 28,

  19. objecttothis commented on Mar 16, 2023

    @objecttothis
    Member

    An array is being passed when it wants a string. Likely needs to have a parameter in a function call changed from have_fun($foo); to have_fun($foo['bar']);

  20. odiea commented on Mar 17, 2023

    @odiea
    Collaborator

    A new one is saving a new form use getsave update a form is looking for postSave

  21. odiea commented on Mar 18, 2023

    @odiea
    Collaborator

    I came across this issue today.
    CRITICAL - 2023-03-17 23:54:51 --> A void function must not return a value
    in APPPATH\Controllers\Suppliers.php on line 100.

  22. objecttothis commented on Mar 18, 2023

    @objecttothis
    Member

    @odiea what is the function on that line?

    Lets move this conversation to the PR. It's off topic from the original issue so it makes it difficult to find later.

  23. jekkos commented on Mar 25, 2023

    @jekkos
    Member

    The build is running again, Currently on CI4 branch we have this issue

    Warning: Task "package" not found.� Use --force to continue.
    
    Aborted due to warnings.
    
    The command "docker run --rm -it -v $(pwd):/app -w /app opensourcepos/node-grunt-bower sh -c "npm install && bower install && grunt package"" exited with 3.
    

    I'll need to take a further look to see how this needs to be fixed

  24. SteveIreland commented on Apr 30, 2023

    @SteveIreland
    CollaboratorAuthor

    I'm going to go ahead and close this issue since the build for development purposes is working. I'm going to open up a new ticket for CI4 to migrate to a Webpack flavored build. I spent the weekend working on it and although I've made some progress there is a lot of detailed crafting that is required.

  25. jekkos commented on Apr 30, 2023

    @jekkos
    Member

    Good news @SteveIreland , thanks for all the hard work

  26. jekkos commented on May 1, 2023

    @jekkos
    Member

    I bumped the base image to php8 now, what commands do you use to do the js build exactly?

  27. SteveIreland commented on May 1, 2023

    @SteveIreland
    CollaboratorAuthor

    If you're referring to the classic build for CI4 the two steps are:

    • npm install
    • npm run build

    I documented the build in https://github.com/opensourcepos/opensourcepos/blob/ci4-upgrade/BUILD.md

  28. jekkos commented on May 2, 2023

    @jekkos
    Member

    Thanks for the reference, which version of npm and node are you using? It seems that the ones in the buildbox are too old.

  29. SteveIreland commented on May 3, 2023

    @SteveIreland
    CollaboratorAuthor

    I've been using node version 18.14.0 and the build is configured to require npm 9.4.2.

  30. jekkos commented on May 5, 2023

    @jekkos
    Member

    Ok I bumped the node version in the buildbox, but it seems that composer is also being started from node. I have made some local changes to separate those as the docker contains only node/grunt/bower and not composer, which comes from the official php repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

dependencies

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions