Skip to content

Commit

Permalink
v2023 deployment: A new chapter begins.
Browse files Browse the repository at this point in the history
  • Loading branch information
shlee322 committed Nov 5, 2023
1 parent 53dd47c commit 3ee6545
Show file tree
Hide file tree
Showing 81 changed files with 15,542 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-20

RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install 20"
RUN su node -c "npm install -g pnpm@8"
17 changes: 17 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"dockerComposeFile": "docker-compose.yml",
"service": "devcontainer",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"forwardPorts": [4000],
"customizations": {
"vscode": {
"extensions": [
]
}
},
"portsAttributes": {
"4000": {
"label": "api-server"
}
}
}
8 changes: 8 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.8'
services:
devcontainer:
build:
context: .
volumes:
- ../..:/workspaces:cached
command: sleep infinity
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
root: true,
env: {
es2021: true,
node: true,
},
plugins: ["prettier"],
extends: ["standard-with-typescript", "plugin:prettier/recommended"],
overrides: [],
parserOptions: {
ecmaVersion: "latest",
project: ["tsconfig.json"],
sourceType: "module",
},
rules: {},
};
29 changes: 29 additions & 0 deletions .github/workflows/cla.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "CLA Assistant"
on:
issue_comment:
types: [created]
pull_request_target:
types: [opened,closed,synchronize]

permissions:
actions: write
contents: write
pull-requests: write
statuses: write

jobs:
CLAAssistant:
runs-on: ubuntu-latest
steps:
- name: "CLA Assistant"
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
uses: contributor-assistant/github-action@v2.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_PERSONAL_ACCESS_TOKEN }}
with:
path-to-signatures: 'signatures/version1/cla.json'
path-to-document: 'https://tracker.delivery/policies/cla'
branch: 'main'
remote-organization-name: shlee322
remote-repository-name: delivery-tracker-cla-signatures
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
generated
.idea
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "@delivery-tracker/server",
"runtimeExecutable": "pnpm",
"cwd": "${workspaceFolder}/packages/server",
"runtimeArgs": ["run", "dev"],
"outputCapture": "std",
"env": {
"LISTEN_PORT": "4000"
},
"preLaunchTask": "DeliveryTrackerServerPreLaunchTask"
}
]
}
10 changes: 10 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "DeliveryTrackerServerPreLaunchTask",
"type": "shell",
"command": "pnpm --filter '@delivery-tracker/server' build-with-deps"
}
]
}
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:20-alpine AS base
RUN npm install -g pnpm@8

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

FROM base AS prod-deps
WORKDIR /app
COPY . /app
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

FROM base AS build
RUN apk update && apk --no-cache add \
python3 \
make \
g++
WORKDIR /app
COPY . /app
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm --filter @delivery-tracker/server build-with-deps

FROM prod-deps
COPY --from=build /app/packages/api/dist /app/packages/api/dist
COPY --from=build /app/packages/core/dist /app/packages/core/dist
COPY --from=build /app/packages/server/dist /app/packages/server/dist

WORKDIR /app/packages/server

ENV NODE_ENV=production
CMD ["pnpm", "start"]
99 changes: 99 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
Copyright 2023 Vint Sanghyeok Lee <shlee322@gmail.com>

Source code in this repository is covered by the Elastic License 2.0.
The default throughout the repository is a license under the Elastic License 2.0,
unless a file header or a license file in a subdirectory specifies another license.

------

Elastic License 2.0

## Acceptance

By using the software, you agree to all of the terms and conditions below.

## Copyright License

The licensor grants you a non-exclusive, royalty-free, worldwide,
non-sublicensable, non-transferable license to use, copy, distribute, make
available, and prepare derivative works of the software, in each case subject to
the limitations and conditions below.

## Limitations

You may not provide the software to third parties as a hosted or managed
service, where the service provides users with access to any substantial set of
the features or functionality of the software.

You may not move, change, disable, or circumvent the license key functionality
in the software, and you may not remove or obscure any functionality in the
software that is protected by the license key.

You may not alter, remove, or obscure any licensing, copyright, or other notices
of the licensor in the software. Any use of the licensor’s trademarks is subject
to applicable law.

## Patents

The licensor grants you a license, under any patent claims the licensor can
license, or becomes able to license, to make, have made, use, sell, offer for
sale, import and have imported the software, in each case subject to the
limitations and conditions in this license. This license does not cover any
patent claims that you cause to be infringed by modifications or additions to
the software. If you or your company make any written claim that the software
infringes or contributes to infringement of any patent, your patent license for
the software granted under these terms ends immediately. If your company makes
such a claim, your patent license ends immediately for work on behalf of your
company.

## Notices

You must ensure that anyone who gets a copy of any part of the software from you
also gets a copy of these terms.

If you modify the software, you must include in any modified copies of the
software prominent notices stating that you have modified the software.

## No Other Rights

These terms do not imply any licenses other than those expressly granted in
these terms.

## Termination

If you use the software in violation of these terms, such use is not licensed,
and your licenses will automatically terminate. If the licensor provides you
with a notice of your violation, and you cease all violation of this license no
later than 30 days after you receive that notice, your licenses will be
reinstated retroactively. However, if you violate these terms after such
reinstatement, any additional violation of these terms will cause your licenses
to terminate automatically and permanently.

## No Liability

*As far as the law allows, the software comes as is, without any warranty or
condition, and the licensor will not be liable to you for any damages arising
out of these terms or the use or nature of the software, under any kind of
legal claim.*

## Definitions

The **licensor** is the entity offering these terms, and the **software** is the
software the licensor makes available under these terms, including any portion
of it.

**you** refers to the individual or entity agreeing to these terms.

**your company** is any legal entity, sole proprietorship, or other kind of
organization that you work for, plus all organizations that have control over,
are under the control of, or are under common control with that
organization. **control** means ownership of substantially all the assets of an
entity, or the power to direct its management and policies by vote, contract, or
otherwise. Control can be direct or indirect.

**your licenses** are all the licenses granted to you for the software under
these terms.

**use** means anything you do with the software requiring one of your licenses.

**trademark** means trademarks, service marks, and similar rights.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Delivery Tracker

Delivery and Shipping Tracking Service

## Usage
### Cloud (Managed Service)
Visit : https://tracker.delivery

### Self-Hosted (Self Service)
#### Setting Up the Development Environment
Delivery Tracker can be set up in local development environments and is also readily available for setup through GitHub Codespaces.

[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/shlee322/delivery-tracker)

Follow the instructions below for GitHub Codespaces:

1. Click the "Open in GitHub Codespaces" button above to create a new Codespace.
2. Once in your Codespace terminal, enter `pnpm install` to install the necessary dependencies.
3. In GitHub Codespaces, navigate to the "Run and Debug" section from the sidebar and then click the "Run" button for "@delivery-tracker/server" to launch the server.
4. The service URL can be accessed via the Ports panel at the bottom of the GitHub Codespaces interface.

#### Deploying Self-Hosted Services
See `Dockerfile`

## Additional Information
### License
- Please read the `LICENSE` file.

### Contact
- Please contact `contact@tracker.delivery` for more information.

### Project Structure
- packages/api : GraphQL API
- packages/core : Scraper code
- packages/cli : A Command Line Interface (CLI) tool that uses the execute function from packages/api.
- packages/http : A self-hosted GraphQL HTTP server that uses the execute function from packages/api.
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"engines": {
"node": ">=18",
"pnpm": ">=8"
},
"devDependencies": {
"@types/node": "^18.16.0",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"prettier": "^2.8.8",
"typescript": "^5.0.4"
}
}
18 changes: 18 additions & 0 deletions packages/api/codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
schema: "src/schema/schema.graphql",
generates: {
"src/schema/generated/resolvers-types.ts": {
config: {
useIndexSignature: true,
scalars: {
DateTime: "string",
CarrierSpecificData: "Map<string, any>",
},
},
plugins: ["typescript", "typescript-resolvers"],
},
},
};
export default config;
23 changes: 23 additions & 0 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "@delivery-tracker/api",
"private": true,
"type": "commonjs",
"exports": {
".": "./dist/index.js"
},
"types": "./dist/index.d.ts",
"scripts": {
"build": "graphql-codegen && tsc -p . && cp src/schema/schema.graphql dist/schema/schema.graphql",
"build-with-deps": "pnpm --filter '@delivery-tracker/core' build-with-deps && pnpm build"
},
"dependencies": {
"@delivery-tracker/core": "workspace:*",
"graphql": "^16.6.0",
"winston": "^3.8.2"
},
"devDependencies": {
"@graphql-codegen/cli": "^3.3.1",
"@graphql-codegen/typescript": "^3.0.4",
"@graphql-codegen/typescript-resolvers": "^3.2.1"
}
}
7 changes: 7 additions & 0 deletions packages/api/src/AppContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { type CarrierRegistry } from "@delivery-tracker/core";

interface AppContext {
carrierRegistry: CarrierRegistry;
}

export type { AppContext };
Loading

0 comments on commit 3ee6545

Please sign in to comment.