mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 12:21:57 +00:00
chore: fix the old spec to build
This commit is contained in:
@@ -384,8 +384,7 @@ describe("values", () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
test("datetime", async () => {
|
test("datetime", async () => {
|
||||||
const value = Value.dynamicDatetime<{ test: "a" }>(
|
const value = Value.dynamicDatetime<{ test: "a" }>(async ({ utils }) => {
|
||||||
async ({ effects, utils }) => {
|
|
||||||
;async () => {
|
;async () => {
|
||||||
;(await utils.getOwnWrapperData("/test").once()) satisfies "a"
|
;(await utils.getOwnWrapperData("/test").once()) satisfies "a"
|
||||||
}
|
}
|
||||||
@@ -395,8 +394,7 @@ describe("values", () => {
|
|||||||
required: { default: null },
|
required: { default: null },
|
||||||
inputmode: "date",
|
inputmode: "date",
|
||||||
}
|
}
|
||||||
},
|
})
|
||||||
)
|
|
||||||
const validator = value.validator
|
const validator = value.validator
|
||||||
validator.unsafeCast("2021-01-01")
|
validator.unsafeCast("2021-01-01")
|
||||||
validator.unsafeCast(null)
|
validator.unsafeCast(null)
|
||||||
|
|||||||
@@ -2,13 +2,12 @@ import * as fs from "fs"
|
|||||||
|
|
||||||
// https://stackoverflow.com/questions/2970525/converting-any-string-into-camel-case
|
// https://stackoverflow.com/questions/2970525/converting-any-string-into-camel-case
|
||||||
export function camelCase(value: string) {
|
export function camelCase(value: string) {
|
||||||
return value.replace(
|
return value
|
||||||
/^([A-Z])|[\s-_](\w)/g,
|
.replace(/([\(\)\[\]])/g, "")
|
||||||
function (match, p1, p2, offset) {
|
.replace(/^([A-Z])|[\s-_](\w)/g, function (match, p1, p2, offset) {
|
||||||
if (p2) return p2.toUpperCase()
|
if (p2) return p2.toUpperCase()
|
||||||
return p1.toLowerCase()
|
return p1.toLowerCase()
|
||||||
},
|
})
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function oldSpecToBuilder(
|
export async function oldSpecToBuilder(
|
||||||
@@ -41,6 +40,7 @@ export default async function makeFileContentFromOld(
|
|||||||
import {WrapperData} from '${wrapperData}'
|
import {WrapperData} from '${wrapperData}'
|
||||||
`)
|
`)
|
||||||
const data = await inputData
|
const data = await inputData
|
||||||
|
const hammerWrapperData = !nested ? ".withWrapperData()" : ""
|
||||||
|
|
||||||
const namedConsts = new Set(["Config", "Value", "List"])
|
const namedConsts = new Set(["Config", "Value", "List"])
|
||||||
const configName = newConst(
|
const configName = newConst(
|
||||||
@@ -73,7 +73,7 @@ export default async function makeFileContentFromOld(
|
|||||||
for (const [key, value] of Object.entries(data)) {
|
for (const [key, value] of Object.entries(data)) {
|
||||||
const variableName = maybeNewConst(key, convertValueSpec(value))
|
const variableName = maybeNewConst(key, convertValueSpec(value))
|
||||||
|
|
||||||
answer += `${JSON.stringify(key)}: ${variableName},`
|
answer += `${JSON.stringify(key)}: ${variableName}${hammerWrapperData},`
|
||||||
}
|
}
|
||||||
return `${answer}}`
|
return `${answer}}`
|
||||||
}
|
}
|
||||||
@@ -364,7 +364,7 @@ export default async function makeFileContentFromOld(
|
|||||||
value.name + "_list_config",
|
value.name + "_list_config",
|
||||||
`
|
`
|
||||||
Config.of({
|
Config.of({
|
||||||
"union": ${unionValueName}
|
"union": ${unionValueName}${hammerWrapperData}
|
||||||
})
|
})
|
||||||
`,
|
`,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user