Skip to content
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

Open
wants to merge 7 commits into
base: development
Choose a base branch
from

Conversation

fabien-renaud
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@Fox-Islam Fox-Islam left a 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

src/messages/README.md Outdated Show resolved Hide resolved
src/messages/README.md Outdated Show resolved Hide resolved
src/messages/README.md Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/core/README.md Outdated Show resolved Hide resolved
src/core/client.js Outdated Show resolved Hide resolved
src/core/client.js Outdated Show resolved Hide resolved
src/core/database.js Outdated Show resolved Hide resolved
src/core/database.js Outdated Show resolved Hide resolved
Comment on lines +1 to +6
{
"hooks": {
"pre-commit": "npm run test",
"pre-push": "npm run test"
}
}
Copy link
Collaborator

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

Copy link
Collaborator Author

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!

Copy link
Collaborator

@Fox-Islam Fox-Islam Feb 9, 2021

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

Copy link
Collaborator Author

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.

Copy link
Collaborator

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

Copy link
Owner

@chris-mcdonald-dev chris-mcdonald-dev left a 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
Comment on lines 3 to 4
import {client} from './core';
import 'dotenv/config';

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 = {

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!

@Fox-Islam Fox-Islam added the conflicts This branch has conflicts with the base branch and must be updated before it can be merged label Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts This branch has conflicts with the base branch and must be updated before it can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants