diff --git a/.dockerignore b/.dockerignore new file mode 120000 index 0000000..3e4e48b --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..902d6dc --- /dev/null +++ b/.env.example @@ -0,0 +1,11 @@ +# SETUP +DISCORD_TOKEN= + +# DB +REDIS_URL= + +# CHANNELS +COOL_LINKS_CHANNEL_ID= + +# API +PAGE_SUMMARIZER_BASE_URL= diff --git a/.eslintignore b/.eslintignore new file mode 120000 index 0000000..3e4e48b --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/.eslintrc.yaml b/.eslintrc.yaml new file mode 100644 index 0000000..77bc756 --- /dev/null +++ b/.eslintrc.yaml @@ -0,0 +1,43 @@ +parser: '@typescript-eslint/parser' +parserOptions: + sourceType: module + ecmaVersion: 2022 + project: ./tsconfig.json + +extends: + - plugin:@typescript-eslint/recommended + - plugin:@typescript-eslint/recommended-requiring-type-checking + - plugin:sonarjs/recommended + - plugin:import/typescript + +plugins: + - simple-import-sort + - import + - only-error + - unused-imports + +settings: + import/resolver: + +rules: + import/exports-last: error + import/first: error + import/no-duplicates: error + import/order: off + + simple-import-sort/imports: error + simple-import-sort/exports: error + + unused-imports/no-unused-imports: error + + import/no-extraneous-dependencies: + - error + - devDependencies: false + +overrides: + - files: + - '*.spec.ts' + rules: + import/no-extraneous-dependencies: + - error + - devDependencies: true diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index 2d39353..80201f0 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -17,12 +17,15 @@ concurrency: jobs: deployment: runs-on: ubuntu-22.04 - permissions: read-all + environment: + name: production + url: http://discord.gg/7Guzz9e + steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -33,7 +36,7 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Login to Heroku - uses: akhileshns/heroku-deploy@v3.12.13 + uses: akhileshns/heroku-deploy@v3.12.14 with: heroku_api_key: ${{secrets.HEROKU_API_KEY}} heroku_app_name: '' diff --git a/.github/workflows/good-practices.yaml b/.github/workflows/good-practices.yaml deleted file mode 100644 index 8d13e23..0000000 --- a/.github/workflows/good-practices.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: Good Practices - -on: - pull_request: - branches: - - master - paths-ignore: - - '**.md' - - '**.*ignore' - - '**.env*' - - renovate.json - - docker-compose.yaml - - '**deployment.yaml' - -jobs: - codeql-analysis: - name: CodeQL Analysis - runs-on: ubuntu-latest - - permissions: - security-events: write - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: javascript - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - - validate-pr-title: - name: Validate PR title - runs-on: ubuntu-22.04 - steps: - - uses: amannn/action-semantic-pull-request@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index c3bfbdc..3b3d6fe 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -1,3 +1,5 @@ +name: Check Integration + on: pull_request: branches: @@ -11,25 +13,33 @@ on: - '**deployment.yaml' jobs: + validate-pr-title: + name: Validate PR title + runs-on: ubuntu-22.04 + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + integration: - name: Continuous integration + name: Continuous integration checks runs-on: ubuntu-22.04 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - - name: Setup pnpm - uses: pnpm/action-setup@v2.2.4 - - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Setup pnpm + uses: pnpm/action-setup@v2.4.0 + - name: Setup Node uses: actions/setup-node@v3 with: @@ -39,14 +49,17 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Format project + run: pnpm format + - name: Type-check project run: pnpm typecheck - name: Lint project - run: pnpm affected:lint + run: pnpm lint - - name: Build project - run: pnpm affected:build + - name: Test project + run: pnpm test - name: Build Docker image for project uses: docker/build-push-action@v4 diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..71bc12f --- /dev/null +++ b/.npmrc @@ -0,0 +1,4 @@ +save-exact=true +prefer-offline=true +engines-strict=true +strict-peer-dependencies=true \ No newline at end of file diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..5538e1c --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +20.6.1 diff --git a/.prettierignore b/.prettierignore new file mode 120000 index 0000000..3e4e48b --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4be32c5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,63 @@ +
+Discord bot used in Codinglab server. +
+ +\n Condense<\/a> <\/p>\n <\/div>\n 26-minute read<\/p>\n Read full article<\/a> · Push to Kindle<\/a> · txtify.it<\/a><\/p>\n <\/div>\n`,
+ htmlContentNotFound: ` \n Home<\/a> <\/p>\n <\/div>\n 0-minute read<\/p>\n Read full article<\/a> · Push to Kindle<\/a> · txtify.it<\/a><\/p>\n <\/div>\n`,
+ pageWithoutSummaryContentUrl: 'https//this-is-a-fake-url.com',
+ pageSummary: {
+ title: 'You Might Not Need an Effect β React',
+ keyFeatures: [
+ 'Effects in React are used to synchronize components with external systems, but they are not always necessary.',
+ 'Effects should not be used to transform data for rendering or handle user events.',
+ 'Unnecessary Effects can be removed to make the code simpler, faster, and less error-prone.',
+ 'In cases where Effects are needed, it is important to handle race conditions and clean up after the Effect.',
+ ],
+ readingTime: '26-minute read',
+ },
+ pageSummaryDiscordView: `**You Might Not Need an Effect β React** \n- Effects in React are used to synchronize components with external systems, but they are not always necessary.\n- Effects should not be used to transform data for rendering or handle user events.\n- Unnecessary Effects can be removed to make the code simpler, faster, and less error-prone.\n- In cases where Effects are needed, it is important to handle race conditions and clean up after the Effect.\nβ 26-minute read`,
+ };
+};
+type SummarizeCoolPagesFixture = ReturnTypeNo content found<\/h2>\n
\n <\/ul>\n <\/div>\n