@takuma-ru/auto-story-generator
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -81,2 +81,6 @@ var __defProp = Object.defineProperty; | ||
}, | ||
EC10: { | ||
title: "Could not get property from stories", | ||
isCustomDetail: true | ||
}, | ||
// Lit | ||
@@ -360,3 +364,17 @@ EL01: { | ||
if (generateOptions.meta.render) { | ||
const renderProperty = initializer.getPropertyOrThrow("render"); | ||
let renderProperty = initializer.getProperty("render"); | ||
while (!renderProperty) { | ||
initializer.addPropertyAssignment({ | ||
name: "render", | ||
initializer: "() => {}" | ||
}); | ||
renderProperty = initializer.getProperty("render"); | ||
} | ||
if (!renderProperty) { | ||
throwErr({ | ||
errorCode: "EC10", | ||
detail: `Could not find render in file ${storiesSourceFile.getFilePath()}` | ||
}); | ||
return; | ||
} | ||
renderProperty.set({ | ||
@@ -367,3 +385,17 @@ initializer: generateOptions.meta.render | ||
if (generateOptions.meta.component) { | ||
const componentProperty = initializer.getPropertyOrThrow("component"); | ||
let componentProperty = initializer.getProperty("component"); | ||
while (!componentProperty) { | ||
initializer.addPropertyAssignment({ | ||
name: "component", | ||
initializer: "null" | ||
}); | ||
componentProperty = initializer.getProperty("component"); | ||
} | ||
if (!componentProperty) { | ||
throwErr({ | ||
errorCode: "EC10", | ||
detail: `Could not find component in file ${storiesSourceFile.getFilePath()}` | ||
}); | ||
return; | ||
} | ||
componentProperty.set({ | ||
@@ -374,3 +406,17 @@ initializer: generateOptions.meta.component | ||
if (generateOptions.meta.args) { | ||
const argsProperty = initializer.getPropertyOrThrow("args"); | ||
let argsProperty = initializer.getProperty("args"); | ||
while (!argsProperty) { | ||
initializer.addPropertyAssignment({ | ||
name: "args", | ||
initializer: "{}" | ||
}); | ||
argsProperty = initializer.getProperty("args"); | ||
} | ||
if (!argsProperty) { | ||
throwErr({ | ||
errorCode: "EC10", | ||
detail: `Could not find args in file ${storiesSourceFile.getFilePath()}` | ||
}); | ||
return; | ||
} | ||
const argText = Object.entries(generateOptions.meta.args).map((x) => x.join(":")).join(", "); | ||
@@ -382,3 +428,17 @@ argsProperty.set({ | ||
if (generateOptions.meta.argTypes) { | ||
const argTypesProperty = initializer.getPropertyOrThrow("argTypes"); | ||
let argTypesProperty = initializer.getProperty("argTypes"); | ||
while (!argTypesProperty) { | ||
initializer.addPropertyAssignment({ | ||
name: "argTypes", | ||
initializer: "{}" | ||
}); | ||
argTypesProperty = initializer.getProperty("argTypes"); | ||
} | ||
if (!argTypesProperty) { | ||
throwErr({ | ||
errorCode: "EC10", | ||
detail: `Could not find argTypes in file ${storiesSourceFile.getFilePath()}` | ||
}); | ||
return; | ||
} | ||
const argTypesText = JSON.stringify( | ||
@@ -385,0 +445,0 @@ generateOptions.meta.argTypes, |
@@ -5,3 +5,3 @@ { | ||
"private": false, | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"main": "./dist/index.js", | ||
@@ -8,0 +8,0 @@ "module": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
63592
1992