Comparing version 1.2.3 to 1.2.5
const { readFileSync, writeFileSync } = require('fs'); | ||
const { loadCSV, readDir } = require('./src/utils'); | ||
const arg = process.argv.slice(2)[0]; | ||
const mode = arg && arg === 'reverse' ? 'reverse' : 'forward'; | ||
const SEARCH_DIR = 'node_modules'; | ||
@@ -11,5 +14,5 @@ const csv = loadCSV(); | ||
for (const c in csv) { | ||
if (data.includes(c)) { | ||
console.log(`Jetifying: ${file}`); | ||
data = data.replace(c, csv[c]); | ||
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' }); | ||
@@ -16,0 +19,0 @@ } |
{ | ||
"name": "jetifire", | ||
"version": "1.2.3", | ||
"version": "1.2.5", | ||
"description": "Jetifire tool migrates support-library-dependent libraries to rely on the equivalent AndroidX packages instead.", | ||
@@ -19,3 +19,3 @@ "keywords": [ | ||
"author": "Yassine Fathi @ Fluicity", | ||
"license": "Creative Commons Attribution 2.5", | ||
"license": "CC-BY-2.0", | ||
"dependencies": {}, | ||
@@ -22,0 +22,0 @@ "homepage": "https://github.com/Fluicity/jetifire#readme", |
# Jetifire - A fast Node implementation | ||
[![npm version](https://badge.fury.io/js/jetifire.svg)](https://badge.fury.io/js/jetifire) | ||
Jetifire tool migrates `support-library-dependent` libraries to rely on the equivalent `AndroidX` packages instead. | ||
@@ -8,3 +10,3 @@ | ||
## Benchmark | ||
s | ||
This is a very fast `Node` port of [Mike Hardy](https://github.com/mikehardy)'s bash version (https://github.com/mikehardy/jetifier) | ||
@@ -27,3 +29,3 @@ | ||
```bash | ||
npx jetify : 44.994 seconds | ||
npx jetify : 44.994 seconds | ||
``` | ||
@@ -34,3 +36,3 @@ | ||
```bash | ||
node . : 2.325 seconds | ||
npx jetifire : 2.325 seconds | ||
``` | ||
@@ -56,7 +58,13 @@ | ||
2. (Optional) add a `postinstall` script to your `package.json`: `"postinstall": "jetifire"` | ||
2. Run Jetifire in `reverse` mode | ||
```bash | ||
./node_modules/.bin/jetifire reverse | ||
``` | ||
3. (Optional) add a `postinstall` script to your `package.json`: `"postinstall": "jetifire"` | ||
## Usage notes | ||
Jetifire reads all your `node_modules` folder and looks for `.java`, `.kotlin` and `.xml` files, and then changes any `android.support.*` imports to its corresponding `androidx.*`. | ||
Jetifire reads all your `node_modules` folder and looks for `.java`, `.kt` and `.xml` files, and then changes any `android.support.*` imports to its corresponding `androidx.*`. | ||
@@ -77,3 +85,1 @@ If there is a type in an `android.support.*` package that does not come from any support library artifact, Jetifire still migrates the type as long as there is a mapping for it. However, this migration is not guaranteed to work, as there might not be mapping rules general enough to cover all the custom types. | ||
* Attribution requires leaving author name, author homepage link, and the license info intact. | ||
@@ -11,3 +11,3 @@ const { readFileSync, readdirSync, statSync } = require('fs'); | ||
else { | ||
if (file.endsWith('.java') || file.endsWith('.xml') || file.endsWith('.kotlin')) { | ||
if (file.endsWith('.java') || file.endsWith('.xml') || file.endsWith('.kt')) { | ||
filesList.push(dir + '/' + file); | ||
@@ -14,0 +14,0 @@ } |
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
189441
0
46
81