From 509ff9e016e62993b252f56bbf5cac202ddf11e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Sun, 27 Nov 2022 16:04:04 +0100 Subject: [PATCH] fix: check CI on local build and start (#182) --- package.json | 1 + pnpm-lock.yaml | 2 ++ server/shared.ts | 5 +++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8c73b4ca..3befd868 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "prettier": "^2.8.0", "rollup-plugin-node-polyfills": "^0.2.1", "shiki": "^0.11.1", + "std-env": "^3.3.1", "theme-vitesse": "^0.6.0", "tippy.js": "^6.3.7", "typescript": "^4.9.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 41c60359..08370c4d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,6 +44,7 @@ specifiers: prettier: ^2.8.0 rollup-plugin-node-polyfills: ^0.2.1 shiki: ^0.11.1 + std-env: ^3.3.1 theme-vitesse: ^0.6.0 tippy.js: ^6.3.7 typescript: ^4.9.3 @@ -101,6 +102,7 @@ devDependencies: prettier: 2.8.0 rollup-plugin-node-polyfills: 0.2.1 shiki: 0.11.1 + std-env: 3.3.1 theme-vitesse: 0.6.0 tippy.js: 6.3.7 typescript: 4.9.3 diff --git a/server/shared.ts b/server/shared.ts index 5c369749..f0f55d18 100644 --- a/server/shared.ts +++ b/server/shared.ts @@ -2,6 +2,7 @@ import _fs from 'unstorage/drivers/fs' // @ts-expect-error unstorage needs to provide backwards-compatible subpath types import _kv from 'unstorage/drivers/cloudflare-kv-http' +import { isCI } from 'std-env' import { $fetch } from 'ohmyfetch' import type { Storage } from 'unstorage' @@ -13,14 +14,14 @@ import { APP_NAME } from '~/constants' const runtimeConfig = useRuntimeConfig() export const HOST_DOMAIN = runtimeConfig.deployUrl - || (process.dev ? 'http://localhost:5314' : 'https://elk.zone') + || (process.dev || !isCI ? 'http://localhost:5314' : 'https://elk.zone') const fs = _fs as typeof import('unstorage/dist/drivers/fs')['default'] const kv = _kv as typeof import('unstorage/dist/drivers/cloudflare-kv-http')['default'] const storage = useStorage() as Storage -if (process.dev) { +if (process.dev || !isCI) { storage.mount('servers', fs({ base: 'node_modules/.cache/servers' })) } else {