on 2022 Jul 08 1:09 PM
Hi,
I have a repository with several Fiori apps. I use NPM workspaces as suggested in several UI5 examples. Each app has its own package.json, in root folder I have the repos root package.json. Each of the apps have the same depencendies (with same version). If I now do "npm install" in a app workspace the node_modules folder is not created anymore, all modules get "installed" in *root* node_modules folder. npm-dependencies seems to be hoisted in root of workspaces node_modules-folder:
If I now open "SAP Application Information" in VS Code it states "Node modules are not installed." because they are *not* in the apps node_modules folder:
And therefore Application modeler does not show any options anymore:
I use NPM 8.10.0, Node.js 16.12.2 and SAP Application Modeler 1.6.5.
I expect the SAP Application modeler to work correctly - am I doing something wrong?
Regards,
Daniel
Hi Daniel,
Thank you for the update. Unfortunately, the Fiori Tools Application Modeler doesn't support (yet) the monorepos. I've addressed the topic at the Product Owner, it will be investigated and in dependency on the results probably turn into a feature request.
Best Regards,
Petr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
Thank you for your message. Unfortunately, I'm not sure which application type you are using. Please be aware of the fact in case a CAP project the node_modules folder is located on the same level as the application folder itself (see cap-project.png). So it looks to me it corresponds to you description in *root* node_modules folder. But since you wrote " If I now do "npm install" in a app workspace the node_modules folder is not created anymore", I'm confused. If your app is a non-cap project, the node_modules folder is located within the app folder.
Could you please try following?
A)
or
B)
The node_modules folder should be installed as expected. If not, let me know. Thanks.
Best Regards,
Petr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi petr.stribrny
maybe I should explain the problem a little bit deeper:
I have one repository with several Apps which I created using VS Code and SAP Fiori Tools. So from my repositories point of view I have a folder for each app. I can 'npm install' in each app folder and the node_modules folder gets created in each of the app folders. That means a huge disk space load. So there are several alternatives like yarn and pnpm that have a concept of workspaces/packages. And this kind of workspace was adapted by npm in version 7. One of the advantages is, that the dependencies are more disk space friendly. npm stores the all unique dependencies in node_modules in root only ("hoisted"). Further readings:
To achieve this, I add simple package.json in root folder (the "workspaces"-node is the interesting part):
{
"name": "myproduct",
"version": "0.0.1",
"private": true,
"description": "my app suite",
"workspaces": [
"./packages/*"
],
"devDependencies": {
"@sap/ui5-builder-webide-extension": "1.0.x",
"@ui5/cli": "^2.14.1",
"@ui5/fs": "^2.0.6",
"@ui5/logger": "^2.0.1",
"@sap/ux-ui5-tooling": "^1.6.3",
"@sap/ux-specification": "UI5-1.96",
"rimraf": "3.0.2"
},
"dependencies": {}
}
With this in place, node_modules folder is not created anymore inside the app folders. All general tooling is still working except VS Code Fiori Tools Application modeler (which seems to hardly check for existence of node_modules folder) - and at the same time the ui5 tooling (or the fiori tooling depending on ui5 tooling) can build the app without problems: ui5/fiori command can be resolved by npm/npx and ui5 tooling itself can resolve the dependencies - see next chapter for more details.
Why else am I doing this:
ui5-tooling has the concept of defining npm-dependencies for e.g. custom control libraries (like descibed here: https://sap.github.io/ui5-tooling/pages/Project/) and some newer community extensions like https://bestofui5.org/#/packages/ui5-tooling-modules (which was mentioned at UI5con last friday).
So from my perspective monorepos mit npm workspaces should be supported by Fiori Tools Application modeler as well. It seems, that this is currently not the case so I wonder, whether this is a bug or a feature request. Monorepos (with any kind of "workspacing") seem to be used by SAP UI5 People as well as the UI5 Community.
Regards,
Daniel
User | Count |
---|---|
71 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.