This commit is contained in:
Patrick Alvin Alcala 2026-03-26 19:08:50 +08:00
parent 82a0fd6eea
commit 4fadb54891
24 changed files with 58 additions and 84 deletions

2
.env Normal file
View file

@ -0,0 +1,2 @@
CONTAINER_NAME=dasig-static
PORT=4320

1
.gitignore vendored
View file

@ -14,7 +14,6 @@ pnpm-debug.log*
# environment variables
.env
.env.local
.env.production

View file

@ -41,7 +41,7 @@ checkBackground()
}
<style lang="sass">
@use '../../configs/design/site.sass' as design
@use '../../design/site.sass' as design
:root
color-scheme: light dark

View file

@ -41,7 +41,7 @@ const borderRadius = getBorderRadius(edges)
}
<style lang="sass">
@use '/src/styles/fonts.sass' as fonts
@use '../../design/fonts.sass' as fonts
@use 'sass:color'
$primaryColor: #0075BB

View file

@ -47,5 +47,5 @@ const { desktop, tablet, mobile } = Astro.props
}
<style lang="sass">
@use '/src/styles/breakpoints.sass'
@use '../../design/breakpoints.sass'
</style>

View file

@ -7,7 +7,7 @@
</footer>
<style lang="sass">
@use '../../configs/design/sizes' as view
@use '../../design/sizes' as view
.dasig-footer
padding: 1rem 0

View file

@ -45,8 +45,8 @@ const config = toml.parse(fs.readFileSync('configs/config.site.toml', 'utf8'))
</html>
<style lang="sass">
@use '../../configs/design/colors.sass' as colors
@use '/src/styles/fonts.sass' as fonts
@use '../../design/colors.sass' as colors
@use '../../design/fonts.sass' as fonts
.body
color: colors.$white

View file

@ -21,7 +21,7 @@ const { background, color, border } = Astro.props
}
<style lang="sass">
@use '../../configs/design/site' as site
@use '../../design/site' as site
@use 'sass:color'
.modal

View file

@ -16,7 +16,3 @@ export { default as Display } from './components/Display.astro'
export { default as Padding } from './components/Padding.astro'
export { default as Modal } from './components/Modal.astro'
export { default as Input } from './components/Input.astro'
// export { default as OptimizeBackground } from './Optimizers/OptimizeBackground'
// export { default as OptimizeImage } from './Optimizers/OptimizeImage'
// export { default as OptimizeLogo } from './Optimizers/OptimizeLogo'

View file

@ -1,17 +0,0 @@
import { JSEncrypt } from "jsencrypt";
import * as fs from "node:fs";
import * as toml from "toml";
const config = toml.parse(
fs.readFileSync("configs/config.security.toml", "utf-8"),
);
const enc = new JSEncrypt();
const PUBLIC_KEY = config.rsa.public_key;
export default (message: string) => {
enc.setPublicKey(PUBLIC_KEY);
const encrypted = enc.encrypt(message).toString();
const fixedEncrypted = encrypted.replace(/\//g, "~");
return fixedEncrypted;
};

View file

@ -1,47 +1,39 @@
import { consola } from "consola";
import process from "node:process";
import sharp from "sharp";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
(async () => {
import { consola } from 'consola'
import process from 'node:process'
import sharp from 'sharp'
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
;(async () => {
const argv = yargs(hideBin(process.argv))
.option("name", {
alias: "n",
describe: "Specify the name of the image",
type: "string",
.option('name', {
alias: 'n',
describe: 'Specify the name of the image',
type: 'string',
demandOption: true,
})
.option("size", {
alias: "s",
describe: "Specify the size of the image",
type: "number",
.option('size', {
alias: 's',
describe: 'Specify the size of the image',
type: 'number',
demandOption: true,
}).argv;
}).argv
const name = argv.name;
const size = argv.size;
const name = argv.name
const size = argv.size
try {
const avifOutputPath = `./@dasig/images/${name.toString().split(".").slice(0, -1).join(".")}.avif`;
const webpOutputPath = `./@dasig/images/${name.toString().split(".").slice(0, -1).join(".")}.webp`;
const avifOutputPath = `./@dasig/images/${name.toString().split('.').slice(0, -1).join('.')}.avif`
const webpOutputPath = `./@dasig/images/${name.toString().split('.').slice(0, -1).join('.')}.webp`
const avifBuffer = await sharp(`./src/images/${name}`)
.avif({ quality: 60 })
.resize(size)
.toBuffer();
await sharp(avifBuffer).toFile(avifOutputPath);
consola.success(`${name} successfully optimized in Avif`);
const avifBuffer = await sharp(`./src/images/${name}.png`).avif({ quality: 60 }).resize(size).toBuffer()
await sharp(avifBuffer).toFile(avifOutputPath)
consola.success(`${name} successfully optimized in Avif`)
const webpBuffer = await sharp(`./src/images/${name}`)
.webp({ quality: 75 })
.resize(size)
.toBuffer();
await sharp(webpBuffer).toFile(webpOutputPath);
consola.success(`${name} successfully optimized in Webp`);
const webpBuffer = await sharp(`./src/images/${name}.png`).webp({ quality: 75 }).resize(size).toBuffer()
await sharp(webpBuffer).toFile(webpOutputPath)
consola.success(`${name} successfully optimized in Webp`)
} catch (error: any) {
consola.error("Error optimizing image:", error);
if (error.message.includes("missing"))
consola.error(`${name} could not be found on image folder`);
consola.error('Error optimizing image:', error)
if (error.message.includes('missing')) consola.error(`${name} could not be found on image folder`)
}
})();
})()

View file

@ -7,6 +7,6 @@ COPY . .
RUN pnpm build
FROM nginx:stable-alpine AS runtime
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./@dasig/deployment/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 4321

View file

@ -1,4 +1,4 @@
@use '../../configs/design/sizes.sass' as sizes
@use '../design/sizes' as sizes
.on-desktop-only
@media only screen and (min-width: 0px) and (max-width: sizes.$desktop)

View file

@ -1,9 +1,10 @@
services:
template:
container_name: template
dasig-static:
container_name: ${CONTAINER_NAME}
image: localhost/${CONTAINER_NAME}:latest
restart: unless-stopped
build:
context: .
dockerfile: Dockerfile
ports:
- 4321:4321
- ${PORT}:4321

View file

@ -1,13 +1,14 @@
[Unit]
Description=DASIG-ASTRO
Description=DASIG-STATIC
[Container]
ContainerName=dasig-astro
Image=localhost/dasig-astro
PublishPort=4321:4321
ContainerName=${CONTAINER_NAME}
Image=localhost/${CONTAINER_NAME}:latest
PublishPort=${PORT}:4321
[Service]
Restart=always
EnvironmentFile=dasig.env
[Install]
WantedBy=multi-user.target default.target

View file

@ -33,8 +33,8 @@ const count = 0
<style lang="sass">
@use 'sass:color'
@use '../../configs/design/site' as design
@use '../styles/functions.sass' as func
@use '../../design/site' as design
@use '../../design/functions.sass' as func
.counter
font-family: inherit

View file

@ -25,7 +25,7 @@ import PA2 from '../../@dasig/images/pat-alcala.webp'
</Layout>
<style lang="sass">
@use '../styles/fonts.sass' as fonts
@use '../../design/fonts.sass' as fonts
h1, h4
background: linear-gradient(135deg, #49e1a0 0%, #294e87 100%)