Skip to content

Commit

Permalink
chore(config): add initial project configuration files
Browse files Browse the repository at this point in the history
- Added ESLint configuration (.eslintrc.json) to enforce coding standards
  - Environment setup for ES2021 and Node.js
  - Extended recommended ESLint and TypeScript configurations
  - Disabled '@typescript-eslint/no-explicit-any' rule
  - Ignored 'node_modules' and 'backup' directories
- Introduced auto-assign configuration (.github/auto-assign.yaml) for pull requests
  - Enabled auto-assigning of reviewers and assignees
  - Configured 'tsdevau' as the default reviewer
  - Set 0 as the number of reviewers to add all reviewers by default
- Set up GitHub Actions workflow for auto-assign (.github/workflows/auto-assign.yaml)
  - Triggered on issue and pull request events
  - Utilized 'kentaro-m/[email protected]' for automatic assignment
- Configured release-please GitHub Actions workflow (.github/workflows/release-please.yaml)
  - Triggered on push events to the 'main' branch
  - Used 'google-github-actions/release-please-action@v4' to manage releases
- Added .gitignore file to exclude unnecessary files and directories
  - Included patterns for Node.js, macOS, Dropbox, Synology, and Visual Studio Code
- Added Prettier configuration (.prettierrc.cjs) for code formatting
  - Used 'prettier-plugin-packagejson' plugin
  - Set print width to 100 and disabled semicolons
  - Configured single attribute per line formatting
- Introduced release-please configuration (.release-please-config.json) for managing releases
  - Defined package name as '@tpstech/ecowitt-api'
  - Configured commit message and pull request title patterns
  - Customized changelog sections for different commit types
- Created release-please manifest (.release-please-manifest.json) to track the current version
- Added build script (build.mjs) using esbuild for bundling the project
  - Configured entry point, bundling, minification, and output directory
- Set up Drizzle ORM configuration (drizzle.config.ts) for database schema management
  - Configured PostgreSQL dialect and database credentials
  - Defined schema and output paths
- Added package.json with project metadata and dependencies
  - Included dependencies: axios, axios-retry, dotenv, drizzle-orm, postgres, zod
  - Included devDependencies: @typescript-eslint/eslint-plugin, @typescript-eslint/parser, drizzle-kit, eslint, prettier, prettier-plugin-packagejson, typescript, vitest
  - Defined scripts for building, formatting, linting, and testing
- Defined application settings (src/appSettings.ts) with retry and polling intervals
- Created database schema (src/dbSchema.ts) using Drizzle ORM
  - Defined tables for outdoor, indoor, solarUvi, rainfallPiezo, wind, pressure, lightning, soilCh1, tempHumidityCh1, and various metrics
- Added main entry point (src/main.ts) to start the polling process
  - Loaded environment variables and initiated request polling
- Implemented request polling functionality (src/requestPolling.ts) with axios and axios-retry
  - Handled periodic polling of the specified URL with retry logic
- Configured TypeScript compiler options (tsconfig.json)
  - Set up base URL, module resolution, and output directory
  - Included types for Vitest testing framework
  - Applied strict type checking and other compiler settings

This commit introduces the initial project setup with essential configurations, scripts, and source code for building, linting, formatting, and running the application.
  • Loading branch information
tsdevau committed May 27, 2024
0 parents commit 905e1b8
Show file tree
Hide file tree
Showing 17 changed files with 3,714 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"overrides": [
{
"env": {
"node": true
},
"files": [".eslintrc.{js,cjs}"],
"parserOptions": {
"sourceType": "script"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/no-explicit-any": "off"
},
"ignorePatterns": ["node_modules", "backup"]
}
25 changes: 25 additions & 0 deletions .github/auto-assign.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Set to true to add reviewers to pull requests
addReviewers: true

# Set to true to add assignees to pull requests
addAssignees: true

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
- tsdevau

# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0
# A list of assignees, overrides reviewers if set
# assignees:
# - tsdevau

# A number of assignees to add to the pull request
# Set to 0 to add all of the assignees.
# Uses numberOfReviewers if unset.
# numberOfAssignees: 2

# A list of keywords to be skipped the process that add reviewers if pull requests include it
# skipKeywords:
# - wip
16 changes: 16 additions & 0 deletions .github/workflows/auto-assign.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
issues:
types: [opened, reopened, unassigned]
pull_request:
types: [opened, reopened, unassigned, ready_for_review, review_requested]

name: Auto Assign

jobs:
add-reviews:
name: Assign Assignee and Reviewers
runs-on: ubuntu-latest
steps:
- uses: kentaro-m/[email protected]
with:
configuration-path: .github/auto-assign.yaml
19 changes: 19 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
config-file: ".release-please-config.json"
token: ${{ secrets.GITHUB_TOKEN }}
210 changes: 210 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# Created by https://www.toptal.com/developers/gitignore/api/node,macos,dropbox,synology,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=node,macos,dropbox,synology,visualstudiocode

### Additional ###
drizzle

### Dropbox ###
# Dropbox settings and caches
.dropbox
.dropbox.attr
.dropbox.cache

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

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

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### Synology ###
# Thumbnails
@eaDir
# Recycle bin
\#recycle

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/node,macos,dropbox,synology,visualstudiocode
9 changes: 9 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import("prettier").Config} */
const config = {
plugins: ["prettier-plugin-packagejson"],
printWidth: 100,
semi: false,
singleAttributePerLine: true,
}

module.exports = config
20 changes: 20 additions & 0 deletions .release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"package-name": "@tpstech/ecowitt-api",
"release-commit-message-pattern": "build(${scope}): 🔖 Release ${component} v${version}",
"pull-request-title-pattern": "build(${scope}): 🔖 Release ${component} v${version}",
"pull-request-header": ":robot: PR by release-please bot",
"changelog-sections": [
{ "type": "feat", "section": "Features & Performance Improvements" },
{ "type": "perf", "section": "Features & Performance Improvements" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "revert", "section": "Work in Progress" },
{ "type": "wip", "section": "Work in Progress" },
{ "type": "docs", "section": "Documentation" },
{ "type": "refactor", "section": "DX Improvements" },
{ "type": "style", "section": "DX Improvements" },
{ "type": "chore", "section": "DX Maintenance & Configuration" },
{ "type": "build", "section": "DX Maintenance & Configuration" },
{ "type": "test", "section": "DX Testing" },
{ "type": "ci", "section": "DX Continuous Integrations" }
]
}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.1"
}
13 changes: 13 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as esbuild from "esbuild"

await esbuild.build({
entryPoints: ["src/main.ts"],
bundle: true,
minify: true,
legalComments: "none",
platform: "node",
target: "node20",
external: [],
format: "esm",
outdir: "build",
})
10 changes: 10 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { config } from "dotenv"
import type { Config } from "drizzle-kit"
config()

export default {
dialect: "postgresql",
dbCredentials: { url: process.env.WEATHER_DB_URL as string },
schema: "./src/dbSchema.ts",
out: "./drizzle",
} satisfies Config
Loading

0 comments on commit 905e1b8

Please sign in to comment.