Skip to content

Commit

Permalink
feat: initial build
Browse files Browse the repository at this point in the history
  • Loading branch information
Bugs5382 committed Dec 21, 2023
0 parents commit 36b35d9
Show file tree
Hide file tree
Showing 23 changed files with 527 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jest.config.ts
release.config.js
/__tests__/**/*
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Bugs5382
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10
4 changes: 4 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
template: |
## What’s Changed
$CHANGES
47 changes: 47 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: GitHub CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
Test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18.x, 20.x, 'lts/*' ]
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm install --ignore-scripts
- name: Run Unit Tests
run: npm run test:ci
- name: Release Drafter
uses: release-drafter/release-drafter@v5.9.0
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Release:
runs-on: ubuntu-latest
needs: [ test ]
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- run: npm install
- name: Semantic Release
run: npm run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
138 changes: 138 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# 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)
.grunta

# 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

# Typedoc
docs

# 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.*

# NPM
package-lock.json

# Webstorm
.idea
16 changes: 16 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Folders
.github
.idea
bin
docs
src
__tests__
coverage

# Files
jest.config.ts
release.config.js
.eslintignore
*.json
*.tgz
*.yml
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Shane

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
29 changes: 29 additions & 0 deletions __tests__/__utils__/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* istanbul ignore next */
import EventEmitter from "node:events";

export function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms))
}

export interface Deferred<T=any> {
resolve: (value: T | PromiseLike<T>) => void
reject: (reason?: any) => void
promise: Promise<T>
}

export function createDeferred<T=any>(noUncaught?: boolean): Deferred<T> {
let dfd: any = {}
dfd.promise = new Promise((resolve, reject) => {
dfd.resolve = resolve
dfd.reject = reject
})
/* istanbul ignore next */
if (noUncaught) {
dfd.promise.catch(() => {})
}
return dfd
}

export function expectEvent<T=any>(emitter: EventEmitter, name: string|symbol): Promise<T> {
return new Promise<T>((resolve) => { emitter.once(name, resolve) })
}
16 changes: 16 additions & 0 deletions __tests__/app.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

describe('fastify-hl7 sample app tests', () => {

describe('no namespace', () => {

test.todo('...placeholder')

})

describe('namespace', () => {

test.todo('...placeholder')

})

})
33 changes: 33 additions & 0 deletions __tests__/hl7.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import fastify, {FastifyInstance} from 'fastify'

let app: FastifyInstance

beforeEach(() => {
app = fastify()
})

afterEach(async () => {
await app.close()
})

describe('plugin fastify-hl7 tests', () => {

describe('registration tests', () => {

test.todo('....placeholder')

})

describe('sanity checks', () => {

test.todo('....placeholder')

})

describe('common action tests', () => {

test.todo('....placeholder')

})

})
8 changes: 8 additions & 0 deletions __tests__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"typeRoots": ["../node_modules/@types", "../@types"]
},
"include": ["./**/*"]
}
11 changes: 11 additions & 0 deletions bin/build-types.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cat >dist/cjs/package.json <<!EOF
{
"type": "commonjs"
}
!EOF

cat >dist/esm/package.json <<!EOF
{
"type": "module"
}
!EOF
23 changes: 23 additions & 0 deletions bin/make-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Generate HTML documentation and commit to the gh-pages branch
# View with: python -m http.server -d docs 8000
#
## Get current docs:
# git worktree add docs/ gh-pages
#
## Release Steps
# update package.json with version=$ver
# npm publish --dry-run
# git tag v$ver
# ./make-docs.sh
# git push origin master gh-pages v$ver
# npm publish
#
set -e

# typedoc.json
node -r ts-node/register/transpile-only node_modules/.bin/typedoc

#lver=$(git describe --long --tags --dirty)
#read -p "Commit to gh-pages as $lver? Press key to continue.. " -n1 -s
# cd docs && git commit --all --message="$lver"
11 changes: 11 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { JestConfigWithTsJest } from 'ts-jest'

const jestConfig: JestConfigWithTsJest = {
preset: 'ts-jest',
testEnvironment: 'node',
coveragePathIgnorePatterns: ["<rootDir>/__tests__/",],
testPathIgnorePatterns: ['/__fixtures__/', '/__utils__/'],
resolver: 'jest-ts-webcompat-resolver',
}

export default jestConfig

0 comments on commit 36b35d9

Please sign in to comment.