React generator problem

After upgrading our in-house app from 7.1.x to 7.2.x we also need to re-develop the front module away from the Polymer-based one to React. As I want to leave the old one in place for now, I tried to follow the instructions on generating a seperate app using the cli, but unfortunately, no luck.

Method 1 - enable studio integration:

  • After I enabled studio integration, I ran the following command:

E:\learn-javascript\akiri-react>npx @cuba-platform/front-generator react-typescript:app

  • It picked up the project as below:

? Please select CUBA project you want to use for generation akiri [C:/Users/skopp/IdeaProjects/akiri]

  • But then it bombs out with:

events.js:288
throw er; // Unhandled ‘error’ event
^

Error: Specified model file does not exist
at Object.readProjectModel (C:\Users\skopp\AppData\Roaming\npm-cache_npx\8584\node_modules@cuba-platform\front-generator\lib\common\base-generator.js:132:15)
at ReactTSAppGenerator. (C:\Users\skopp\AppData\Roaming\npm-cache_npx\8584\node_modules@cuba-platform\front-generator\lib\generators\react-typescript\app\index.js:60:58)
at Generator.next ()
at fulfilled (C:\Users\skopp\AppData\Roaming\npm-cache_npx\8584\node_modules@cuba-platform\front-generator\lib\generators\react-typescript\app\index.js:5:58)
Emitted ‘error’ event on ReactTSAppGenerator instance at:
at Immediate. (C:\Users\skopp\AppData\Roaming\npm-cache_npx\8584\node_modules@cuba-platform\front-generator\node_modules\yeoman-generator\lib\index.js:852:20)
at processImmediate (internal/timers.js:456:21)

Method 2 - Generating the model

  • Model is generated fine (although very large)

E:\learn-javascript\akiri-react>npx @cuba-platform/front-generator react-typescript:app --model C:\Users\skopp\IdeaProjects\akiri\projectModel.json

works until:


force entities\base\cubaat$SshCredentials.ts
force enums\enums.ts
force services.ts
C:\Users\skopp\AppData\Roaming\npm-cache_npx\11608\node_modules@cuba-platform\front-generator\node_modules\prettier\index.js:9750
throw error;
^

SyntaxError: ‘=’ expected. (23:58)
21 | };
22 |

23 | export type queries_SlaughterStatement_slaughterStatement-query_params = {
| ^
24 | email: string;
25 | };
26 |
at t (C:\Users\skopp\AppData\Roaming\npm-cache_npx\11608\node_modules@cuba-platform\front-generator\node_modules\prettier\parser-typescript.js:1:285)
at Object.parse (C:\Users\skopp\AppData\Roaming\npm-cache_npx\11608\node_modules@cuba-platform\front-generator\node_modules\prettier\parser-typescript.js:14:180461)
…etc.

Unfortunately I was this far unable to produce the problem in a basic application, but I am willing to send the generated model file if it will help.

Hi,

It looks like a bug in SDK generation. Could you please attach src/cuba/queries.ts (from client-side app) and rest-queries.xml from the main project?

Hi Vlad,

the queries.ts is not generated yet (I suspect the error happens in the generation process. See screen shot below:
image(1)

Attached please find the rest-queries.xml

rest-queries.xml (5.0 KB)

Hi, could you please also attach projectModel.json ?

Hi Vlad,

can I send it to you directly as the company feel uncomfortable with me publishing it on an open forum?

Yes, you can PM me, also you can grab only services part of the json.

Ok, I solved the issue - to document and maybe help somebody in the future:

Inside my rest-queries.xml I still had queries named e.g. slaughterStatement-query, probably left over from a previous upgrade.

I renamed them to e.g. slaughterStatementQuery and that solved the generation problem.