mirror of
https://github.com/zhigang1992/examples.git
synced 2026-01-12 17:13:21 +08:00
Add postPublish hook example
This commit is contained in:
8
with-postpublish-hooks/.babelrc
Normal file
8
with-postpublish-hooks/.babelrc
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"presets": ["babel-preset-expo"],
|
||||
"env": {
|
||||
"development": {
|
||||
"plugins": ["transform-react-jsx-source"]
|
||||
}
|
||||
}
|
||||
}
|
||||
3
with-postpublish-hooks/.gitignore
vendored
Normal file
3
with-postpublish-hooks/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules/**/*
|
||||
.expo/*
|
||||
npm-debug.*
|
||||
1
with-postpublish-hooks/.watchmanconfig
Normal file
1
with-postpublish-hooks/.watchmanconfig
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
24
with-postpublish-hooks/README.md
Normal file
24
with-postpublish-hooks/README.md
Normal 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`.
|
||||
BIN
with-postpublish-hooks/assets/icons/app.png
Normal file
BIN
with-postpublish-hooks/assets/icons/app.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
BIN
with-postpublish-hooks/assets/icons/loading.png
Normal file
BIN
with-postpublish-hooks/assets/icons/loading.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
36
with-postpublish-hooks/exp.json
Normal file
36
with-postpublish-hooks/exp.json
Normal 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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
3
with-postpublish-hooks/hooks/echo.js
Normal file
3
with-postpublish-hooks/hooks/echo.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = ({ config, log }) => {
|
||||
log(config.message);
|
||||
}
|
||||
24
with-postpublish-hooks/main.js
Normal file
24
with-postpublish-hooks/main.js
Normal 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);
|
||||
14
with-postpublish-hooks/package.json
Normal file
14
with-postpublish-hooks/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
3786
with-postpublish-hooks/yarn.lock
Normal file
3786
with-postpublish-hooks/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user