66 lines
1.9 KiB
Makefile
66 lines
1.9 KiB
Makefile
.PHONY: build
|
|
build: build-image
|
|
|
|
|
|
.PHONY: pre-commit
|
|
pre-commit: shellcheck regenerate-entities update-index-js rust-lint
|
|
|
|
|
|
.PHONY: debug
|
|
debug:
|
|
pnpm install
|
|
pnpm run build:debug
|
|
pnpm run migrate
|
|
pnpm run start
|
|
|
|
|
|
.PHONY: shellcheck
|
|
shellcheck:
|
|
shellcheck --external-sources update.sh
|
|
shellcheck --external-sources neko/update/*
|
|
|
|
|
|
.PHONY: rust-lint
|
|
rust-lint:
|
|
cd packages/backend/native-utils && pnpm run lint
|
|
|
|
|
|
.PHONY: regenerate-entities
|
|
regenerate-entities:
|
|
pnpm run migrate
|
|
cd packages/backend/native-utils && \
|
|
sea-orm-cli generate entity \
|
|
--output-dir='src/model/entity' \
|
|
--database-url='postgres://firefish:password@localhost:25432/firefish_db' \
|
|
--date-time-crate='chrono' \
|
|
--model-extra-attributes='NAPI_EXTRA_ATTR_PLACEHOLDER' && \
|
|
for file in src/model/entity/*; do \
|
|
base=$$(basename -- "$${file}"); \
|
|
jsname=$$(printf '%s\n' "$${base%.*}" | perl -pe 's/(^|_)./uc($$&)/ge;s/_//g'); \
|
|
attribute=$$(printf 'napi_derive::napi(object, js_name = "%s")' "$${jsname}"); \
|
|
sed -i "s/NAPI_EXTRA_ATTR_PLACEHOLDER/$${attribute}/" "$${file}"; \
|
|
done
|
|
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
|
|
|
|
|
|
.PHONY: update-index-js
|
|
update-index-js:
|
|
pnpm --filter='native-utils' run build:debug
|
|
[ -f packages/backend/native-utils/built/index.js ]
|
|
pnpm run format
|
|
rm neko/index.js
|
|
cp packages/backend/native-utils/built/index.js neko/index.js
|
|
|
|
|
|
.PHONY: build-image
|
|
build-image:
|
|
. neko/update/utils && \
|
|
buildah build \
|
|
--no-cache \
|
|
--platform linux/amd64 \
|
|
--build-arg "VERSION=$$(version_ci)" \
|
|
--tag docker.io/naskya/firefish \
|
|
--tag registry.code.naskya.net/naskya/firefish \
|
|
--tag "registry.code.naskya.net/naskya/firefish:$$(version_ci | cut -d':' -f2)" \
|
|
.
|