Make Apache config optional and add more links to index
This commit is contained in:
parent
403ae18b6e
commit
e84900a652
16 changed files with 280 additions and 82 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { spawn } from "node:child_process";
|
||||
import { join } from "node:path";
|
||||
import { program, Option } from "commander";
|
||||
|
||||
interface DeployLftpOptions {
|
||||
|
|
@ -7,17 +8,18 @@ interface DeployLftpOptions {
|
|||
password: string;
|
||||
targetFolder: string;
|
||||
sourceFolder: string;
|
||||
assetsFolder: string;
|
||||
}
|
||||
|
||||
async function deployLftp({ host, user, password, targetFolder, sourceFolder }: DeployLftpOptions) {
|
||||
async function deployLftp({ host, user, password, targetFolder, sourceFolder, assetsFolder }: DeployLftpOptions) {
|
||||
const process = spawn(
|
||||
"lftp",
|
||||
[
|
||||
"-c",
|
||||
[
|
||||
`open -u ${user},${password} ${host}`,
|
||||
`mirror --reverse --include-glob assets/* --delete --only-missing --no-perms --verbose ${sourceFolder} ${targetFolder}`,
|
||||
`mirror --reverse --exclude-glob assets/* --delete --no-perms --verbose ${sourceFolder} ${targetFolder}`,
|
||||
`mirror --reverse --include-glob ${join(assetsFolder, "*")} --delete --only-missing --no-perms --verbose ${sourceFolder} ${targetFolder}`,
|
||||
`mirror --reverse --exclude-glob ${join(assetsFolder, "*")} --delete --no-perms --verbose ${sourceFolder} ${targetFolder}`,
|
||||
`bye`,
|
||||
].join("\n"),
|
||||
],
|
||||
|
|
@ -58,5 +60,10 @@ await program
|
|||
.env("DEPLOY_LFTP_SOURCEFOLDER")
|
||||
.default("dist/"),
|
||||
)
|
||||
.addOption(
|
||||
new Option("-a, --assets-folder <localDir>", "Directory inside of --source-folder of assets with hash-based names")
|
||||
.env("DEPLOY_LFTP_ASSETSFOLDER")
|
||||
.default("assets/"),
|
||||
)
|
||||
.action(deployLftp)
|
||||
.parseAsync();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue