This is a template that is used by the @sdeverywhere/create package to generate a
new project that uses SDEverywhere for a Svelte-based web application.
The project includes:
config directory that contains CSV files for configuring the generated
model and applicationnpm run dev) that allows for rapid prototyping
of the model and app# Create a new project (you can also use yarn or pnpm here, if preferred).
npm create @sdeverywhere@latest -- --template svelte
# Enter development mode for your model. This will start a live
# development environment that will build a JavaScript version of the
# model and run checks on it any time you make changes to:
# - the config files
# - the Vensim model file (<name>.mdl)
# - the model check definitions (model/checks/*.yaml)
# - the model comparison definitions (model/comparisons/*.yaml)
npm run dev
The Vensim model is in model/{MODEL_NAME}.mdl.
The sde.config.js file is used by the sde command line tool to generate
a JavaScript version of the model, which is copied into the core package
at build time (into the packages/core/src/model/generated directory).
The web app is developed using the Svelte framework.
See packages/app/src/app.svelte for the top-level App component.
The code that runs the generated model is located in
packages/core/src/model/model.ts. This code:
If you are modifying SDEverywhere (the packages in this repository) and want
to use this template-svelte example to test your changes, you can use it directly
without copying to a separate directory.
The template already includes the "SIR" Vensim model in model/MODEL_NAME.mdl
and associated graph and slider configuration in the config directory, so it
can be used right away without following the "Quick Start" instructions.
Note that this example is already configured in pnpm-workspace.yaml, which
means that its dependencies (e.g., @sdeverywhere/cli) are already linked to
the ones from the packages directory in this repository; no separate linking
step is necessary.
The following assumes that you have already run pnpm install in the top-level
directory, and have built the local packages with pnpm build.
# Enter local development mode for the project (this uses `sde dev`)
pnpm dev
This project automatically publishes your simulator and model-check reports to a public website whenever you push changes to GitHub.
main branch is available at https://yourusername.github.io/your-project-name/latesthttps://yourusername.github.io/your-project-name/branch/feature-name)https://yourusername.github.io/your-project-name/branch/feature-name/appmain build will be available at https://yourusername.github.io/your-project-name/branch/feature-name/extras/check-compare-to-basehttps://yourusername.github.io/your-project-name/branch/feature-name/extras/check-bundle.jsOnce published, you can share the web address with anyone. They can:
SDEverywhere is distributed under the MIT license. See LICENSE for more details.