Add astro framework and update nodejs

This commit is contained in:
2026-03-07 11:06:07 +03:00
parent 7d488fbdf2
commit 08a160a6a1
10 changed files with 8191 additions and 6704 deletions

7
.gitignore vendored
View File

@@ -4,10 +4,13 @@
.config/ .config/
.home/ .home/
output_*
node_modules/ node_modules/
dist/
.astro/
# Legacy (удалить после завершения миграции)
output_*
var/ var/
vendor/ vendor/
.php_cs.cache .php_cs.cache
.php-cs-fixer.cache .php-cs-fixer.cache

View File

@@ -9,103 +9,39 @@ vars:
sh: id -g sh: id -g
PROJECT: "homepage" PROJECT: "homepage"
PHP_IMAGE: "{{.PROJECT}}-php"
NODE_IMAGE: "{{.PROJECT}}-node" NODE_IMAGE: "{{.PROJECT}}-node"
DOCKER_COMMON_OPTS: >- DOCKER_COMMON_OPTS: >-
--rm --rm
--interactive
--tty
--user {{.USER_ID}}:{{.GROUP_ID}} --user {{.USER_ID}}:{{.GROUP_ID}}
--volume /etc/passwd:/etc/passwd:ro --volume /etc/passwd:/etc/passwd:ro
--volume /etc/group:/etc/group:ro --volume /etc/group:/etc/group:ro
--volume "./:/srv/app" --volume "./:/srv/app"
--workdir "/srv/app" --workdir "/srv/app"
-e XDG_CONFIG_HOME=/srv/app/.config
-e XDG_CACHE_HOME=/srv/app/.cache
-e HOME=/srv/app/.home -e HOME=/srv/app/.home
tasks: tasks:
build-docker: build-docker:
cmds: cmds:
- docker build --file docker/php/Dockerfile --tag "{{.PHP_IMAGE}}" .
- docker build --file docker/node/Dockerfile --tag "{{.NODE_IMAGE}}" . - docker build --file docker/node/Dockerfile --tag "{{.NODE_IMAGE}}" .
composer:
cmds:
- docker run {{.DOCKER_COMMON_OPTS}} "{{.PHP_IMAGE}}" composer {{.CLI_ARGS}}
npm: npm:
cmds: cmds:
- docker run {{.DOCKER_COMMON_OPTS}} "{{.NODE_IMAGE}}" npm {{.CLI_ARGS}} - docker run {{.DOCKER_COMMON_OPTS}} "{{.NODE_IMAGE}}" npm {{.CLI_ARGS}}
sculpin: install:
cmds: cmds:
- docker run {{.DOCKER_COMMON_OPTS}} "{{.PHP_IMAGE}}" ./vendor/bin/sculpin {{.CLI_ARGS}}
shell-node:
cmds:
- docker run {{.DOCKER_COMMON_OPTS}} "{{.NODE_IMAGE}}" bash
install-dependencies:
cmds:
- task: composer
vars: { CLI_ARGS: "install" }
- task: npm - task: npm
vars: { CLI_ARGS: "install" } vars: { CLI_ARGS: "install" }
format-pages: dev:
cmds: cmds:
- task: npm - docker run {{.DOCKER_COMMON_OPTS}} -p 4321:4321 "{{.NODE_IMAGE}}" npm run dev
vars: { CLI_ARGS: 'run format-md' }
format-assets:
cmds:
- task: npm
vars: { CLI_ARGS: 'run format-webpack' }
- task: npm
vars: { CLI_ARGS: 'run format-js' }
- task: npm
vars: { CLI_ARGS: 'run format-vue' }
- task: npm
vars: { CLI_ARGS: 'run format-style' }
format-php:
cmds:
- docker run {{.DOCKER_COMMON_OPTS}} "{{.PHP_IMAGE}}" php-cs-fixer fix
build-dev:
vars:
APP_OUTPUT_DIR: output_dev
NPM_SCRIPT: build
APP_ENV: dev
APP_URL: homepage.site
cmds:
- rm -rf ./{{.APP_OUTPUT_DIR}}/*
- task: npm
vars: { CLI_ARGS: 'run {{.NPM_SCRIPT}}' }
- task: sculpin
vars: { CLI_ARGS: 'generate --env="{{.APP_ENV}}" --url="{{.APP_URL}}" --no-interaction -vv' }
build-prod: build-prod:
vars:
APP_OUTPUT_DIR: output_prod
NPM_SCRIPT: build-prod
APP_ENV: prod
APP_URL: https://vakhrushev.me
cmds: cmds:
- rm -rf ./{{.APP_OUTPUT_DIR}}/* - docker run {{.DOCKER_COMMON_OPTS}} "{{.NODE_IMAGE}}" npm run build
- task: npm
vars: { CLI_ARGS: 'run {{.NPM_SCRIPT}}' }
- task: sculpin
vars: { CLI_ARGS: 'generate --env="{{.APP_ENV}}" --url="{{.APP_URL}}" --no-interaction -vv' }
make-post:
vars:
POST_DATE:
sh: date +'%Y-%m-%d'
cmd: touch "source/_articles/{{.POST_DATE}}-new-post.md"
deploy: deploy:
vars: vars:

12
astro.config.mjs Normal file
View File

@@ -0,0 +1,12 @@
import { defineConfig } from 'astro/config';
import tailwindcss from '@tailwindcss/vite';
import vue from '@astrojs/vue';
import sitemap from '@astrojs/sitemap';
export default defineConfig({
site: 'https://vakhrushev.me',
integrations: [vue(), sitemap()],
vite: {
plugins: [tailwindcss()],
},
});

View File

@@ -1,3 +1,3 @@
FROM nginx:stable FROM nginx:stable
COPY output_prod /usr/share/nginx/html COPY dist /usr/share/nginx/html

View File

@@ -1,6 +1,3 @@
FROM node:12 FROM node:22-slim
ENV npm_config_fund=false
ENV npm_config_update_notifier=false
WORKDIR /srv/app WORKDIR /srv/app

14706
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,49 +1,22 @@
{ {
"name": "homepage", "name": "homepage",
"author": "Anton Vakhrushev", "author": "Anton Vakhrushev",
"license": "", "version": "2.0.0",
"version": "1.0.0", "type": "module",
"description": "Homepage", "description": "Anton Vakhrushev homepage",
"devDependencies": {
"@anwinged/predictor": "^0.2.1",
"@babel/core": "^7.14.6",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-transform-runtime": "^7.14.5",
"@babel/preset-env": "^7.14.7",
"@babel/runtime": "^7.14.6",
"autoprefixer": "^9.8.6",
"babel-loader": "^8.2.2",
"css-loader": "^2.1.1",
"glob": "^7.1.7",
"mini-css-extract-plugin": "^0.6.0",
"node-sass": "^4.14.1",
"postcss-loader": "^3.0.0",
"prettier": "^1.19.1",
"sass-loader": "^7.3.1",
"style-loader": "^0.23.1",
"underscore": "^1.13.1",
"vue": "^2.6.14",
"vue-loader": "^15.9.7",
"vue-style-loader": "^4.1.3",
"vue-template-compiler": "^2.6.14",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12"
},
"scripts": { "scripts": {
"watch": "", "dev": "astro dev --host 0.0.0.0",
"build": "webpack --config webpack.config.js --progress", "build": "astro build",
"build-prod": "webpack --config webpack.config.js --env.production", "preview": "astro preview --host 0.0.0.0"
"format-webpack": "prettier --single-quote --trailing-comma es5 --write \"./webpack.config.js\"",
"format-js": "prettier --single-quote --trailing-comma es5 --write \"./source/_assets/**/*.js\"",
"format-vue": "prettier --single-quote --trailing-comma es5 --write \"./source/_assets/**/*.vue\"",
"format-style": "prettier --single-quote --write \"source/_assets/**/*.scss\"",
"format-md": "prettier --print-width=80 --parser=markdown --write \"source/**/*.md\""
}, },
"dependencies": {}, "dependencies": {
"browserslist": [ "astro": "^5",
"last 5 version", "@astrojs/vue": "^5",
"> 1%", "@astrojs/sitemap": "^3",
"maintained node versions", "@astrojs/rss": "^4",
"not dead" "@astrojs/mdx": "^4",
] "vue": "^3",
"tailwindcss": "^4",
"@tailwindcss/vite": "^4"
}
} }

13
src/pages/index.astro Normal file
View File

@@ -0,0 +1,13 @@
---
---
<html lang="ru">
<head>
<meta charset="utf-8" />
<title>Антон Вахрушев</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<h1>Антон Вахрушев</h1>
<p>Сайт в процессе обновления.</p>
</body>
</html>

12
src/styles/global.css Normal file
View File

@@ -0,0 +1,12 @@
@import 'tailwindcss';
@theme {
--font-serif: 'PT Serif', serif;
--font-mono: 'Source Code Pro', monospace;
--color-text: #24292e;
--color-link: #0366d6;
--color-rule: #e6e6e6;
--breakpoint-content: 740px;
}

3
tsconfig.json Normal file
View File

@@ -0,0 +1,3 @@
{
"extends": "astro/tsconfigs/strict"
}