SAP / ui5-tooling

An open and modular toolchain to develop state of the art applications based on the UI5 framework
https://sap.github.io/ui5-tooling
Apache License 2.0
465 stars 69 forks source link

Yarn 2.0 support #207

Closed bd82 closed 4 years ago

bd82 commented 4 years ago

Hello.

Does UI5 Tooling work with Yarn 2.0?

It seems many OSS Dev tools required some adjustments (no more node_modules dir)

When I attempted to run yarn build on the openui5-sample-app while also using the yarn 2 global cache option I got an error related to some node resolver. This may indicate some adjustments may be needed...

Do the plugin system of UI5-Tooling rely on file system structure (node_modules) directory structure?

RandomByte commented 4 years ago

Thanks for testing this! I think we'll need to switch to a resolver that can handle PnP. Also relevant link: https://legacy.yarnpkg.com/en/docs/pnp/getting-started

matz3 commented 4 years ago

I've could reproduce the issue with Yarn v2.0.0-rc.27 and with enableGlobalCache: true. Unfortunately I couldn't figure out how to link my local UI5 Tooling projects with Yarn as they seem to have changed how the link command works. Therefore I couldn't analyze the problem, yet. The affected modules seems to be ui5-project.

yarn build --verbose                                                       
verb cli:middlewares:base using @ui5/cli version 1.13.1 (from ~/.yarn/berry/cache/@ui5-cli-npm-1.13.1-c691be5d50-1.zip/node_modules/@ui5/cli/bin/ui5.js)
verb cli:middlewares:base using node version v12.13.0
verb normalizer:normalizer Building dependency tree...
verb normalizer:translators:npm Analyzing openui5-sample-app (/github/SAP-samples/openui5-sample-app) (dependency of nothing - root project)
verb normalizer:translators:npm Analyzing @openui5/sap.m (~/.yarn/berry/cache/@openui5-sap.m-npm-1.74.0-488f568124-1.zip/node_modules/@openui5/sap.m) (dependency of openui5-sample-app)
verb normalizer:translators:npm Analyzing @openui5/sap.ui.core (~/.yarn/berry/cache/@openui5-sap.ui.core-npm-1.74.0-a5c36e62f6-1.zip/node_modules/@openui5/sap.ui.core) (dependency of openui5-sample-app)
verb normalizer:translators:npm Analyzing @openui5/themelib_sap_fiori_3 (~/.yarn/berry/cache/@openui5-themelib_sap_fiori_3-npm-1.74.0-b986c413fc-1.zip/node_modules/@openui5/themelib_sap_fiori_3) (dependency of openui5-sample-app)

⚠️  Process Failed With Error

Error Message:
[npm translator] Could not locate module @openui5/sap.ui.core via resolve logic (error: Cannot find module '@openui5/sap.ui.core/package.json' from '~/.yarn/berry/cache/@openui5-sap.m-npm-1.74.0-488f568124-1.zip/node_modules/@openui5/sap.m') or in a collection

Stack Trace:
Error: [npm translator] Could not locate module @openui5/sap.ui.core via resolve logic (error: Cannot find module '@openui5/sap.ui.core/package.json' from '~/.yarn/berry/cache/@openui5-sap.m-npm-1.74.0-488f568124-1.zip/node_modules/@openui5/sap.m') or in a collection
    at ~/.yarn/berry/cache/@ui5-project-npm-1.2.0-dc10b6cece-1.zip/node_modules/@ui5/project/lib/translators/npm.js:308:11
    at async Promise.all (index 0)
    at async Promise.all (index 0)
    at async Object.generateProjectTree (~/.yarn/berry/cache/@ui5-project-npm-1.2.0-dc10b6cece-1.zip/node_modules/@ui5/project/lib/normalizer.js:26:16)
    at async Object.handleBuild [as handler] (~/.yarn/berry/cache/@ui5-cli-npm-1.13.1-c691be5d50-1.zip/node_modules/@ui5/cli/lib/cli/commands/build.js:81:15)

Without enabling the global cache it works just fine. @bd82 is this matching with your observations or did you encounter issues with Yarn 2 in general?

bd82 commented 4 years ago

@matz3 this is indeed the issue I've reported.

matz3 commented 4 years ago

I managed to debug the issue and I can't find any indication that something is wrong within our code. The paths returned by the "resolve" module look the same in both scenarios. The only difference is that it can't locate transitive dependencies for whatever reason when using the global cache. As the latest Yarn version is still a RC, I would like to wait for the stable version to be released before having a deeper look into this issue.

bd82 commented 4 years ago

Yarn 2.0 was released, they just did not sort out the releases/installers yet

RandomByte commented 4 years ago

On npm there are only RCs (multiple!) available: https://www.npmjs.com/package/yarn

bd82 commented 4 years ago

We can try again in a week, hopefully they will sort their releases by then

bd82 commented 4 years ago

BTW, if yarn 2.0 in local mode works with the OpenUI5-Sample-App is it safe to assume Yarn 2.0 (Local) and UI5-Tooling are compatible?

RandomByte commented 4 years ago

is it safe to assume Yarn 2.0 (Local) and UI5-Tooling are compatible?

Yes, I think that's what Matthias confirmed works. We'll investigate the global cache mode issue once a final 2.0 release is available.

matz3 commented 4 years ago

Yes. We are using the "resolve" module in version 1.9+, as suggested by Yarn for other bundlers here: https://yarnpkg.com/features/pnp#caveats-and-work-in-progress

bd82 commented 4 years ago

Great.

The Local Cache mode is the one which is more interesting for me at this time 👍

matz3 commented 4 years ago

Still doesn't work with 2.0.0-rc.32. But as Yarn 2 is still not finally released, I'm closing this issue for now. As already mentioned we are using the resolve module as expected, so I don't see any issue on our side.