mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
Compare commits
6 Commits
7fefabd9bf
...
a368f935b2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a368f935b2 | ||
|
|
a4396ddf18 | ||
|
|
b45d06bbe0 | ||
|
|
7e7a010d5e | ||
|
|
e493e3e932 | ||
|
|
850722cb7d |
11
Makefile
11
Makefile
@@ -1,21 +1,28 @@
|
|||||||
dev:
|
dev:
|
||||||
@docker compose down
|
@docker compose down
|
||||||
@docker compose -f dev.compose.yml pull
|
@docker compose -f dev.compose.yml pull
|
||||||
@docker compose -f dev.compose.yml up -d --wait
|
@docker compose -f dev.compose.yml up -d --wait --remove-orphans
|
||||||
@node ace migration:fresh
|
@node ace migration:fresh
|
||||||
@pnpm run dev
|
@pnpm run dev
|
||||||
|
|
||||||
prod:
|
prod:
|
||||||
@docker compose -f dev.compose.yml down
|
@docker compose -f dev.compose.yml down
|
||||||
@docker compose pull
|
@docker compose pull
|
||||||
@docker compose up -d --build --wait
|
@docker compose up -d --build --wait --remove-orphans
|
||||||
|
|
||||||
seed:
|
seed:
|
||||||
@node ace db:seed
|
@node ace db:seed
|
||||||
|
|
||||||
|
fresh:
|
||||||
|
@node ace migration:fresh
|
||||||
|
|
||||||
down:
|
down:
|
||||||
@-docker compose down
|
@-docker compose down
|
||||||
@-docker compose -f dev.compose.yml down
|
@-docker compose -f dev.compose.yml down
|
||||||
|
|
||||||
release:
|
release:
|
||||||
@pnpm run release
|
@pnpm run release
|
||||||
|
|
||||||
|
docker-weight:
|
||||||
|
@DOCKER_IMAGE_WEIGHT=$$(docker save axekin-axekin:latest | wc -c | awk '{printf "%.3f", $$1/1024/1024}'); \
|
||||||
|
echo "Docker image weight: $${DOCKER_IMAGE_WEIGHT} Mo"
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export default defineConfig({
|
|||||||
],
|
],
|
||||||
|
|
||||||
assetsBundler: false,
|
assetsBundler: false,
|
||||||
unstable_assembler: {
|
hooks: {
|
||||||
onBuildStarting: [() => import('@adonisjs/vite/build_hook')],
|
onBuildStarting: [() => import('@adonisjs/vite/build_hook')],
|
||||||
onDevServerStarted: [() => import('@izzyjs/route/dev_hook')],
|
onDevServerStarted: [() => import('@izzyjs/route/dev_hook')],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import User from '#user/models/user';
|
|||||||
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
|
|
||||||
|
const ID_OFFSET = 100;
|
||||||
|
|
||||||
export default class extends BaseSeeder {
|
export default class extends BaseSeeder {
|
||||||
static environment = ['development', 'testing'];
|
static environment = ['development', 'testing'];
|
||||||
|
|
||||||
@@ -11,7 +13,7 @@ export default class extends BaseSeeder {
|
|||||||
const users = await getUserIds();
|
const users = await getUserIds();
|
||||||
|
|
||||||
const collections = faker.helpers.multiple(
|
const collections = faker.helpers.multiple(
|
||||||
() => createRandomCollection(users),
|
(_, index) => createRandomCollection(users, ID_OFFSET + index),
|
||||||
{
|
{
|
||||||
count: 50,
|
count: 50,
|
||||||
}
|
}
|
||||||
@@ -25,12 +27,10 @@ export async function getUserIds() {
|
|||||||
return users.map(({ id }) => id);
|
return users.map(({ id }) => id);
|
||||||
}
|
}
|
||||||
|
|
||||||
let collectionId = 0;
|
function createRandomCollection(userIds: User['id'][], id: number) {
|
||||||
function createRandomCollection(userIds: User['id'][]) {
|
|
||||||
const authorId = faker.helpers.arrayElements(userIds, 1).at(0);
|
const authorId = faker.helpers.arrayElements(userIds, 1).at(0);
|
||||||
collectionId++;
|
|
||||||
return {
|
return {
|
||||||
id: collectionId,
|
id,
|
||||||
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
|
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
|
||||||
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
|
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
|
||||||
visibility: Visibility.PRIVATE,
|
visibility: Visibility.PRIVATE,
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import User from '#user/models/user';
|
|||||||
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
|
|
||||||
|
const ID_OFFSET = 100;
|
||||||
|
|
||||||
export default class extends BaseSeeder {
|
export default class extends BaseSeeder {
|
||||||
static environment = ['development', 'testing'];
|
static environment = ['development', 'testing'];
|
||||||
|
|
||||||
@@ -12,9 +14,12 @@ export default class extends BaseSeeder {
|
|||||||
const users = await getUserIds();
|
const users = await getUserIds();
|
||||||
|
|
||||||
const links = await Promise.all(
|
const links = await Promise.all(
|
||||||
faker.helpers.multiple(async () => createRandomLink(users), {
|
faker.helpers.multiple(
|
||||||
count: 500,
|
async (_, index) => createRandomLink(users, ID_OFFSET + index),
|
||||||
})
|
{
|
||||||
|
count: 500,
|
||||||
|
}
|
||||||
|
)
|
||||||
);
|
);
|
||||||
await Link.createMany(links.filter((a) => typeof a !== 'undefined') as any);
|
await Link.createMany(links.filter((a) => typeof a !== 'undefined') as any);
|
||||||
}
|
}
|
||||||
@@ -25,7 +30,7 @@ async function getCollectionIds(authorId: User['id']) {
|
|||||||
return collection.map(({ id }) => id);
|
return collection.map(({ id }) => id);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createRandomLink(userIds: User['id'][]) {
|
async function createRandomLink(userIds: User['id'][], id: number) {
|
||||||
const authorId = faker.helpers.arrayElements(userIds, 1).at(0)!;
|
const authorId = faker.helpers.arrayElements(userIds, 1).at(0)!;
|
||||||
const collections = await getCollectionIds(authorId);
|
const collections = await getCollectionIds(authorId);
|
||||||
|
|
||||||
@@ -35,7 +40,7 @@ async function createRandomLink(userIds: User['id'][]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: faker.string.uuid(),
|
id,
|
||||||
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
|
name: faker.string.alphanumeric({ length: { min: 5, max: 25 } }),
|
||||||
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
|
description: faker.string.alphanumeric({ length: { min: 0, max: 254 } }),
|
||||||
url: faker.internet.url(),
|
url: faker.internet.url(),
|
||||||
|
|||||||
@@ -3,22 +3,27 @@ import { GoogleToken } from '@adonisjs/ally/types';
|
|||||||
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
import { BaseSeeder } from '@adonisjs/lucid/seeders';
|
||||||
import { faker } from '@faker-js/faker';
|
import { faker } from '@faker-js/faker';
|
||||||
|
|
||||||
|
const ID_OFFSET = 100;
|
||||||
|
|
||||||
export default class extends BaseSeeder {
|
export default class extends BaseSeeder {
|
||||||
static environment = ['development', 'testing'];
|
static environment = ['development', 'testing'];
|
||||||
|
|
||||||
async run() {
|
async run() {
|
||||||
const users = faker.helpers.multiple(createRandomUser, {
|
const users = faker.helpers.multiple(
|
||||||
count: 25,
|
(_, index) => createRandomUser(ID_OFFSET + index),
|
||||||
});
|
{
|
||||||
|
count: 25,
|
||||||
|
}
|
||||||
|
);
|
||||||
await User.createMany(users);
|
await User.createMany(users);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createRandomUser() {
|
export function createRandomUser(index: number) {
|
||||||
return {
|
return {
|
||||||
id: faker.number.int(),
|
id: index,
|
||||||
email: faker.internet.email(),
|
email: faker.internet.email(),
|
||||||
name: faker.internet.userName(),
|
name: faker.internet.username(),
|
||||||
nickName: faker.internet.displayName(),
|
nickName: faker.internet.displayName(),
|
||||||
avatarUrl: faker.image.avatar(),
|
avatarUrl: faker.image.avatar(),
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: var(--mantine-font-size-sm);
|
font-size: var(--mantine-font-size-sm);
|
||||||
color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1));
|
color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1));
|
||||||
padding: var(--mantine-spacing-xs) var(--mantine-spacing-sm);
|
padding: rem(8px) rem(12px);
|
||||||
border-radius: var(--mantine-radius-sm);
|
border-radius: var(--mantine-radius-sm);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ export default function CollectionItem({
|
|||||||
}
|
}
|
||||||
}, [collection.id, activeCollection?.id]);
|
}, [collection.id, activeCollection?.id]);
|
||||||
|
|
||||||
const linksCount = collection?.links.length ?? 0;
|
|
||||||
const showLinks = linksCount > 0;
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
className={classes.link}
|
className={classes.link}
|
||||||
@@ -39,11 +37,6 @@ export default function CollectionItem({
|
|||||||
<Text lineClamp={1} maw={'200px'} style={{ wordBreak: 'break-all' }}>
|
<Text lineClamp={1} maw={'200px'} style={{ wordBreak: 'break-all' }}>
|
||||||
{collection.name}
|
{collection.name}
|
||||||
</Text>
|
</Text>
|
||||||
{showLinks && (
|
|
||||||
<Text style={{ whiteSpace: 'nowrap' }} c="dimmed" ml="sm">
|
|
||||||
— {linksCount}
|
|
||||||
</Text>
|
|
||||||
)}
|
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
import { router, usePage } from '@inertiajs/react';
|
import { router } from '@inertiajs/react';
|
||||||
import { ColorSchemeScript, createTheme, MantineProvider } from '@mantine/core';
|
import { ColorSchemeScript, MantineProvider } from '@mantine/core';
|
||||||
|
import '@mantine/core/styles.css';
|
||||||
|
import '@mantine/spotlight/styles.css';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { ReactNode, useEffect } from 'react';
|
import { ReactNode, useEffect } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { InertiaPage } from '~/types/inertia';
|
|
||||||
|
|
||||||
import '@mantine/core/styles.css';
|
|
||||||
import '@mantine/spotlight/styles.css';
|
|
||||||
import '../styles/index.css';
|
import '../styles/index.css';
|
||||||
|
|
||||||
const theme = createTheme({});
|
|
||||||
const TRANSITION_IN_CLASS = '__transition_fadeIn';
|
const TRANSITION_IN_CLASS = '__transition_fadeIn';
|
||||||
const TRANSITION_OUT_CLASS = '__transition_fadeOut';
|
const TRANSITION_OUT_CLASS = '__transition_fadeOut';
|
||||||
|
|
||||||
export default function BaseLayout({ children }: { children: ReactNode }) {
|
export default function BaseLayout({ children }: { children: ReactNode }) {
|
||||||
const { i18n } = useTranslation();
|
const { i18n } = useTranslation();
|
||||||
const { language } = usePage<InertiaPage>().props;
|
|
||||||
i18n.changeLanguage(language);
|
|
||||||
dayjs.locale(i18n.language);
|
dayjs.locale(i18n.language);
|
||||||
|
|
||||||
const findAppElement = () => document.getElementById('app');
|
const findAppElement = () => document.getElementById('app');
|
||||||
@@ -34,7 +29,6 @@ export default function BaseLayout({ children }: { children: ReactNode }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const currentLocation = new URL(window.location.href);
|
const currentLocation = new URL(window.location.href);
|
||||||
flipClass(TRANSITION_IN_CLASS, TRANSITION_OUT_CLASS);
|
|
||||||
|
|
||||||
const removeStartEventListener = router.on(
|
const removeStartEventListener = router.on(
|
||||||
'start',
|
'start',
|
||||||
@@ -58,7 +52,7 @@ export default function BaseLayout({ children }: { children: ReactNode }) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ColorSchemeScript />
|
<ColorSchemeScript />
|
||||||
<MantineProvider theme={theme}>{children}</MantineProvider>
|
<MantineProvider>{children}</MantineProvider>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
71
package.json
71
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "my-links",
|
"name": "my-links",
|
||||||
"version": "3.1.2",
|
"version": "3.1.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -40,64 +40,64 @@
|
|||||||
"@adonisjs/prettier-config": "^1.4.5",
|
"@adonisjs/prettier-config": "^1.4.5",
|
||||||
"@adonisjs/tsconfig": "^1.4.1",
|
"@adonisjs/tsconfig": "^1.4.1",
|
||||||
"@faker-js/faker": "^9.9.0",
|
"@faker-js/faker": "^9.9.0",
|
||||||
"@japa/assert": "^4.0.1",
|
"@japa/assert": "^4.1.1",
|
||||||
"@japa/plugin-adonisjs": "^4.0.0",
|
"@japa/plugin-adonisjs": "^4.0.0",
|
||||||
"@japa/runner": "^4.2.0",
|
"@japa/runner": "^4.3.0",
|
||||||
"@swc/core": "^1.12.9",
|
"@swc/core": "^1.13.3",
|
||||||
"@types/luxon": "^3.6.2",
|
"@types/luxon": "^3.7.1",
|
||||||
"@types/node": "^24.0.10",
|
"@types/node": "^22.14.0",
|
||||||
"@types/react": "^19.1.8",
|
"@types/react": "^19.1.9",
|
||||||
"@types/react-dom": "^19.1.6",
|
"@types/react-dom": "^19.1.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.35.1",
|
"@typescript-eslint/eslint-plugin": "^8.39.0",
|
||||||
"@vite-pwa/assets-generator": "^1.0.0",
|
"@vite-pwa/assets-generator": "^1.0.0",
|
||||||
"eslint": "^9.30.1",
|
"@vitejs/plugin-react": "^4.7.0",
|
||||||
|
"eslint": "^9.32.0",
|
||||||
"hot-hook": "^0.4.0",
|
"hot-hook": "^0.4.0",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^16.1.2",
|
"lint-staged": "^15.5.0",
|
||||||
"pino-pretty": "^13.0.0",
|
"pino-pretty": "^13.1.1",
|
||||||
"postcss": "^8.5.6",
|
"postcss": "^8.5.6",
|
||||||
"postcss-preset-mantine": "^1.18.0",
|
"postcss-preset-mantine": "^1.18.0",
|
||||||
"postcss-simple-vars": "^7.0.1",
|
"postcss-simple-vars": "^7.0.1",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"release-it": "^19.0.3",
|
"release-it": "^18.1.2",
|
||||||
"ts-node-maintained": "^10.9.5",
|
"ts-node-maintained": "^10.9.6",
|
||||||
"typescript": "~5.8.3",
|
"typescript": "~5.9.2",
|
||||||
"vite": "^7.0.2"
|
"vite": "^6.2.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@adonisjs/ally": "^5.1.0",
|
"@adonisjs/ally": "^5.1.0",
|
||||||
"@adonisjs/auth": "^9.4.0",
|
"@adonisjs/auth": "^9.4.2",
|
||||||
"@adonisjs/core": "^6.19.0",
|
"@adonisjs/core": "^6.19.0",
|
||||||
"@adonisjs/cors": "^2.2.1",
|
"@adonisjs/cors": "^2.2.1",
|
||||||
"@adonisjs/inertia": "^3.1.1",
|
"@adonisjs/inertia": "^3.1.1",
|
||||||
"@adonisjs/lucid": "^21.7.0",
|
"@adonisjs/lucid": "^21.8.0",
|
||||||
"@adonisjs/session": "^7.5.1",
|
"@adonisjs/session": "^7.5.1",
|
||||||
"@adonisjs/shield": "^8.2.0",
|
"@adonisjs/shield": "^8.2.0",
|
||||||
"@adonisjs/static": "^1.1.1",
|
"@adonisjs/static": "^1.1.1",
|
||||||
"@adonisjs/vite": "^4.0.0",
|
"@adonisjs/vite": "^4.0.0",
|
||||||
"@inertiajs/react": "^2.0.14",
|
"@inertiajs/react": "^2.0.17",
|
||||||
"@izzyjs/route": "^1.2.0",
|
"@izzyjs/route": "^1.2.0",
|
||||||
"@mantine/core": "^8.1.2",
|
"@mantine/core": "^7.17.3",
|
||||||
"@mantine/hooks": "^8.1.2",
|
"@mantine/hooks": "^7.17.3",
|
||||||
"@mantine/spotlight": "^8.1.2",
|
"@mantine/spotlight": "^7.17.3",
|
||||||
"@vinejs/vine": "^3.0.1",
|
"@vinejs/vine": "^3.0.1",
|
||||||
"@vitejs/plugin-react-oxc": "^0.2.3",
|
"bentocache": "^1.5.0",
|
||||||
"bentocache": "^1.4.0",
|
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"edge.js": "^6.2.1",
|
"edge.js": "^6.3.0",
|
||||||
"i18next": "^25.3.1",
|
"i18next": "^24.2.3",
|
||||||
"knex": "^3.1.0",
|
"knex": "^3.1.0",
|
||||||
"luxon": "^3.6.1",
|
"luxon": "^3.7.1",
|
||||||
"node-html-parser": "^7.0.1",
|
"node-html-parser": "^7.0.1",
|
||||||
"pg": "^8.16.3",
|
"pg": "^8.16.3",
|
||||||
"react": "^19.1.0",
|
"react": "^19.1.1",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.1",
|
||||||
"react-hotkeys-hook": "^5.1.0",
|
"react-hotkeys-hook": "^4.6.1",
|
||||||
"react-i18next": "^15.6.0",
|
"react-i18next": "^15.6.1",
|
||||||
"react-icons": "^5.5.0",
|
"react-icons": "^5.5.0",
|
||||||
"reflect-metadata": "^0.2.2",
|
"reflect-metadata": "^0.2.2",
|
||||||
"vite-plugin-pwa": "^1.0.1",
|
"vite-plugin-pwa": "^1.0.2",
|
||||||
"zustand": "^5.0.6"
|
"zustand": "^5.0.7"
|
||||||
},
|
},
|
||||||
"hotHook": {
|
"hotHook": {
|
||||||
"boundaries": [
|
"boundaries": [
|
||||||
@@ -120,10 +120,5 @@
|
|||||||
},
|
},
|
||||||
"volta": {
|
"volta": {
|
||||||
"node": "24.1.0"
|
"node": "24.1.0"
|
||||||
},
|
|
||||||
"pnpm": {
|
|
||||||
"overrides": {
|
|
||||||
"vite": "npm:rolldown-vite@latest"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2524
pnpm-lock.yaml
generated
2524
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@ import project from '#config/project';
|
|||||||
import { getDirname } from '@adonisjs/core/helpers';
|
import { getDirname } from '@adonisjs/core/helpers';
|
||||||
import inertia from '@adonisjs/inertia/client';
|
import inertia from '@adonisjs/inertia/client';
|
||||||
import adonisjs from '@adonisjs/vite/client';
|
import adonisjs from '@adonisjs/vite/client';
|
||||||
import react from '@vitejs/plugin-react-oxc';
|
import react from '@vitejs/plugin-react';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import { VitePWA } from 'vite-plugin-pwa';
|
import { VitePWA } from 'vite-plugin-pwa';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user