-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: Refactoring the whole app #7
base: development
Are you sure you want to change the base?
Draft: Refactoring the whole app #7
Conversation
91aa10a
to
b3416c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't looked at this as an overview but picked up a few small typos
{ | ||
"hooks": { | ||
"pre-commit": "npm run test", | ||
"pre-push": "npm run test" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be better to put these checks in a workflow file and prevent merge instead of enforcing it on pre-commit since anybody can disable their pre-commit locally and push
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know about GitHub workflow, so I guess I will just leave it to you! I see GitHub hooks as a reminder for the developers to not push or merge broken code, but you're right saying that you can just skip Git hooks. We can remove this feature if it doesn't make senses for you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you create a .yml
file in .github/workflows/ with these contents it should pick it up as a job when you next push:
name: Node CI
on:
push:
branches:
- "**"
jobs:
lint:
name: Run linters
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
- name: Install Node.js dependencies
run: npm install
- name: Run linters
run: npm run lint
Alternatively (the better solution, imo):
name: Lint
on:
push:
branches:
- "**"
jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install Node.js dependencies
run: npm install
- name: Run linters
uses: wearerequired/lint-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
eslint: true
prettier: true
which integrates with GitHub but we'd need to add a GitHub token into the secrets first and also add the .github directory into the .eslintignore and .prettierignore files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github Secrets aren't a problem. And there's no point adding .github
directory on the .eslintignore
and .prettierignore
, since we're only running linter on the src
folder.
I think we can integrate both git hooks and github workflow: git hooks allows you to automatically validate your code before comiting and pushing your branch, then github workflow force a validation before merging your branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! Adding the secret is easy, it should just be done before pushing the workflow file (otherwise it'll fail the check)
Maybe, but I'm not sure about it since it would add a redundant dependency on husky, it isn't a particularly large package but if possible we should try to minimise package bloat whenever we can
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨ Love the way the refactor looks! ✨
I left some comments based on the conversation we had earlier.
src/index.js
Outdated
import {client} from './core'; | ||
import 'dotenv/config'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! ✨ Just a brief reminder for us to require the dotenv
first before importing client
and remove the additional dotenv
configs from the src/core
modules like we discussed earlier!
@@ -0,0 +1,5 @@ | |||
const clientConfig = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just following up on the conversation we had,
I agree with you about adding a short comment explaining the purpose of the config here!
No description provided.