From ab83f9265d4a524bc86929beb85c5ff00bb036a9 Mon Sep 17 00:00:00 2001 From: Innei Date: Sat, 12 Mar 2022 12:28:14 +0800 Subject: [PATCH] chore: submodule --- .gitignore | 1 - .gitmodules | 3 +++ assets | 1 + dockerfile | 3 +-- package.json | 2 +- scripts/assets-push.sh | 7 +------ scripts/zip-asset.sh | 3 +-- 7 files changed, 8 insertions(+), 12 deletions(-) create mode 100644 .gitmodules create mode 160000 assets diff --git a/.gitignore b/.gitignore index caf740fc..202e1217 100644 --- a/.gitignore +++ b/.gitignore @@ -41,7 +41,6 @@ release.zip run data -assets .env scripts/workflow/docker-compose.yml diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..e3ac9fef --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "assets"] + path = assets + url = git@github.com:mx-space/assets.git diff --git a/assets b/assets new file mode 160000 index 00000000..76e070fe --- /dev/null +++ b/assets @@ -0,0 +1 @@ +Subproject commit 76e070feab4f96449769a79d78bf4a2c6f4c8759 diff --git a/dockerfile b/dockerfile index b0ef0bfe..346b938a 100644 --- a/dockerfile +++ b/dockerfile @@ -2,8 +2,7 @@ FROM node:16-alpine as builder WORKDIR /app COPY . . RUN apk add git make gcc g++ alpine-sdk python3 py3-pip python2 unzip -RUN git clone https://github.com/mx-space/assets.git --depth=1 -RUN rm -rf assets/.git +RUN git submodule update --init --recursive RUN npm i -g pnpm RUN pnpm install RUN pnpm bundle diff --git a/package.json b/package.json index 2380af1d..2b9b7cb2 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "homepage": "https://github.com/mx-space/mx-server#readme", "issues": "https://github.com/mx-space/mx-server/issues", "scripts": { - "prepare": "husky install", + "prepare": "husky install && git submodule update --init --recursive", "prebuild": "rimraf dist", "build": "nest build", "dev": "NODE_PATH=`npm root --quiet -g` npm run start", diff --git a/scripts/assets-push.sh b/scripts/assets-push.sh index 807c0f9c..b17f5cfd 100644 --- a/scripts/assets-push.sh +++ b/scripts/assets-push.sh @@ -1,9 +1,4 @@ - cd assets -git init git add . -git commit -m 'update assets' -git remote add origin git@github.com:mx-space/assets.git -git branch -M master +git commit -m 'update assets' --amend git push -u origin master -f -rm -rf .git \ No newline at end of file diff --git a/scripts/zip-asset.sh b/scripts/zip-asset.sh index 65dd2e47..070325e8 100644 --- a/scripts/zip-asset.sh +++ b/scripts/zip-asset.sh @@ -1,7 +1,6 @@ #!/bin/sh set -e -git clone https://github.com/mx-space/assets.git --depth=1 -rm -rf assets/.git +git submodule update --init --recursive cp -R assets out cp ecosystem.config.js out node scripts/download-latest-admin-assets.js