Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvicenti committed Oct 15, 2018
0 parents commit 656a48d
Show file tree
Hide file tree
Showing 18 changed files with 9,353 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["react-native"]
}
62 changes: 62 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
version: 2

defaults: &defaults
docker:
- image: circleci/node:7.10
working_directory: ~/project

jobs:
install-dependencies:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/project
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- restore_cache:
keys:
- v1-dependencies-example-{{ checksum "example/package.json" }}
- v1-dependencies-example-
- run: |
yarn install
yarn install --cwd example
- save_cache:
key: v1-dependencies-{{ checksum "package.json" }}
paths: node_modules
- save_cache:
key: v1-dependencies-example-{{ checksum "example/package.json" }}
paths: example/node_modules
- persist_to_workspace:
root: .
paths: .
lint:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- run: |
yarn run lint
unit-tests:
<<: *defaults
steps:
- attach_workspace:
at: ~/project
- run: yarn test -- --coverage
- store_artifacts:
path: coverage
destination: coverage

workflows:
version: 2
build-and-test:
jobs:
- install-dependencies
- lint:
requires:
- install-dependencies
- unit-tests:
requires:
- install-dependencies
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]

# change these settings to your own preference
indent_style = space
indent_size = 2

# we recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
jest-setup.js
16 changes: 16 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "eslint-config-satya164",

"plugins": ["react-native-globals"],

"env": {
"es6": true,
"react-native-globals/all": true,
},

"rules": {
"import/no-unresolved": "off",
"react/sort-comp": "off",
"jest/no-disabled-tests": "off",
}
}
53 changes: 53 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# OSX
#
.DS_Store

# XDE
.expo/

# VSCode
.vscode/
tsconfig.json
jsconfig.json

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IJ
#
.idea
.gradle
local.properties

# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore

# Build
dist/
15 changes: 15 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"increment": "conventional:angular",
"changelogCommand": "conventional-changelog -p angular | tail -n +3",
"safeBump": false,
"src": {
"commitMessage": "chore: release %s",
"tagName": "v%s"
},
"npm": {
"publish": true
},
"github": {
"release": true
}
}
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 React Native Community

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# React Navigation Web

[![npm version](https://badge.fury.io/js/%40react-navigation%2Fweb.svg)](https://badge.fury.io/js/%40react-navigation%2Fweb) [![CircleCI badge](https://circleci.com/gh/react-navigation/react-navigation-web/tree/master.svg?style=shield)](https://circleci.com/gh/react-navigation/react-navigation-web/tree/master) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://reactnavigation.org/docs/contributing.html)

## Docs

Documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/).
3 changes: 3 additions & 0 deletions createBrowserApp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* eslint-disable import/no-commonjs */

module.exports = require('./dist/navigators/createBrowserApp');
3 changes: 3 additions & 0 deletions handleServerRequest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* eslint-disable import/no-commonjs */

module.exports = require('./dist/handleServerRequest');
7 changes: 7 additions & 0 deletions jest-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* eslint-env jest
*/

// No setup

import React from 'react';
91 changes: 91 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"name": "@react-navigation/web",
"version": "1.0.0-alpha.0",
"description": "Tools for react-navigation on web browsers and servers",
"main": "dist/index.js",
"files": [
"dist/",
"src/",
"LICENSE.md",
"README.md"
],
"react-native": "src/index.js",
"scripts": {
"test": "jest",
"lint": "eslint .",
"format": "eslint . --fix",
"build": "babel --no-babelrc --plugins=syntax-jsx,syntax-class-properties,syntax-object-rest-spread,transform-flow-strip-types src --copy-files --out-dir dist --ignore '**/__tests__/**'",
"prepare": "yarn build",
"release": "release-it"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"keywords": [
"react-navigation",
"routing",
"ios",
"android",
"stack"
],
"repository": {
"type": "git",
"url": "git+https://github.com/react-navigation/react-navigation-web.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/react-navigation/react-navigation-web/issues"
},
"homepage": "https://github.com/react-navigation/react-navigation-web#readme",
"dependencies": {
"@react-navigation/core": "^3.0.0-alpha.5",
"history": "^4.7.2",
"query-string": "^6.2.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-jest": "^22.4.1",
"babel-plugin-syntax-class-properties": "^6.13.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-syntax-object-rest-spread": "^6.13.0",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-preset-react-native": "^4.0.0",
"conventional-changelog-cli": "^2.0.5",
"eslint": "^4.12.1",
"eslint-config-satya164": "^1.0.1",
"eslint-plugin-react-native-globals": "^0.1.0",
"husky": "^0.14.3",
"jest": "^22.1.3",
"jest-expo": "^30.0.0",
"prettier": "^1.8.2",
"react": "16.3.1",
"react-dom": "16.3.1",
"react-native": "^0.55.4",
"react-test-renderer": "16.3.1",
"release-it": "^7.6.1"
},
"peerDependencies": {
"react": "*"
},
"jest": {
"preset": "react-native",
"testRegex": "/__tests__/[^/]+-test\\.js$",
"setupFiles": [
"<rootDir>/jest-setup.js"
],
"coveragePathIgnorePatterns": [
"jest-setup.js"
],
"modulePathIgnorePatterns": [
"<rootDir>/example/"
],
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-navigation/core)"
]
},
"prettier": {
"trailingComma": "es5",
"singleQuote": true
}
}
7 changes: 7 additions & 0 deletions src/__tests__/__snapshots__/createBrowserApp-test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`SwitchNavigator works on web renders successfully 1`] = `
<div>
Other Screen
</div>
`;
52 changes: 52 additions & 0 deletions src/__tests__/createBrowserApp-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React, { Component } from 'react';
import renderer from 'react-test-renderer';
import { createSwitchNavigator } from '@react-navigation/core';
import createBrowserApp from '../createBrowserApp';

class HomeScreen extends Component {
static navigationOptions = () => ({
title: 'Home',
});

render() {
return <div>Hello Home</div>;
}
}

class OtherScreen extends Component {
static navigationOptions = () => ({
title: 'Other',
});

render() {
return <div>Other Screen</div>;
}
}

jest.mock('history', () => ({
createBrowserHistory: () => ({
push: () => {},
listen: () => {},
location: {
pathname: '/OtherScreen',
search: '?foo=bar',
},
}),
}));

global.document = {
title: 'Empty Title',
};

describe('SwitchNavigator works on web', () => {
test('renders successfully', () => {
const AppNavigator = createSwitchNavigator({
HomeScreen,
OtherScreen,
});
const App = createBrowserApp(AppNavigator);
const rendered = renderer.create(<App />).toJSON();

expect(rendered).toMatchSnapshot();
});
});
Loading

0 comments on commit 656a48d

Please sign in to comment.