Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to develop without copying library to node_modules #105

Merged
merged 6 commits into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Example/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"presets": ["react-native"]
"presets": ["react-native"],
"plugins": [
["module-resolver", {
"alias": {
"react-native-reanimated": "../src/Animated"
}
}]
]
}
8 changes: 8 additions & 0 deletions Example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Run the example

+ Clone the repository
+ Run `yarn` to install the dependencies of library
+ `cd` to this directory
+ Run `yarn` to install the dependencies of example
+ Run `yarn start` to start the packager with custom config
+ `react-native run-ios` or `react-native run-android`
15 changes: 15 additions & 0 deletions Example/cli.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const path = require('path');
const blacklist = require('metro/src/blacklist');
const glob = require('glob-to-regexp');

module.exports = {
getProjectRoots() {
return [__dirname, path.resolve(__dirname, '..')];
},
getProvidesModuleNodeModules() {
return ['react-native', 'react', 'fbjs'];
},
getBlacklistRE() {
return blacklist([glob(`${path.resolve(__dirname, '..')}/node_modules/*`)]);
},
};
10 changes: 4 additions & 6 deletions Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"postinstall":
"rm -rf node_modules/react-native-reanimated/{.git,node_modules,Example}"
"start": "node node_modules/react-native/local-cli/cli.js start --config ../../../../cli.config.js",
"test": "jest"
},
"dependencies": {
"react": "16.4.1",
"react-native": "0.56.0",
"react-native-gesture-handler": "^1.0.5",
"react-native-reanimated": "file:..",
"react-navigation": "^2.6.2"
},
"devDependencies": {
"babel-jest": "23.2.0",
"babel-plugin-module-resolver": "^3.1.1",
"babel-preset-react-native": "^5",
"glob-to-regexp": "^0.4.0",
"jest": "23.3.0",
"react-test-renderer": "16.4.1"
},
Expand Down
38 changes: 33 additions & 5 deletions Example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ babel-helpers@^6.24.1:
babel-runtime "^6.22.0"
babel-template "^6.24.1"

babel-jest@23.2.0, babel-jest@^23.2.0:
babel-jest@^23.2.0:
version "23.2.0"
resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-23.2.0.tgz#14a9d6a3f4122dfea6069d37085adf26a53a4dba"
dependencies:
Expand Down Expand Up @@ -905,6 +905,16 @@ babel-plugin-jest-hoist@^23.2.0:
version "23.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-23.2.0.tgz#e61fae05a1ca8801aadee57a6d66b8cefaf44167"

babel-plugin-module-resolver@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-3.1.1.tgz#881cf67e3d4b8400d5eaaefc1be44d2dc1fe404f"
dependencies:
find-babel-config "^1.1.0"
glob "^7.1.2"
pkg-up "^2.0.0"
reselect "^3.0.1"
resolve "^1.4.0"

babel-plugin-syntax-class-properties@^6.8.0:
version "6.13.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz#d7eb23b79a317f8543962c505b827c7d6cac27de"
Expand Down Expand Up @@ -2096,6 +2106,13 @@ finalhandler@1.1.0:
statuses "~1.3.1"
unpipe "~1.0.0"

find-babel-config@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/find-babel-config/-/find-babel-config-1.1.0.tgz#acc01043a6749fec34429be6b64f542ebb5d6355"
dependencies:
json5 "^0.5.1"
path-exists "^3.0.0"

find-cache-dir@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-1.0.0.tgz#9288e3e9e3cc3748717d39eade17cf71fc30ee6f"
Expand Down Expand Up @@ -2236,6 +2253,10 @@ glob-parent@^2.0.0:
dependencies:
is-glob "^2.0.0"

glob-to-regexp@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.0.tgz#49bd677b1671022bd10921c3788f23cdebf9c7e6"

glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
Expand Down Expand Up @@ -3999,6 +4020,12 @@ pkg-dir@^2.0.0:
dependencies:
find-up "^2.1.0"

pkg-up@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f"
dependencies:
find-up "^2.1.0"

plist@2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/plist/-/plist-2.0.1.tgz#0a32ca9481b1c364e92e18dc55c876de9d01da8b"
Expand Down Expand Up @@ -4179,9 +4206,6 @@ react-native-gesture-handler@^1.0.5:
invariant "^2.2.2"
prop-types "^15.5.10"

"react-native-reanimated@file:..":
version "1.0.0-alpha.4"

react-native-safe-area-view@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.7.0.tgz#38f5ab9368d6ef9e5d18ab64212938af3ec39421"
Expand Down Expand Up @@ -4520,6 +4544,10 @@ require-main-filename@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1"

reselect@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/reselect/-/reselect-3.0.1.tgz#efdaa98ea7451324d092b2b2163a6a1d7a9a2147"

resolve-cwd@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a"
Expand All @@ -4538,7 +4566,7 @@ resolve@1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"

resolve@^1.3.2, resolve@^1.5.0:
resolve@^1.3.2, resolve@^1.4.0, resolve@^1.5.0:
version "1.8.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26"
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"jest-react-native": "18.0.0",
"lint-staged": "^8.0.0-beta.1",
"prettier": "^1.13.4",
"react": "^16.0.0-alpha.12",
"react": "16.4.1",
"react-dom": "^16.0.0-beta.5",
"react-native": "^0.56.0",
"react-test-renderer": "^16.0.0-alpha.12"
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5029,7 +5029,7 @@ react-transform-hmr@^1.0.4:
global "^4.3.0"
react-proxy "^1.1.7"

react@^16.0.0-alpha.12:
react@16.4.1:
version "16.4.1"
resolved "https://registry.yarnpkg.com/react/-/react-16.4.1.tgz#de51ba5764b5dbcd1f9079037b862bd26b82fe32"
dependencies:
Expand Down