forked from birdwingo/react-native-instagram-stories
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9bffc95
commit e2d8068
Showing
43 changed files
with
18,763 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
module.exports = { | ||
"root": true, | ||
"env": { | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 12, | ||
"sourceType": "module", | ||
"project": ["./tsconfig.json"], | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"import" | ||
], | ||
"extends": [ | ||
"airbnb", | ||
"airbnb-typescript" | ||
], | ||
"rules": { | ||
// React | ||
"react/jsx-props-no-spreading": "off", | ||
"react/prop-types": "off", | ||
"react/function-component-definition": "off", | ||
|
||
// Spaces | ||
'semi': [ | ||
'error', | ||
'always' | ||
], | ||
'no-trailing-spaces': [ | ||
'error', { | ||
'ignoreComments': true | ||
} | ||
], | ||
'space-before-function-paren': [ | ||
'error', { | ||
'anonymous': 'always', | ||
'named': 'never', | ||
'asyncArrow': 'always' | ||
} | ||
], | ||
'space-in-parens': [ | ||
'error', 'always' | ||
], | ||
'space-before-blocks': 'error', | ||
'no-whitespace-before-property': 'error', | ||
'newline-before-return': 'error', | ||
'no-multi-spaces': 'error', | ||
'arrow-parens': [ 'error', 'always' ], | ||
'array-bracket-spacing': [ 'error', 'always' ], | ||
'arrow-spacing': 'error', | ||
'lines-between-class-members': [ 'error', 'always', { 'exceptAfterSingleLine': true } ], | ||
'@typescript-eslint/lines-between-class-members': [ 'error', 'always', { 'exceptAfterSingleLine': true } ], | ||
|
||
// Basics | ||
'camelcase': 'error', | ||
'no-var': 'error', | ||
'prefer-const': 'error', | ||
'eqeqeq': [ 'error', 'always' ], | ||
'no-return-assign': 'error', | ||
'no-return-await': 'error', | ||
'no-throw-literal': 'error', | ||
'new-cap': [ 'error', { 'newIsCap': true } ], | ||
'no-unneeded-ternary': 'error', | ||
'no-template-curly-in-string': 'error', | ||
'template-curly-spacing': 'error', | ||
'curly': [ 'error', 'all' ], | ||
'padded-blocks': [ 'error', 'always' ], | ||
'no-underscore-dangle': ["error", { "allowAfterThis": true }], | ||
'import/extensions':'off', | ||
'no-plusplus': 'off', | ||
'import/prefer-default-export': 'off', | ||
'no-mixed-operators': 'off', | ||
'no-param-reassign': 'off', | ||
'import/no-named-as-default': 'off', | ||
'import/no-extraneous-dependencies': 'off', | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: NPM Package Publish | ||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm ci | ||
- run: npm run build | ||
- run: | | ||
npm version ${{ github.event.release.tag_name }} --no-git-tag-version --allow-same-version && \ | ||
npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
slackNotification: | ||
name: Slack Notification | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Slack Notification | ||
uses: rtCamp/action-slack-notify@v2 | ||
env: | ||
SLACK_CHANNEL: frontend | ||
SLACK_COLOR: ${{ job.status }} | ||
SLACK_ICON: https://raw.githubusercontent.com/birdwingo/react-native-instagram-stories/main/src/assets/images/logo.png | ||
SLACK_MESSAGE: Publish Release ${{ github.event.release.tag_name }} ${{ job.status == 'success' && 'has been successful' || 'has been failed' }} | ||
SLACK_TITLE: 'Instagram stories publish release :rocket:' | ||
SLACK_USERNAME: NPM | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Github Release | ||
on: | ||
pull_request: | ||
types: [closed] | ||
branch: main | ||
jobs: | ||
release: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.AUTH_TOKEN }} | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm ci | ||
- name: Set up git user for release | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
- run: npm run release | ||
- name: Push changes | ||
run: git push --follow-tags origin main | ||
- run: npm run build | ||
- run: npm run test | ||
- name: Get version from package-lock.json | ||
id: get_version | ||
run: echo "::set-output name=version::$(node -p "require('./package-lock.json').version")" | ||
- name: Get changelog | ||
id: get_changelog | ||
run: | | ||
CHANGELOG=$(awk '/^### \[[0-9]+\.[0-9]+\.[0-9]+\]/{if (version!="") {exit}; version=$2} version!="" {print}' CHANGELOG.md) | ||
echo "::set-output name=changelog::${CHANGELOG}" | ||
- name: Create Release | ||
uses: actions/create-release@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} | ||
with: | ||
tag_name: "v${{ steps.get_version.outputs.version }}" | ||
release_name: "v${{ steps.get_version.outputs.version }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules | ||
/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
module.exports = { | ||
presets: ['module:metro-react-native-babel-preset'], | ||
plugins: ['react-native-reanimated/plugin'], | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {extends: ['@commitlint/config-conventional']} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
|
||
import { BackHandler, Dimensions } from 'react-native'; | ||
|
||
jest.mock('react-native-reanimated', () => { | ||
|
||
const View = require('react-native').View; | ||
|
||
return { | ||
Value: jest.fn(), | ||
event: jest.fn(), | ||
add: jest.fn(), | ||
eq: jest.fn(), | ||
set: jest.fn(), | ||
cond: jest.fn(), | ||
interpolate: jest.fn(), | ||
View: (props) => <View {...props} />, | ||
createAnimatedComponent: (cb) => cb, | ||
Extrapolate: { CLAMP: jest.fn() }, | ||
Transition: { | ||
Together: 'Together', | ||
Out: 'Out', | ||
In: 'In', | ||
}, | ||
useSharedValue: jest.fn(), | ||
useDerivedValue: (a) => ({ value: a() }), | ||
useAnimatedScrollHandler: () => () => {}, | ||
useAnimatedGestureHandler: () => () => {}, | ||
useAnimatedStyle: (cb) => cb(), | ||
useAnimatedRef: () => ({ current: null }), | ||
useAnimatedReaction: (value, cb) => cb(value(), ''), | ||
useAnimatedProps: (cb) => cb(), | ||
withTiming: (toValue, _, cb) => { | ||
cb && cb(true); | ||
return toValue; | ||
}, | ||
withSpring: (toValue, _, cb) => { | ||
cb && cb(true); | ||
return toValue; | ||
}, | ||
withDecay: (_, cb) => { | ||
cb && cb(true); | ||
return 0; | ||
}, | ||
withDelay: (_, animationValue) => { | ||
return animationValue; | ||
}, | ||
withSequence: (..._animations) => { | ||
return 0; | ||
}, | ||
withRepeat: (animation, _, __, cb) => { | ||
cb(); | ||
return animation; | ||
}, | ||
cancelAnimation: () => {}, | ||
measure: () => ({ | ||
x: 0, | ||
y: 0, | ||
width: 0, | ||
height: 0, | ||
pageX: 0, | ||
pageY: 0, | ||
}), | ||
Easing: { | ||
linear: (cb) => cb(), | ||
ease: (cb) => cb(), | ||
quad: (cb) => cb(), | ||
cubic: (cb) => cb(), | ||
poly: (cb) => cb(), | ||
sin: (cb) => cb(), | ||
circle: (cb) => cb(), | ||
exp: (cb) => cb(), | ||
elastic: (cb) => cb(), | ||
back: (cb) => cb(), | ||
bounce: (cb) => cb(), | ||
bezier: () => ({ factory: (cb) => cb() }), | ||
bezierFn: (cb) => cb(), | ||
steps: (cb) => cb(), | ||
in: (cb) => cb(), | ||
out: (cb) => cb(), | ||
inOut: (cb) => cb(), | ||
}, | ||
Extrapolation: { | ||
EXTEND: 'extend', | ||
CLAMP: 'clamp', | ||
IDENTITY: 'identity', | ||
}, | ||
runOnJS: (fn) => fn, | ||
runOnUI: (fn) => fn, | ||
}; | ||
}); | ||
|
||
jest.mock('react-native-gesture-handler', () => { | ||
|
||
const View = require('react-native').View; | ||
const ScrollView = require('react-native').ScrollView; | ||
|
||
return { | ||
GestureDetector: ({gesture, children}) => ( | ||
<View | ||
onResponderStart={gesture.onStart} | ||
onResponderEnd={gesture.onEnd} | ||
onResponderMove={gesture.onUpdate} | ||
testID="gestureContainer" | ||
> | ||
{children} | ||
</View> | ||
), | ||
ScrollView | ||
}; | ||
|
||
}); |
Oops, something went wrong.