Skip to content

Commit

Permalink
Update packages for production, remove unused packages, update README
Browse files Browse the repository at this point in the history
We can do `yarn install --production`
  • Loading branch information
mrkvon committed Jul 8, 2024
1 parent 801f7ef commit 4597e88
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 88 deletions.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,26 @@ Alternatively, you may provide the configuration as environment variables

You can find full list of config options in [.env.sample](./.env.sample)

### Provide private key for JWT

You must provide a path to a private key for signing and verifying JWT tokens in `.env` file. You can generate it:

```
openssl ecparam -name prime256v1 -genkey -noout -out ecdsa-p256-private.pem
```

Default algorithm is ES256, but you can specify a different one.

### Run

Install for production:

```sh
yarn install --frozen-lockfile --production
```

Run:

```sh
yarn start
```
Expand All @@ -47,7 +65,17 @@ Service API is documented in [OpenAPI schema](./apidocs/openapi.json) (still wor

## Tests

Run `yarn test`
Install for development:

```sh
yarn install --frozen-lockfile
```

Run:

```sh
yarn test
```

Tests are placed in [src/test/](./src/test/)

Expand Down
40 changes: 17 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,26 @@
"main": "dist/index.js",
"scripts": {
"start": "yarn build && node dist/index.js",
"build": "rm -rf dist && tsc && yarn copy-hbs",
"build": "rm -rf dist && tsc --project tsconfig.production.json && yarn copy-hbs",
"copy-hbs": "cp src/templates/*.hbs dist/templates && cp src/templates/*.css dist/templates",
"format": "prettier 'src/**/*.ts' '**/*.{md,yml,yaml,json}' --write",
"lint": "eslint . --ext .ts",
"test": "mocha",
"generate-key": "openssl ecparam -name prime256v1 -genkey -noout -out ecdsa-p256-private.pem",
"generate-api-docs": "tsc && node dist/generate-api-docs.js"
},
"license": "MIT",
"devDependencies": {
"@solid/community-server": "^7.0.2",
"@types/bcryptjs": "^2.4.2",
"@types/chai": "^4.3.5",
"@types/co-body": "^6.1.0",
"@types/fs-extra": "^11.0.4",
"@types/jsonwebtoken": "^9.0.5",
"@types/koa": "^2.13.7",
"@types/koa-static": "^4.0.3",
"@types/koa__cors": "^4.0.1",
"@types/koa__router": "^12.0.0",
"@types/lodash": "^4.14.196",
"@types/maildev": "^0.0.7",
"@types/mocha": "^10.0.1",
"@types/n3": "^1.16.0",
"@types/node": "^20.4.2",
"@types/nodemailer": "^6.4.9",
"@types/parse-link-header": "^2.0.1",
"@types/sinon": "^10.0.15",
"@types/tough-cookie": "^4.0.5",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.19.0",
"chai": "^4.3.7",
"cheerio": "^1.0.0-rc.12",
"cross-fetch": "^4.0.0",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.6.1",
Expand All @@ -46,24 +34,29 @@
"msw": "^2.0.14",
"prettier": "^3.0.0",
"puppeteer": "^22.2.0",
"rdf-namespaces": "^1.11.0",
"sinon": "^15.2.0",
"swagger-autogen": "^2.23.6",
"tough-cookie": "^4.1.3",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
"ts-node": "^10.9.1"
},
"dependencies": {
"@inrupt/solid-client-authn-node": "^1.17.0",
"@koa/bodyparser": "^5.0.0",
"@koa/cors": "^4.0.0",
"@koa/router": "^12.0.0",
"@ldhop/core": "^0.0.0-alpha.1",
"@solid/access-token-verifier": "^2.0.5",
"@types/co-body": "^6.1.0",
"@types/fs-extra": "^11.0.4",
"@types/jsonwebtoken": "^9.0.5",
"@types/koa": "^2.13.7",
"@types/koa-static": "^4.0.3",
"@types/koa__cors": "^4.0.1",
"@types/koa__router": "^12.0.0",
"@types/lodash": "^4.14.196",
"@types/n3": "^1.16.0",
"@types/node": "^20.4.2",
"@types/nodemailer": "^6.4.9",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"bcryptjs": "^2.4.3",
"cross-fetch": "^4.0.0",
"css-authn": "^0.0.15-alpha.3",
"dotenv": "^16.0.0",
"fs-extra": "^11.2.0",
Expand All @@ -76,6 +69,7 @@
"lodash": "^4.17.21",
"n3": "^1.17.0",
"nodemailer": "^6.9.4",
"parse-link-header": "^2.0.0"
"rdf-namespaces": "^1.11.0",
"typescript": "^5.1.6"
}
}
16 changes: 16 additions & 0 deletions tsconfig.production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"target": "es6",
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"rootDir": "src",
"strict": true,
"noImplicitAny": true,
"downlevelIteration": true
},
"lib": ["esnext"],
"exclude": ["src/test", "src/generate-api-docs.ts"]
}
65 changes: 1 addition & 64 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2443,16 +2443,6 @@
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45"
integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==

"@inrupt/solid-client-authn-core@^1.17.0":
version "1.17.0"
resolved "https://registry.yarnpkg.com/@inrupt/solid-client-authn-core/-/solid-client-authn-core-1.17.0.tgz#fb8332dfb863cb898491c4e1db9d27f34319dd5c"
integrity sha512-r0P3nArdJX5yiY0/ZPmKVJ/xe20Unw+qrUn+ysAmAXQvL+V0gDcuGFZwrqHgMA1r6+1dLIqxlKGzMKLigFnJcw==
dependencies:
"@inrupt/universal-fetch" "^1.0.1"
events "^3.3.0"
jose "^4.10.0"
uuid "^9.0.0"

"@inrupt/solid-client-authn-core@^1.17.5":
version "1.17.5"
resolved "https://registry.yarnpkg.com/@inrupt/solid-client-authn-core/-/solid-client-authn-core-1.17.5.tgz#fc1eb1a3f4558bc924934862b5f1865a4f50dd4e"
Expand All @@ -2463,17 +2453,6 @@
jose "^4.15.4"
uuid "^9.0.1"

"@inrupt/solid-client-authn-node@^1.17.0":
version "1.17.0"
resolved "https://registry.yarnpkg.com/@inrupt/solid-client-authn-node/-/solid-client-authn-node-1.17.0.tgz#8e6faaf5b0c96a8cb24450750a4be20d48baa177"
integrity sha512-rJsoNDn/EpvvcFvaV9gXI3TdRx0alS6+MYn1TFWbLE4qNKjBDb3hFUaCVN6tlTx3o0F9kT856mKx/XVGz/Hrww==
dependencies:
"@inrupt/solid-client-authn-core" "^1.17.0"
"@inrupt/universal-fetch" "^1.0.1"
jose "^4.3.7"
openid-client "~5.4.2"
uuid "^9.0.0"

"@inrupt/universal-fetch@^1.0.1":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@inrupt/universal-fetch/-/universal-fetch-1.0.2.tgz#9e9ef73b2e19ea3c1b89411efa14cd3c212817f4"
Expand Down Expand Up @@ -2887,11 +2866,6 @@
resolved "https://registry.yarnpkg.com/@types/async-lock/-/async-lock-1.4.0.tgz#e7d555d037f93e911d54000acb626e783ff9023a"
integrity sha512-2+rYSaWrpdbQG3SA0LmMT6YxWLrI81AqpMlSkw3QtFc2HGDufkweQSn30Eiev7x9LL0oyFrBqk1PXOnB9IEgKg==

"@types/bcryptjs@^2.4.2":
version "2.4.2"
resolved "https://registry.yarnpkg.com/@types/bcryptjs/-/bcryptjs-2.4.2.tgz#e3530eac9dd136bfdfb0e43df2c4c5ce1f77dfae"
integrity sha512-LiMQ6EOPob/4yUL66SZzu6Yh77cbzJFYll+ZfaPiPPFswtIlA/Fs1MzdKYA7JApHU49zQTbJGX3PDmCpIdDBRQ==

"@types/bcryptjs@^2.4.4":
version "2.4.6"
resolved "https://registry.yarnpkg.com/@types/bcryptjs/-/bcryptjs-2.4.6.tgz#2b92e3c2121c66eba3901e64faf8bb922ec291fa"
Expand Down Expand Up @@ -3221,11 +3195,6 @@
"@types/koa" "*"
"@types/node" "*"

"@types/parse-link-header@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@types/parse-link-header/-/parse-link-header-2.0.1.tgz#be4b412eb36e5d6bffc481e3f6e38b7706a4c9ee"
integrity sha512-BrKNSrRTqn3UkMXvdVtr/znJch0PMBpEvEP8oBkxDx7eEGntuFLI+WpA5HGsNHK4SlqyhaMa+Ks0ViwyixQB5w==

"@types/proper-lockfile@^4.1.2":
version "4.1.2"
resolved "https://registry.yarnpkg.com/@types/proper-lockfile/-/proper-lockfile-4.1.2.tgz#49537cee7134055ee13a1833b76a1c298f39bb26"
Expand Down Expand Up @@ -3335,11 +3304,6 @@
resolved "https://registry.yarnpkg.com/@types/statuses/-/statuses-2.0.4.tgz#041143ba4a918e8f080f8b0ffbe3d4cb514e2315"
integrity sha512-eqNDvZsCNY49OAXB0Firg/Sc2BgoWsntsLUdybGFOhAfCD6QJ2n9HXUIHGqt5qjrxmMv4wS8WLAw43ZkKcJ8Pw==

"@types/tough-cookie@^4.0.5":
version "4.0.5"
resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304"
integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==

"@types/triple-beam@^1.3.2":
version "1.3.2"
resolved "https://registry.yarnpkg.com/@types/triple-beam/-/triple-beam-1.3.2.tgz#38ecb64f01aa0d02b7c8f4222d7c38af6316fef8"
Expand Down Expand Up @@ -6263,7 +6227,7 @@ jake@^10.8.5:
filelist "^1.0.4"
minimatch "^3.1.2"

jose@^4.10.0, jose@^4.10.3, jose@^4.14.4, jose@^4.3.7:
jose@^4.10.3:
version "4.14.4"
resolved "https://registry.yarnpkg.com/jose/-/jose-4.14.4.tgz#59e09204e2670c3164ee24cbfe7115c6f8bff9ca"
integrity sha512-j8GhLiKmUAh+dsFXlX1aJCbt5KMibuKb+d7j1JaOJG6s2UjX1PQlW+OKB/sD4a/5ZYF4RcmYmLSndOoU3Lt/3g==
Expand Down Expand Up @@ -7083,11 +7047,6 @@ object-assign@^4:
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==

object-hash@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-2.2.0.tgz#5ad518581eefc443bd763472b8ff2e9c2c0d54a5"
integrity sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==

object-hash@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9"
Expand Down Expand Up @@ -7225,16 +7184,6 @@ open@^9.1.0:
is-inside-container "^1.0.0"
is-wsl "^2.2.0"

openid-client@~5.4.2:
version "5.4.3"
resolved "https://registry.yarnpkg.com/openid-client/-/openid-client-5.4.3.tgz#c75d2f6d07a25d383a72c8ff34605a36b7e2cd73"
integrity sha512-sVQOvjsT/sbSfYsQI/9liWQGVZH/Pp3rrtlGEwgk/bbHfrUDZ24DN57lAagIwFtuEu+FM9Ev7r85s8S/yPjimQ==
dependencies:
jose "^4.14.4"
lru-cache "^6.0.0"
object-hash "^2.2.0"
oidc-token-hash "^5.0.3"

optionator@^0.9.3:
version "0.9.3"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64"
Expand Down Expand Up @@ -7330,13 +7279,6 @@ parse-json@^5.2.0:
json-parse-even-better-errors "^2.3.0"
lines-and-columns "^1.1.6"

parse-link-header@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/parse-link-header/-/parse-link-header-2.0.0.tgz#949353e284f8aa01f2ac857a98f692b57733f6b7"
integrity sha512-xjU87V0VyHZybn2RrCX5TIFGxTVZE6zqqZWMPlIKiSKuWh/X5WZdt+w1Ki1nXB+8L/KtL+nZ4iq+sfI6MrhhMw==
dependencies:
xtend "~4.0.1"

parse5-htmlparser2-tree-adapter@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz#23c2cc233bcf09bb7beba8b8a69d46b08c62c2f1"
Expand Down Expand Up @@ -9151,11 +9093,6 @@ xmlchars@^2.2.0:
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"
integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==

xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==

y18n@^5.0.5:
version "5.0.8"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
Expand Down

0 comments on commit 4597e88

Please sign in to comment.