#api-request #neocities #sync #deployment #file #requests #amount

app neocities-sync

在最少进行API请求的情况下同步文件到neocities

1个稳定版本

1.0.0 2024年6月25日

密码学类别中排名第356

MIT许可证

25KB
528

neocities-sync

在最少进行neocities的API请求的情况下同步文件。

您可以使用它将ViteAstroNext.js应用程序部署到neocities。

neocities-sync

  • 仅上传已修改的文件。
  • 删除在neocities上存在但本地不存在的文件。
  • .state文件中本地存储SHA1哈希值。
  • 如果.state文件不存在,它将从一个neocities获取所有文件哈希并将它们存储在.state文件中。
  • 如果设置了--ignore-disallowed-file-types,它将忽略不允许的文件类型。如果您不是支持者,请使用此选项。

安装

cargo install neocities-sync

用法

❯ neocities-sync --help

|\---/|
| x_x |   neocities-sync
 \_-_/

Sync files to neocities while doing the least amount of API requests.

Usage: neocities-sync <COMMAND>

Commands:
  login   Login to neocities
  logout  Logout from neocities
  sync    Sync a directory to neocities
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version
❯ neocities-sync sync --help

Sync a directory to neocities

Usage: neocities-sync sync [OPTIONS] [PATH]

Arguments:
  [PATH]  The directory to sync [default: .]

Options:
  -s, --state <STATE>                 Path to the state file. Used to keep track of the last sync
  -i, --ignore-disallowed-file-types  Use this if you are NOT a supporter
  -h, --help                          Print help

将Vite/Astro/Next.js应用程序部署到neocities

运行您的构建命令。假设您的构建输出在dist目录中,我们可以使用neocities-sync将文件上传到neocities。

首先使用neocities-sync login命令登录。它将提示您输入用户名和密码(在终端中不会显示)

❯ neocities-sync dist --ignore-disallowed-file-types --state .state

在这里,我们使用--state .state将状态存储在dist目录之外,因为它将在每次构建后清空。

现在,每次您对应用程序进行更改时,重新运行构建命令,然后运行neocities-sync命令。它将仅上传已修改的文件。

贡献

欢迎提交拉取请求。

依赖项

~10–22MB
~325K SLoC