Add postPublish hook example

This commit is contained in:
Brent Vatne
2017-05-03 19:38:11 -07:00
parent eb600d9271
commit 21d6339488
12 changed files with 3900 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}

3
with-postpublish-hooks/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
node_modules/**/*
.expo/*
npm-debug.*

View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1,24 @@
# postPublish hooks
## How to use
## Configure it
- Create an incoming webhook for your Slack server and replace
`https://hooks.slack.com/put-your-stuff-here` in `exp.json` with your
webhook url -- or remove the `expo-postpublish-slack-notify` hook
entirely from `exp.json`.
## Running the app
- `cd` into the `app` directory and run `yarn` or `npm install`
- Open `app` with `exp` or XDE, try it out.
## The idea behind the example
It's common to need to perform a set of tasks once you publish an update
to your project. For example, you may want to notify people on Twitter
or Slack, upload sourcemaps and cut a release on Sentry, etc. This
example demonstrates how you can write your own simple hooks with
`./hooks/echo.js`, and install and use hooks distributed through npm,
such as `expo-prepublish-slack-notify`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -0,0 +1,36 @@
{
"name": "with-postpublish-hooks",
"description": "Demo project with postPublish hooks. The actual app itself is empty, the interesting part is in the hooks configuration in exp.json",
"slug": "with-postpublish-hooks",
"privacy": "unlisted",
"sdkVersion": "16.0.0",
"version": "1.0.0",
"orientation": "portrait",
"icon": "https://s3.amazonaws.com/exp-brand-assets/ExponentEmptyManifest_192.png",
"loading": {
"icon": "https://s3.amazonaws.com/exp-brand-assets/ExponentEmptyManifest_192.png",
"hideExponentText": false
},
"packagerOpts": {
"assetExts": [
"ttf",
"mp4"
]
},
"hooks": {
"postPublish": [
{
"file": "./hooks/echo",
"config": {
"message": "hello brent"
}
},
{
"file": "expo-postpublish-slack-notify",
"config": {
"webhookUrl": "https://hooks.slack.com/put-your-stuff-here"
}
}
]
}
}

View File

@@ -0,0 +1,3 @@
module.exports = ({ config, log }) => {
log(config.message);
}

View File

@@ -0,0 +1,24 @@
import Expo from 'expo';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Text>Open up main.js to start working on your app!</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
Expo.registerRootComponent(App);

View File

@@ -0,0 +1,14 @@
{
"name": "with-postpublish-hooks",
"version": "0.0.0",
"description": "Hello Expo!",
"author": null,
"private": true,
"main": "main.js",
"dependencies": {
"expo": "16.0.0",
"expo-postpublish-slack-notify": "^1.0.0",
"react": "16.0.0-alpha.6",
"react-native": "https://github.com/expo/react-native/archive/sdk-16.0.0.tar.gz"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "victory-native-example",
"description": "Using victory-native in Expo, see the source: , see the source: https://github.com/expo/examples/blob/master/with-victory-native",
"description": "Using victory-native in Expo, see the source: https://github.com/expo/examples/blob/master/with-victory-native",
"slug": "victory-native-example",
"privacy": "public",
"sdkVersion": "16.0.0",