This commit is contained in:
mike12345567 2021-01-27 18:09:32 +00:00
parent 56c7f8094c
commit b7e7dbba65
2 changed files with 32 additions and 29 deletions

View File

@ -34,7 +34,9 @@
})) }))
return [...acc, ...viewsArr] return [...acc, ...viewsArr]
}, []) }, [])
$: queries = $backendUiStore.queries.filter(query => query.queryVerb === "read").map(query => ({ $: queries = $backendUiStore.queries
.filter(query => query.queryVerb === "read")
.map(query => ({
label: query.name, label: query.name,
name: query.name, name: query.name,
tableId: query._id, tableId: query._id,

View File

@ -10,14 +10,7 @@ const FILENAME = "../manifest.json"
* https://github.com/helpers/handlebars-helpers * https://github.com/helpers/handlebars-helpers
*/ */
const COLLECTIONS = [ const COLLECTIONS = ["math", "array", "number", "url", "string", "comparison"]
"math",
"array",
"number",
"url",
"string",
"comparison",
]
const outputJSON = {} const outputJSON = {}
@ -59,7 +52,8 @@ function getCommentInfo(file, func) {
// from here work back until we have the comment // from here work back until we have the comment
if (lookForward(lines, funcLines, idx)) { if (lookForward(lines, funcLines, idx)) {
let fromIdx = idx let fromIdx = idx
let start = 0, end = 0 let start = 0,
end = 0
do { do {
if (lines[fromIdx].includes("*/")) { if (lines[fromIdx].includes("*/")) {
end = fromIdx end = fromIdx
@ -96,7 +90,10 @@ function getCommentInfo(file, func) {
function run() { function run() {
const foundNames = [] const foundNames = []
for (let collection of COLLECTIONS) { for (let collection of COLLECTIONS) {
const collectionFile = fs.readFileSync(`../node_modules/handlebars-helpers/lib/${collection}.js`, "utf8") const collectionFile = fs.readFileSync(
`../node_modules/handlebars-helpers/lib/${collection}.js`,
"utf8"
)
const collectionInfo = {} const collectionInfo = {}
// collect information about helper // collect information about helper
let hbsHelperInfo = helpers[collection]() let hbsHelperInfo = helpers[collection]()
@ -115,7 +112,14 @@ function run() {
const jsDocInfo = getCommentInfo(collectionFile, fnc) const jsDocInfo = getCommentInfo(collectionFile, fnc)
let args = jsDocInfo.tags let args = jsDocInfo.tags
.filter(tag => tag.title === "param") .filter(tag => tag.title === "param")
.map(tag => tag.description && tag.description.replace(/`/g, "").split(" ")[0].trim()) .map(
tag =>
tag.description &&
tag.description
.replace(/`/g, "")
.split(" ")[0]
.trim()
)
collectionInfo[name] = fixSpecialCases(name, { collectionInfo[name] = fixSpecialCases(name, {
args, args,
numArgs: args.length, numArgs: args.length,
@ -127,15 +131,12 @@ function run() {
} }
// add the date helper // add the date helper
outputJSON["date"] = { outputJSON["date"] = {
"date": { date: {
args: [ args: ["datetime", "format"],
"datetime",
"format"
],
numArgs: 2, numArgs: 2,
example: "{{date now \"YYYY\"}}", example: '{{date now "YYYY"}}',
description: "Format a date using moment.js data formatting." description: "Format a date using moment.js data formatting.",
} },
} }
fs.writeFileSync(FILENAME, JSON.stringify(outputJSON, null, 2)) fs.writeFileSync(FILENAME, JSON.stringify(outputJSON, null, 2))
} }