Angular Elements - Are they a lib or an app in NRWL/NX? - angular-elements

Trying to build a suite of angular elements (web components) in an NX workspace.
I tried first as a lib, but couldn't 'build'. I retried as an app - but I cannot create a storybook for it since its not a lib.
What's the path to peace?

I think the answer is to make a publishable lib:
ng g #nrwl/angular:lib my-elements --publishable
This will create a library with the build architect to your workspace file, which is what you need to run ng build my-elements.

Related

Regenerate XCFramework if there is a code change

I have a Demo project and Framework which can be integrated with multiple ways(Cocoapods, SPM - using generated XCFramework, directly integrate with XCFramework)
For distributing Demo app to external users we integrate the Framework with SPM.
Problem with this approch is during development its makes really hard to regenerate XCFramework after each change, so I have decided to drag and drop the Framework's project to Demo app, but cant understand how to recompile XCFramework if there is a change.
Could you please help me with understading how to handle this scenario.
Create an .xcworkspace that contains the framework project and the demo app project side by side, then inside the demo app target General settings (see screenshot), add the .framework file from the framework project within the workspace instead of depending on the .xcframework binary file directly.
After that, add a "Copy File" build phase that embeds the framework file.

Do I have to install gin framework in every new folder I create in visual Studio code for Golang programmes?

I have already installed gin framework in a different folder on my desktop named Gingo. I am learning how to build a web RESTful API through the Gin framework,
by starting the implementation of the backend code that is needed to support our Go Music.
But I have created another folder on my desktop for this Go Music named backend, so do I have to install gin framework in this folder as well?
The project can be found at https://github.com/gin-gonic/
gin.
i think you must install in every project, in my opinion because framework on golang just thrid party labrary. but if you want to install on your system you can try this. maybe its can be new journery on your programming
The way you use external libraries and frameworks in Go is by using Go modules. Initialise your project by running go mod init name-of-project in the backend folder (or whatever the root folder is for your Go code).
Now, if you want to add gin to your project, you can run go get github.com/gin-gonic/gin, which adds gin to the dependencies of your project (you can see all dependencies in the go.mod file in the project root).
The gin code will be downloaded and placed in the pkg folder in your GOPATH (often ~/go). This way the code has to be downloaded only once, and every time you import it it is simply using the already present code. You do have to add it to the dependencies of your project every time though.
For more information about Go modules: https://zetcode.com/golang/module/

Can I link an XCUITest target to a different Project's app target OR use XCTest/XCUITest outside of a UI Test Bundle target?

I am currently building out a test suite in an Xcode workspace that contains 3 existing projects. 2 App projects and a common framework project. Both apps are very similar in regards to UI with some minor differences.
I am trying to find a way to share the XCUITest framework I made for App A with App B.
Currently, App A has a test target set inside of its AppA.xcodeproj. All of App A's tests are doing great and easy to maintain. I need to extend this to App B and refactor App A's framework to only the App A exclusive bits so App A and App B can share the common XCUITest framework code base from a central base.
I have tried to create a new project, move over the UI test code and point the new UI Test target at App A's executable, but I could not figure out how to get the option to show.
I set the App A app as a Target Dependency in the New Project's test target > Build Phases tab, but no luck. I was able to set App A's target in the new test target's scheme but still landed on an error.
Assertion Failure: CommonBasePage.swift:21: failed: caught "NSInternalInconsistencyException",
"No target application path specified via test configuration: <XCTestConfiguration: 0x60400014e910>
testBundleURL:file:///Users/user.name/Library/Developer/Xcode/DerivedData/.../Debug-iphonesimulator/NewTestTarget-Runner.app/PlugIns/NewTestTarget.xctest/
testBundleRelativePath:(null)
productModuleName:NewTestTarget
testsToSkip:(null)
testsToRun:NewBasePage/testExample
reportResultsToIDE:YES
sessionIdentifier:<>
pathToXcodeReportingSocket:(null)
disablePerformanceMetrics:no
treatMissingBaselinesAsFailures:no
baselineFileURL:(null)
baselineFileRelativePath:(null)
targetApplicationPath:(null)
targetApplicationBundleID:(null)
testApplicationDependencies:
{...
I'm assuming targetApplicationPath:(null), targetApplicationBundleID:(null) should have legit target values but I'm unsure where else to look in order to set them.
I gave up on that and tried to create a new project & target as a Cocoa Touch Framework to shift the common code to a central point but was not able to import XCTest, which my framework depends on for XCUIApplication and XCUIElement fields.
import XCTest //Causes "Cannot load underlying module for 'XCTest'"I tried adding XCTest.framework to the targets "Link Binary with Libraries" section under build phases but no luck.
Is there a way to work with the XCTest framework outside of a test target?
OR
Is there a way to point one project's test target at another project's app target?
You can link XCTest and any other framework to anything. Make sure you have $(PLATFORM_DIR)/Developer/Library/Frameworks in both LD_RUNPATH_SEARCH_PATHS and FRAMEWORK_SEARCH_PATHS.
Making framework for shared code is a good idea.

Fabric manual integration with react-native-firebase on iOS

I'm trying to manually integrate fabric and crashlytics into my react native iOS project without using CocoaPods following this guide:
https://rnfirebase.io/docs/v4.3.x/crashlytics/ios
Steps I've taken so far
I've added the Fabric and Crashlytics library to my project. They are in a folder called Firebase, the rest of the Firebase framework is working.
I've added the run phase script.
But I still get this error:
Below are my header and framework search paths.
Header search paths:
Framework search paths:
Am I missing anything?
The instructions for manual integration have been merged into the react-native-firebase docs:
https://github.com/invertase/react-native-firebase-docs/blob/master/docs/crashlytics/ios.md

installing electron app is too slow because of native dependencies that need installing into user end pc

I have an electron app with 2 package.json files.
The root/package.json has all devDependencies, and the root/app/package.json has all dependencies which is necessary for app running.
So I package app folder using electron-packager, then build installer for windows using inno setup.
But when I install the app, because the node_modules in app has too many dependencies, the installer is so slow in order to extract all contents from node_modules.
Other apps cost 3-10s for installing, but mine 25-35s.
So what should I do for this? Maybe I can bundle the js using webpack before packaging?
Thanks.
You should absolutely use something like webpack (or equivalent) to bundle your application. Webpack does an excellent job at tree-shaking your dependencies and only keeping the resultant necessary modules.
I have already posted a possible solution for electron projects, including a build process approach that leads to installation building. My particular recommendation leaned on utilizing Wix for MSI deployment but the build process items are still applicable (steps 1-6) for anyone wanting to understand a possible process for the items important to doing this work (even if you use another installer). Hope this helps:
https://stackoverflow.com/a/46474978/3946706
Are you packaging a web app into electron? The slow packaging time is probably because of bundling web node modules into the electron app which is not necessary.
https://medium.com/#hellobharadwaj/electron-plus-angular-react-why-use-2-different-package-json-files-361ae47d07f3

Resources