This package provides a plugin that reads CSV files used to configure a library or app around a System Dynamics model generated by SDEverywhere.
The best way to get started with SDEverywhere is to follow the Quick Start instructions.
If you follow those instructions, the @sdeverywhere/plugin-config
package will be added to your project automatically, in which case you can skip the next section and jump straight to the "Usage" section below.
# npm
npm install --save-dev @sdeverywhere/plugin-config
# pnpm
pnpm add -D @sdeverywhere/plugin-config
# yarn
yarn add -D @sdeverywhere/plugin-config
Note: If you followed the "Quick Start" instructions above, the create
script will have already performed the following steps for you.
Reading these instructions can still be helpful if you are setting up a project manually or want to understand how plugin-config
can be integrated into your project.
To get started:
- Copy the included template config files to your local project:
cd your-model-project
npm install --save-dev @sdeverywhere/plugin-config
cp -rf "./node_modules/@sdeverywhere/plugin-config/template-config" ./config
-
Replace the placeholder values in the CSV files with values that are suitable for your model.
-
Add a line to your
sde.config.js
file that uses theconfigProcessor
function supplied by this package:
import { configProcessor } from '@sdeverywhere/plugin-config'
export async function config() {
return {
// Specify the Vensim model to read
modelFiles: ['example.mdl'],
// Read csv files from `config` directory and write to the recommended output
// directory structure. See `ConfigProcessorOptions` for more details.
modelSpec: configProcessor({
config: 'config'
}),
plugins: [
// ...
]
}
}
- Run
sde bundle
orsde dev
; your config files will be used to drive the build process.
API documentation (for plugin configuration options) is available in the docs
directory.
SDEverywhere is distributed under the MIT license. See LICENSE
for more details.