React Native - should I relink after an library update? - reactjs

After I update an already existing React Native library, is it necessary to relink it again?

linking just sets up your native projects to link to the module in your node_modules. Unless there is a major change to the module, you only need to do it once.
For iOS, this will modify your .pbxproj file, updating your targets and adding links to the framework (if needed) and the .xcodeproj in node_modules/<module>
For android, it will modify your settings.gradle file to include the project from node_modules. It will also update your build.gradle to compile the new library, and it will modify your MainApplication.java file to add the new lib to react.

No, you don't need to relink the lib.

Related

How to compile sveltekit library to plain javascript and resources?

I've created my library with npm init svelte and selected Library skeleton project. After writing my component and doing the production build I see in package directory that it is not plain JS because it also contains MyComponent.svelte. I would like my component library to be used by plain JS (or TS) projects. How can I compile it to be pure JS with css and image resources (and *.d.ts)?
If I remember correctly this allows the Svelte compiler to better optimize builds if these files can be used directly. (The package.json has a "svelte" property to identify the entry point for Svelte.)
You probably have to run a separate build process on the resulting package to fully compile everything. The current packaging mechanism (svelte-package) has no options regarding this.

Is there a way to do an unminified rollup build of an npm package?

I am using a React library that builds with rollup, and there is a bug with how it behaves in my application. I want to be able to directly edit the installed library code in node_modules/ to see if that fixes the issue, without having rebuild the library every time I make a change (if it is minified, I can't find the code I want to edit and so can't skip building it again from the unminified source). How do I do this, or is there another work around?

CSS modules won't import in NextJS when using a module created using nwb

I created a React component and uploaded it to a private git repo. It's a fairly simple component that renders a data table that can be sorted etc. I used nwb to for the setup / build process (https://github.com/insin/nwb).
It's not published on npm, so when I want to use it on a project I install via something like npm install --save git+ssh://git#github.com/Me/myRepo.git. This all works fine in normal React projects.
Unfortunately on a NextJS site I'm working on, NextJS won't compile, and is giving the error CSS Modules cannot be imported from within node_modules and linking me to https://nextjs.org/docs/messages/css-modules-npm
That page suggests that I might be accidentally using the package's source files - but I'm not. When I look in my /node_modules/myComponent/ folder, there's a /lib/ folder that has the compiled source. However, the styles are still in separate files and are included into the compiled source just like you might normally do (var _defaultModule = _interopRequireDefault(require("./styles/default.module.scss"));).
I did some searching online and it seems like the "quick and easy" solution is to use https://github.com/martpie/next-transpile-modules.
I'd prefer to solve this by fixing my repo though, so that when I install it on a project (whether NextJS or whatever) I get whatever it is that NextJS wants.
So my various questions are:
Is there a way to set up my repo so NextJS is happy with it?
Is nwb not the preferred way to make a React component? Should I have used some other process? I'm not having this problem with any other component, so it seems like this is something I did wrong with my repo.

How to make CN1Lib that depends on other CN1Lib

I'm trying to create a CN1Lib from Steve's cloudinary source, it uses BouncyCastleCN1Lib.cn1lib.
How do I use this lib in my code?
When I clean build, I got errors pointing to javabc.SecureRandom and org.bouncycastle.crypto, even though I have the CN1Lib inside my lib folder and there's no way to do refresh libs as all codenameone options are disabled because I don't have the `CodeNameOneBuildClient.jar for the taskdef.
You can't nest cn1libs. If you need to use classes from one cn1lib in another you need to specify that as a requirement to your users and change the classpath of the project to compile against the other cn1lib.
Then in the final project both cn1libs should be placed in the lib directory for the project to work.

Adding packages like moment.js & account.js to meteor Project

How do I add these JS packages to a meteor project? Do I simply place the JS files in the public folder so the client and server can access them? Or is there some specific steps that I need to follow?
These kind of standalone libraries can be directly placed in the /lib directory under your project.
For use on both the client and the server, place them into project/lib folder.
Or if you want to use them only at client-side, place them as usual in project/client/lib
In short, It depends.
I would recommend you check out http://atmosphere.meteor.com for a list of packages. If what you're looking for is there, install meteorite with npm install -g meteorite (https://github.com/oortcloud/meteorite)
Once you have metorite installed you can install these community packages quite easily using mrt add packagename
Most packages are on http://atmosphere.meteor.com.
But if for some reason the JS package you want isn't on atmosphere, depending on the package, if its a UI package (e.g datepicker, etc) put it in the /client/lib folder to avoid meteor crashing (only accessible by client).
If its a type of module abstractor (e.g backbone - backbone is included in meteor already btw: add using meteor add backbone) you could put it in the /lib directory of your package, it will be referenced automatically by both the server and client.
You have to add the packages via console.
Type "meteor add accounts-password" for example.
See here
Perhaps you should watch some of these videos here
to get an idea how meteor packages are added.

Resources