Skip to content

Commit

Permalink
Move mocks to lib/Mock and build Mock.ts (#7313)
Browse files Browse the repository at this point in the history
* Move mocks to lib/Mock and build Mock.ts

* update gitignore

* Fix mocks location

* update package.json main
  • Loading branch information
yogevbd authored Dec 1, 2021
1 parent a4e902e commit 121bd73
Show file tree
Hide file tree
Showing 31 changed files with 36 additions and 24 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,7 @@ playground/ios/Podfile.lock
website/package-lock.json

# detox artifacts
artifacts/
artifacts/

# Navigation mocks
Mock*
2 changes: 1 addition & 1 deletion Mock.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './lib/dist/Mock';
export * from './lib/Mock';
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
setupFilesAfterEnv: ['./jest-setup.js'],
testPathIgnorePatterns: ['/node_modules/'],
moduleNameMapper: {
'react-native-navigation/Mock': '<rootDir>/lib/src/Mock',
'react-native-navigation/Mock': '<rootDir>/lib/Mock',
'react-native-navigation': '<rootDir>/lib/src',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/playground/img/[email protected]',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { Button, View, Text } from 'react-native';
import { Navigation } from '../..';
import { Navigation } from '../../src';
import { ComponentProps } from '../ComponentProps';
import { VISIBLE_SCREEN_TEST_ID } from '../constants';
import { LayoutStore } from '../Stores/LayoutStore';
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { Button, TouchableOpacity } from 'react-native';
import { Navigation, OptionsTopBarButton } from '../../';
import { Navigation, OptionsTopBarButton } from '../../src';
import { events } from '../Stores/EventsStore';

interface ButtonProps {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { Button, View, Text } from 'react-native';
import { Navigation, OptionsTopBarButton } from '../..';
import { OptionsTopBar, OptionsTopBarBackButton } from '../../interfaces/Options';
import { Navigation, OptionsTopBarButton } from '../../src';
import { OptionsTopBar, OptionsTopBarBackButton } from '../../src/interfaces/Options';
import ParentNode from '../Layouts/ParentNode';
import { LayoutStore } from '../Stores/LayoutStore';
import { NavigationButton } from './NavigationButton';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import { Options } from '../../index';
import { Options } from '../../src/index';
import { LayoutStore } from '../Stores/LayoutStore';
import ParentNode from './ParentNode';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import { OptionsTopBarButton } from 'react-native-navigation/interfaces/Options';
import { OptionsTopBarButton } from '../../src';
import { events } from '../Stores/EventsStore';
import ParentNode from './ParentNode';

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/src/Mock/Layouts/Node.ts → lib/Mock/Layouts/Node.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Options } from '../../index';
import { Options } from '../../src/index';
import ParentNode from './ParentNode';

interface Data {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';
import { OptionsTopBarButton } from '../../interfaces/Options';
import { Options } from '../../index';
import { OptionsTopBarButton } from '../../src/interfaces/Options';
import { Options } from '../../src/index';
import { LayoutStore } from '../Stores/LayoutStore';
import ComponentNode from './ComponentNode';
import LayoutNodeFactory from './LayoutNodeFactory';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import {
ComponentDidDisappearEvent,
ComponentWillAppearEvent,
ModalDismissedEvent,
} from '../../interfaces/ComponentEvents';
import { ComponentDidAppearEvent, NavigationButtonPressedEvent } from '../../index';
import { BottomTabPressedEvent } from '../../interfaces/Events';
} from '../../src/interfaces/ComponentEvents';
import { ComponentDidAppearEvent, NavigationButtonPressedEvent } from '../../src/index';
import { BottomTabPressedEvent } from '../../src/interfaces/Events';

export const events = {
navigationButtonPressed: [(_event: NavigationButtonPressedEvent) => {}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash';
import BottomTabsNode from '../Layouts/BottomTabsNode';
import ParentNode from '../Layouts/ParentNode';
import LayoutNodeFactory from '../Layouts/LayoutNodeFactory';
import { Options } from '../../interfaces/Options';
import { Options } from '../../src/interfaces/Options';
import StackNode from '../Layouts/StackNode';

const remx = require('remx');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LayoutStore } from '../Stores/LayoutStore';
import LayoutNodeFactory from '../Layouts/LayoutNodeFactory';
import { LayoutNode } from 'react-native-navigation/commands/LayoutTreeCrawler';
import { LayoutNode } from '../../src/commands/LayoutTreeCrawler';
import { events } from '../Stores/EventsStore';
import _ from 'lodash';
import ComponentNode from '../Layouts/ComponentNode';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import {
ModalDismissedEvent,
ScreenPoppedEvent,
ModalAttemptedToDismissEvent,
} from '../../interfaces/ComponentEvents';
} from '../../src/interfaces/ComponentEvents';
import {
CommandCompletedEvent,
BottomTabSelectedEvent,
BottomTabLongPressedEvent,
BottomTabPressedEvent,
} from '../../interfaces/Events';
} from '../../src/interfaces/Events';
import { events } from './../Stores/EventsStore';

export class NativeEventsReceiver {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"bin": {
"rnn-link": "./autolink/postlink/run.js"
},
"main": "lib/dist/index.js",
"typings": "lib/dist/index.d.ts",
"main": "lib/dist/src/index.js",
"typings": "lib/dist/src/index.d.ts",
"scripts": {
"build": "node ./scripts/build",
"watch": "node ./scripts/watch",
Expand Down
6 changes: 4 additions & 2 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ run();
function run() {
if (isWindows) {
exec.execSync(`del /F /S /Q lib\\dist`);
exec.execSync(`tsc --project tsconfig.build.json`);
exec.execSync(`tsc --project tsconfig.build.json && tsc --project tsconfig.mocks.json`);
} else {
exec.execSync(`rm -rf ./lib/dist && tsc --project tsconfig.build.json`);
exec.execSync(
`rm -rf ./lib/dist && tsc --project tsconfig.build.json && tsc --project tsconfig.mocks.json`
);
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"react-native-navigation/*": ["lib/src/*"]
}
},
"include": ["./lib/src/**/*", "./playground/**/*"]
"include": ["./lib/src/**/*", "./playground/**/*", "lib/Mock"]
}
7 changes: 7 additions & 0 deletions tsconfig.mocks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"outDir": "./"
},
"include": ["Mock.ts"]
}

0 comments on commit 121bd73

Please sign in to comment.