init from site

This commit is contained in:
2025-03-07 14:59:06 +01:00
parent ba7ba3a090
commit f3475181ff
2634 changed files with 376169 additions and 54 deletions
+3
View File
@@ -0,0 +1,3 @@
node_modules/
config.json
.kbot
+43
View File
@@ -0,0 +1,43 @@
# File Deployment Script
A simple deployment script that uses Node-SSH to:
1. Upload a file from `./releases/dist.zip` to `/var/vhosts/polymech.io/httpdocs`
2. Unzip the file on the server
## Prerequisites
- Node.js
- NPM
## Installation
```bash
npm install
```
## Configuration
Edit the `config.json` file with your server credentials:
```json
{
"server": {
"host": "your-server-host",
"username": "your-username",
"password": "your-password",
"port": 22
}
}
```
## Usage
```bash
npm run deploy
```
## Note
For security, `config.json` is included in `.gitignore` to prevent sensitive credentials from being committed to version control.
+5
View File
@@ -0,0 +1,5 @@
#npm run build
sh scripts/deploy.sh
#sh scripts/sync.sh
#sh scripts/zip.sh
+59
View File
@@ -0,0 +1,59 @@
/**
* Deployment Script
* Uploads dist.zip to server and unzips it
*/
const { NodeSSH } = require('node-ssh');
const fs = require('fs');
const path = require('path');
// Load credentials from config.json
const config = require('./config.json');
// Paths
const localFilePath = './releases/dist.zip';
const remoteDirectory = '/var/www/vhosts/polymech.io/httpdocs';
const remoteFilePath = `${remoteDirectory}/dist.zip`;
const ssh = new NodeSSH();
/**
* Main deployment function
*/
async function deploy() {
try {
// Check if the local file exists
if (!fs.existsSync(localFilePath)) {
throw new Error(`File ${localFilePath} not found`);
}
console.log('Connecting to server...');
await ssh.connect({
host: config.server.host,
username: config.server.username,
password: config.server.password,
port: config.server.port
});
// Upload the file
console.log(`Uploading ${localFilePath} to ${remoteFilePath}...`);
await ssh.putFile(localFilePath, remoteFilePath);
// Unzip the file
console.log(`Unzipping file on server...`);
await ssh.execCommand(`unzip -o ${remoteFilePath} -d ${remoteDirectory}`);
// Optional: Clean up the zip file after extraction
console.log(`Removing zip file...`);
await ssh.execCommand(`rm ${remoteFilePath}`);
console.log('Deployment completed successfully!');
} catch (error) {
console.error('Deployment failed:', error);
} finally {
// Close the connection
ssh.dispose();
}
}
deploy();
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
# Example script for Google Drive operations using rclone
# Define local and remote paths
LOCAL_DIR="./dist"
GDRIVE_DIR="polymech:/httpdocs"
rclone copy "${LOCAL_DIR}" "${GDRIVE_DIR}" --progress --transfers 4
+253
View File
@@ -0,0 +1,253 @@
{
"name": "file-deployment",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "file-deployment",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"@plastichub/fs": "file:../../../osr/osr-mono/packages/fs",
"@plastichub/osr-commons": "file:../../../osr/osr-mono/packages/osr-commons",
"node-ssh": "^13.2.0"
}
},
"../../../osr/osr-mono/packages/fs": {
"name": "@plastichub/fs",
"version": "0.13.41",
"license": "BSD-3-Clause",
"dependencies": {
"@plastichub/core": "^0.2.6",
"denodeify": "^1.2.1",
"errno": "^0.1.4",
"glob": "^10.4.1",
"mime": "^2.0.3",
"minimatch": "^3.0.4",
"mkdirp": "^0.5.1",
"progress-stream": "^1.2.0",
"q": "^1.4.1",
"rimraf": "^6.0.1",
"write-file-atomic": "^1.3.1",
"yargs": "^17.7.2"
},
"devDependencies": {
"@types/denodeify": "^1.2.35",
"@types/glob": "^8.1.0",
"@types/mime": "^2.0.3",
"@types/minimatch": "^3.0.5",
"@types/mkdirp": "^0.5.2",
"@types/node": "^22.12.0",
"chai": "^3.5.0",
"codecov": "^3.8.3",
"fs-extra": "^4.0.3",
"istanbul": "^0.4.5",
"mocha": "^11.1.0",
"mocha-typescript": "^1.1.17",
"ts-node": "^3.3.0",
"tslint": "^5.20.1",
"tslint-presets": "^2.0.0",
"typescript": "^5.7.3"
},
"engines": {
"node": ">= 8.0.0"
}
},
"../../../osr/osr-mono/packages/osr-commons": {
"name": "@plastichub/osr-commons",
"version": "0.5.3",
"license": "BSD-3-Clause",
"dependencies": {
"@plastichub/core": "^0.2.6",
"@plastichub/fs": "^0.13.41",
"cryptr": "^6.0.3",
"env-var": "^7.5.0",
"fast-glob": "^3.3.2",
"filenamify": "^4.3.0",
"glob": "^11.0.0",
"glob-base": "^0.3.0",
"is-glob": "^4.0.3",
"parse-glob": "^3.0.4",
"sanitize-filename": "^1.6.3",
"tslog": "^4.9.3",
"typescript": "^5.6.3",
"yargs": "^17.7.2",
"zod": "^3.24.1",
"zod-to-json-schema": "^3.23.5",
"zod-to-ts": "^1.2.0"
},
"devDependencies": {
"@types/node": "^22.12.0"
},
"engines": {
"node": ">= 14.0.0"
}
},
"node_modules/@plastichub/fs": {
"resolved": "../../../osr/osr-mono/packages/fs",
"link": true
},
"node_modules/@plastichub/osr-commons": {
"resolved": "../../../osr/osr-mono/packages/osr-commons",
"link": true
},
"node_modules/asn1": {
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
"integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
"license": "MIT",
"dependencies": {
"safer-buffer": "~2.1.0"
}
},
"node_modules/bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
"integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
"license": "BSD-3-Clause",
"dependencies": {
"tweetnacl": "^0.14.3"
}
},
"node_modules/buildcheck": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/buildcheck/-/buildcheck-0.0.6.tgz",
"integrity": "sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==",
"optional": true,
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/cpu-features": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/cpu-features/-/cpu-features-0.0.10.tgz",
"integrity": "sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA==",
"hasInstallScript": true,
"optional": true,
"dependencies": {
"buildcheck": "~0.0.6",
"nan": "^2.19.0"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/is-stream": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
"license": "MIT",
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
"integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
"license": "MIT",
"dependencies": {
"semver": "^6.0.0"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/nan": {
"version": "2.22.1",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.22.1.tgz",
"integrity": "sha512-pfRR4ZcNTSm2ZFHaztuvbICf+hyiG6ecA06SfAxoPmuHjvMu0KUIae7Y8GyVkbBqeEIidsmXeYooWIX9+qjfRQ==",
"license": "MIT",
"optional": true
},
"node_modules/node-ssh": {
"version": "13.2.0",
"resolved": "https://registry.npmjs.org/node-ssh/-/node-ssh-13.2.0.tgz",
"integrity": "sha512-7vsKR2Bbs66th6IWCy/7SN4MSwlVt+G6QrHB631BjRUM8/LmvDugtYhi0uAmgvHS/+PVurfNBOmELf30rm0MZg==",
"license": "MIT",
"dependencies": {
"is-stream": "^2.0.0",
"make-dir": "^3.1.0",
"sb-promise-queue": "^2.1.0",
"sb-scandir": "^3.1.0",
"shell-escape": "^0.2.0",
"ssh2": "^1.14.0"
},
"engines": {
"node": ">= 10"
}
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"license": "MIT"
},
"node_modules/sb-promise-queue": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/sb-promise-queue/-/sb-promise-queue-2.1.1.tgz",
"integrity": "sha512-qXfdcJQMxMljxmPprn4Q4hl3pJmoljSCzUvvEBa9Kscewnv56n0KqrO6yWSrGLOL9E021wcGdPa39CHGKA6G0w==",
"license": "MIT",
"engines": {
"node": ">= 8"
}
},
"node_modules/sb-scandir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/sb-scandir/-/sb-scandir-3.1.0.tgz",
"integrity": "sha512-70BVm2xz9jn94zSQdpvYrEG101/UV9TVGcfWr9T5iob3QhCK4lYXeculfBqPGFv3XTeKgx4dpWyYIDeZUqo4kg==",
"license": "MIT",
"dependencies": {
"sb-promise-queue": "^2.1.0"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/semver": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/shell-escape": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/shell-escape/-/shell-escape-0.2.0.tgz",
"integrity": "sha512-uRRBT2MfEOyxuECseCZd28jC1AJ8hmqqneWQ4VWUTgCAFvb3wKU1jLqj6egC4Exrr88ogg3dp+zroH4wJuaXzw==",
"license": "MIT"
},
"node_modules/ssh2": {
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.16.0.tgz",
"integrity": "sha512-r1X4KsBGedJqo7h8F5c4Ybpcr5RjyP+aWIG007uBPRjmdQWfEiVLzSK71Zji1B9sKxwaCvD8y8cwSkYrlLiRRg==",
"hasInstallScript": true,
"dependencies": {
"asn1": "^0.2.6",
"bcrypt-pbkdf": "^1.0.2"
},
"engines": {
"node": ">=10.16.0"
},
"optionalDependencies": {
"cpu-features": "~0.0.10",
"nan": "^2.20.0"
}
},
"node_modules/tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
"license": "Unlicense"
}
}
}
+20
View File
@@ -0,0 +1,20 @@
{
"name": "file-deployment",
"version": "1.0.0",
"description": "Simple deployment script using Node-SSH",
"main": "deploy.js",
"type": "commonjs",
"scripts": {
"deploy": "node deploy.js"
},
"keywords": [
"deployment"
],
"author": "Guenter",
"license": "ISC",
"dependencies": {
"@plastichub/fs": "file:../../../osr/osr-mono/packages/fs",
"@plastichub/osr-commons": "file:../../../osr/osr-mono/packages/osr-commons",
"node-ssh": "^13.2.0"
}
}
+8
View File
@@ -0,0 +1,8 @@
echo "Starting sync from ./dist to polymech:/httpdocs..."
rclone sync ./dist polymech:/httpdocs \
--progress \
--stats-one-line \
-v
echo "Sync completed!"
+11
View File
@@ -0,0 +1,11 @@
osr-sync sync --logLevel=debug --clear=false --source='.' --target='../astro-playground' --debug=false --profile="./sync-playground.json"
cd ../astro-playground
git add -A .
git commit -m "Synced from site"
git push
# osr-sync sync --logLevel=debug --clear=false --source='.' --target='../guides' --debug=false --profile="./sync-playground.json"
#cd ../guides
#git add .
#git commit -m "Synced from site"
#git push
+17
View File
@@ -0,0 +1,17 @@
## Todos
skip checked todos
- platform : windows
- environment : Astro (5.3+)
- language: Typescript, ESM
- dont use classes
- no lazy imports
- use pure functions
- each handler has the same function signature and naming
- [ ] create a registry of handlers, transforming json data to platform specific formats, in ../src/model/registry.ts, the input schema is provided (see ../polymech-mono/packages/commons/src/component.ts), create a new file per type, eg: ../src/model/rss.ts
- [ ] "rss" (@astrojs/rss)
- [ ] "merchant" (google)
- [ ] "json-ld" (products)
- [ ] evaluate the registry on demand
+8
View File
@@ -0,0 +1,8 @@
## Todos
skip checked todos
- [ ] create javascript script, using Node-SSH :
- [ ] upload a file from "./releases/dist.zip", to /var/vhosts/polymech.io/httpdocs
- [ ] unzip the file on the server
- [ ] assume credentials from a json file
+13
View File
@@ -0,0 +1,13 @@
#kbotd --prompt=./Gallery.md --mode=completion --dst=./GalleryK.astro --filters=code --router=openai --model=gpt-4o
#kbotd --prompt=./Gallery.md --mode=completion --dst=./GalleryK2.astro --filters=code --include=./GalleryS.astro --router=openai --model=gpt-4o
#kbotd --prompt=./Lightbox.md --mode=completion --dst=./GalleryL.astro --filters=code --include=./GalleryM.astro --include=./lightbox.html --router=openai --model=gpt-4o
#kbotd --prompt=./todos.md --mode=completion --dst=./GalleryL2.astro --filters=code --include=./GalleryL.astro --model=openai/o1
#kbotd --prompt=./todos.md --include=resources.astro --filters=code
#kbotd --prompt=./todos.md --model=anthropic/claude-3.7-sonnet
# kbotd --prompt=./todos-merchant.md --model=anthropic/claude-3.7-sonnet --include=../../polymech-mono/packages/commons/src/component.ts
#--model=anthropic/claude-3.7-sonnet \
kbotd --preferences ./todos-merchant.md \
--include=../../polymech-mono/packages/commons/src/component.ts \
--disable=terminal,git,npm,user,interact,search,email,web \
--disableTools=read_file,read_files,list_files,file_exists,web
+37
View File
@@ -0,0 +1,37 @@
// src/integrations/build-logger.ts
import type { AstroIntegration } from 'astro';
export default function buildLogger(): AstroIntegration {
return {
name: 'build-logger',
hooks: {
'astro:build:start': () => {
console.log('Build started');
},
'astro:build:setup': ({ vite, target }) => {
console.log(`Build setup for target: ${target}`);
},
'astro:build:generated': ({ dir }) => {
console.log(`Files generated in: ${dir}`);
},
'astro:build:ssr': ({ manifest }) => {
console.log('SSR build complete');
console.log(`Manifest entries: ${Object.keys(manifest).length}`);
},
'astro:build:done': ({ dir, routes }) => {
console.log('Build completed');
console.log(`Output directory: ${dir}`);
console.log(`Built routes: ${routes.length}`);
// Log details of each built route
routes.forEach((route, index) => {
console.log(`[${index + 1}] Route: ${route.route}`);
console.log(` Type: ${route.type}`);
if (route.distURL) {
console.log(` Output: ${route.distURL.pathname}`);
}
});
}
},
};
}
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
osr-sync zip --logLevel=debug --clear=false --source='./dist' --target='./dist.zip' --debug=false --profile="./sync-deploy.json"