From 4bd3b1e0941bb551802749747d0339ee32b22dbd Mon Sep 17 00:00:00 2001 From: Ashhhleyyy Date: Sat, 13 Aug 2022 22:04:21 +0100 Subject: [PATCH] feat(deploy): build standalone server --- .drone.yml | 13 ++++++++----- .gitignore | 1 + .prettierignore | 1 + package.json | 4 +++- pnpm-lock.yaml | 7 +++++++ 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index f798cb2..15c3a4b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -13,16 +13,19 @@ steps: image: node-pnpm:16-alpine commands: - pnpm format:check -- name: Build site +- name: Build image: node-pnpm:16-alpine commands: - - pnpm build -- name: Deploy site + - pnpm build:site + - pnpm build:server +- name: Deploy image: alpine commands: - apk add curl ca-certificates zip - - cd dist && zip -r ../deploy.zip * && cd .. - - 'curl --fail --upload-file deploy.zip -H "Authorization: token $GITEA_TOKEN" https://git.ashhhleyyy.dev/api/packages/ash/generic/doodly/$DRONE_COMMIT_SHA/doodly.zip' + - cd dist && zip -r ../deploy-site.zip * && cd .. + - cd build && zip -r ../deploy-server.zip * && cd .. + - 'curl --fail --upload-file deploy-site.zip -H "Authorization: token $GITEA_TOKEN" https://git.ashhhleyyy.dev/api/packages/ash/generic/doodly/$DRONE_COMMIT_SHA/doodly-site.zip' + - 'curl --fail --upload-file deploy-server.zip -H "Authorization: token $GITEA_TOKEN" https://git.ashhhleyyy.dev/api/packages/ash/generic/doodly/$DRONE_COMMIT_SHA/doodly-server.zip' environment: GITEA_TOKEN: from_secret: GITEA_TOKEN diff --git a/.gitignore b/.gitignore index a547bf3..27e8db9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ lerna-debug.log* node_modules dist dist-ssr +build *.local # Editor directories and files diff --git a/.prettierignore b/.prettierignore index f4f0eec..b531a32 100644 --- a/.prettierignore +++ b/.prettierignore @@ -17,6 +17,7 @@ pnpm-lock.yaml node_modules dist dist-ssr +build *.local .next/ diff --git a/package.json b/package.json index 7bf24bf..65688c5 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "type": "module", "scripts": { "dev": "vite --host 0.0.0.0", - "build": "vite build", + "build:site": "vite build", + "build:server": "ncc build src/server/main.ts -o build/", "preview": "vite preview", "check": "svelte-check --tsconfig ./tsconfig.json", "dev:server": "node --loader ts-node/esm src/server/main.ts", @@ -15,6 +16,7 @@ "devDependencies": { "@sveltejs/vite-plugin-svelte": "^1.0.1", "@tsconfig/svelte": "^3.0.0", + "@vercel/ncc": "^0.34.0", "prettier": "^2.7.1", "prettier-plugin-svelte": "^2.7.0", "svelte": "^3.49.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a6a0075..aec030b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,7 @@ specifiers: '@fontsource/noto-sans': ^4.5.11 '@sveltejs/vite-plugin-svelte': ^1.0.1 '@tsconfig/svelte': ^3.0.0 + '@vercel/ncc': ^0.34.0 bulma: ^0.9.4 prettier: ^2.7.1 prettier-plugin-svelte: ^2.7.0 @@ -27,6 +28,7 @@ dependencies: devDependencies: '@sveltejs/vite-plugin-svelte': 1.0.1_svelte@3.49.0+vite@3.0.6 '@tsconfig/svelte': 3.0.0 + '@vercel/ncc': 0.34.0 prettier: 2.7.1 prettier-plugin-svelte: 2.7.0_o3ioganyptcsrh6x4hnxvjkpqi svelte: 3.49.0 @@ -1449,6 +1451,11 @@ packages: resolution: {integrity: sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==} dev: true + /@vercel/ncc/0.34.0: + resolution: {integrity: sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A==} + hasBin: true + dev: true + /accepts/1.3.8: resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} engines: {node: '>= 0.6'}