Skip to content

Commit

Permalink
Long needed maintenance (#46)
Browse files Browse the repository at this point in the history
* upgrade graphql-subscriptions and eslint

- Breaking: Minimum Node.js version >=14
- Breaking: `graphql-subscriptions` >= 2.0.0
- Breaking: `graphql` 16.x; dropped support for 14.x 15.x
- Changed from deprecated `tslint` to `eslint`
- Upgraded vulnerable packages `nodemon`, `mocha`, `sinon`, `ts-node`

* upgrade circleci image to cimg/node:16

* feat: upgrade dependencies + restructure + fix linting issues

* test: migrate to jest + clean-up dependencies

* build: clean-up npm tarball + prevent from direct publish

* Move tests to github

* Update dependencies monthly

* Add CodeQL Analysis

* Add name

* Version bump

* Dependency update and eslint config

* Set nvmrc to lts/* as tests are being run on lts as well

* Remove release-it

* Remove badges

* Switch from nodemon to ts-node-dev

* Streamline build process

* Rename tests

* Linting autofix

* switch to toBeDefined

* no-void

* Ignore explicit any and object injection

* Remove unneeded deps

---------

Co-authored-by: Shahyar G <[email protected]>
Co-authored-by: Dmitri Dimitrioglo <[email protected]>
  • Loading branch information
3 people authored Jan 23, 2024
1 parent 27243ba commit 04c81af
Show file tree
Hide file tree
Showing 36 changed files with 6,494 additions and 10,606 deletions.
40 changes: 0 additions & 40 deletions .circleci/config.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lib
.eslintrc.js
jest.config.js
121 changes: 121 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"env": {
"node": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:security/recommended-legacy",
"plugin:sonarjs/recommended",
"plugin:unicorn/recommended",
"standard"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./test/tsconfig.json"
},
"plugins": [
"@typescript-eslint",
"jest",
"security",
"sonarjs",
"unicorn"
],
"ignorePatterns": [
"dist",
"coverage"
],
"rules": {
"indent": [
"error",
2,
{
"MemberExpression": 0,
"SwitchCase": 1
}
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-console": [
"error"
],
"space-before-blocks": [
"error",
"always"
],
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"keyword-spacing": [
"error",
{
"before": true,
"after": true
}
],
"arrow-spacing": [
"error",
{
"before": true,
"after": true
}
],
"comma-dangle": [
"error",
"never"
],
"curly": [
"error",
"all"
],
"brace-style": [
"error",
"1tbs"
],
"space-before-function-paren": [
"error",
{
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}
],
"func-names": [
"error",
"as-needed"
],
"import/order": [
"error",
{
"groups": [
["builtin", "external"],
["internal", "parent", "sibling", "index"]
],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "always"
}
],
"unicorn/no-null": "off",
"security/detect-object-injection": "off",
"@typescript-eslint/no-explicit-any": "off"
}
}
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly

- package-ecosystem: npm
directory: /
schedule:
interval: monthly
groups:
npm-dependencies:
patterns:
- "*"
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '31 7 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'TypeScript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
source-root: src
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Run Tests

on:
pull_request:
push:
branches:
- main

concurrency:
group: test-${{ github.ref_name }}
cancel-in-progress: true

jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
services:
rabbit:
image: rabbitmq:management-alpine
env:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
ports:
- 5672:5672
- 15672:15672
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set Node.js LTS
uses: actions/[email protected]
with:
node-version: lts/*
registry-url: "https://npm.pkg.github.com"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run Tests
run: npm test
env:
AMQP_ADDRESS: rabbit

- name: Check linting
run: npm run lint
37 changes: 10 additions & 27 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,20 @@
logs
*.log

# Runtime data
pids
*.pid
*.seed
.stage

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
.nyc_output
# OS
.DS_Store

# Coverage directory used by tools like istanbul
# Tests
coverage
junit
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# IDEs
.idea
.vscode

# node-waf configuration
.lock-wscript
# Node.js
node_modules

# Compiled binary addons (http://nodejs.org/api/addons.html)
release
# Compiled
lib
dist

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# JSDoc
jsdoc

# MAC specific files
.DS_Store
40 changes: 0 additions & 40 deletions .npmignore

This file was deleted.

1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/*
Loading

0 comments on commit 04c81af

Please sign in to comment.