meta: backend/native-utils -> backend-rs

This commit is contained in:
naskya 2024-02-12 23:14:23 +09:00
parent 4356099fec
commit fe0bfe31b3
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
146 changed files with 175 additions and 164 deletions

View file

@ -10,7 +10,7 @@ node_modules
report.*.json
# Rust
packages/backend/native-utils/target
packages/backend-rs/target
# Cypress
cypress/screenshots

View file

@ -8,12 +8,12 @@ RUN curl --proto '=https' --tlsv1.2 --silent --show-error --fail https://sh.rust
ENV PATH="/root/.cargo/bin:${PATH}"
# Copy only the cargo dependency-related files first, to cache efficiently
COPY packages/backend/native-utils/Cargo.toml packages/backend/native-utils/Cargo.toml
COPY packages/backend/native-utils/Cargo.lock packages/backend/native-utils/Cargo.lock
COPY packages/backend/native-utils/src/lib.rs packages/backend/native-utils/src/
COPY packages/backend-rs/Cargo.toml packages/backend-rs/Cargo.toml
COPY packages/backend-rs/Cargo.lock packages/backend-rs/Cargo.lock
COPY packages/backend-rs/src/lib.rs packages/backend-rs/src/
# Install cargo dependencies
RUN cargo fetch --locked --manifest-path /firefish/packages/backend/native-utils/Cargo.toml
RUN cargo fetch --locked --manifest-path /firefish/packages/backend-rs/Cargo.toml
# Copy only the dependency-related files first, to cache efficiently
COPY package.json pnpm*.yaml ./
@ -22,22 +22,22 @@ COPY packages/client/package.json packages/client/package.json
COPY packages/sw/package.json packages/sw/package.json
COPY packages/firefish-js/package.json packages/firefish-js/package.json
COPY packages/megalodon/package.json packages/megalodon/package.json
COPY packages/backend/native-utils/package.json packages/backend/native-utils/package.json
COPY packages/backend/native-utils/npm/linux-x64-musl/package.json packages/backend/native-utils/npm/linux-x64-musl/package.json
COPY packages/backend/native-utils/npm/linux-arm64-musl/package.json packages/backend/native-utils/npm/linux-arm64-musl/package.json
COPY packages/backend-rs/package.json packages/backend-rs/package.json
COPY packages/backend-rs/npm/linux-x64-musl/package.json packages/backend-rs/npm/linux-x64-musl/package.json
COPY packages/backend-rs/npm/linux-arm64-musl/package.json packages/backend-rs/npm/linux-arm64-musl/package.json
# Configure pnpm, and install dev mode dependencies for compilation
RUN corepack enable && corepack prepare pnpm@latest --activate && pnpm i --frozen-lockfile
# Copy in the rest of the native-utils rust files
COPY packages/backend/native-utils packages/backend/native-utils/
# Copy in the rest of the rust files
COPY packages/backend-rs packages/backend-rs/
# Compile native-utils
RUN pnpm run --filter native-utils build
# Compile backend-rs
RUN pnpm run --filter backend-rs build
# Copy in the rest of the files to compile
COPY . ./
RUN env NODE_ENV=production sh -c "pnpm run --filter '!native-utils' build && pnpm run gulp"
RUN env NODE_ENV=production sh -c "pnpm run --filter '!backend-rs' build && pnpm run gulp"
# Trim down the dependencies to only those for production
RUN pnpm i --prod --frozen-lockfile
@ -64,7 +64,7 @@ COPY --from=build /firefish/packages/firefish-js/node_modules /firefish/packages
COPY --from=build /firefish/built /firefish/built
COPY --from=build /firefish/packages/backend/built /firefish/packages/backend/built
COPY --from=build /firefish/packages/backend/assets/instance.css /firefish/packages/backend/assets/instance.css
COPY --from=build /firefish/packages/backend/native-utils/built /firefish/packages/backend/native-utils/built
COPY --from=build /firefish/packages/backend-rs/built /firefish/packages/backend-rs/built
RUN corepack enable && corepack prepare pnpm@latest --activate
ENV NODE_ENV=production

View file

@ -1,3 +1,14 @@
# Unreleased
## For systemd users
- `packages/backend/native-utils` can be removed.
- This directory was removed in the repository, but it's not completely removed from your system by `git pull --ff`, because some folders like `packages/backend/native-utils/built` are not tracked by git.
```sh
rm --recursive --force packages/backend/native-utils
```
# v20240206
## For all users

View file

@ -3,7 +3,7 @@
This directory contains all of the packages Firefish uses.
- `backend`: Main backend code written in TypeScript for NodeJS
- `backend/native-utils`: Backend code written in Rust, bound to NodeJS by [NAPI-RS](https://napi.rs/)
- `backend-rs`: Backend code written in Rust, bound to NodeJS by [NAPI-RS](https://napi.rs/)
- `client`: Web interface written in Vue3 and TypeScript
- `sw`: Web [Service Worker](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) written in TypeScript
- `firefish-js`: TypeScript SDK for both backend and client, also published on [NPM](https://www.npmjs.com/package/firefish-js) for public use

View file

@ -196,6 +196,33 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backend-rs"
version = "0.0.0"
dependencies = [
"async-trait",
"basen",
"cfg-if",
"chrono",
"cuid2",
"derive_more",
"jsonschema",
"napi",
"napi-build",
"napi-derive",
"once_cell",
"parse-display",
"pretty_assertions",
"rand",
"schemars",
"sea-orm",
"serde",
"serde_json",
"thiserror",
"tokio",
"utoipa",
]
[[package]]
name = "backtrace"
version = "0.3.69"
@ -1319,33 +1346,6 @@ dependencies = [
"libloading",
]
[[package]]
name = "native-utils"
version = "0.0.0"
dependencies = [
"async-trait",
"basen",
"cfg-if",
"chrono",
"cuid2",
"derive_more",
"jsonschema",
"napi",
"napi-build",
"napi-derive",
"once_cell",
"parse-display",
"pretty_assertions",
"rand",
"schemars",
"sea-orm",
"serde",
"serde_json",
"thiserror",
"tokio",
"utoipa",
]
[[package]]
name = "nix"
version = "0.27.1"

View file

@ -1,6 +1,6 @@
[package]
edition = "2021"
name = "native-utils"
name = "backend-rs"
version = "0.0.0"
[features]

View file

@ -0,0 +1,3 @@
# `backend-rs-android-arm-eabi`
This is the **armv7-linux-androideabi** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-android-arm-eabi",
"name": "backend-rs-android-arm-eabi",
"version": "0.0.0",
"os": [
"android"
@ -7,12 +7,12 @@
"cpu": [
"arm"
],
"main": "native-utils.android-arm-eabi.node",
"main": "backend-rs.android-arm-eabi.node",
"files": [
"native-utils.android-arm-eabi.node"
"backend-rs.android-arm-eabi.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-android-arm64`
This is the **aarch64-linux-android** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-android-arm64",
"name": "backend-rs-android-arm64",
"version": "0.0.0",
"os": [
"android"
@ -7,12 +7,12 @@
"cpu": [
"arm64"
],
"main": "native-utils.android-arm64.node",
"main": "backend-rs.android-arm64.node",
"files": [
"native-utils.android-arm64.node"
"backend-rs.android-arm64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-darwin-arm64`
This is the **aarch64-apple-darwin** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-darwin-arm64",
"name": "backend-rs-darwin-arm64",
"version": "0.0.0",
"os": [
"darwin"
@ -7,12 +7,12 @@
"cpu": [
"arm64"
],
"main": "native-utils.darwin-arm64.node",
"main": "backend-rs.darwin-arm64.node",
"files": [
"native-utils.darwin-arm64.node"
"backend-rs.darwin-arm64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-darwin-universal`
This is the **universal-apple-darwin** binary for `backend-rs`

View file

@ -0,0 +1,15 @@
{
"name": "backend-rs-darwin-universal",
"version": "0.0.0",
"os": [
"darwin"
],
"main": "backend-rs.darwin-universal.node",
"files": [
"backend-rs.darwin-universal.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-darwin-x64`
This is the **x86_64-apple-darwin** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-darwin-x64",
"name": "backend-rs-darwin-x64",
"version": "0.0.0",
"os": [
"darwin"
@ -7,12 +7,12 @@
"cpu": [
"x64"
],
"main": "native-utils.darwin-x64.node",
"main": "backend-rs.darwin-x64.node",
"files": [
"native-utils.darwin-x64.node"
"backend-rs.darwin-x64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-freebsd-x64`
This is the **x86_64-unknown-freebsd** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-freebsd-x64",
"name": "backend-rs-freebsd-x64",
"version": "0.0.0",
"os": [
"freebsd"
@ -7,12 +7,12 @@
"cpu": [
"x64"
],
"main": "native-utils.freebsd-x64.node",
"main": "backend-rs.freebsd-x64.node",
"files": [
"native-utils.freebsd-x64.node"
"backend-rs.freebsd-x64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-linux-arm-gnueabihf`
This is the **armv7-unknown-linux-gnueabihf** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-linux-arm-gnueabihf",
"name": "backend-rs-linux-arm-gnueabihf",
"version": "0.0.0",
"os": [
"linux"
@ -7,12 +7,12 @@
"cpu": [
"arm"
],
"main": "native-utils.linux-arm-gnueabihf.node",
"main": "backend-rs.linux-arm-gnueabihf.node",
"files": [
"native-utils.linux-arm-gnueabihf.node"
"backend-rs.linux-arm-gnueabihf.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-linux-arm64-gnu`
This is the **aarch64-unknown-linux-gnu** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-linux-arm64-gnu",
"name": "backend-rs-linux-arm64-gnu",
"version": "0.0.0",
"os": [
"linux"
@ -7,9 +7,9 @@
"cpu": [
"arm64"
],
"main": "native-utils.linux-arm64-gnu.node",
"main": "backend-rs.linux-arm64-gnu.node",
"files": [
"native-utils.linux-arm64-gnu.node"
"backend-rs.linux-arm64-gnu.node"
],
"license": "MIT",
"engines": {
@ -18,4 +18,4 @@
"libc": [
"glibc"
]
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-linux-arm64-musl`
This is the **aarch64-unknown-linux-musl** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-linux-arm64-musl",
"name": "backend-rs-linux-arm64-musl",
"version": "0.0.0",
"os": [
"linux"
@ -7,9 +7,9 @@
"cpu": [
"arm64"
],
"main": "native-utils.linux-arm64-musl.node",
"main": "backend-rs.linux-arm64-musl.node",
"files": [
"native-utils.linux-arm64-musl.node"
"backend-rs.linux-arm64-musl.node"
],
"license": "MIT",
"engines": {
@ -18,4 +18,4 @@
"libc": [
"musl"
]
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-linux-x64-gnu",
"name": "backend-rs-linux-x64-gnu",
"version": "0.0.0",
"os": [
"linux"
@ -7,9 +7,9 @@
"cpu": [
"x64"
],
"main": "native-utils.linux-x64-gnu.node",
"main": "backend-rs.linux-x64-gnu.node",
"files": [
"native-utils.linux-x64-gnu.node"
"backend-rs.linux-x64-gnu.node"
],
"license": "MIT",
"engines": {
@ -18,4 +18,4 @@
"libc": [
"glibc"
]
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-linux-x64-musl`
This is the **x86_64-unknown-linux-musl** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-linux-x64-musl",
"name": "backend-rs-linux-x64-musl",
"version": "0.0.0",
"os": [
"linux"
@ -7,9 +7,9 @@
"cpu": [
"x64"
],
"main": "native-utils.linux-x64-musl.node",
"main": "backend-rs.linux-x64-musl.node",
"files": [
"native-utils.linux-x64-musl.node"
"backend-rs.linux-x64-musl.node"
],
"license": "MIT",
"engines": {
@ -18,4 +18,4 @@
"libc": [
"musl"
]
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-win32-arm64-msvc`
This is the **aarch64-pc-windows-msvc** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-win32-arm64-msvc",
"name": "backend-rs-win32-arm64-msvc",
"version": "0.0.0",
"os": [
"win32"
@ -7,12 +7,12 @@
"cpu": [
"arm64"
],
"main": "native-utils.win32-arm64-msvc.node",
"main": "backend-rs.win32-arm64-msvc.node",
"files": [
"native-utils.win32-arm64-msvc.node"
"backend-rs.win32-arm64-msvc.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-win32-ia32-msvc`
This is the **i686-pc-windows-msvc** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-win32-ia32-msvc",
"name": "backend-rs-win32-ia32-msvc",
"version": "0.0.0",
"os": [
"win32"
@ -7,12 +7,12 @@
"cpu": [
"ia32"
],
"main": "native-utils.win32-ia32-msvc.node",
"main": "backend-rs.win32-ia32-msvc.node",
"files": [
"native-utils.win32-ia32-msvc.node"
"backend-rs.win32-ia32-msvc.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
}

View file

@ -0,0 +1,3 @@
# `backend-rs-win32-x64-msvc`
This is the **x86_64-pc-windows-msvc** binary for `backend-rs`

View file

@ -1,5 +1,5 @@
{
"name": "native-utils-win32-x64-msvc",
"name": "backend-rs-win32-x64-msvc",
"version": "0.0.0",
"os": [
"win32"
@ -7,12 +7,12 @@
"cpu": [
"x64"
],
"main": "native-utils.win32-x64-msvc.node",
"main": "backend-rs.win32-x64-msvc.node",
"files": [
"native-utils.win32-x64-msvc.node"
"backend-rs.win32-x64-msvc.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}
}

View file

@ -1,10 +1,10 @@
{
"name": "native-utils",
"name": "backend-rs",
"version": "0.0.0",
"main": "built/index.js",
"types": "built/index.d.ts",
"napi": {
"name": "native-utils",
"name": "backend-rs",
"triples": {
"additional": [
"aarch64-apple-darwin",

Some files were not shown because too many files have changed in this diff Show more