Skip to content

Commit

Permalink
feat: set up standalone /shared root folder for clean sharing of ty…
Browse files Browse the repository at this point in the history
…pes and utils (#2322)

* build: set up separate shared package with its own node_modules

this allows for true independence and allows typescript build orchestration

* build: set up tooling to handle new shared root folder

* ref: collapse types into single file

* feat: correct types used in document types

* feat: use shared types in client

* chore: update mongoose to v5.13.2

allows some new inference of types for instance/static methods

* feat(shared): add more Dto and Base types for Agency

* feat(agency): use new shared types as base for backend types

* build: revert alias tooling

This partially reverts commit 089eee5.

Not going to bother for now, backend build somehow keeps failing with aliases

* fix: correct built server file path

changed due to inclusion of a new shared folder in the compilation step

* feat: remove unused types/api files

agency and user.ts have been superseded by their new shared/types files

* feat: update _id type for UserBase

Co-authored-by: Antariksh Mahajan <[email protected]>

Co-authored-by: Antariksh Mahajan <[email protected]>
  • Loading branch information
karrui and mantariksh authored Jul 14, 2021
1 parent 2bf0f50 commit c3a329b
Show file tree
Hide file tree
Showing 23 changed files with 724 additions and 133 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"es6": true,
"node": true
},
"ignorePatterns": ["./shared"],
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"globals": {
"Atomics": "readonly",
Expand Down
59 changes: 22 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"build-frontend": "webpack --config webpack.prod.js",
"build-frontend-dev": "webpack --config webpack.dev.js",
"build-frontend-dev:watch": "webpack --config webpack.dev.js --watch",
"start": "node -r dotenv/config dist/backend/app/server.js",
"start": "node -r dotenv/config dist/backend/src/app/server.js",
"dev": "docker-compose up --build",
"docker-dev": "npm run build-frontend-dev:watch & ts-node-dev --respawn --transpile-only --inspect=0.0.0.0 --exit-child -r dotenv/config -- src/app/server.ts",
"test": "npm run test-backend && npm run test-frontend",
Expand All @@ -33,7 +33,7 @@
"test-e2e-build": "npm run build-backend && npm run build-frontend-dev",
"test-e2e-ci": "env-cmd -f tests/.test-env --use-shell \"npm run download-binary && npm run testcafe-command\"",
"testcafe-command": "testcafe --skip-js-errors -c 2 chrome:headless ./tests/end-to-end --app \"npm run test-e2e-server\" --app-init-delay 10000",
"test-e2e-server": "concurrently --success last --kill-others \"mockpass\" \"maildev\" \"node dist/backend/app/server.js\" \"node ./tests/mock-webhook-server.js\"",
"test-e2e-server": "concurrently --success last --kill-others \"mockpass\" \"maildev\" \"node dist/backend/src/app/server.js\" \"node ./tests/mock-webhook-server.js\"",
"lint-code": "eslint src/ --quiet --fix",
"lint-style": "stylelint '*/**/*.css' --quiet --fix",
"lint-html": "htmlhint && prettier --write './src/public/**/*.html' --ignore-path './dist/**' --loglevel silent",
Expand Down Expand Up @@ -124,7 +124,7 @@
"lodash": "^4.17.21",
"moment-timezone": "0.5.33",
"mongodb-uri": "^0.9.7",
"mongoose": "^5.12.13",
"mongoose": "^5.13.2",
"multiparty": ">=4.2.2",
"neverthrow": "^4.2.2",
"ng-infinite-scroll": "^1.3.0",
Expand Down
20 changes: 20 additions & 0 deletions shared/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"root": true,
"plugins": ["import", "simple-import-sort", "prettier"],
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"rules": {
"@typescript-eslint/no-unused-vars": "error"
}
}
],
"env": { "es6": true },
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
}
}
Loading

0 comments on commit c3a329b

Please sign in to comment.