How to use ethereumjs-tx in browser - javascript

Does it is needed to install npm ethereumjs-tx while using a browser version of it which is directly downloaded from github.
If yes then how we can import the ethereumjs-tx module in our script file.
Because both are two different things as my knowledge.

ethereumjs-tx as a browser build can be found here
If it helps anyone in the future. EthereumJS community have created browser builds for most of their repositories here. Please use with caution as it has not been updated regularly. But they have put instructions on how to create a build for the latest versions over here

Related

Live Server vs Lite Server

Just starting with JavaScript. Do I have to have Lite Server or can I use VS Code's Liveserver extension instead? Any research I've done on the topic leads into node.js, package.json, and NPMs which I don't understand.
If Lite Server is needed, do you install it through terminal/command line or do you have to install it in the html document you want to apply it to? Thanks.
They are both pretty similar and for your purposes, VSCode's Live server will work fine for you especially if you are not familiar with npm, node, and do not have a package.json.
If you would like to learn more about npm and what a package.json is check this out.

Why some libraries in simple vanilla Js require NPM?

I am pretty new to js. And I am looking to learn js. Recently I came across one library called bounce.js which is animation library. Which require NPM to install but why? I am dont want to use NPM (or any packet Manager) they havent provided min.js file to direct import in scrpit tag?? Why??. Similarly for Tailwind it require NPM. And as NPM require it means I need vercel to deploy and all stuff.
2) As I use django I dont know how to install NPM modules in my templates.
Please help me clear out from this mess.
When all I can find is NPM based installation guides I like to search the library name followed by CDN which typically brings up some minified results. In your case I tried searching for bounce.js CDN which brought up lots of results including this one:
https://cdnjs.com/libraries/bounce.js/0.8.2
which points to
https://cdnjs.cloudflare.com/ajax/libs/bounce.js/0.8.2/bounce.min.js
You should be able to do some searching and find the CDN you wish to use. If you want the source JS to serve from your own server you can visit the .js link and right click and download (or copy and paste into your own file).
One of the advantages of using npm over a direct download is facilitating the integration into your workflow.
For instance, if you use a module bundler, the bundler will generate an "optimised", minified version for you: Getting rid of unused code for you (=> Tree shaking) reducing the size of your resulting code, solving some import issues, and more
NPM will also help you keep track of your imported library. You know if you use an up-to-date or outdated version. It will also inform you about
Eventual securities issues. And much more.
There are many, many advantages of using npm over direct download.

Minify javascript library from latest repository commit

I'm trying to build a simple frontend example of machine learning using ml5.js, my problem is that one of the key feature I need has been merged to the master branch only five days ago and has not been added to the released min.js linked in the readme.md.
I was wondering if it was possible to build myself a minified version of the library using the code from the latest commit.
Thanks in advance
In fact I was just missing some instruction from the CONTRIBUTION.md
It was just a matter of cloning the repository and then run npm install & run

React native - which files to include in version control after installing native-base?

I started react-native project, and decided to test native-base library. Installing it and its dependencies resulted in changes to both ios and android folders. I'm not sure should I put these changes to version control or not?
The changes were:
ios:
ios/AppName.xcodeproj/project.pbxproj: I see hashes with fonts added
ios/AppName/Info.plist: Fonts are added here too inside tags
android:
android/app/src/main/assets/fonts/[20 different fonts]
So apparently, installing react-native native-base resulted in getting some fonts to the native folders? The best practise standard .gitignore files for react-native projects does not ignore these files, hence my version control client is showing the files to me. But I wonder if all of those changes were made only because of installing some third party libraries, then should I put them to version control? As the peer coders will also install those, and they should get the same files, right?
What I worry is that some important files in the native directory will become unsynced between the developers of this project. If they install the native-base, and it results in change for some core files in ios side, then that change might not be exactly the same (for example, there might have been minor version update etc.). I don't really know what to do, please help!
Apparently a very similar issue has came up for others too.
One possible solution is to check, whether it's a compatibility issue and downgrade React Native for start.
The other potential solution might be is to reinstall React Native with NPM:
npm install react-native --save
If this doesn't help, try again, but before installing React Native with NPM, remove package-lock.json and the node_modules directory (on Linux):
rm -rf package-lock.json node_modules
If you use Yarn, try to use NPM instead and see whether this resolves your problem.

How to know if a package from Node Package Management (NPM) is tested

I am relatively new to Node.js and NPM, and I have a kind of naive question. I would like to know if there is a way to know if package published on NPM is tested, and if there is away could we automate that process, and if there is tool or framwork that tell me this packages is tested. Also, does NPM require developers to provide a test for their packages.
Thank you
NPM is just a package manager. As they say in their site,
It's a way to reuse code from other developers, and also a way to
share your code with them, and it makes it easy to manage the
different versions of code.
NPM does not require developers to provide a test for their packages.
Best to use a package that has more stars and downloads cos that vouch for the package.
P.S: Never forget that a developer can pull his/her code from npm anytime :)
There is no way to know absolutely for sure, but usually a good indicator is if the author/maintainer has a test script set in the module's package.json. npm does not require modules to have tests.
NPM doesn't require package developers to write tests for their code.
To understand if a specific package is tested, the best you can do is browse the source code of the package: does it have tests? Just unit tests or other types like integration tests and the like? Are these tests ready to run with straightforward commands? Do these tests offer good code coverage of the package? Do they actually test relevant cases?
To automate a process that tells you if a package has been tested, this process will have to make multiple checks within the source code of the package, as there are multiple conventions on how to write, name and structure tests within a Node.js codebase (not to mention the amount of available testing frameworks that can be used). My concern with this approach is how complicated (if possible) would it be to automatically determine if a package is well tested, without actually having a human look at the tests.

Categories