-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retail Shopping Cart - Initial (#33)
* chore; added Solution Folder (and physical folder) for Retail * initial; business logic with Emmett * feat; added api (app code), tests, npm scripts, docker-compose, etc * added launch.json for nodejs debugging in vscode * added Solution Folder reflecting the Shopping Cart (shopping-cart) * chore; formatting of solution-wide docker-compose * chore: streamlined docker-compose of nodejs shopping-carts * removed volumes from dock-comp, streamlined name * fix: removed dist folder * feat: added health-check for sanity-check 😆😁🤣💀 * chore: updated gitignore to account for node/express/JS/TS components * fix: removed references to volumes (ESDB) * initial Dockerfile; running into issues with ESLint and its config * adjustments to minimize potential errors / causes of Dockerfile fail
- Loading branch information
1 parent
e75e3ca
commit 4c3a0a6
Showing
25 changed files
with
6,957 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/.git | ||
/node_modules | ||
.dockerignore | ||
.env | ||
Dockerfile | ||
fly.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Editor configuration, see http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/node_modules/* | ||
# build artifacts | ||
dist/*coverage/* | ||
|
||
# data definition files | ||
**/*.d.ts | ||
|
||
# custom definition files | ||
/src/types/ | ||
|
||
!.eslintrc.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"env": { | ||
"es2023": true, | ||
"node": true | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"plugin:prettier/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2023, | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"rules": { | ||
"no-unused-vars": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" } | ||
], | ||
"@typescript-eslint/no-misused-promises": ["off"], | ||
"@typescript-eslint/prefer-namespace-keyword": "off" | ||
}, | ||
"settings": { | ||
"import/resolver": { | ||
"typescript": {} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v20.12.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**/dist/ | ||
**/lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug current file", | ||
"type": "node", | ||
"request": "launch", | ||
|
||
// Debug current file in VSCode | ||
"program": "${file}", | ||
|
||
/* | ||
Path to tsx binary | ||
Assuming locally installed | ||
*/ | ||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/tsx", | ||
|
||
/* | ||
Open terminal when debugging starts (Optional) | ||
Useful to see console.logs | ||
*/ | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen", | ||
|
||
// Files to exclude from debugger (e.g. call stack) | ||
"skipFiles": [ | ||
// Node.js internal core modules | ||
"<node_internals>/**", | ||
|
||
// Ignore all dependencies (optional) | ||
"${workspaceFolder}/node_modules/**" | ||
] | ||
}, | ||
{ | ||
"name": "Debug All Tests (Node)", | ||
"type": "node", | ||
"request": "launch", | ||
"skipFiles": ["<node_internals>/**"], | ||
"runtimeExecutable": "npm", | ||
"runtimeArgs": [ | ||
"run-script", | ||
"test", | ||
"--inspect-brk=9229", | ||
"--preserve-symlinks" | ||
], // Use --inspect-brk for debugging | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen", | ||
"cwd": "${workspaceFolder}", | ||
"sourceMaps": true, | ||
"smartStep": true, | ||
"resolveSourceMapLocations": [ | ||
"${workspaceFolder}/**", | ||
"!**/node_modules/**" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnPaste": false, | ||
"editor.formatOnSave": true, | ||
|
||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "explicit", | ||
"source.fixAll.eslint": "explicit", | ||
"source.addMissingImports": "always" | ||
}, | ||
|
||
"editor.tabSize": 2, | ||
|
||
"files.exclude": { | ||
"**/*.tsbuildinfo": true | ||
}, | ||
"files.eol": "\n", | ||
|
||
"typescript.preferences.importModuleSpecifier": "relative", | ||
"eslint.workingDirectories": [{ "mode": "auto" }], | ||
"debug.javascript.terminalOptions": { | ||
"nodeVersionHint": 20 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "build:ts:watch", | ||
"group": "build", | ||
"problemMatcher": [], | ||
"label": "npm: build:ts:watch", | ||
"detail": "tsc --watch" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# syntax = docker/dockerfile:1 | ||
|
||
# Adjust NODE_VERSION as desired | ||
FROM node:20.12.2-slim AS base | ||
|
||
LABEL fly_launch_runtime="Node.js" | ||
|
||
# Node.js app lives here | ||
WORKDIR /app | ||
|
||
# Set production environment | ||
ENV NODE_ENV="development" | ||
|
||
|
||
# Throw-away build stage to reduce size of final image | ||
FROM base as build | ||
|
||
# Install packages needed to build node modules | ||
RUN apt-get update -qq && \ | ||
apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3 | ||
|
||
# Install node modules | ||
COPY --link package-lock.json package.json ./ | ||
RUN npm ci --include=dev | ||
|
||
# Copy application code | ||
COPY --link src . | ||
|
||
# Build application | ||
RUN npm run build | ||
|
||
# Remove development dependencies | ||
RUN npm prune --omit=dev | ||
|
||
|
||
# Final stage for app image | ||
FROM base | ||
|
||
# Copy built application | ||
COPY --from=build /app /app | ||
|
||
# Start the server by default, this can be overwritten at runtime | ||
EXPOSE 3000 | ||
CMD [ "npm", "run", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
services: | ||
|
||
esdb: | ||
image: eventstore/eventstore:24.2.0-jammy | ||
# use this image if you're running ARM-based processor like an Apple M1 | ||
# image: eventstore/eventstore:24.2.0-alpha-arm64v8 | ||
container_name: ecomm_esdb_retail | ||
environment: | ||
EVENTSTORE_INSECURE: 'true' | ||
EVENTSTORE_CLUSTER_SIZE: 1 | ||
EVENTSTORE_RUN_PROJECTIONS: all | ||
EVENTSTORE_START_STANDARD_PROJECTIONS: 'true' | ||
EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP: 'true' | ||
# EVENTSTORE__PLUGINS__CONNECTORS__ENABLED: 'true' # only enabled in EE | ||
command: | ||
[ | ||
"--ExtIp=0.0.0.0", # Have ESDB listen on all ports not just localhost | ||
] | ||
ports: | ||
- '2113:2113' | ||
- '1113:1113' | ||
networks: | ||
- esdb_network | ||
|
||
networks: | ||
esdb_network: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import globals from "globals"; | ||
import pluginJs from "@eslint/js"; | ||
import tseslint from "typescript-eslint"; | ||
|
||
|
||
export default [ | ||
{languageOptions: { globals: globals.browser }}, | ||
pluginJs.configs.recommended, | ||
...tseslint.configs.recommended, | ||
]; |
Oops, something went wrong.