Skip to content

Commit

Permalink
Merge branch 'release/0.2.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
prisca-c committed May 1, 2024
2 parents 93db992 + 9f7a210 commit c31a8f0
Show file tree
Hide file tree
Showing 75 changed files with 5,366 additions and 2,286 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# http://editorconfig.org

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.json]
insert_final_newline = unset

[**.min.js]
indent_style = unset
insert_final_newline = unset

[MakeFile]
indent_style = space

[*.md]
trim_trailing_whitespace = false
40 changes: 12 additions & 28 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
# Since the ".env" file is gitignored, you can use the ".env.example" file to
# build a new ".env" file when you clone the repo. Keep this file up-to-date
# when you add new variables to `.env`.

# This file will be committed to version control, so make sure not to have any
# secrets in it. If you are cloning this repo, create a copy of this file named
# ".env" and populate it with your secrets.

# When adding additional environment variables, the schema in "/src/env.js"
# should be updated accordingly.
NODE_ENV="development"
PORT="3000"
HOSTNAME="localhost"

# Prisma
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
DATABASE_URL="file:./db.sqlite"

# Next Auth
# You can generate a new secret on the command line with:
# openssl rand -base64 32
# https://next-auth.js.org/configuration/options#secret
# NEXTAUTH_SECRET=""
NEXTAUTH_URL="http://localhost:3000"

# Next Auth Twitch Provider
TWITCH_CLIENT_ID=""
TWITCH_CLIENT_SECRET=""
TZ=UTC
PORT=3333
HOST=localhost
LOG_LEVEL=info
APP_KEY=lTtQy5-Mp2Vl-lhSrc92tBLhWitA7JK8
NODE_ENV=development
SESSION_DRIVER=cookie
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=
DB_DATABASE=
42 changes: 0 additions & 42 deletions .eslintrc.cjs

This file was deleted.

57 changes: 19 additions & 38 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,44 +1,25 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Dependencies and AdonisJS build
node_modules
build
tmp

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# database
/prisma/db.sqlite
/prisma/db.sqlite-journal
# Secrets
.env
.env.local
.env.production.local
.env.development.local

# next.js
/.next/
/out/
next-env.d.ts
# Frontend assets compiled code
public/assets

# production
/build
# Build tools specific
npm-debug.log
yarn-error.log

# misc
.DS_Store
*.pem
# Editors specific
.fleet
.idea
.vscode

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables
.env
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
/.env.production
# Platform specific
.DS_Store
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [0.2.0] - 2024-05-01
### Added
- ~~Add i18n handling to the project with `next-intl`.~~
- Switch project from `NextJS` to `AdonisJS`.

## [0.1.1] - 2024-04-25
### Added
- Add Socket.io to the project.
6 changes: 0 additions & 6 deletions README.md

This file was deleted.

28 changes: 28 additions & 0 deletions ace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
|--------------------------------------------------------------------------
| JavaScript entrypoint for running ace commands
|--------------------------------------------------------------------------
|
| DO NOT MODIFY THIS FILE AS IT WILL BE OVERRIDDEN DURING THE BUILD
| PROCESS.
|
| See docs.adonisjs.com/guides/typescript-build-process#creating-production-build
|
| Since, we cannot run TypeScript source code using "node" binary, we need
| a JavaScript entrypoint to run ace commands.
|
| This file registers the "ts-node/esm" hook with the Node.js module system
| and then imports the "bin/console.ts" file.
|
*/

/**
* Register hook to process TypeScript files using ts-node
*/
import { register } from 'node:module'
register('ts-node/esm', import.meta.url)

/**
* Import ace console entrypoint
*/
await import('./bin/console.js')
107 changes: 107 additions & 0 deletions adonisrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { defineConfig } from '@adonisjs/core/app'

export default defineConfig({
/*
|--------------------------------------------------------------------------
| Commands
|--------------------------------------------------------------------------
|
| List of ace commands to register from packages. The application commands
| will be scanned automatically from the "./commands" directory.
|
*/
commands: [() => import('@adonisjs/core/commands'), () => import('@adonisjs/lucid/commands')],

/*
|--------------------------------------------------------------------------
| Service providers
|--------------------------------------------------------------------------
|
| List of service providers to import and register when booting the
| application
|
*/
providers: [
() => import('@adonisjs/core/providers/app_provider'),
() => import('@adonisjs/core/providers/hash_provider'),
{
file: () => import('@adonisjs/core/providers/repl_provider'),
environment: ['repl', 'test'],
},
() => import('@adonisjs/core/providers/vinejs_provider'),
() => import('@adonisjs/core/providers/edge_provider'),
() => import('@adonisjs/session/session_provider'),
() => import('@adonisjs/vite/vite_provider'),
() => import('@adonisjs/shield/shield_provider'),
() => import('@adonisjs/static/static_provider'),
() => import('@adonisjs/cors/cors_provider'),
() => import('@adonisjs/lucid/database_provider'),
() => import('@adonisjs/auth/auth_provider'),
() => import('@adonisjs/inertia/inertia_provider'),
() => import('@adonisjs/i18n/i18n_provider')
],

/*
|--------------------------------------------------------------------------
| Preloads
|--------------------------------------------------------------------------
|
| List of modules to import before starting the application.
|
*/
preloads: [() => import('#start/routes'), () => import('#start/kernel')],

/*
|--------------------------------------------------------------------------
| Tests
|--------------------------------------------------------------------------
|
| List of test suites to organize tests by their type. Feel free to remove
| and add additional suites.
|
*/
tests: {
suites: [
{
files: ['tests/unit/**/*.spec(.ts|.js)'],
name: 'unit',
timeout: 2000,
},
{
files: ['tests/functional/**/*.spec(.ts|.js)'],
name: 'functional',
timeout: 30000,
},
],
forceExit: false,
},

/*
|--------------------------------------------------------------------------
| Metafiles
|--------------------------------------------------------------------------
|
| A collection of files you want to copy to the build folder when creating
| the production build.
|
*/
metaFiles: [
{
pattern: 'resources/views/**/*.edge',
reloadServer: false,
},
{
pattern: 'public/**',
reloadServer: false,
},
{
pattern: 'resources/lang/**/*.{json,yaml,yml}',
reloadServer: false,
}
],

assetsBundler: false,
unstable_assembler: {
onBuildStarting: [() => import('@adonisjs/vite/build_hook')],
},
})
45 changes: 45 additions & 0 deletions app/exceptions/handler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import app from '@adonisjs/core/services/app'
import { HttpContext, ExceptionHandler } from '@adonisjs/core/http'
import type { StatusPageRange, StatusPageRenderer } from '@adonisjs/core/types/http'

export default class HttpExceptionHandler extends ExceptionHandler {
/**
* In debug mode, the exception handler will display verbose errors
* with pretty printed stack traces.
*/
protected debug = !app.inProduction

/**
* Status pages are used to display a custom HTML pages for certain error
* codes. You might want to enable them in production only, but feel
* free to enable them in development as well.
*/
protected renderStatusPages = app.inProduction

/**
* Status pages is a collection of error code range and a callback
* to return the HTML contents to send as a response.
*/
protected statusPages: Record<StatusPageRange, StatusPageRenderer> = {
'404': (error, { inertia }) => inertia.render('errors/not_found', { error }),
'500..599': (error, { inertia }) => inertia.render('errors/server_error', { error }),
}

/**
* The method is used for handling errors and returning
* response to the client
*/
async handle(error: unknown, ctx: HttpContext) {
return super.handle(error, ctx)
}

/**
* The method is used to report error to the logging service or
* the a third party error monitoring service.
*
* @note You should not attempt to send a response from this method.
*/
async report(error: unknown, ctx: HttpContext) {
return super.report(error, ctx)
}
}
Loading

0 comments on commit c31a8f0

Please sign in to comment.