@sdeverywhere/plugin-config 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Climate Interactive / New Venture Fund
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # @sdeverywhere/plugin-config
2
+
3
+ This package provides a plugin that reads CSV files used to configure a library or app
4
+ around an SDEverywhere-generated system dynamics model.
5
+
6
+ ## Install
7
+
8
+ ```sh
9
+ # npm
10
+ npm install --save-dev @sdeverywhere/plugin-config
11
+
12
+ # pnpm
13
+ pnpm add -D @sdeverywhere/plugin-config
14
+
15
+ # yarn
16
+ yarn add -D @sdeverywhere/plugin-config
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ To get started:
22
+
23
+ 1. Copy the included template config files to your local project:
24
+
25
+ ```sh
26
+ cd your-model-project
27
+ npm install --save-dev @sdeverywhere/plugin-config
28
+ cp -rf "./node_modules/@sdeverywhere/plugin-config/template-config" ./config
29
+ ```
30
+
31
+ 2. Replace the placeholder values in the CSV files with values that are suitable for your model.
32
+
33
+ 3. Add a line to your `sde.config.js` file that uses the `configProcessor` function supplied by this package:
34
+
35
+ ```js
36
+ import { configProcessor } from '@sdeverywhere/plugin-config'
37
+
38
+ export async function config() {
39
+ return {
40
+ // Specify the Vensim model to read
41
+ modelFiles: ['sample.mdl'],
42
+
43
+ // Read csv files from `config` directory and write to the `generated` directory
44
+ modelSpec: configProcessor({
45
+ config: configDir,
46
+ out: genDir
47
+ }),
48
+
49
+ plugins: [
50
+ // ...
51
+ ]
52
+ }
53
+ }
54
+ ```
55
+
56
+ 4. Run `sde bundle` or `sde dev`; your config files will be used to drive the build process.
57
+
58
+ ## License
59
+
60
+ SDEverywhere is distributed under the MIT license. See `LICENSE` for more details.