Set up web app deployment (#399)
* env * vercel.json * u * global * ignore * preview * vercel * turbo * fix turbo * rm TAMAGUI_DISABLE_WARN_DYNAMIC_LOAD * use globaThis
This commit is contained in:
parent
539eb6f35d
commit
12428280cf
|
@ -0,0 +1 @@
|
||||||
|
TAMAGUI_TARGET=web
|
|
@ -0,0 +1 @@
|
||||||
|
TAMAGUI_TARGET=web
|
|
@ -0,0 +1 @@
|
||||||
|
TAMAGUI_TARGET=web
|
|
@ -22,3 +22,7 @@ dist-ssr
|
||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
!.env.*
|
||||||
|
.env*.local
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "TAMAGUI_TARGET='web' vite",
|
"dev": "TAMAGUI_TARGET=web vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && TAMAGUI_TARGET=web vite build",
|
||||||
"preview": "vite preview",
|
"preview": "TAMAGUI_TARGET=web vite preview",
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
"typecheck": "tsc",
|
"typecheck": "tsc",
|
||||||
"clean": "rimraf node_modules .turbo"
|
"clean": "rimraf node_modules .turbo"
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://openapi.vercel.sh/vercel.json",
|
||||||
|
"git": {
|
||||||
|
"deploymentEnabled": {
|
||||||
|
"main": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ignoreCommand": "git diff --quiet HEAD^ HEAD ../../{patches,package.json,turbo.json} ../../packages/{colors,components,icons,status-js} ./",
|
||||||
|
"installCommand": "yarn install --cwd ../../ --frozen-lockfile",
|
||||||
|
"buildCommand": "turbo run build --cwd ../../ --filter=web..."
|
||||||
|
}
|
|
@ -1,13 +1,10 @@
|
||||||
import { tamaguiPlugin } from '@tamagui/vite-plugin'
|
import { tamaguiPlugin } from '@tamagui/vite-plugin'
|
||||||
import react from '@vitejs/plugin-react-swc'
|
import react from '@vitejs/plugin-react-swc'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig, loadEnv } from 'vite'
|
||||||
|
|
||||||
import type { PluginOption } from 'vite'
|
import type { PluginOption } from 'vite'
|
||||||
|
|
||||||
process.env.TAMAGUI_TARGET = 'web'
|
|
||||||
process.env.TAMAGUI_DISABLE_WARN_DYNAMIC_LOAD = '1'
|
|
||||||
|
|
||||||
const tamaguiConfig = {
|
const tamaguiConfig = {
|
||||||
components: ['@status-im/components'],
|
components: ['@status-im/components'],
|
||||||
config: './tamagui.config.ts',
|
config: './tamagui.config.ts',
|
||||||
|
@ -15,22 +12,28 @@ const tamaguiConfig = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @see: https://vitejs.dev/config
|
// @see: https://vitejs.dev/config
|
||||||
export default defineConfig({
|
export default defineConfig(({ mode }) => {
|
||||||
resolve: {
|
const env = loadEnv(mode, process.cwd(), '')
|
||||||
// mainFields: ['module', 'jsnext:main', 'jsnext'],
|
|
||||||
alias: {
|
return {
|
||||||
'@status-im/components/hooks': path.resolve(
|
resolve: {
|
||||||
'../../packages/components/hooks'
|
// mainFields: ['module', 'jsnext:main', 'jsnext'],
|
||||||
),
|
alias: {
|
||||||
'@status-im/components': path.resolve('../../packages/components/src'),
|
'@status-im/components/hooks': path.resolve(
|
||||||
|
'../../packages/components/hooks'
|
||||||
|
),
|
||||||
|
'@status-im/components': path.resolve('../../packages/components/src'),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
define: {
|
||||||
define: {
|
// @see https://github.com/tamagui/tamagui/blob/a0d5fa0d05e6988a7cfa2a5e7823f295b82bae10/packages/tamagui/src/setup.ts#LL20C1-L20C28
|
||||||
TAMAGUI_TARGET: JSON.stringify('web'),
|
global: 'globalThis',
|
||||||
},
|
'process.env.TAMAGUI_TARGET': JSON.stringify(env.TAMAGUI_TARGET),
|
||||||
plugins: [
|
},
|
||||||
react(),
|
plugins: [
|
||||||
tamaguiPlugin(tamaguiConfig) as PluginOption,
|
react(),
|
||||||
// tamaguiExtractPlugin(tamaguiConfig)
|
tamaguiPlugin(tamaguiConfig) as PluginOption,
|
||||||
],
|
// tamaguiExtractPlugin(tamaguiConfig)
|
||||||
|
],
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -26,6 +26,7 @@ yarn-error.log*
|
||||||
.pnpm-debug.log*
|
.pnpm-debug.log*
|
||||||
|
|
||||||
# local env files
|
# local env files
|
||||||
|
!.env.*
|
||||||
.env*.local
|
.env*.local
|
||||||
|
|
||||||
# vercel
|
# vercel
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"typecheck": "tsc",
|
"typecheck": "tsc",
|
||||||
"clean": "rimraf .next .tamagui .vercel/output node_modules",
|
"clean": "rimraf .next .tamagui .vercel/output node_modules",
|
||||||
"serve": "next start --port 8151"
|
"preview": "next start --port 8151"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@radix-ui/react-dialog": "^1.0.3",
|
"@radix-ui/react-dialog": "^1.0.3",
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"main": false
|
"main": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ignoreCommand": "git diff --quiet HEAD^ HEAD ../../{patches,package.json} ../../packages/{colors,components,icons} ./",
|
"ignoreCommand": "git diff --quiet HEAD^ HEAD ../../{patches,package.json,turbo.json} ../../packages/{colors,components,icons,status-js} ./",
|
||||||
"installCommand": "yarn install --cwd ../../ --frozen-lockfile",
|
"installCommand": "yarn install --cwd ../../ --frozen-lockfile",
|
||||||
"buildCommand": "turbo run build --cwd ../../ --filter=website..."
|
"buildCommand": "turbo run build --cwd ../../ --filter=website..."
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
"dependsOn": ["^build"],
|
"dependsOn": ["^build"],
|
||||||
"outputs": ["dist/**"]
|
"outputs": ["dist/**"]
|
||||||
},
|
},
|
||||||
|
"web#build": {
|
||||||
|
"dependsOn": ["^build"],
|
||||||
|
"outputs": ["dist/**"]
|
||||||
|
},
|
||||||
"website#build": {
|
"website#build": {
|
||||||
"dependsOn": ["^build"],
|
"dependsOn": ["^build"],
|
||||||
"env": ["TAMAGUI_TARGET", "TAMAGUI_DISABLE_WARN_DYNAMIC_LOAD"],
|
"env": ["TAMAGUI_TARGET", "TAMAGUI_DISABLE_WARN_DYNAMIC_LOAD"],
|
||||||
|
|
Loading…
Reference in New Issue