Feature: Migrate to Typescript7 & AdonisJs7
This commit is contained in:
@@ -28,3 +28,5 @@ yarn-error.log
|
||||
|
||||
/backend/public/
|
||||
/backend/storage/
|
||||
/backend/.adonisjs/
|
||||
/backend/database/schema.ts
|
||||
|
||||
@@ -13,13 +13,20 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
### Changed
|
||||
|
||||
- Migrated TypeScript from `5.8.3` to `7.0.2`
|
||||
- Migrated AdonisJS from `6.x` to `7.3.5`
|
||||
- Refactored admin module-generator source builders to compose imports and source sections through
|
||||
shared source-file helpers while preserving the existing generation payload.
|
||||
- Renamed module-generator builder classes and files from template-builder terminology to
|
||||
source-builder terminology.
|
||||
- Updated module-generator frontend documentation to reference the new source-builder names.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix prettier one line import break sorting and class order
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed "prettier-plugin-one-line-imports"
|
||||
|
||||
## [1.0.1] - 2026-06-30
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
Node.js >= 22.14.0
|
||||
npm >= 11.6.2
|
||||
Node.js >= v24.18.0
|
||||
npm >= 11.15.0
|
||||
Database PostgreSQL
|
||||
|
||||
#### Installation
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
FROM node:22-alpine3.20
|
||||
FROM node:24-alpine3.22
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install workspace deps
|
||||
COPY package.json package-lock.json ./
|
||||
|
||||
RUN npm ci
|
||||
RUN npm ci --force
|
||||
|
||||
# Copy project
|
||||
COPY apps/admin ./apps/admin
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"types": ["node"],
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
/* Linting */
|
||||
@@ -20,7 +21,6 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"baseUrl": "./",
|
||||
/* Path alias */
|
||||
"paths": {
|
||||
"#*": ["./src/*"]
|
||||
|
||||
@@ -62,7 +62,7 @@ export default defineConfig(({ mode }) => {
|
||||
host: true,
|
||||
strictPort: true,
|
||||
port: 5173,
|
||||
open: true
|
||||
open: false
|
||||
},
|
||||
define: Object.fromEntries(
|
||||
Object.entries(mergedEnv).map(([key, value]) => [
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
# Adonis v6 backend (development mode)
|
||||
FROM node:22-alpine3.20
|
||||
# Adonis v7 backend (development mode)
|
||||
FROM node:24-alpine3.22
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -7,7 +7,7 @@ WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
|
||||
# Install workspace dependencies (monorepo-aware)
|
||||
RUN npm ci
|
||||
RUN npm ci --force
|
||||
|
||||
# Copy backend source
|
||||
COPY backend ./backend
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import vine from '@vinejs/vine'
|
||||
import type { Request } from '@adonisjs/core/http'
|
||||
import type { HttpContext } from '@adonisjs/core/http'
|
||||
import { pathSchema } from '#base_modules/FileManager/validator/schemas'
|
||||
import { ROOT_PATH } from '#base_modules/FileManager/config/general'
|
||||
import PathService from '#base_modules/FileManager/services/path_service'
|
||||
|
||||
const pathService = new PathService()
|
||||
|
||||
export default async function getValidatedPathFromRequest(request: Request): Promise<string> {
|
||||
export default async function getValidatedPathFromRequest(
|
||||
request: HttpContext['request']
|
||||
): Promise<string> {
|
||||
const segments = request.param('*', [ROOT_PATH])
|
||||
const path = pathService.join(...segments.map(decodeURIComponent))
|
||||
return vine.compile(pathSchema).validate(path)
|
||||
|
||||
@@ -6,7 +6,7 @@ const FileManagerController = () =>
|
||||
|
||||
router
|
||||
.group(() => {
|
||||
router.get('/', [FileManagerController, 'index'])
|
||||
router.get('/', [FileManagerController, 'index']).as('root')
|
||||
|
||||
router.put('/entries/rename', [FileManagerController, 'rename'])
|
||||
router.post('/folders', [FileManagerController, 'createFolder'])
|
||||
@@ -19,7 +19,7 @@ router
|
||||
router.get('/search', [FileManagerController, 'search'])
|
||||
|
||||
router.delete('/*', [FileManagerController, 'destroy'])
|
||||
router.get('/*', [FileManagerController, 'index'])
|
||||
router.get('/*', [FileManagerController, 'index']).as('nested')
|
||||
})
|
||||
.prefix('/file-manager')
|
||||
.use([middleware.auth()])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cuid } from '@adonisjs/core/helpers'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import { posix } from 'node:path'
|
||||
|
||||
export interface FileNameMeta {
|
||||
@@ -74,7 +74,7 @@ export default class PathService {
|
||||
counter++
|
||||
|
||||
if (counter > 5) {
|
||||
newName = `${cuid()}${ext}`
|
||||
newName = `${randomUUID()}${ext}`
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { defineConfig, drivers } from '@adonisjs/core/encryption'
|
||||
import env from '#start/env'
|
||||
|
||||
const encryptionConfig = defineConfig({
|
||||
default: 'app',
|
||||
list: {
|
||||
app: drivers.aes256gcm({
|
||||
id: 'app',
|
||||
keys: [env.get('APP_KEY')],
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
||||
export default encryptionConfig
|
||||
@@ -1,2 +1,8 @@
|
||||
import { configApp } from '@adonisjs/eslint-config'
|
||||
export default configApp()
|
||||
|
||||
export default [
|
||||
{
|
||||
ignores: ['.adonisjs/**', 'database/schema.ts'],
|
||||
},
|
||||
...configApp(),
|
||||
]
|
||||
|
||||
+15
-15
@@ -9,7 +9,7 @@
|
||||
"build": "node ace build",
|
||||
"dev": "node ace serve --hmr",
|
||||
"test": "node ace test",
|
||||
"lint": "eslint .",
|
||||
"lint": "node ../scripts/eslint-with-typescript6.cjs .",
|
||||
"format": "prettier --write .",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
@@ -35,32 +35,32 @@
|
||||
"#base_modules/*": "./app/base_modules/*.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@adonisjs/assembler": "^7.8.2",
|
||||
"@adonisjs/tsconfig": "^1.4.0",
|
||||
"@japa/api-client": "^3.1.0",
|
||||
"@adonisjs/assembler": "^8.4.0",
|
||||
"@adonisjs/tsconfig": "^2.0.0",
|
||||
"@japa/api-client": "^3.2.1",
|
||||
"@japa/assert": "^4.0.1",
|
||||
"@japa/plugin-adonisjs": "^4.0.0",
|
||||
"@japa/runner": "^4.4.0",
|
||||
"@japa/plugin-adonisjs": "^5.2.0",
|
||||
"@japa/runner": "^5.3.0",
|
||||
"@japa/spec-reporter": "^1.3.3",
|
||||
"@poppinss/ts-exec": "^1.4.4",
|
||||
"@swc/core": "1.11.24",
|
||||
"@types/luxon": "^3.6.2",
|
||||
"@types/supertest": "^6.0.3",
|
||||
"hot-hook": "^0.4.0",
|
||||
"pino-pretty": "^13.0.0",
|
||||
"pino-pretty": "^13.1.3",
|
||||
"supertest": "^7.1.4",
|
||||
"ts-node-maintained": "^10.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@adonisjs/auth": "^9.4.0",
|
||||
"@adonisjs/bouncer": "^3.1.6",
|
||||
"@adonisjs/core": "^6.18.0",
|
||||
"@adonisjs/cors": "^2.2.1",
|
||||
"@adonisjs/drive": "^3.4.1",
|
||||
"@adonisjs/lucid": "^21.6.1",
|
||||
"@adonisjs/validator": "^13.0.2",
|
||||
"@adonisjs/auth": "^10.1.0",
|
||||
"@adonisjs/bouncer": "^4.0.0",
|
||||
"@adonisjs/core": "^7.3.5",
|
||||
"@adonisjs/cors": "^3.0.0",
|
||||
"@adonisjs/drive": "^4.0.0",
|
||||
"@adonisjs/lucid": "^22.4.2",
|
||||
"@aws-sdk/client-s3": "^3.1064.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.1064.0",
|
||||
"@vinejs/vine": "^3.0.1",
|
||||
"@vinejs/vine": "^4.0.1",
|
||||
"adonis-autoswagger": "^3.73.0",
|
||||
"handlebars": "^4.7.8",
|
||||
"luxon": "^3.6.1",
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
"jsx": "react",
|
||||
"rootDir": "./",
|
||||
"outDir": "./build",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"#modules/*": ["modules/*"],
|
||||
"#Modules/*": ["modules/*"],
|
||||
"#base_modules/*": ["app/base_modules/*"]
|
||||
"#modules/*": ["./modules/*"],
|
||||
"#Modules/*": ["./modules/*"],
|
||||
"#base_modules/*": ["./app/base_modules/*"]
|
||||
},
|
||||
"types": ["@japa/runner", "supertest"]
|
||||
}
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ services:
|
||||
REDIS_CONNECTION: local
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
command: sh -c "npm install && node ace migration:run && node ace db:seed && npm run dev"
|
||||
command: sh -c "cd /app && npm install --force && cd backend && node ace migration:run && node ace db:seed && npm run dev"
|
||||
|
||||
postgres:
|
||||
image: postgres:17
|
||||
@@ -114,7 +114,7 @@ services:
|
||||
- /app/apps/admin/node_modules
|
||||
environment:
|
||||
- CHOKIDAR_USEPOLLING=true
|
||||
command: sh -c "npm install && npm run dev"
|
||||
command: sh -c "cd /app && npm install --force && cd apps/admin && npm run dev"
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
@@ -7,6 +7,7 @@ export default [
|
||||
"**/dist/**",
|
||||
"**/build/**",
|
||||
"**/.adonisjs/**",
|
||||
"backend/database/schema.ts",
|
||||
"node_modules/**",
|
||||
],
|
||||
},
|
||||
|
||||
Generated
+3046
-2270
File diff suppressed because it is too large
Load Diff
+18
-10
@@ -4,9 +4,10 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"license": "UNLICENSED",
|
||||
"packageManager": "npm@11.15.0",
|
||||
"engines": {
|
||||
"node": "^22.14.0",
|
||||
"npm": "^11.6.2"
|
||||
"node": ">=24.0.0",
|
||||
"npm": ">=11.6.2"
|
||||
},
|
||||
"workspaces": [
|
||||
"apps/*",
|
||||
@@ -25,17 +26,23 @@
|
||||
"version:patch": "npm version patch --no-git-tag-version && npm version patch --workspaces --no-git-tag-version",
|
||||
"version:minor": "npm version minor --no-git-tag-version && npm version minor --workspaces --no-git-tag-version",
|
||||
"version:major": "npm version major --no-git-tag-version && npm version major --workspaces --no-git-tag-version",
|
||||
"prepare": "husky"
|
||||
"prepare": "husky",
|
||||
"lint": "node scripts/eslint-with-typescript6.cjs .",
|
||||
"lint:fix": "node scripts/eslint-with-typescript6.cjs --fix ."
|
||||
},
|
||||
"imports": {},
|
||||
"devDependencies": {
|
||||
"@adonisjs/eslint-config": "2.0.0",
|
||||
"@adonisjs/prettier-config": "1.4.4",
|
||||
"@ianvs/prettier-plugin-sort-imports": "4.4.1",
|
||||
"@japa/api-client": "^3.2.1",
|
||||
"@japa/assert": "^4.2.0",
|
||||
"@japa/runner": "^5.3.0",
|
||||
"@japa/spec-reporter": "^1.3.3",
|
||||
"@types/node": "22.15.23",
|
||||
"@typescript-eslint/eslint-plugin": "8.33.0",
|
||||
"@typescript-eslint/parser": "8.33.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.64.0",
|
||||
"@typescript-eslint/parser": "^8.64.0",
|
||||
"@typescript/native": "npm:typescript@^7.0.2",
|
||||
"eslint": "9.27.0",
|
||||
"eslint-config-prettier": "10.1.5",
|
||||
"eslint-plugin-prettier": "5.4.0",
|
||||
@@ -45,8 +52,9 @@
|
||||
"lint-staged": "^16.2.7",
|
||||
"prettier": "3.5.3",
|
||||
"prettier-plugin-tailwindcss": "0.6.11",
|
||||
"typescript": "5.8.3",
|
||||
"typescript-eslint": "8.32.1"
|
||||
"typescript": "^7.0.2",
|
||||
"typescript-eslint": "^8.64.0",
|
||||
"typescript-eslint-ts6": "npm:@typescript/typescript6@^6.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"latest-version": "^9.0.0",
|
||||
@@ -54,15 +62,15 @@
|
||||
},
|
||||
"lint-staged": {
|
||||
"apps/**/*.{ts,tsx,js,jsx}": [
|
||||
"eslint --fix",
|
||||
"node scripts/eslint-with-typescript6.cjs --fix",
|
||||
"prettier --write"
|
||||
],
|
||||
"backend/**/*.{ts,js}": [
|
||||
"eslint --fix",
|
||||
"node scripts/eslint-with-typescript6.cjs --fix",
|
||||
"prettier --write"
|
||||
],
|
||||
"packages/**/*.{ts,tsx,js,jsx}": [
|
||||
"eslint --fix",
|
||||
"node scripts/eslint-with-typescript6.cjs --fix",
|
||||
"prettier --write"
|
||||
],
|
||||
"**/*.{json,md,yml}": [
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
const Module = require('node:module')
|
||||
const { createRequire } = require('node:module')
|
||||
const path = require('node:path')
|
||||
|
||||
const rootRequire = createRequire(path.join(process.cwd(), 'package.json'))
|
||||
const ts6 = rootRequire('typescript-eslint-ts6')
|
||||
const originalLoad = Module._load
|
||||
|
||||
Module._load = function patchedLoad(request, parent, isMain) {
|
||||
if (request === 'typescript') {
|
||||
return ts6
|
||||
}
|
||||
|
||||
return originalLoad.apply(this, arguments)
|
||||
}
|
||||
|
||||
require('../node_modules/eslint/bin/eslint.js')
|
||||
@@ -0,0 +1,25 @@
|
||||
# Troubleshooting
|
||||
|
||||
## `npm install` fails with `ERESOLVE`
|
||||
|
||||
The project uses TypeScript 7, but `typescript-eslint@8.64.0` declares support only for TypeScript versions below 6.1. npm therefore reports a peer-dependency conflict during a normal install.
|
||||
|
||||
The project runs ESLint through `scripts/eslint-with-typescript6.cjs`, which supplies a compatible TypeScript 6 version to ESLint. Until `typescript-eslint` officially supports TypeScript 7, install dependencies with:
|
||||
|
||||
```bash
|
||||
npm install --force
|
||||
```
|
||||
|
||||
For a clean, reproducible installation from `package-lock.json`, use:
|
||||
|
||||
```bash
|
||||
npm ci --force
|
||||
```
|
||||
|
||||
When adding or updating a dependency, include the same flag:
|
||||
|
||||
```bash
|
||||
npm install <package-name> --force
|
||||
```
|
||||
|
||||
Use the Node and npm versions declared by `.nvmrc` and `package.json`. The `--force` workaround can be removed once the installed `typescript-eslint` version supports TypeScript 7 and the TypeScript 6 ESLint shim is no longer needed.
|
||||
+6
-7
@@ -1,13 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@crux-kit/utils": ["packages/utils/src"],
|
||||
"@crux-kit/hooks": ["packages/hooks/src"],
|
||||
"@crux-kit/intl-name": ["packages/services/intl-name/src"],
|
||||
"@crux-kit/intl-date": ["packages/services/intl-date/src"],
|
||||
"@crux-kit/local-storage": ["packages/services/local-storage/src"],
|
||||
"@crux-kit/keenicon": ["packages/design-system/keenicon/src"]
|
||||
"@crux-kit/utils": ["./packages/utils/src"],
|
||||
"@crux-kit/hooks": ["./packages/hooks/src"],
|
||||
"@crux-kit/intl-name": ["./packages/services/intl-name/src"],
|
||||
"@crux-kit/intl-date": ["./packages/services/intl-date/src"],
|
||||
"@crux-kit/local-storage": ["./packages/services/local-storage/src"],
|
||||
"@crux-kit/keenicon": ["./packages/design-system/keenicon/src"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user