Skip to content

Commit

Permalink
Better env
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin committed Oct 18, 2023
1 parent 347b87a commit 055ac8c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ celerybeat-schedule
*.sage.py

# Environments
.env
/.env
.env.local
.venv
env/
venv/
Expand Down Expand Up @@ -159,9 +160,6 @@ jspm_packages/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

Expand Down
2 changes: 2 additions & 0 deletions packages/playground-website/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Bundle and use local version of typespec libraries
VITE_USE_LOCAL_LIBRARIES=true
4 changes: 2 additions & 2 deletions packages/playground-website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<title>TypeSpec Playground</title>
<script async src="./node_modules/es-module-shims/dist/es-module-shims.js"></script>
<script>
const noLibraryBundling = "%VITE_NO_LIBRARY_BUNDLING%" === "true";
if (noLibraryBundling) {
const useLocalLibrary = "%VITE_USE_LOCAL_LIBRARIES%" === "true";
if (!useLocalLibrary) {
document.currentScript.after(
Object.assign(document.createElement("script"), {
type: "importmap-shim",
Expand Down
4 changes: 2 additions & 2 deletions packages/playground-website/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defineConfig, loadEnv } from "vite";

export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
const noLibraryBundling = env["VITE_NO_LIBRARY_BUNDLING"] === "true";
const useLocalLibraries = env["VITE_USE_LOCAL_LIBRARIES"] === "true";

const config = definePlaygroundViteConfig({
defaultEmitter: "@typespec/openapi3",
Expand Down Expand Up @@ -51,7 +51,7 @@ export default defineConfig(({ mode }) => {
githubIssueUrl: `https://github.com/microsoft/typespec/issues/new`,
documentationUrl: "https://microsoft.github.io/typespec",
},
skipBundleLibraries: noLibraryBundling,
skipBundleLibraries: useLocalLibraries,
});

config.plugins!.push(
Expand Down

0 comments on commit 055ac8c

Please sign in to comment.