mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
feat(env): setup env prefix and typescript for client-side (#584)
This commit is contained in:
@@ -11,3 +11,6 @@ node_modules
|
|||||||
.tuono
|
.tuono
|
||||||
out
|
out
|
||||||
target
|
target
|
||||||
|
|
||||||
|
# Ignore local env files
|
||||||
|
*.local
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
"types": ["tuono/build-client"],
|
||||||
|
|
||||||
/* Bundler mode */
|
/* Bundler mode */
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
|
|||||||
@@ -11,3 +11,6 @@ node_modules
|
|||||||
.tuono
|
.tuono
|
||||||
out
|
out
|
||||||
target
|
target
|
||||||
|
|
||||||
|
# Ignore local env files
|
||||||
|
*.local
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
declare module '*.module.css' {
|
|
||||||
const classes: Record<string, string>
|
|
||||||
export default classes
|
|
||||||
}
|
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
|
"types": ["tuono/build-client"],
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
|
|||||||
@@ -11,3 +11,6 @@ node_modules
|
|||||||
.tuono
|
.tuono
|
||||||
out
|
out
|
||||||
target
|
target
|
||||||
|
|
||||||
|
# Ignore local env files
|
||||||
|
*.local
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
"types": ["tuono/build-client"],
|
||||||
|
|
||||||
/* Bundler mode */
|
/* Bundler mode */
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
|
|||||||
@@ -11,3 +11,6 @@ node_modules
|
|||||||
.tuono
|
.tuono
|
||||||
out
|
out
|
||||||
target
|
target
|
||||||
|
|
||||||
|
# Ignore local env files
|
||||||
|
*.local
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
"types": ["tuono/build-client"],
|
||||||
|
|
||||||
/* Bundler mode */
|
/* Bundler mode */
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
|
|||||||
@@ -27,6 +27,9 @@
|
|||||||
"types": "./dist/esm/build/index.d.ts",
|
"types": "./dist/esm/build/index.d.ts",
|
||||||
"default": "./dist/esm/build/index.js"
|
"default": "./dist/esm/build/index.js"
|
||||||
},
|
},
|
||||||
|
"./build-client": {
|
||||||
|
"types": "./dist/esm/build-client/index.d.ts"
|
||||||
|
},
|
||||||
"./config": {
|
"./config": {
|
||||||
"types": "./dist/esm/config/index.d.ts",
|
"types": "./dist/esm/config/index.d.ts",
|
||||||
"default": "./dist/esm/config/index.js"
|
"default": "./dist/esm/config/index.js"
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
import 'vite/client'
|
||||||
@@ -2,3 +2,4 @@ export const DOT_TUONO_FOLDER_NAME = '.tuono'
|
|||||||
export const CONFIG_FOLDER_NAME = 'config'
|
export const CONFIG_FOLDER_NAME = 'config'
|
||||||
export const CONFIG_FILE_NAME = 'config.mjs'
|
export const CONFIG_FILE_NAME = 'config.mjs'
|
||||||
export const SERVER_CONFIG_NAME = 'config.json'
|
export const SERVER_CONFIG_NAME = 'config.json'
|
||||||
|
export const ENV_PREFIX = 'TUONO_PUBLIC_'
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import type { TuonoConfig } from '../config'
|
|||||||
|
|
||||||
import { blockingAsync } from './utils'
|
import { blockingAsync } from './utils'
|
||||||
import { createJsonConfig, loadConfig } from './config'
|
import { createJsonConfig, loadConfig } from './config'
|
||||||
|
import { ENV_PREFIX } from './constants'
|
||||||
|
|
||||||
const VITE_SSR_PLUGINS: Array<Plugin> = [
|
const VITE_SSR_PLUGINS: Array<Plugin> = [
|
||||||
{
|
{
|
||||||
@@ -45,6 +46,7 @@ function createBaseViteConfigFromTuonoConfig(
|
|||||||
publicDir: '../public',
|
publicDir: '../public',
|
||||||
cacheDir: 'cache',
|
cacheDir: 'cache',
|
||||||
envDir: '../',
|
envDir: '../',
|
||||||
|
envPrefix: ENV_PREFIX,
|
||||||
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: tuonoConfig.vite?.alias ?? {},
|
alias: tuonoConfig.vite?.alias ?? {},
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export default mergeConfig(
|
|||||||
'./src/index.ts',
|
'./src/index.ts',
|
||||||
'./src/build/index.ts',
|
'./src/build/index.ts',
|
||||||
'./src/config/index.ts',
|
'./src/config/index.ts',
|
||||||
|
'./src/build-client/index.ts',
|
||||||
'./src/ssr/index.ts',
|
'./src/ssr/index.ts',
|
||||||
'./src/hydration/index.tsx',
|
'./src/hydration/index.tsx',
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user