mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-10 14:25:58 +00:00
Add ability to publish NPM module to git
The top-level package.json explicitly includes the directories it needs (vendor/.npmignore cuts down the cruft). The publish-beta.sh script essentially uses `npm pack` to package up the NPM module and then push it into an orphaned `beta` branch.
This commit is contained in:
parent
a6549a0cc2
commit
3da6b54df6
14
README.md
14
README.md
@ -2,7 +2,7 @@
|
||||
Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for Realm's JavaScript bindings for integrating with mobile apps built using ReactNative and Apache Cordova (PhoneGap).
|
||||
|
||||
## Setup
|
||||
This repository uses submodules so you need to run `git submodule update --init --recursive` in the realm-js root directory before running any examples or including the project in your app.
|
||||
This repository uses submodules so you need to run `git submodule update --init --recursive` in the realm-js root directory before running any examples.
|
||||
|
||||
## ReactNative Example
|
||||
Make sure your environment is set up to run react native applications. Follow the instructions here https://facebook.github.io/react-native/docs/getting-started.html.
|
||||
@ -10,11 +10,13 @@ Make sure your environment is set up to run react native applications. Follow th
|
||||
The ReactNative example project is in the `examples/ReactExample` directory. You need to run `npm install` in this directory before running the example for the first time.
|
||||
|
||||
## ReactNative Project Setup
|
||||
- Create a new ReactNative project `react-native init <project-name>` and open the generated XCode project.
|
||||
- Drag `RealmJS.xcodeproj` into the `Libraries` folder in your project.
|
||||
- Drag `RealmReact.framework` from the `Products` directory under `RealmJS.xcodeproj` into the `Embedded Binaries` section in the `General` tab for your app's target settings. Make sure the checkbox under `Code Sign On Copy` is **not checked** because having it checked will cause issues when trying to run your app on a device.
|
||||
- In the `Build Phases` tab for your app's target settings, add `RealmReact.framework` to the `Link Binary with Library` build phases.
|
||||
- In your app's `package.json` file, add the `realm` dependency with a path to the `realm-js/lib` folder like this: `"realm": "file:path/to/realm-js/lib"` (symlinks are not yet supported by the React Native packager, see [issue #637](https://github.com/facebook/react-native/issues/637)).
|
||||
- Create a new ReactNative project: `react-native init <project-name>`
|
||||
- Change directories into the new project (`cd <project-name>`) and add the `realm` dependency: `npm install --save git+ssh://git@github.com/realm/realm-js.git#beta` (please note it's **essential** to leave the `#beta` at the end)
|
||||
- Open the generated Xcode project (`ios/<project-name>.xcodeproj`)
|
||||
- Making sure the top-level project is selected in the sidebar, change the `iOS Deployment Target` to at least `8.0` in the project settings.
|
||||
- Right-click the `Libraries` group in the sidebar and click `Add Files to “<project-name>”`. Select `node_modules/realm/RealmJS.xcodeproj` from the dialog.
|
||||
- Drag `RealmReact.framework` from the `Products` directory under `RealmJS.xcodeproj` into the `Embedded Binaries` section in the `General` tab for your app's target settings.
|
||||
- In the `Build Phases` tab for your app's target settings, make sure `RealmReact.framework` is added to the `Link Binary with Library` build phase.
|
||||
- You can now `require('realm')` in your app's JS to use Realm!
|
||||
|
||||
## Getting Started
|
||||
|
@ -880,11 +880,6 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
"$(BUILT_PRODUCTS_DIR)",
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
@ -894,6 +889,7 @@
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
"$(SRCROOT)/vendor",
|
||||
"$(SRCROOT)/vendor/GCDWebServer",
|
||||
"$(SRCROOT)/../react-native/React/Base",
|
||||
"$(SRCROOT)/tests/react-test-app/node_modules/react-native/React/Base",
|
||||
"$(SRCROOT)/examples/ReactExample/node_modules/react-native/React/Base",
|
||||
);
|
||||
@ -918,16 +914,12 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
"$(BUILT_PRODUCTS_DIR)",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
"$(SRCROOT)/vendor",
|
||||
"$(SRCROOT)/vendor/GCDWebServer",
|
||||
"$(SRCROOT)/../react-native/React/Base",
|
||||
"$(SRCROOT)/tests/react-test-app/node_modules/react-native/React/Base",
|
||||
"$(SRCROOT)/examples/ReactExample/node_modules/react-native/React/Base",
|
||||
);
|
||||
@ -951,16 +943,12 @@
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
"$(BUILT_PRODUCTS_DIR)",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
"$(SRCROOT)/vendor",
|
||||
"$(SRCROOT)/vendor/GCDWebServer",
|
||||
"$(SRCROOT)/../react-native/React/Base",
|
||||
"$(SRCROOT)/tests/react-test-app/node_modules/react-native/React/Base",
|
||||
"$(SRCROOT)/examples/ReactExample/node_modules/react-native/React/Base",
|
||||
);
|
||||
|
@ -7,6 +7,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"react-native": "0.16.0",
|
||||
"realm": "file:../../lib"
|
||||
"realm": "file:../.."
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "realm",
|
||||
"version": "0.0.1",
|
||||
"private": true
|
||||
}
|
14
package.json
Normal file
14
package.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "realm",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib",
|
||||
"react-native",
|
||||
"scripts",
|
||||
"src",
|
||||
"vendor",
|
||||
"RealmJS.xcodeproj"
|
||||
]
|
||||
}
|
43
scripts/publish-beta.sh
Executable file
43
scripts/publish-beta.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Check if the worktree (or submodules) are dirty.
|
||||
if ! git diff --ignore-submodules=none --no-ext-diff --quiet --exit-code HEAD; then
|
||||
echo 'Publishing requires a clean work tree!' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GIT_AUTHOR_NAME=$(git config --get user.name)
|
||||
GIT_AUTHOR_EMAIL=$(git config --get user.email)
|
||||
GIT_ORIGIN_URL=$(git ls-remote --get-url origin)
|
||||
|
||||
# Reset these variables just in case they were inherited from the environment.
|
||||
TEMP_DIR=
|
||||
PACKAGE=
|
||||
|
||||
# Cleanup before this script exits.
|
||||
trap 'rm -rf "$TEMP_DIR" "$PACKAGE"' EXIT
|
||||
|
||||
TEMP_DIR=$(mktemp -d -t realm-js)
|
||||
PACKAGE=$(npm pack | tail -n 1)
|
||||
|
||||
tar -xf "$PACKAGE" -C "$TEMP_DIR"
|
||||
|
||||
(
|
||||
cd "$TEMP_DIR/package"
|
||||
|
||||
export GIT_AUTHOR_NAME
|
||||
export GIT_AUTHOR_EMAIL
|
||||
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
|
||||
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
|
||||
|
||||
git init
|
||||
git add .
|
||||
git commit -m 'Beta build'
|
||||
git remote add origin "$GIT_ORIGIN_URL"
|
||||
git push -f origin master:beta
|
||||
)
|
@ -7,7 +7,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"react-native": "0.16.0",
|
||||
"realm": "file:../../lib",
|
||||
"realm": "file:../..",
|
||||
"realm-tests": "file:../lib"
|
||||
}
|
||||
}
|
||||
|
16
vendor/.npmignore
vendored
Normal file
16
vendor/.npmignore
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
.travis.yml
|
||||
|
||||
GCDWebServer/*.podspec
|
||||
GCDWebServer/*.xcodeproj
|
||||
GCDWebServer/*.sh
|
||||
GCDWebServer/Frameworks
|
||||
GCDWebServer/GCDWebDAVServer
|
||||
GCDWebServer/GCDWebUploader
|
||||
GCDWebServer/iOS
|
||||
GCDWebServer/Mac
|
||||
GCDWebServer/Tests
|
||||
GCDWebServer/tvOS
|
||||
|
||||
PEGTL/Makefile
|
||||
PEGTL/examples
|
||||
PEGTL/unit_tests
|
Loading…
x
Reference in New Issue
Block a user