Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with FOAL CONNECT for angular>13 (project) : foal connect angular frontend_dir #1197

Closed
Gfoulon opened this issue Dec 17, 2022 · 2 comments · Fixed by #1236
Closed

Comments

@Gfoulon
Copy link

Gfoulon commented Dec 17, 2022

Version of FoalTS: 3.1.0

First of all : FoalTS is really great!

I faced the following error when I try to connect an angular frontend project to FOAL, I've got the following error:

config.projects[config.defaultProject].architect ||= {};
TypeError: Cannot read properties of undefined (reading 'architect')

If I understand well config.defaultProject has been removed from Angular.json since Angular v14.
(found on angular-cli : defaultProject deprecated [https://github.com/angular/angular-cli/issues/23470])

I found a solution which works for me (on IONIC projects), but not sure that's the best way to solve the issue:

In node_modules@foal\cli\lib\generate\generators\angular\connect-angular.js :

    if (config.defaultProject === undefined) {
        console.log("NO default project (Angular>14 - use firstproject 'app'?) => ",angularProject);
    }
    config.projects[angularProject].architect ||= {};
    config.projects[angularProject].architect.serve ||= {};
    config.projects[angularProject].architect.serve.options ||= {};
    config.projects[angularProject].architect.serve.options.proxyConfig = 'src/proxy.conf.json';
    // Output build directory
    const outputPath = (0, path_1.join)((0, path_1.relative)(path, process.cwd()), 'public')
        // Make projects generated on Windows build on Unix.
        .replace(/\\/g, '/');
    config.projects[angularProject].architect.build ||= {};
    config.projects[angularProject].architect.build.options ||= {};
    config.projects[angularProject].architect.build.options.outputPath = outputPath;
    return JSON.stringify(config, null, 2);

Hope this could help.

@Gfoulon Gfoulon added the bug label Dec 17, 2022
@LoicPoullain LoicPoullain added this to Backlog in Issue tracking via automation Dec 19, 2022
@LoicPoullain
Copy link
Member

Hi @Gfoulon 👋

First of all : FoalTS is really great!

Thank you!

I faced the following error when I try to connect an angular frontend project to FOAL, I've got the following error:

Do you want to submit a PR to fix this? The command foal connect command should always support the latest version of the CLI (Angular, Vue, etc) (not the previous ones).

The files to change are located in:

  • packages/cli/src/generate/specs/angular
  • packages/cli/src/generate/fixtures/angular (default json file generated by Angular CLI)
  • packages/cli/src/generate/generators/angular

@LoicPoullain
Copy link
Member

The bug has been fixed in #1236. The fix will be released with v4.2.

Thank you for reporting the issue and for the suggestion proposal 👍

Issue tracking automation moved this from To Do to Done / Closed This Release Oct 24, 2023
@LoicPoullain LoicPoullain mentioned this issue Oct 24, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Issue tracking
  
Done / Closed This Release
Development

Successfully merging a pull request may close this issue.

2 participants