MCPcopy Create free account
hub / github.com/SplootCode/splootcode / serialize

Method serialize

packages/core/src/language/projects/project.ts:196–229  ·  view source on GitHub ↗
(includeSecrets = false)

Source from the content-addressed store, hash-verified

194 }
195
196 serialize(includeSecrets = false): string {
197 let environmentVars = this.environmentVars
198 if (!includeSecrets) {
199 environmentVars = new Map(
200 [...this.environmentVars.entries()].map(([key, [value, secret]]) => {
201 if (secret) {
202 return [key, ['', secret]]
203 }
204 return [key, [value, secret]]
205 })
206 )
207 }
208
209 const serProj: SerializedProject = {
210 name: this.name,
211 layouttype: this.layoutType,
212 runSettings: this.runSettings,
213 title: this.title,
214 splootversion: this.splootversion,
215 version: this.version,
216 environmentVars: Object.fromEntries(environmentVars),
217 dependencies: [...this.dependencies],
218 packages: this.packages.map((pack) => {
219 const packRef: SerializedSplootPackageRef = {
220 name: pack.name,
221 buildType: pack.buildType,
222 }
223 return packRef
224 }),
225 tutorial: this.tutorial,
226 }
227
228 return JSON.stringify(serProj, null, 2) + '\n'
229 }
230}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected