Skip to content

Commit

Permalink
refactor: add comment to main generated index.js (#413)
Browse files Browse the repository at this point in the history
* add comment to main generated index.js
* update test snapshots
  • Loading branch information
brodycj authored Feb 18, 2021
1 parent e433631 commit 48e52e0
Show file tree
Hide file tree
Showing 33 changed files with 81 additions and 13 deletions.
8 changes: 6 additions & 2 deletions templates/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ ${objectClassName};
// for module without view:
name: ({ view }) => !view && 'index.js',
content: ({ objectClassName }) =>
`import { NativeModules } from 'react-native';
`// main index.js
import { NativeModules } from 'react-native';
const { ${objectClassName} } = NativeModules;
Expand All @@ -89,7 +91,9 @@ export default ${objectClassName};
// for module with view:
name: ({ view }) => view && 'index.js',
content: ({ objectClassName }) =>
`import { requireNativeComponent } from 'react-native';
`// main index.js
import { requireNativeComponent } from 'react-native';
const ${objectClassName} = requireNativeComponent('${objectClassName}', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ public class IntegrationViewTestPackagePackage implements ReactPackage {
},
Object {
"name": "react-native-integration-view-test-package/index.js",
"theContent": "import { requireNativeComponent } from 'react-native';
"theContent": "// main index.js
import { requireNativeComponent } from 'react-native';
const IntegrationViewTestPackage = requireNativeComponent('IntegrationViewTestPackage', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,9 @@ public class IntegrationTestPackagePackage implements ReactPackage {
},
Object {
"name": "react-native-integration-test-package/index.js",
"theContent": "import { NativeModules } from 'react-native';
"theContent": "// main index.js
import { NativeModules } from 'react-native';
const { IntegrationTestPackage } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { requireNativeComponent } from 'react-native';
const AliceBobbi = requireNativeComponent('AliceBobbi', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { requireNativeComponent } from 'react-native';
const AliceBobbi = requireNativeComponent('AliceBobbi', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { requireNativeComponent } from 'react-native';
const AliceBobbi = requireNativeComponent('AliceBobbi', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { requireNativeComponent } from 'react-native';
const AliceBobbi = requireNativeComponent('AliceBobbi', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { requireNativeComponent } from 'react-native';
const AliceBobbi = requireNativeComponent('AliceBobbi', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { SuperAwesomeModule } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { ABCAliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ content:
"* outputFile name: react-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ content:
"* outputFile name: custom-native-alice-bobbi/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ content:
"* outputFile name: custom-native-module/index.js
content:
--------
// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ AliceBobbi;
},
Object {
"outputFileName": "react-native-alice-bobbi/index.js",
"theContent": "import { NativeModules } from 'react-native';
"theContent": "// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ AliceBobbi;
},
Object {
"outputFileName": "react-native-alice-bobbi/index.js",
"theContent": "import { NativeModules } from 'react-native';
"theContent": "// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ AliceBobbi;
},
Object {
"outputFileName": "react-native-alice-bobbi/index.js",
"theContent": "import { NativeModules } from 'react-native';
"theContent": "// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ TestPackage;
},
Object {
"outputFileName": "react-native-test-package/index.js",
"theContent": "import { NativeModules } from 'react-native';
"theContent": "// main index.js
import { NativeModules } from 'react-native';
const { TestPackage } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,9 @@ TestPackage;
},
Object {
"outputFileName": "react-native-test-package/index.js",
"theContent": "import { NativeModules } from 'react-native';
"theContent": "// main index.js
import { NativeModules } from 'react-native';
const { TestPackage } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ AliceBobbi;
},
Object {
"outputFileName": "react-native-alice-bobbi/index.js",
"theContent": "import { NativeModules } from 'react-native';
"theContent": "// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ AliceBobbi;
},
Object {
"outputFileName": "react-native-alice-bobbi/index.js",
"theContent": "import { NativeModules } from 'react-native';
"theContent": "// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ AliceBobbi;
},
Object {
"outputFileName": "react-native-alice-bobbi/index.js",
"theContent": "import { NativeModules } from 'react-native';
"theContent": "// main index.js
import { NativeModules } from 'react-native';
const { AliceBobbi } = NativeModules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ ABCAliceBobbi;
},
Object {
"outputFileName": "react-native-alice-bobbi/index.js",
"theContent": "import { NativeModules } from 'react-native';
"theContent": "// main index.js
import { NativeModules } from 'react-native';
const { ABCAliceBobbi } = NativeModules;
Expand Down

0 comments on commit 48e52e0

Please sign in to comment.