Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@mattoakes/bob
Advanced tools
👷♂️ Simple CLI to build React Native libraries for different targets.
The CLI can build code for following targets:
Metro handles compiling source code for React Native libraries, but it's possible to use them in other targets such as web. Currently, to handle this, we need to have multiple babel configs and write a long babel-cli
command in our package.json
. We also need to keep the configs in sync between our projects.
Just as an example, this is a command we have in one of the packages: babel --extensions '.js,.ts,.tsx' --no-babelrc --config-file=./babel.config.publish.js src --ignore '**/__tests__/**' --copy-files --source-maps --delete-dir-on-start --out-dir dist && del-cli 'dist/**/__tests__' && yarn tsc --emitDeclarationOnly
. This isn't all, there's even a separate babel.config.publish.js
file. And this only works for webpack and Metro, and will fail on Node due to ESM usage.
Bob wraps tools such as babel
and typescript
to simplify these common tasks across multiple projects. It's tailored specifically to React Native projects to minimize the configuration required.
Open a Terminal in your project, and run:
yarn add --dev @react-native-community/bob
To configure your project to use Bob, open a Terminal and run yarn bob init
for automatic configuration.
To configure your project manually, follow these steps:
In your package.json
, specify the targets to build for:
"@react-native-community/bob": {
"source": "src",
"output": "lib",
"targets": [
["aar", {"reverseJetify": true}],
["commonjs", {"flow": true}],
"module",
"typescript",
]
}
Add bob
to your prepare
step:
"scripts": {
"prepare": "bob build"
}
Configure the appropriate entry points:
"main": "lib/commonjs/index.js",
"module": "lib/module/index.js",
"react-native": "src/index.js",
"types": "lib/typescript/src/index.d.ts",
"files": [
"lib/",
"src/"
]
Add the output directory to .gitignore
and .eslintignore
# generated files by bob
lib/
Add the output directory to jest.modulePathIgnorePatterns
if you use Jest
"modulePathIgnorePatterns": ["<rootDir>/lib/"]
And we're done 🎉
MIT
FAQs
CLI to build JavaScript files for React Native libraries
The npm package @mattoakes/bob receives a total of 1 weekly downloads. As such, @mattoakes/bob popularity was classified as not popular.
We found that @mattoakes/bob demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.