Skip to content

Commit

Permalink
update boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
patroza committed Dec 15, 2023
1 parent b0aab95 commit d8724ca
Show file tree
Hide file tree
Showing 151 changed files with 11,917 additions and 7,061 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN curl https://get.volta.sh | bash
WORKDIR /workspaces/boilerplate

# and install node and pnpm
RUN volta install node@18
RUN volta install node@20
RUN npm i -g pnpm

RUN echo
Expand Down
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ node_modules/
vitest.config.ts
vitest.config.test.ts
libs/
_project/frontend-nuxt
_project/frontend
5 changes: 0 additions & 5 deletions .eslintrc.api.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,4 @@ module.exports = {
root: true,
...base,
plugins: base.plugins.concat(["formatjs"]),
rules: {
...base.rules,
'codegen/codegen': ['error', { presets: require('@effect-app/eslint-codegen-model') }],
"@typescript-eslint/no-empty-interface": "off"
},
}
13 changes: 7 additions & 6 deletions .eslintrc.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@ module.exports = (dirName, forceTS = false, project = undefined) => {
"@typescript-eslint/no-use-before-define": ["warn", { functions: false, classes: true, variables: true}],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-empty-interface": [
"error",
{
allowSingleExtends: true,
},
],
"@typescript-eslint/no-empty-interface": "off",
// "@typescript-eslint/no-empty-interface": [
// "error",
// {
// allowSingleExtends: true,
// },
// ],
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
"sort-destructure-keys/sort-destructure-keys": "error", // Mainly to sort render props
Expand Down
3 changes: 1 addition & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const makeBase = require("./.eslintrc.base")
const base = makeBase(__dirname, true, "tsconfig.all2.json")
const base = makeBase(__dirname, undefined, "tsconfig.all2.json")
module.exports = {
root: true,
...base,
plugins: base.plugins.concat(["formatjs"]),
rules: {
...base.rules,
'codegen/codegen': ['error', { presets: require('@effect-app/eslint-codegen-model') }],
"@typescript-eslint/no-empty-interface": "off"
},
}
11 changes: 11 additions & 0 deletions .eslintrc.packages.base.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const makeBase = require("./.eslintrc.base")
module.exports = (...args) => {
const base = makeBase(...args)
return {...base,
plugins: base.plugins.concat(["formatjs"]),
rules: {
...base.rules,
'codegen/codegen': ['error', { presets: require('@effect-app/eslint-codegen-model') }],
"@typescript-eslint/no-empty-interface": "off"
},}
}
12 changes: 3 additions & 9 deletions .eslintrc.packages.cjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
const makeBase = require("./.eslintrc.base")
const base = makeBase(__dirname, undefined, "tsconfig.packages.json")
const makeBase = require("./.eslintrc.packages.base.cjs")
const base = makeBase(__dirname, true, "tsconfig.packages.json")
module.exports = {
root: true,
...base,
plugins: base.plugins.concat(["formatjs"]),
rules: {
...base.rules,
'codegen/codegen': ['error', { presets: require('@effect-app/eslint-codegen-model') }],
"@typescript-eslint/no-empty-interface": "off"
},
...base
}
3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ _cjs/
_mjs/
_esm/

.data/
.data.*/


# CMake
cmake-build-*/
Expand Down
7 changes: 6 additions & 1 deletion .ncurc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
"reject": [
"jwks-rsa",
"applicationinsights",
"faker",
"@types/faker",
"redis",
"@types/redis",
"@formatjs/intl"
"next-auth",
"@formatjs/intl",
"@effect/language-service",
"eslint-plugin-codegen"
]
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.13.0
20.10.0
8 changes: 2 additions & 6 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// TODO: Write a marker to package.json instead?
const enforceSingleVersion = [
"@effect/io",
"@effect/stm",
// Language service currently depends on them
// "@fp-ts/core",
"@effect/data",
"effect",
"@fp-ts/optic",
"@effect-app/core",
"@effect-app/infra-adapters",
Expand Down Expand Up @@ -47,6 +43,6 @@ function afterAllResolved(lockfile, context) {

module.exports = {
hooks: {
afterAllResolved,
afterAllResolved
}
}
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// {
// "name": "UI debug",
// "request": "launch",
// "cwd": "${workspaceFolder}/_project/frontend-nuxt",
// "cwd": "${workspaceFolder}/_project/frontend",
// "runtimeArgs": [
// "dev:debug"
// ],
Expand All @@ -40,13 +40,13 @@
{
"name": "UI Debug Attach",
"port": 9230,
"cwd": "${workspaceFolder}/_project/frontend-nuxt",
"cwd": "${workspaceFolder}/_project/frontend",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node",
"webRoot": "${workspaceFolder}/_project/frontend-nuxt",
"webRoot": "${workspaceFolder}/_project/frontend",
"sourceMaps": true
},
]
Expand Down
18 changes: 9 additions & 9 deletions .vscode/model.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"body": [
"/** @tsplus type $1 */",
"@useClassFeaturesForSchema",
"export class $1 extends Model<$1>()({ // TODO MNModel<$1, $1.ConstructorInput, $1.Encoded, $1.Props> ()({",
"export class $1 extends ExtendedClass<$1, $1.ConstructorInput, $1.From, $1.Fields> ()({",
"$2",
"}) {}"
],
Expand All @@ -28,7 +28,7 @@
"body": [
"/** @tsplus type $1 */",
"@useClassFeaturesForSchema",
"export class $1 extends Model<$1>()({$2}) {}",
"export class $1 extends Class<$1>()({$2}) {}",
""
],
"description": "Defines a Model signature"
Expand All @@ -37,12 +37,12 @@
"prefix": "un",
"body": [
"const $1__ = union({ $2 })",
"const $1_ = enhanceClassUnion(OpaqueSchema<$1, $1.Encoded>()($1__))",
"export type $1 = ParsedShapeOfCustom<typeof $1__> & UnionBrand",
"const $1_ = enhanceClassUnion(OpaqueSchema<$1, $1.From>()($1__))",
"export type $1 = To<typeof $1__> & UnionBrand",
"export interface $1Schema extends Identity<typeof $1_> {}",
"export const $1: $1Schema = $1_",
"export namespace $1 {",
" export type Encoded = EncodedOf<typeof $1__> & UnionBrand",
" export type From = From<typeof $1__> & UnionBrand",
"}"
]
},
Expand Down Expand Up @@ -89,19 +89,19 @@
"Response": {
"prefix": "res",
"body": [
"export class Response extends Model<Response()({$1}) {}",
"export class Response extends Class<Response()({$1}) {}",
""
],
"description": "Defines a Response signature"
},
"controller": {
"prefix": "controller",
"body": [
"const { controllers, matchWithServices } = matchFor($1Rsc)",
"const ${1/(.*)/${1:/camelcase}/} = matchFor($1Rsc)",
"",
"const $2 = matchWithServices(\"$2\")($3)",
"const $2 = ${1/(.*)/${1:/camelcase}/}.$2($3)",
"",
"export const $1Controllers = controllers({ $2 })"
"export default ${1/(.*)/${1:/camelcase}/}.controllers({ $2 })"
]
}
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
"source.addMissingImports"
]
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.codeActionsOnSave": [
Expand Down
14 changes: 7 additions & 7 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"label": "Watch API, Models, Resources",
"type": "shell",
"command": "pnpm watch",
"command": "pnpm watch-src",
// "options": {
// "cwd": "${workspaceRoot}/_project/api/_test",
// },
Expand Down Expand Up @@ -90,7 +90,7 @@
"type": "shell",
"command": "pnpm watch",
"options": {
"cwd": "${workspaceRoot}/_project/frontend-nuxt"
"cwd": "${workspaceRoot}/_project/frontend"
},
"dependsOn": [
"Watch API, Models, Resources"
Expand All @@ -108,7 +108,7 @@
"base": "$tsc-watch",
"fileLocation": [
"relative",
"${workspaceRoot}/_project/frontend-nuxt",
"${workspaceRoot}/_project/frontend",
],
}
]
Expand Down Expand Up @@ -147,7 +147,7 @@
"type": "shell",
"command": "pnpm dev",
"options": {
"cwd": "${workspaceRoot}/_project/frontend-nuxt"
"cwd": "${workspaceRoot}/_project/frontend"
},
"dependsOrder": "sequence",
"dependsOn": [
Expand All @@ -171,8 +171,8 @@
],
"background": {
"activeOnStart": true,
"beginsPattern": "building",
"endsPattern": "Vite client warmed up"
"beginsPattern": "Nuxi",
"endsPattern": "Vite client warmed up in",
}
},
"presentation": {
Expand Down Expand Up @@ -244,7 +244,7 @@
"type": "shell",
"command": "pnpm build",
"options": {
"cwd": "${workspaceRoot}/_project/frontend-nuxt"
"cwd": "${workspaceRoot}/_project/frontend"
},
"group": "build",
"dependsOrder": "sequence",
Expand Down
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM node:20-alpine

RUN npm i -g pnpm

# Install CUPS/AVAHI
RUN apk update --no-cache && apk add --no-cache cups cups-filters avahi inotify-tools

WORKDIR /app

# pnpm fetch does require only lockfile
COPY patches ./patches
COPY pnpm-lock.yaml .npmrc ./
RUN pnpm fetch --prod

COPY package.json pnpm-workspace.yaml ./

COPY _project/models/package.json ./_project/models/
COPY _project/resources/package.json ./_project/resources/
COPY _project/messages/package.json ./_project/messages/
#COPY _project/core/package.json ./_project/core/
COPY _project/api/package.json ./_project/api/

# As we're going to deploy, we want only the minimal production dependencies.
# TODO
RUN pnpm install --frozen-lockfile --prod
#RUN --mount=type=cache,target=/root/.pnpm pnpm_CACHE_FOLDER=/root/.pnpm pnpm install --frozen-lockfile --prod

COPY _project/models/dist ./_project/models/dist
COPY _project/resources/dist ./_project/resources/dist
COPY _project/messages/dist ./_project/messages/dist
#COPY _project/core/dist ./_project/core/dist
COPY _project/api/dist ./_project/api/dist

#COPY data ./data

WORKDIR /app/_project/api
ENV NODE_ENV production
EXPOSE 3610
ENV PORT=3610
ENV TZ=Europe/Berlin
ARG API_VERSION
ENV API_VERSION=${API_VERSION:-docker_default}
ENV SENTRY_RELEASE=${API_VERSION:-docker_default}

CMD ["pnpm", "start"]
14 changes: 14 additions & 0 deletions Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.github
.data
.git
.vscode
.idea
Dockerfile
Dockerfile.*
node_modules
**/node_modules
*.log
docs
#**/dist
**/.env.local
_project/frontend
Loading

0 comments on commit d8724ca

Please sign in to comment.