Comparing version 1.4.3 to 1.5.0
# Changelog | ||
## 1.5.0 | ||
- node version courtesy of [Yassine Fathi](@m4tt72)! Super fast, no bash needed! It's amazing | ||
## 1.4.2 | ||
@@ -4,0 +8,0 @@ |
28
index.js
@@ -1,7 +0,21 @@ | ||
/* | ||
This is a command-line only Java program | ||
It installs into node_modules/.bin/jetifier-standalone | ||
*/ | ||
const { readFileSync, writeFileSync } = require('fs'); | ||
const { loadCSV, readDir } = require('./src/utils'); | ||
const arg = process.argv.slice(2)[0]; | ||
const mode = arg && ((arg === 'reverse') || (arg === '-r')) ? 'reverse' : 'forward'; | ||
const SEARCH_DIR = 'node_modules'; | ||
const csv = loadCSV(); | ||
const files = readDir(SEARCH_DIR); | ||
for (const file of files) { | ||
let data = readFileSync(file, { encoding: 'utf8' }); | ||
for (const c in csv) { | ||
if (data.includes(mode === 'forward' ? c : csv[c])) { | ||
console.log(`${mode}-jetifying: ${file}`); | ||
data = mode === 'forward' ? data.replace(new RegExp(c, 'g'), csv[c]) : data.replace(new RegExp(csv[c], 'g'), c); | ||
writeFileSync(file, data, { encoding: 'utf8' }); | ||
} | ||
} | ||
} |
{ | ||
"name": "jetifier", | ||
"version": "1.4.3", | ||
"version": "1.5.0", | ||
"description": "jetifier from Android Studio, in npm package format", | ||
@@ -28,2 +28,9 @@ "main": "index.js", | ||
"author": "Mike Hardy (github@mikehardy.net)", | ||
"contributors": [ | ||
{ | ||
"name": "Yassine Fathi", | ||
"email": "yassine@flui.city", | ||
"url": "https://github.com/m4tt72" | ||
} | ||
], | ||
"license": "MIT", | ||
@@ -30,0 +37,0 @@ "bugs": { |
@@ -16,4 +16,2 @@ | ||
* [Troubleshooting](#troubleshooting) | ||
* [Windows Notes](#getting-it-working-in-windows) | ||
* [Performance Notes](#performance-notes-how-to-set-workers-parameter) | ||
* [Contributing](#contributing) | ||
@@ -44,4 +42,4 @@ | ||
1. Convert your app to AndroidX via the [standard AndroidX migration](https://developer.android.com/jetpack/androidx/migrate) | ||
1. `npm install --save-dev jetifier` (or use yarn, but install it locally in your project, not globally) | ||
1. `npx jetify` or `npx jetify -w=1` (to specify the number of parallel workers) | ||
1. `npm install --save-dev jetifier` | ||
1. `npx jetify` | ||
1. `npx react-native run-android` (your app should correctly compile and work) | ||
@@ -85,29 +83,6 @@ 1. Call `npx jetify` run in the postinstall target of your package.json (Any time your dependencies update you have to jetify again) | ||
1. You have a dependency that does not allow overrides of compileSdk, so you can't set the compileSdk to 28 as AndroidX requires: <https://github.com/razorpay/react-native-razorpay/pull/201>. This can lead to errors in resource merger where styles reference unknown attributes. Open pull requests with the libraries that do this | ||
1. There used to be a big section on Windows troubleshooting because the original implementation was bash+sed, but [Yassine Fathi](m4tt72) contributed a node port and now it just runs. If it the new node version isn't working for you, `./node_modules/bin/jetify.sh` is still present in the archive and you can try it | ||
So far there has not been a case of `npx jetify` failing that wasn't based in an error in a library, so if you have a problem please examine the error and the dependency very closely and help the libraries with fixes. | ||
### Getting it working in Windows | ||
Jetify is a bash script so you need an updated WSL to make it work with bash, find and sed installed. | ||
First install jetifier from a Windows command prompt: | ||
npm i --save-dev jetifier | ||
Then from WSL, you can run it using: | ||
npx jetify | ||
...or if that doesn't work | ||
./bin/node_modules/jetify | ||
### Performance Notes (how to set workers parameter) | ||
In testing, it appeared that performance improved up to the number of virtual cores on a system, and then was flat but did not degrade after that no matter how many extra workers there were. So the default of 20 should result in maximum performance on even powerful systems, but smaller CI virtual machines should be fine as well. | ||
You will want a bash version of 5 or higher for best results. bash version 4.x ships as the default on macOS up to at least 10.14.5. Replacing the system bash with a modern bash from (for example) brew is your responsibility if you want higher performance. | ||
Your mileage may vary. | ||
## Contributing | ||
@@ -114,0 +89,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
2734420
26
50
96
2