Skip to content

Commit 48e52e0

Browse files
author
Chris Brody
authored
refactor: add comment to main generated index.js (#413)
* add comment to main generated index.js * update test snapshots
1 parent e433631 commit 48e52e0

File tree

33 files changed

+81
-13
lines changed

33 files changed

+81
-13
lines changed

templates/general.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ ${objectClassName};
7979
// for module without view:
8080
name: ({ view }) => !view && 'index.js',
8181
content: ({ objectClassName }) =>
82-
`import { NativeModules } from 'react-native';
82+
`// main index.js
83+
84+
import { NativeModules } from 'react-native';
8385
8486
const { ${objectClassName} } = NativeModules;
8587
@@ -89,7 +91,9 @@ export default ${objectClassName};
8991
// for module with view:
9092
name: ({ view }) => view && 'index.js',
9193
content: ({ objectClassName }) =>
92-
`import { requireNativeComponent } from 'react-native';
94+
`// main index.js
95+
96+
import { requireNativeComponent } from 'react-native';
9397
9498
const ${objectClassName} = requireNativeComponent('${objectClassName}', null);
9599

tests/integration/cli/create/view/__snapshots__/cli-create-with-view.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ public class IntegrationViewTestPackagePackage implements ReactPackage {
305305
},
306306
Object {
307307
"name": "react-native-integration-view-test-package/index.js",
308-
"theContent": "import { requireNativeComponent } from 'react-native';
308+
"theContent": "// main index.js
309+
310+
import { requireNativeComponent } from 'react-native';
309311
310312
const IntegrationViewTestPackage = requireNativeComponent('IntegrationViewTestPackage', null);
311313

tests/integration/cli/create/with-defaults/__snapshots__/cli-create-with-defaults.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ public class IntegrationTestPackagePackage implements ReactPackage {
306306
},
307307
Object {
308308
"name": "react-native-integration-test-package/index.js",
309-
"theContent": "import { NativeModules } from 'react-native';
309+
"theContent": "// main index.js
310+
311+
import { NativeModules } from 'react-native';
310312
311313
const { IntegrationTestPackage } = NativeModules;
312314

tests/with-injection/create/view/with-defaults/__snapshots__/create-view-with-defaults.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ content:
104104
"* outputFile name: react-native-alice-bobbi/index.js
105105
content:
106106
--------
107+
// main index.js
108+
107109
import { requireNativeComponent } from 'react-native';
108110
109111
const AliceBobbi = requireNativeComponent('AliceBobbi', null);

tests/with-injection/create/view/with-example/with-defaults/__snapshots__/create-view-with-example-with-defaults.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ content:
108108
"* outputFile name: react-native-alice-bobbi/index.js
109109
content:
110110
--------
111+
// main index.js
112+
111113
import { requireNativeComponent } from 'react-native';
112114
113115
const AliceBobbi = requireNativeComponent('AliceBobbi', null);

tests/with-injection/create/view/with-example/with-options/__snapshots__/create-view-with-example-with-options.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ content:
108108
"* outputFile name: react-native-alice-bobbi/index.js
109109
content:
110110
--------
111+
// main index.js
112+
111113
import { requireNativeComponent } from 'react-native';
112114
113115
const AliceBobbi = requireNativeComponent('AliceBobbi', null);

tests/with-injection/create/view/with-options/for-android/__snapshots__/lib-view-android-config-options.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ content:
9292
"* outputFile name: react-native-alice-bobbi/index.js
9393
content:
9494
--------
95+
// main index.js
96+
9597
import { requireNativeComponent } from 'react-native';
9698
9799
const AliceBobbi = requireNativeComponent('AliceBobbi', null);

tests/with-injection/create/view/with-options/for-ios/__snapshots__/create-view-with-options-for-ios.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ content:
9393
"* outputFile name: react-native-alice-bobbi/index.js
9494
content:
9595
--------
96+
// main index.js
97+
9698
import { requireNativeComponent } from 'react-native';
9799
98100
const AliceBobbi = requireNativeComponent('AliceBobbi', null);

tests/with-injection/create/with-defaults/__snapshots__/create-with-defaults.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ content:
104104
"* outputFile name: react-native-alice-bobbi/index.js
105105
content:
106106
--------
107+
// main index.js
108+
107109
import { NativeModules } from 'react-native';
108110
109111
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-defaults/bogus-platforms/bogus-name/__snapshots__/bogus-platforms-name.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ content:
8181
"* outputFile name: react-native-alice-bobbi/index.js
8282
content:
8383
--------
84+
// main index.js
85+
8486
import { NativeModules } from 'react-native';
8587
8688
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-defaults/bogus-platforms/empty-array/__snapshots__/bogus-platforms-empty-array.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ content:
8181
"* outputFile name: react-native-alice-bobbi/index.js
8282
content:
8383
--------
84+
// main index.js
85+
8486
import { NativeModules } from 'react-native';
8587
8688
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-defaults/bogus-platforms/empty-string/__snapshots__/bogus-platforms-empty-string.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ content:
8181
"* outputFile name: react-native-alice-bobbi/index.js
8282
content:
8383
--------
84+
// main index.js
85+
8486
import { NativeModules } from 'react-native';
8587
8688
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-example/for-android-only/__snapshots__/create-with-example-for-android-only.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ content:
9696
"* outputFile name: react-native-alice-bobbi/index.js
9797
content:
9898
--------
99+
// main index.js
100+
99101
import { NativeModules } from 'react-native';
100102
101103
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-example/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ content:
108108
"* outputFile name: react-native-alice-bobbi/index.js
109109
content:
110110
--------
111+
// main index.js
112+
111113
import { NativeModules } from 'react-native';
112114
113115
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-example/with-missing-package-scripts/__snapshots__/recover-from-missing-package-scripts.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ content:
108108
"* outputFile name: react-native-alice-bobbi/index.js
109109
content:
110110
--------
111+
// main index.js
112+
111113
import { NativeModules } from 'react-native';
112114
113115
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-example/with-null-options/with-null-prefix/__snapshots__/create-with-example-with-null-prefix.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ content:
108108
"* outputFile name: react-native-alice-bobbi/index.js
109109
content:
110110
--------
111+
// main index.js
112+
111113
import { NativeModules } from 'react-native';
112114
113115
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-example/with-options/__snapshots__/create-with-example-with-options.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ content:
108108
"* outputFile name: react-native-alice-bobbi/index.js
109109
content:
110110
--------
111+
// main index.js
112+
111113
import { NativeModules } from 'react-native';
112114
113115
const { SuperAwesomeModule } = NativeModules;

tests/with-injection/create/with-name-in-camel-case/__snapshots__/create-with-name-in-camel-case.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ content:
104104
"* outputFile name: react-native-alice-bobbi/index.js
105105
content:
106106
--------
107+
// main index.js
108+
107109
import { NativeModules } from 'react-native';
108110
109111
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-options/for-android/__snapshots__/create-with-options-for-android.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ content:
9292
"* outputFile name: react-native-alice-bobbi/index.js
9393
content:
9494
--------
95+
// main index.js
96+
9597
import { NativeModules } from 'react-native';
9698
9799
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-options/for-ios/__snapshots__/create-with-options-for-ios.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ content:
9393
"* outputFile name: react-native-alice-bobbi/index.js
9494
content:
9595
--------
96+
// main index.js
97+
9698
import { NativeModules } from 'react-native';
9799
98100
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-options/platforms-array/__snapshots__/platforms-array.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ content:
104104
"* outputFile name: react-native-alice-bobbi/index.js
105105
content:
106106
--------
107+
// main index.js
108+
107109
import { NativeModules } from 'react-native';
108110
109111
const { ABCAliceBobbi } = NativeModules;

tests/with-injection/create/with-options/platforms-comma-separated/__snapshots__/platforms-comma-separated.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ content:
104104
"* outputFile name: react-native-alice-bobbi/index.js
105105
content:
106106
--------
107+
// main index.js
108+
107109
import { NativeModules } from 'react-native';
108110
109111
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-options/with-custom-module-prefix/__snapshots__/create-with-custom-module-prefix.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ content:
104104
"* outputFile name: custom-native-alice-bobbi/index.js
105105
content:
106106
--------
107+
// main index.js
108+
107109
import { NativeModules } from 'react-native';
108110
109111
const { AliceBobbi } = NativeModules;

tests/with-injection/create/with-options/with-module-name/__snapshots__/create-with-module-name.test.js.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ content:
104104
"* outputFile name: custom-native-module/index.js
105105
content:
106106
--------
107+
// main index.js
108+
107109
import { NativeModules } from 'react-native';
108110
109111
const { AliceBobbi } = NativeModules;

tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/bogus-name/__snapshots__/cli-command-with-bogus-platforms-name.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ AliceBobbi;
114114
},
115115
Object {
116116
"outputFileName": "react-native-alice-bobbi/index.js",
117-
"theContent": "import { NativeModules } from 'react-native';
117+
"theContent": "// main index.js
118+
119+
import { NativeModules } from 'react-native';
118120
119121
const { AliceBobbi } = NativeModules;
120122

tests/with-mocks/cli/command/action-func/with-logging/with-bogus-platforms/empty-string/__snapshots__/cli-command-with-empty-platforms-string.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ AliceBobbi;
114114
},
115115
Object {
116116
"outputFileName": "react-native-alice-bobbi/index.js",
117-
"theContent": "import { NativeModules } from 'react-native';
117+
"theContent": "// main index.js
118+
119+
import { NativeModules } from 'react-native';
118120
119121
const { AliceBobbi } = NativeModules;
120122

tests/with-mocks/cli/command/action-func/with-options/__snapshots__/cli-command-func-with-options.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ AliceBobbi;
114114
},
115115
Object {
116116
"outputFileName": "react-native-alice-bobbi/index.js",
117-
"theContent": "import { NativeModules } from 'react-native';
117+
"theContent": "// main index.js
118+
119+
import { NativeModules } from 'react-native';
118120
119121
const { AliceBobbi } = NativeModules;
120122

tests/with-mocks/cli/program/with-defaults/for-android/__snapshots__/cli-program-with-defaults-for-android.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,9 @@ TestPackage;
311311
},
312312
Object {
313313
"outputFileName": "react-native-test-package/index.js",
314-
"theContent": "import { NativeModules } from 'react-native';
314+
"theContent": "// main index.js
315+
316+
import { NativeModules } from 'react-native';
315317
316318
const { TestPackage } = NativeModules;
317319

tests/with-mocks/cli/program/with-example/with-logging/__snapshots__/cli-program-with-example-with-logging.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,9 @@ TestPackage;
399399
},
400400
Object {
401401
"outputFileName": "react-native-test-package/index.js",
402-
"theContent": "import { NativeModules } from 'react-native';
402+
"theContent": "// main index.js
403+
404+
import { NativeModules } from 'react-native';
403405
404406
const { TestPackage } = NativeModules;
405407

tests/with-mocks/lib/create/with-example/with-logging/with-defaults/__snapshots__/create-with-example-with-defaults.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ AliceBobbi;
185185
},
186186
Object {
187187
"outputFileName": "react-native-alice-bobbi/index.js",
188-
"theContent": "import { NativeModules } from 'react-native';
188+
"theContent": "// main index.js
189+
190+
import { NativeModules } from 'react-native';
189191
190192
const { AliceBobbi } = NativeModules;
191193

tests/with-mocks/lib/create/with-example/with-logging/with-error/__snapshots__/with-yarn-error-logging.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ AliceBobbi;
185185
},
186186
Object {
187187
"outputFileName": "react-native-alice-bobbi/index.js",
188-
"theContent": "import { NativeModules } from 'react-native';
188+
"theContent": "// main index.js
189+
190+
import { NativeModules } from 'react-native';
189191
190192
const { AliceBobbi } = NativeModules;
191193

tests/with-mocks/lib/create/with-example/with-logging/with-null-options/with-null-prefix/__snapshots__/create-with-example-with-options.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ AliceBobbi;
185185
},
186186
Object {
187187
"outputFileName": "react-native-alice-bobbi/index.js",
188-
"theContent": "import { NativeModules } from 'react-native';
188+
"theContent": "// main index.js
189+
190+
import { NativeModules } from 'react-native';
189191
190192
const { AliceBobbi } = NativeModules;
191193

tests/with-mocks/lib/create/with-example/with-logging/with-options/__snapshots__/create-with-example-with-options.test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ ABCAliceBobbi;
179179
},
180180
Object {
181181
"outputFileName": "react-native-alice-bobbi/index.js",
182-
"theContent": "import { NativeModules } from 'react-native';
182+
"theContent": "// main index.js
183+
184+
import { NativeModules } from 'react-native';
183185
184186
const { ABCAliceBobbi } = NativeModules;
185187

0 commit comments

Comments
 (0)