LSS-Manager / LSSM-V.4

The Official Repository for LSS Manager V4
https://lss-manager.de
Other
56 stars 92 forks source link

[build] local build supress error message for branches and releasenotes #2870

Closed Cr4zyc4k3 closed 7 months ago

Cr4zyc4k3 commented 8 months ago

image image is it possible to delete these messages locally?

Originally posted by @deoxis9001 in https://github.com/LSS-Manager/LSSM-V.4/issues/2865#issuecomment-1925746524

buffcode commented 7 months ago

What is the recommended way to detect the local development environment?

I tested wrapping the following blocks with if (BRANCH !== 'dummy') { ... }, so Webpack can drop the code. But probably there is some better check.

jxn-30 commented 7 months ago

What is the recommended way to detect the local development environment?

I tested wrapping the following blocks with if (BRANCH !== 'dummy') { ... }, so Webpack can drop the code. But probably there is some better check.

* Branches: https://github.com/buffcode/LSSM-V.4/blob/271e5e520e31d93883595ce983862d7779d41b94/src/components/settings.vue#L850-L856

* Release notes: https://github.com/buffcode/LSSM-V.4/blob/eb48d37b27fcf6e215bd51956e01c9ad7c6538c0/src/mainpageCore.ts#L135-L138

I would not rely on a check if we're running on a local server as we already did in src/config.ts. It exports a const PORT_ENV_KEY which could be used: const isLocalServer = typeof process !== 'undefined' && PORT_ENV_KEY in process.env;

Probably, one would have to do that within /build/index.ts and define a global constant within DefinePlugin to handle it correctly und to allow dropping the code accordingly. In combination with correct type in src/global.d.ts that could work.

buffcode commented 7 months ago

Couldn't we reuse MODE? It currently maps development (which is the default when no mode is specified) to beta.

Either we could refine this and passtrough production | beta | development, or just check for beta at those places as this is also the default for the dev branch.

jxn-30 commented 7 months ago

Distinguishing between beta and development is definitely mandatory in my eyes as we would otherwise supress the error messages at the live beta build.

Cr4zyc4k3 commented 7 months ago

Done in #2865 . File download will be done in the prebuild phase.