From 7d32ca1fc8e63ec94ded4a846878840c99b59995 Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Mon, 1 Jan 2024 15:06:50 +0530 Subject: [PATCH] docs: Updating Contributing Requirements (#116) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📝 Update the requirements in docs * Update Changelog * Add pre-commit hook workflow * Apply formatting to all files in TestingApp --- .github/workflows/pre-commit-hook-run.yml | 25 + CHANGELOG.md | 2 + CONTRIBUTING.md | 7 +- TestingApp/.eslintrc.js | 4 - TestingApp/.prettierrc.js | 7 - TestingApp/App.js | 487 +++++++++--------- .../async-storage.js | 4 +- TestingApp/__tests__/App-test.js | 12 +- TestingApp/babel.config.js | 2 +- TestingApp/index.js | 6 +- TestingApp/metro.config.js | 16 +- examples/with-thirdparty/babel.config.js | 8 +- package.json | 4 +- 13 files changed, 305 insertions(+), 279 deletions(-) create mode 100644 .github/workflows/pre-commit-hook-run.yml delete mode 100644 TestingApp/.eslintrc.js delete mode 100644 TestingApp/.prettierrc.js diff --git a/.github/workflows/pre-commit-hook-run.yml b/.github/workflows/pre-commit-hook-run.yml new file mode 100644 index 0000000..90ddb9c --- /dev/null +++ b/.github/workflows/pre-commit-hook-run.yml @@ -0,0 +1,25 @@ +name: "Pre commit hook check" + +on: + pull_request: + types: + - opened + - reopened + - edited + - synchronize + +jobs: + pre-commit-check: + name: Pre commit hook check + runs-on: ubuntu-latest + container: rishabhpoddar/supertokens_website_sdk_testing_node_16 + steps: + - uses: actions/checkout@v2 + - run: git init && git add --all && git -c user.name='test' -c user.email='test@example.com' commit -m 'init for pr action' + - run: npm i --force || true + # the below command is there cause otherwise running npm run check-circular-dependencies gives an error like: + # Your cache folder contains root-owned files, due to a bug in + # npm ERR! previous versions of npm which has since been addressed. + - run: chown -R 1001:121 "/github/home/.npm" + - run: npm i --force + - run: ./hooks/pre-commit.sh \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d2a45c9..2616365 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [unreleased] +- Update contributing Prerequisites +- Remove unused ESLint and Prettier config files from TestingApp ## [4.0.8] - 2023-09-26 - use `URL` polyfill for `shouldDoInterceptionBasedOnUrl`: https://github.com/supertokens/supertokens-react-native/pull/111 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 40bf5a6..02489f4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ We're so excited you're interested in helping with SuperTokens! We are happy to ## Development Setup ### Prerequisites -- Nodejs & npm +- **Node.js v16.x** & npm - IDE: [VSCode](https://code.visualstudio.com/download)(recommended) or equivalent IDE ### Project Setup @@ -55,11 +55,12 @@ We're so excited you're interested in helping with SuperTokens! We are happy to cp -r ./test/tough-cookie ./node_modules/ npm i git+https://github.com:/supertokens-react-native.git ``` -5. Navigate to `supertokens-react-native/TestingApp` and run all tests +5. Add a static entry for `127.0.0.1 localhost.org` in your `/etc/hosts` file +6. Navigate to `supertokens-react-native/TestingApp` and run all tests ``` INSTALL_PATH=../../supertokens-root npm test ``` -6. If all tests pass the output should be: +7. If all tests pass the output should be: React Native tests passing diff --git a/TestingApp/.eslintrc.js b/TestingApp/.eslintrc.js deleted file mode 100644 index 40c6dcd..0000000 --- a/TestingApp/.eslintrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: '@react-native-community', -}; diff --git a/TestingApp/.prettierrc.js b/TestingApp/.prettierrc.js deleted file mode 100644 index 84196d9..0000000 --- a/TestingApp/.prettierrc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - bracketSpacing: false, - jsxBracketSameLine: true, - singleQuote: true, - trailingComma: 'all', - arrowParens: 'avoid', -}; diff --git a/TestingApp/App.js b/TestingApp/App.js index d49805f..b3c10ef 100644 --- a/TestingApp/App.js +++ b/TestingApp/App.js @@ -6,244 +6,253 @@ * @flow strict-local */ - import React from 'react'; - import { - View, - Text, - Button - } from 'react-native'; - - import SuperTokens from "supertokens-react-native" - import axios from "axios"; +import React from "react"; +import { View, Text, Button } from "react-native"; + +import SuperTokens from "supertokens-react-native"; +import axios from "axios"; SuperTokens.addAxiosInterceptors(axios); -const BASE_URL = "http://192.168.1.100:8080/" - - class App extends React.Component { - - constructor(props) { - super(props); - this.state = { - loggedIn: undefined, - sessionVerified: undefined - }; - } - - render() { - if (this.state.loggedIn === undefined) { - return ( - - ); - } else if (this.state.loggedIn) { - if (this.state.sessionVerified === undefined) { - return ( - - ); - } else if (this.state.sessionVerified) { - return ( - - - Logged in, session verification passed! - - -