Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Commit

Permalink
chore: setup monorepo with yarn workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Aug 1, 2019
1 parent 203c0aa commit 315c55e
Show file tree
Hide file tree
Showing 62 changed files with 7,944 additions and 3,031 deletions.
16 changes: 0 additions & 16 deletions .babelrc

This file was deleted.

3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules/
coverage/
dist/
lib/
types/
web-build/
web-report/
11 changes: 0 additions & 11 deletions .eslintrc

This file was deleted.

8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "satya164",
"settings": {
"react": { "version": "16" },
"import/core-modules": ["@navigation-ex/core", "@navigation-ex/routers"]
},
"env": { "browser": true }
}
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@
.cache
.vscode
.idea
.expo

/coverage/
/types/
/lib/
/dist/
/node_modules/

node_modules/
web-build/
web-report/

npm-debug.*

*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
17 changes: 17 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable import/no-commonjs */
/* eslint-env node */

module.exports = {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
},
],
'@babel/preset-react',
'@babel/preset-typescript',
],
plugins: ['@babel/plugin-proposal-class-properties'],
};
34 changes: 0 additions & 34 deletions example/index.html

This file was deleted.

67 changes: 23 additions & 44 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
{
"name": "navigation-ex",
"private": true,
"version": "0.0.0",
"description": "Rethinking navigation",
"keywords": [],
"types": "types/index.d.ts",
"main": "lib/index.js",
"files": [
"lib/",
"types/",
"index.d.ts"
],
"private": true,
"workspaces": {
"packages": [
"packages/*"
],
"nohoist": [
"**/expo",
"**/expo/**",
"**/react-native",
"**/react-native/**"
]
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -21,48 +25,25 @@
"lint": "eslint --ext '.js,.ts,.tsx' .",
"typescript": "tsc --noEmit",
"test": "jest",
"prebuild": "del lib/ types/",
"babel": "babel src --out-dir lib --ignore '**/__tests__/**' --source-maps",
"declarations": "tsc --declaration --emitDeclarationOnly --outDir types",
"build": "yarn babel && yarn declarations",
"example": "parcel example/index.html",
"prepare": "yarn build",
"release": "release-it"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"core-js": "^3.1.3",
"shortid": "^2.2.14"
"example": "yarn --cwd packages/example"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.5.0",
"@babel/preset-env": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"@babel/runtime": "^7.5.5",
"@commitlint/config-conventional": "^8.0.0",
"@release-it/conventional-changelog": "^1.1.0",
"@types/jest": "^24.0.13",
"@types/react": "^16.8.19",
"@types/react-dom": "^16.8.4",
"@types/shortid": "^0.0.29",
"codecov": "^3.5.0",
"commitlint": "^8.0.0",
"core-js": "^3.1.4",
"del-cli": "^2.0.0",
"eslint": "^5.16.0",
"eslint-config-satya164": "^2.4.1",
"husky": "^2.4.0",
"jest": "^24.8.0",
"parcel": "^1.12.3",
"prettier": "^1.18.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-native-testing-library": "^1.9.1",
"react-test-renderer": "^16.8.6",
"release-it": "^12.3.0",
"typescript": "^3.5.1"
},
"husky": {
Expand All @@ -73,14 +54,12 @@
},
"jest": {
"testEnvironment": "node",
"modulePathIgnorePatterns": [
"<rootDir>/types/",
"<rootDir>/lib/"
],
"testRegex": "/__tests__/.*\\.(test|spec)\\.(js|tsx?)$",
"transform": {
"^.+\\.(js|ts|tsx)$": "babel-jest"
},
"setupFiles": ["<rootDir>/jest/setup.js"]
"setupFiles": [
"<rootDir>/jest/setup.js"
]
}
}
20 changes: 20 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@navigation-ex/core",
"version": "0.0.1",
"main": "src/index",
"license": "MIT",
"dependencies": {
"shortid": "^2.2.14"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"react": "^16.8.3",
"react-native-testing-library": "^1.9.1",
"react-test-renderer": "^16.8.3",
"@types/react": "^16.8.19",
"@types/shortid": "^0.0.29"
},
"peerDependencies": {
"react": "^16.8.3"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,7 +1,7 @@
import * as React from 'react';
import useNavigation from './useNavigation';

type EffectCallback = (() => undefined) | (() => () => void);
type EffectCallback = (() => void) | (() => () => void);

/**
* Hook to an effect in a focused screen, similar to `React.useEffect`.
Expand All @@ -15,7 +15,7 @@ export default function useFocusEffect(callback: EffectCallback) {

React.useEffect(() => {
let isFocused = false;
let cleanup: (() => void) | undefined;
let cleanup: (() => void) | void;

// We need to run the effect on intial render/dep changes if the screen is focused
if (navigation.isFocused()) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions packages/example/.expo-shared/assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"f9155ac790fd02fadcdeca367b02581c04a353aa6d5aa84409a59f6804c87acd": true,
"89ed26367cdb9b771858e026f2eb95bfdb90e5ae943e716575327ec325f39c44": true
}
1 change: 1 addition & 0 deletions packages/example/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './src/index';
30 changes: 30 additions & 0 deletions packages/example/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"expo": {
"name": "@navigation-ex/example",
"slug": "navigation-ex-example",
"privacy": "public",
"sdkVersion": "34.0.0",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
}
}
}
Binary file added packages/example/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/example/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions packages/example/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable import/no-commonjs */
/* eslint-env node */

module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
46 changes: 46 additions & 0 deletions packages/example/metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* eslint-disable import/no-commonjs, import/no-extraneous-dependencies */
/* eslint-env node */

const path = require('path');
const fs = require('fs');
const escape = require('escape-string-regexp');
const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = {
projectRoot: __dirname,
watchFolders: [path.resolve(__dirname, '..', '..')],

resolver: {
blacklistRE: blacklist(
[
...fs
.readdirSync(path.resolve(__dirname, '..'))
.filter(d => d !== 'example'),
'..',
].map(
it =>
new RegExp(
`^${escape(
path.resolve(__dirname, '..', it, 'node_modules')
)}\\/.*$`
)
)
),

providesModuleNodeModules: [
'@babel/runtime',
'react',
'react-native',
'shortid',
],
},

transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
};
Loading

0 comments on commit 315c55e

Please sign in to comment.