Skip to content

Commit

Permalink
Merge pull request #7 from montasim/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
montasim authored Aug 12, 2024
2 parents 839fa72 + a688980 commit a7c2005
Show file tree
Hide file tree
Showing 10 changed files with 1,915 additions and 2,013 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# Use: Prevent committing dependencies which can be installed via package managers.
####################################################
node_modules/
.yarn/

####################################################
# BUILD OUTPUTS
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/build-on-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build on Merge

on:
pull_request:
types: [closed]
branches:
- '**'

jobs:
check-merge:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3
run: echo "Code checked out successfully."

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
run: echo "Node.js set up with version $(node -v)."

- name: Install dependencies
run: |
echo "Installing dependencies..."
yarn install
echo "Dependencies installed successfully."
- name: Build the project
run: |
echo "Building the project..."
yarn build
if [ $? -eq 0 ]; then
echo "Build successful."
else
echo "Build failed."
exit 1
fi
- name: Check build success
run: echo "Build completed successfully, PR can be merged."
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Continuous Integration

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Log checkout commit
run: echo "Checked out $(git rev-parse --short HEAD)"

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Log Node.js version
run: echo "Using Node.js $(node -v)"

- name: Install dependencies
run: |
echo "Installing dependencies..."
yarn install
echo "Dependencies installed."
- name: Run lint checks
run: |
echo "Running lint checks..."
yarn lint:check
echo "Lint checks completed."
- name: Run Prettier checks
run: |
echo "Running Prettier checks..."
yarn prettier:check
echo "Prettier checks completed."
- name: Build the project
run: |
echo "Building the project..."
yarn build
echo "Build completed."
15 changes: 15 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
echo "Running lint checks..."
yarn lint:check
if [ $? -ne 0 ]; then
echo "Lint checks failed."
exit 1
fi

echo "Running Prettier checks..."
yarn prettier:check
if [ $? -ne 0 ]; then
echo "Prettier checks failed."
exit 1
fi

echo "Pre-commit checks passed."
16 changes: 16 additions & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used to specify the Node.js version for the project when using Node Version Manager (NVM).
# It ensures that all developers and environments use the same Node.js version, avoiding potential issues
# related to version discrepancies.
#
# @file .nvmrc
# @description Node Version Manager (NVM) configuration file that defines the Node.js version to be used
# for this project. By specifying the version here, you can ensure consistency across different development
# environments.
#
# @example
# # To switch to the specified Node.js version in this project, run:
# nvm use
#
# @version 20.11.1 - The specific Node.js version to be used for this project.

20.11.1
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ yarn.lock
.babelrc
.env
.env.development
.yarn
3 changes: 2 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {

// Rules define how ESLint applies linting to the code
rules: {
'no-console': 'warn', // Warns about console usage
'no-console': ['warn', { allow: ['error', 'table'] }], // Warns about console usage except for console.error and console.table
'func-names': 'off', // Turns off the requirement to name functions
'no-underscore-dangle': 'off', // Allows dangling underscores in identifiers
'consistent-return': 'off', // Does not require function return values to be consistent
Expand All @@ -54,6 +54,7 @@ export default {
// Paths to ignore during linting
ignores: [
'.idea/**', // Ignores all files in the .idea folder
'.yarn/**', // Ignores all files in the .yarn folder
'node_modules/**', // Ignores all files in node_modules
'build/**', // Ignores all files in the build output directory
'logs/**', // Ignores log files
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"generate-docs:code": "jsdoc -c jsdoc.json",
"generate-docs:api": "node --experimental-modules swagger.js",
"clean": "yarn autoclean --init",
"postinstall": "yarn autoclean --force && yarn build"
"postinstall": "yarn autoclean --force && yarn build",
"prepare": "husky"
},
"keywords": [
"node express mongodb boilerplate",
Expand Down Expand Up @@ -93,6 +94,7 @@
"@babel/core": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"eslint": "^9.5.0",
"husky": "^9.1.4",
"jsdoc": "^4.0.3",
"nodemon": "^3.1.4",
"prettier": "^3.3.2",
Expand Down
Loading

0 comments on commit a7c2005

Please sign in to comment.