Add VITE_KC_KCL_SAMPLES_REF env var

This commit is contained in:
Pierre Jacquier
2025-02-12 15:19:19 -05:00
parent e8c206be77
commit 41c543f898
9 changed files with 12 additions and 3 deletions

View File

@ -4,6 +4,7 @@ VITE_KC_API_WS_MODELING_URL=wss://api.dev.zoo.dev/ws/modeling/commands
VITE_KC_API_BASE_URL=https://api.dev.zoo.dev VITE_KC_API_BASE_URL=https://api.dev.zoo.dev
VITE_KC_SITE_BASE_URL=https://dev.zoo.dev VITE_KC_SITE_BASE_URL=https://dev.zoo.dev
VITE_KC_SITE_APP_URL=https://app.dev.zoo.dev VITE_KC_SITE_APP_URL=https://app.dev.zoo.dev
VITE_KC_KCL_SAMPLES_REF=72d6d197d055a42a0afb9bedebae69f12fd3d3d9
VITE_KC_SKIP_AUTH=false VITE_KC_SKIP_AUTH=false
VITE_KC_CONNECTION_TIMEOUT_MS=5000 VITE_KC_CONNECTION_TIMEOUT_MS=5000
# ONLY add your token in .env.development.local if you want to skip auth, otherwise this token takes precedence! # ONLY add your token in .env.development.local if you want to skip auth, otherwise this token takes precedence!

View File

@ -3,5 +3,6 @@ VITE_KC_API_WS_MODELING_URL=wss://api.zoo.dev/ws/modeling/commands
VITE_KC_API_BASE_URL=https://api.zoo.dev VITE_KC_API_BASE_URL=https://api.zoo.dev
VITE_KC_SITE_BASE_URL=https://zoo.dev VITE_KC_SITE_BASE_URL=https://zoo.dev
VITE_KC_SITE_APP_URL=https://app.zoo.dev VITE_KC_SITE_APP_URL=https://app.zoo.dev
VITE_KC_KCL_SAMPLES_REF=72d6d197d055a42a0afb9bedebae69f12fd3d3d9
VITE_KC_SKIP_AUTH=false VITE_KC_SKIP_AUTH=false
VITE_KC_CONNECTION_TIMEOUT_MS=15000 VITE_KC_CONNECTION_TIMEOUT_MS=15000

1
interface.d.ts vendored
View File

@ -70,6 +70,7 @@ export interface IElectronAPI {
VITE_KC_SKIP_AUTH: string VITE_KC_SKIP_AUTH: string
VITE_KC_CONNECTION_TIMEOUT_MS: string VITE_KC_CONNECTION_TIMEOUT_MS: string
VITE_KC_DEV_TOKEN: string VITE_KC_DEV_TOKEN: string
VITE_KC_KCL_SAMPLES_REF: string
NODE_ENV: string NODE_ENV: string
PROD: string PROD: string
DEV: string DEV: string

View File

@ -85,7 +85,7 @@
"fmt": "prettier --write ./src *.ts *.json *.js ./e2e ./packages", "fmt": "prettier --write ./src *.ts *.json *.js ./e2e ./packages",
"fmt-check": "prettier --check ./src *.ts *.json *.js ./e2e ./packages", "fmt-check": "prettier --check ./src *.ts *.json *.js ./e2e ./packages",
"fetch:wasm": "./get-latest-wasm-bundle.sh", "fetch:wasm": "./get-latest-wasm-bundle.sh",
"fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/kcl-samples/achalmers/kw-pattern/manifest.json", "fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/kcl-samples/$VITE_KC_KCL_SAMPLES_REF/manifest.json",
"isomorphic-copy-wasm": "(copy src/wasm-lib/pkg/wasm_lib_bg.wasm public || cp src/wasm-lib/pkg/wasm_lib_bg.wasm public)", "isomorphic-copy-wasm": "(copy src/wasm-lib/pkg/wasm_lib_bg.wasm public || cp src/wasm-lib/pkg/wasm_lib_bg.wasm public)",
"build:wasm-dev": "yarn wasm-prep && (cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt", "build:wasm-dev": "yarn wasm-prep && (cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
"build:wasm": "yarn wasm-prep && cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings && cd ../.. && yarn isomorphic-copy-wasm && yarn fmt", "build:wasm": "yarn wasm-prep && cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings && cd ../.. && yarn isomorphic-copy-wasm && yarn fmt",

View File

@ -15,6 +15,7 @@ export const VITE_KC_SKIP_AUTH = env.VITE_KC_SKIP_AUTH as string | undefined
export const VITE_KC_CONNECTION_TIMEOUT_MS = export const VITE_KC_CONNECTION_TIMEOUT_MS =
env.VITE_KC_CONNECTION_TIMEOUT_MS as string | undefined env.VITE_KC_CONNECTION_TIMEOUT_MS as string | undefined
export const VITE_KC_DEV_TOKEN = env.VITE_KC_DEV_TOKEN as string | undefined export const VITE_KC_DEV_TOKEN = env.VITE_KC_DEV_TOKEN as string | undefined
export const VITE_KC_KCL_SAMPLES_REF = env.VITE_KC_KCL_SAMPLES_REF as string | undefined
export const PROD = env.PROD as string | undefined export const PROD = env.PROD as string | undefined
export const TEST = env.TEST as string | undefined export const TEST = env.TEST as string | undefined
export const DEV = env.DEV as string | undefined export const DEV = env.DEV as string | undefined

View File

@ -1,3 +1,5 @@
import { VITE_KC_KCL_SAMPLES_REF } from "env"
export const APP_NAME = 'Modeling App' export const APP_NAME = 'Modeling App'
/** Search string in new project names to increment as an index */ /** Search string in new project names to increment as an index */
export const INDEX_IDENTIFIER = '$n' export const INDEX_IDENTIFIER = '$n'
@ -106,7 +108,7 @@ export const MAKE_TOAST_MESSAGES = {
/** The URL for the KCL samples manifest files */ /** The URL for the KCL samples manifest files */
export const KCL_SAMPLES_MANIFEST_URLS = { export const KCL_SAMPLES_MANIFEST_URLS = {
remote: remote:
'https://raw.githubusercontent.com/KittyCAD/kcl-samples/main/manifest.json', `https://raw.githubusercontent.com/KittyCAD/kcl-samples/${VITE_KC_KCL_SAMPLES_REF}/manifest.json`,
localFallback: '/kcl-samples-manifest-fallback.json', localFallback: '/kcl-samples-manifest-fallback.json',
} as const } as const

View File

@ -7,6 +7,7 @@ import { UnitLength_type } from '@kittycad/lib/dist/types/src/models'
import { reportRejection } from './trap' import { reportRejection } from './trap'
import { IndexLoaderData } from './types' import { IndexLoaderData } from './types'
import { copyFileShareLink } from './links' import { copyFileShareLink } from './links'
import { VITE_KC_KCL_SAMPLES_REF } from 'env'
interface OnSubmitProps { interface OnSubmitProps {
sampleName: string sampleName: string
@ -63,7 +64,7 @@ export function kclCommands(commandProps: KclCommandConfig): Command[] {
const pathParts = data.sample.split('/') const pathParts = data.sample.split('/')
const projectPathPart = pathParts[0] const projectPathPart = pathParts[0]
const primaryKclFile = pathParts[1] const primaryKclFile = pathParts[1]
const sampleCodeUrl = `https://raw.githubusercontent.com/KittyCAD/kcl-samples/main/${encodeURIComponent( const sampleCodeUrl = `https://raw.githubusercontent.com/KittyCAD/kcl-samples/${VITE_KC_KCL_SAMPLES_REF}/${encodeURIComponent(
projectPathPart projectPathPart
)}/${encodeURIComponent(primaryKclFile)}` )}/${encodeURIComponent(primaryKclFile)}`

View File

@ -45,6 +45,7 @@ process.env.VITE_KC_API_WS_MODELING_URL ??= viteEnv.VITE_KC_API_WS_MODELING_URL
process.env.VITE_KC_API_BASE_URL ??= viteEnv.VITE_KC_API_BASE_URL process.env.VITE_KC_API_BASE_URL ??= viteEnv.VITE_KC_API_BASE_URL
process.env.VITE_KC_SITE_BASE_URL ??= viteEnv.VITE_KC_SITE_BASE_URL process.env.VITE_KC_SITE_BASE_URL ??= viteEnv.VITE_KC_SITE_BASE_URL
process.env.VITE_KC_SITE_APP_URL ??= viteEnv.VITE_KC_SITE_APP_URL process.env.VITE_KC_SITE_APP_URL ??= viteEnv.VITE_KC_SITE_APP_URL
process.env.VITE_KC_KCL_SAMPLES_REF ??= viteEnv.VITE_KC_KCL_SAMPLES_REF
process.env.VITE_KC_SKIP_AUTH ??= viteEnv.VITE_KC_SKIP_AUTH process.env.VITE_KC_SKIP_AUTH ??= viteEnv.VITE_KC_SKIP_AUTH
process.env.VITE_KC_CONNECTION_TIMEOUT_MS ??= process.env.VITE_KC_CONNECTION_TIMEOUT_MS ??=
viteEnv.VITE_KC_CONNECTION_TIMEOUT_MS viteEnv.VITE_KC_CONNECTION_TIMEOUT_MS

View File

@ -187,6 +187,7 @@ contextBridge.exposeInMainWorld('electron', {
'VITE_KC_API_BASE_URL', 'VITE_KC_API_BASE_URL',
'VITE_KC_SITE_BASE_URL', 'VITE_KC_SITE_BASE_URL',
'VITE_KC_SITE_APP_URL', 'VITE_KC_SITE_APP_URL',
'VITE_KC_KCL_SAMPLES_REF',
'VITE_KC_SKIP_AUTH', 'VITE_KC_SKIP_AUTH',
'VITE_KC_CONNECTION_TIMEOUT_MS', 'VITE_KC_CONNECTION_TIMEOUT_MS',
'VITE_KC_DEV_TOKEN', 'VITE_KC_DEV_TOKEN',