@c6fc/spellcraft 0.0.8 → 0.0.9

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.
Files changed (2) hide show
  1. package/README.md +11 -20
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -129,8 +129,8 @@ $ npx spellcraft --help
129
129
  Commands:
130
130
  spellcraft generate <filename> Generates files from a configuration
131
131
  spellcraft importModule <npmPackage> [name] Configures the current project to use a SpellCraft module
132
- spellcraft aws-identity Display the AWS IAM identity of the SpellCraft context
133
- spellcraft aws-exportcredentials Export the current credentials as environment variables
132
+ spellcraft aws-identity Display the AWS IAM identity of the SpellCraft context # Added by a module
133
+ spellcraft aws-exportcredentials Export the current credentials as environment variables # Added by a module
134
134
  ```
135
135
 
136
136
  ## Programmatic Usage (API)
@@ -139,10 +139,9 @@ For more advanced workflows, such as integration into larger automation scripts,
139
139
 
140
140
  The typical flow is:
141
141
  1. Instantiate `SpellFrame`.
142
- 2. Load necessary modules.
143
- 3. (Optional) Run module initializers with `init()`.
144
- 4. Render the Jsonnet file with `render()`.
145
- 5. Write the resulting object to disk with `write()`.
142
+ 2. Run module initializers with `init()`.
143
+ 3. Render the Jsonnet file with `render()`.
144
+ 4. Write the resulting object to disk with `write()`.
146
145
 
147
146
  ```javascript
148
147
  // my-automation-script.js
@@ -157,30 +156,22 @@ const frame = new SpellFrame({
157
156
  });
158
157
 
159
158
  (async () => {
160
- try {
161
- // 2. Load modules programmatically (this assumes they are in package.json)
162
- // This loads modules listed in 'spellcraft_modules/packages.json'
163
- // and from the local 'spellcraft_modules/' directory.
164
- // frame.loadModuleByName('my-module-key', 'my-npm-package');
165
-
166
- // 3. Initialize modules (if any modules registered an init function)
159
+
160
+ // 2. Initialize modules before rendering.
167
161
  await frame.init();
168
162
 
169
- // 4. Render the master Jsonnet file
163
+ // 3. Render the master Jsonnet file
170
164
  const manifest = await frame.render(path.resolve('./manifest.jsonnet'));
171
165
 
172
166
  // The result is available in memory
173
167
  console.log('Rendered Manifest:', JSON.stringify(manifest, null, 2));
174
168
 
175
- // 5. Write the manifest object to the filesystem
176
- frame.write(manifest);
169
+ // 4. Write the manifest object to the filesystem. Defaults to the contents of
170
+ // the most recent 'render'.
171
+ frame.write();
177
172
 
178
173
  console.log('Successfully wrote files to the dist/ directory!');
179
174
 
180
- } catch (error) {
181
- console.error('An error occurred during the SpellCraft process:', error);
182
- process.exit(1);
183
- }
184
175
  })();
185
176
  ```
186
177
 
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "name": "@c6fc/spellcraft",
10
10
  "description": "Extensible JSonnet CLI platform",
11
- "version": "0.0.8",
11
+ "version": "0.0.9",
12
12
  "main": "src/index.js",
13
13
  "directories": {
14
14
  "lib": "lib"