1
0
Fork 1
mirror of https://example.com synced 2024-11-22 11:16:38 +09:00

dev: update lockfiles in make pre-commit

This commit is contained in:
naskya 2024-01-22 01:29:49 +09:00
parent 971da24c49
commit e1b2b2a10d
Signed by: naskya
GPG key ID: 712D413B3A9FED5C

View file

@ -1,9 +1,29 @@
PACKAGE_JSONS := package.json
PACKAGE_JSONS += packages/backend/package.json
PACKAGE_JSONS += packages/client/package.json
PACKAGE_JSONS += packages/firefish-js/package.json
PACKAGE_JSONS += packages/megalodon/package.json
PACKAGE_JSONS += packages/sw/package.json
RUST_DIR := packages/backend/native-utils
CARGO_TOMLS := $(RUST_DIR)/Cargo.toml
CARGO_TOMLS += $(RUST_DIR)/migration/Cargo.toml
.PHONY: build .PHONY: build
build: build-image build: build-image
.PHONY: pre-commit .PHONY: pre-commit
pre-commit: shellcheck regenerate-entities update-index-js rust-lint pre-commit: shellcheck pnpm-lock.yaml $(RUST_DIR)/Cargo.lock regenerate-entities update-index-js rust-lint
pnpm-lock.yaml: pnpm-workspace.yaml $(PACKAGE_JSONS)
pnpm install
$(RUST_DIR)/Cargo.lock: $(CARGO_TOMLS)
cd $(RUST_DIR) && cargo update
.PHONY: debug .PHONY: debug
@ -22,13 +42,13 @@ shellcheck:
.PHONY: rust-lint .PHONY: rust-lint
rust-lint: rust-lint:
cd packages/backend/native-utils && pnpm run lint cd $(RUST_DIR) && pnpm run lint
.PHONY: regenerate-entities .PHONY: regenerate-entities
regenerate-entities: regenerate-entities:
pnpm run migrate pnpm run migrate
cd packages/backend/native-utils && \ cd $(RUST_DIR) && \
sea-orm-cli generate entity \ sea-orm-cli generate entity \
--output-dir='src/model/entity' \ --output-dir='src/model/entity' \
--database-url='postgres://firefish:password@localhost:25432/firefish_db' \ --database-url='postgres://firefish:password@localhost:25432/firefish_db' \
@ -41,16 +61,16 @@ regenerate-entities:
sed -i "s/NAPI_EXTRA_ATTR_PLACEHOLDER/$${attribute}/" "$${file}"; \ sed -i "s/NAPI_EXTRA_ATTR_PLACEHOLDER/$${attribute}/" "$${file}"; \
done done
sed -i 's/#\[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)\]/#[derive(Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)]\n#[napi_derive::napi]/' \ sed -i 's/#\[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)\]/#[derive(Debug, PartialEq, Eq, EnumIter, DeriveActiveEnum)]\n#[napi_derive::napi]/' \
packages/backend/native-utils/src/model/entity/sea_orm_active_enums.rs $(RUST_DIR)/src/model/entity/sea_orm_active_enums.rs
.PHONY: update-index-js .PHONY: update-index-js
update-index-js: update-index-js:
pnpm --filter='native-utils' run build:debug pnpm --filter='native-utils' run build:debug
[ -f packages/backend/native-utils/built/index.js ] [ -f $(RUST_DIR)/built/index.js ]
pnpm run format pnpm run format
rm neko/index.js rm neko/index.js
cp packages/backend/native-utils/built/index.js neko/index.js cp $(RUST_DIR)/built/index.js neko/index.js
.PHONY: build-image .PHONY: build-image