Conditional Compilation with Create React App - create-react-app

I'm working on an application that is written in TypeScript and built with Create React App (CRA). The application needs buttons for reseting various things, so people carrying out manual software testing can do their job. How can I convince CRA to leave the test functionalities out when compiling a production build? I wouldn't want to leave a "loaded gun" behind a simple if statement and a runtime configuration option that might accidentally be turned on one day.

I'm not sure if it is a good practice, but I would have place these buttons with some html tags like data-test-show and hide them (display none or something).
On the test environment I would add some css styles for that attribute to show such elements.

Related

Nuxt js styling issue

I recently joined a team working on a nuxt js frontend application. Since the beginning, I could not make the project run properly in terms of styling.
Styles, classes, are correctly loaded in the html, I can clearly see them in the code inspector.
Though, it does not behave like it normally should (See picture 1). I compared nearly everything with the other developers and impossible to find a fix.
Did any of you already have such an issue ? And any idea of how to fix it ?
Thank you
Small example of the styling issue I have between 2 menus

VS Code stops letting me collapse code and navigate to definition when working in Vue.js

I've been having a really weird issue with VS Code. After using it for an undetermined amount of time, I'm unable to collapse code and navigate to definition. The arrow indicators in the left margin for collapsing code disappear and I can't seem to get them to come back. Closing the file doesn't work, and restarting the app doesn't work either. The only thing that works is a complete system restart. The same thing happens with ctrl+clicking a class name expecting it to navigate to definition but it doesn't.
I thought at first it was probably an extension I installed so I uninstalled all my extensions, restarted the app and now the collapse icons don't show up at all. I'm working in VueJS and think it might have something to do with *.vue extensions but I'm not sure.
You need Vetur for pretty much any functionality in *.vue files, and Vue Peek for Ctrl+Clicking paths

Different UI for Android/iOS in interpreted JS cross-platform tools

Some cross-platform tools (like Xamarin native and RubyMotion) allow the development of two separate views for Android and iOS, while keeping the business logic shared for both of them. Others (like Apache Cordova or Xamarin.Forms) share both UI and business layer, with the option to use platform-specific overrides when necessary.
What is the state of the interpreted JavaScript frameworks (NativeScript, React Native or Appcelerator)? Are they all focused on creating single UI with platform overrides, or do they allow creating two separate views for each platform? For example, is it possible to create a view using Fragments in Android, but a different view on iOS (since Fragments do not exist there)?
Cordova uses WebView, that mean GUI level will be the same for both Android and iOS but different per Device version. In case of Android each client has own Chronium version and it can break UI behaviour. So developers use Crosswalk to set fixed Chronium version. (extra 20M to your application).
BTW Ionic that uses Cordova architecture uses native behaviour per platform. For example for Android Tabs located at the top, on iOS - at the bottom
On other hand Xamarin (C#), React-Native(JS) and NativeScript(JS) call native APIs. They don't use WebView but generate Native code.
For example if you create button - it will look different: on Android - material theme, on iOS - iPhone theme
Anyways, the bottom line is: everything depends on resources and time. If you want to build application fast, with the same view - I would go on Ionic2+ Angular2 + Cordova.
If you you have more time - go on React-Native or NativeScript (Still has poor documentation) or Xamarin (C#).
React-native's slogan is Learn once, write everywhere. So, you can choose what suits your needs, you can:
Share UI between platforms.
Share Only business logic.
So, the answer for react-native is yes. You can create separate UIs or you can share it.
Since you are writing components, one way of separating this logic is to write component.android.js and component.ios.js and the platform loads the appropriate one for you. Note that you can also do that programmatically.
You can see that in action in the official f8 app made by facebook using react-native

React Native Dynamically load modules/plugins?

As far as I've searched it appears to be impossible to load modules (=plugins/libraries?) dynamically (I'm very new to React Native..).
What I'd like to accomplish is to let the user of the app load additional functions as she/he desires.
Example:
A user wants to add a music plugin to the app.
Intuitively, I'd long for something like dynamic library loading. The user would fetch the library, it'll be loaded into the code and can then be executed. However, in React Native it seems like there are only modules that can be loaded?
Alternatively, I'd hope that auto-updating the app would allow to add modules "on-the-fly" ( https://github.com/aerofs/react-native-auto-updater or www.npmjs.com/package/react-native-hot-load ). But I fear that this is only for JS and data content?
The ability to dynamically add functionality to the app is an essential part of the app. I have no previous experience worth mentioning in mobile app development.
Question: Is it possible to dynamically add functionality (also native in nature) to React Native apps?
If not, would there be a workaround?
EDIT: I have found the following repository on github: https://github.com/yusefnapora/react-dynamic-linking-example .
Unfortunately, without any description. I have no idea about Objective-C, but the repo name sounds promising. Anybody knows what its purpose is?

VB.NET Ignoring bad references at compilation

I've got a problem with a program that references a third party ActiveX component that I've been refused permission to distribute.
The AX component is used on some user defined controls which the user can add programatically, which makes isolating them fairly easy.
However, the problem is that if the program is installed on a machine without the third party component then it just crashes, where I would much prefer it to just alert the user to the missing component and then disable the functionality that requires the component.
In the past I've tried adding the reference programatically but have found that this solution doesn't work with this particular control.
Any suggestions as to a strategy that allows the program to run despite missing referenced components would be much appreciated.
You use a launcher app. Deploy both apps. The shortcut you show to the user should start your launcher app. The launcher will first check that all the dependencies are in place, and if so go on to start your app. Otherwise, it will show the user a nicer error message, and perhaps point them to where they can find the missing dependency.