Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Bento committed Apr 12, 2019
1 parent 73a2e76 commit e80ff06
Show file tree
Hide file tree
Showing 11 changed files with 4,359 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
.codemod-update-imports
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.codemod-update-imports
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rn-update-deprecated-modules",
"description": "Codemod to update import declarations as per react-native > 0.59.x deprecations.",
"version": "0.0.6",
"version": "0.59.0",
"author": {
"name": "Lucas Bento",
"email": "[email protected]",
Expand All @@ -15,6 +15,10 @@
"command-exists": "^1.2.8",
"read-pkg-up": "^5.0.0"
},
"devDependencies": {
"jest": "^24.7.1",
"jscodeshift": "^0.6.3"
},
"homepage": "https://github.com/lucasbento/rn-update-deprecated-modules",
"keywords": [
"cli",
Expand All @@ -23,5 +27,8 @@
],
"license": "MIT",
"main": "index.js",
"repository": "https://github.com/lucasbento/rn-update-deprecated-modules"
"repository": "https://github.com/lucasbento/rn-update-deprecated-modules",
"scripts": {
"test": "jest"
}
}
6 changes: 6 additions & 0 deletions src/__testfixtures__/ModuleWithoutDefaultExport.input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from "react";
import { WebView, AsyncStorage, Image } from "react-native";

const MyComponent = () => {};

export default MyComponent;
8 changes: 8 additions & 0 deletions src/__testfixtures__/ModuleWithoutDefaultExport.output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react";
import { Image } from "react-native";
import AsyncStorage from "@react-native-community/async-storage";
import { WebView } from "react-native-website";

const MyComponent = () => {};

export default MyComponent;
6 changes: 6 additions & 0 deletions src/__testfixtures__/MultipleImports.input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from "react";
import { AsyncStorage, Image } from "react-native";

const MyComponent = () => {};

export default MyComponent;
7 changes: 7 additions & 0 deletions src/__testfixtures__/MultipleImports.output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";
import { Image } from "react-native";
import AsyncStorage from "@react-native-community/async-storage";

const MyComponent = () => {};

export default MyComponent;
6 changes: 6 additions & 0 deletions src/__testfixtures__/OneImport.input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from "react";
import { AsyncStorage } from "react-native";

const MyComponent = () => {};

export default MyComponent;
6 changes: 6 additions & 0 deletions src/__testfixtures__/OneImport.output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from "react";
import AsyncStorage from "@react-native-community/async-storage";

const MyComponent = () => {};

export default MyComponent;
16 changes: 16 additions & 0 deletions src/__tests__/codemod.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const tests = [
'OneImport',
];

const defineTest = require('jscodeshift/dist/testUtils').defineTest;

describe('Codemod', () => {
tests.forEach(test =>
defineTest(
__dirname,
'codemod',
null,
test,
)
);
});
Loading

0 comments on commit e80ff06

Please sign in to comment.